Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to change prices???


tkm

Recommended Posts

I have over 2,500 items and I need a way to increase the price. I want to increase each price by 30-35%. Is there a way to do this without having to manually edit each price one at a time?

Link to comment
Share on other sites

here I came up with this real quick like and tested it realy quick like too.

 

put in the percentage and let the slave change all prices by that percentage (can be posotive or negative).

 

save this as a file, like price_change.php or something and upload to your site and run it:

<?php

 require('includes/application_top.php');

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

 <title>Price Update</title>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<div class="pageHeading" align="center">Quick Percentage Price Updates</div>

<?php

if ($_GET['action'] == update) {

?>

<p class="main" align="center"><strong>MASTER: </strong>Increase the prices by <?php echo $_POST['increase']; ?>%</p> 

<?php

 $products_query_raw = "select products_id, products_price from " . TABLE_PRODUCTS . " order by products_id";

 $products_query = tep_db_query($products_query_raw);

 

 while ($products = tep_db_fetch_array($products_query)) {

$increase = (round($products['products_price']*10)/10)*($_POST['increase']/100);

$new_price = $products['products_price'] + $increase;

tep_db_query("update " . TABLE_PRODUCTS . " set products_price = $new_price where products_id = '" . $products['products_id'] . "'");

 }

?>

<p class="main" align="center"><strong>SLAVE: </strong>It is done, Master.</p>

<hr width="50%">

<?php

}

?>

<form name="update_price" method="post" action="<?php echo $PHP_SELF . '?action=update'; ?>">

<p class="main" align="center"><strong>SLAVE: </strong>Master, how much shall I increase the prices by?</p>

 <p class="main" align="center"><strong>MASTER: </strong>You shall increase 

   them all by  

   <input type="text" name="increase" size="3">

    %</p>

 <p class="main" align="center">

   <input type="submit" name="Submit" value="Do It!">

 </p>

</form>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

should do the trick... backup 1st just in case.

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Link to comment
Share on other sites

no problem... it was late and I was bored, so hope you don't me having a little fun with it :lol:

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...