Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Increase prices


Pjotr

Recommended Posts

you could run a script like this:

<?php
 include('includes/application_top.php');

 $price_query = tep_db_query("select products_id, products_price from products");
 while ($price_result = tep_db_fetch_array($price_query)) {
   $price = $price_result['products_price'];
   $new_price = $price + ($price * .02);
   tep_db_query("update products set products_price = '" . $new_price . "' where products_id = '" . $price_result['products_id'] . "'");
 }
?>

Do you ship UPS?

Give your customers order tracking without leaving your site. Track multi-package shipments. XML, cURL

 

Download the contribution here:

UPS Tracking

Link to comment
Share on other sites

  • 1 month later...

Thanks a ton! I was looking for the same thing!!!!!!!

 

What I did FIRST though was add another row in my products table, called 'products_price_original' (Decimal 15,4).

 

I then executed this:

 

UPDATE products set products_price_original = products_price

 

This copied all the original/existing prices straight over to my new row.

The reason why did this is that working with percentages can be tricky if you wish to ever revert back to your original prices after your sale/special is over.

For eg: if you reduce everything by 10%, to revert back you would have to add something like 11.09999999% to try to get your prices back to the way they were. You can get it pretty close, but not perfect.

 

The method of 'backing up' your old prices easily enables you to execute that command again later (in reverse obviously) and restoring your original prices across the board without messing about with percentages.

 

Hope someone finds this helpful.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...