Jump to content
Sign in to follow this  
chooch

QUICK PRICE/STOCK UPDATE

Recommended Posts

Running version 1.1.3 of Quick Prices Updates. Currently the products net price and stock appear as editable fields in the Quick Price Updates page in admin. How can I add retail price as another field to update?

 

Thanks in advance.

Edited by golfman2006

Share this post


Link to post
Share on other sites

I just tried installing this and get a blank page as well in my admin.

I have a menu to the left but when I click on anything (my store, catalog etc) the place where the menu options should show up is completely blank.

 

Was I supposed to install the stock options contrib first?

 

I only downloaded and installed

Quick Price Updates v1.0


Blessings, Dawn

Wife of 1 and Mama to 6!

Oscommerce Pro In the Making! :P

Share this post


Link to post
Share on other sites

Never mind..I don't know how this fixed it but it did. I just replaced the files I changed per the contrib install instructions with my backup files from before I started, and let the quick_priceupdates.php in the admin folder as it and now it works!


Blessings, Dawn

Wife of 1 and Mama to 6!

Oscommerce Pro In the Making! :P

Share this post


Link to post
Share on other sites
Running version 1.1.3 of Quick Prices Updates. Currently the products net price and stock appear as editable fields in the Quick Price Updates page in admin. How can I add retail price as another field to update?

 

Thanks in advance.

 

I ended up adding similar code for Net Price to pull up and edit MSRP also. Here is the entire code from quick_priceupdates.php that I used. Hopefully, this helps others as most of us need to update Retail and Net prices, not just Net price.

 

I also set the checkbox at bottom of page for Confirm Status Change(Active/Inactive) to be unchecked by default as our store we rarely, if ever, inactivate an entire categories worth of products at one time. If you have that checkbox checked when updating prices, all statuses are set to Inactive and you must manually update each through admin. This created an issue for our users, so leaving the field unchecked is also included below in the code. Feel free to run a compre to see the code changes made.

<?php
/*
 $Id: server_info.php,v 1.3 2002/03/16 01:36:56 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2002 osCommerce

 Released under the GNU General Public License

 Original Author: Mattice <mattice@xs4all.nl>
 Adaptations By:  Mike Lessar <mlessar@bluetruck.net>
		   Dustin Chambers <info@dllmodz.com>
*/

 require('includes/application_top.php');

/// optional parameter to set max products per row:
$max_cols = 3; //default 3

/// optional parameter to set width of product & info display
$width = 200; //default 200

?>
<!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><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading">Quick Price Update</td>

	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td>

<table style="border:none" border="0" width="90%" align="center" class="none"><tr><td>
<?php
// we've done nothing cool yet... 
$msg_stack = 'Queried products from category';

// Product Price (Net) BOC
if ($HTTP_POST_VARS['price_update']) { 

  //set counter
 $stock = 0;
 $status_a = 0;
 $status_d = 0;


 while (list($key, $value) = each($price_update)) {

 // update the quatity in stock
  $update = tep_db_query("UPDATE products SET products_price = $value WHERE products_id = $key");
  $stock_i++;
 }	 
$msg_stack = '<br>Updated <br>"Products Price (Net)"</b>';
}
// Product Price (Net) EOC

// Product Price (MSRP) BOC
if ($HTTP_POST_VARS['price_updateb']) { 

  //set counter
 $stock = 0;
 $status_a = 0;
 $status_d = 0;


 while (list($key, $value) = each($price_updateb)) {

 // update the quatity in stock
  $update = tep_db_query("UPDATE products SET products_msrp = $value WHERE products_id = $key");
  $stock_i++;
 }	 
$msg_stack = '<br>Updated <br>"Products Price (MSRP)"</b>';
}
// Product Price (MSRP) EOC

// Stock Update) BOC
if ($HTTP_POST_VARS['stock_update']) { 

  //set counter
 $stock_i = 0;
 $status_a = 0;
 $status_d = 0;


 while (list($key, $value) = each($stock_update)) {

 // update the quatity in stock
  $update = tep_db_query("UPDATE products SET products_quantity = $value WHERE products_id = $key");
  $stock_i++;

// we're de-re-activating the selected products
  if ($HTTP_POST_VARS['update_status']) {
 if ($value >= 1 ) { 
				   $dereac = tep_db_query("UPDATE products SET products_status = 1 WHERE products_id = $key");
 $status_a++;
 }else{
				   $dereac = tep_db_query("UPDATE products SET products_status = 0 WHERE products_id = $key");
 $status_d++;
}
  }
 }	 
$msg_stack = '<br>Total Products: ' . $stock_i . '<br># Active: ' . $status_a . '<br># Not Active: ' .  $status_d;
}
// Stock Update EOC

?>
<br><form method="post" action="quick_priceupdates.php">
<?php

  // first select all categories that have 0 as parent:
  $sql = tep_db_query("SELECT c.categories_id, cd.categories_name from categories c, categories_description cd WHERE c.parent_id = 0 AND c.categories_id = cd.categories_id AND cd.language_id = 1");
   echo '<table border="0" align="center"><tr>';
	while ($parents = tep_db_fetch_array($sql)) {
	   // check if the parent has products
	   $check = tep_db_query("SELECT products_id FROM products_to_categories WHERE categories_id = '" . $parents['categories_id'] . "'");
   if (tep_db_num_rows($check) > 0) {

		  $tree = tep_get_category_tree(); 
		  $dropdown= tep_draw_pull_down_menu('cat_id', $tree, '', 'onChange="this.form.submit();"'); //single
		  $all_list = '<form method="post" action="quick_priceupdates.php"><th class="smallText" align="left" valign="top">All categories:<br>' . $dropdown . '</form></th>';

	   } else {

	   // get the tree for that parent
		  $tree = tep_get_category_tree($parents['categories_id']);
		 // draw a dropdown with it:
			$dropdown = tep_draw_pull_down_menu('cat_id', $tree, '', 'onChange="this.form.submit();"');
			$list .= '<form method="post" action="quick_priceupdates.php"><th class="smallText" align="left" valign="top">' . $parents['categories_name'] . '<br>' . $dropdown . '</form></th>';
	}
   }
   echo /*$list .*/ $all_list . '</form></tr></table><p>';

  // see if there is a category ID:

 if ($HTTP_POST_VARS['cat_id']) {

  // start the table
  echo '<form method="post" action="quick_priceupdates.php"><table border="0" width="100%"><tr>';
   $i = 0;

  // get all active prods in that specific category

   $sql2 = tep_db_query("SELECT p.products_id, 
   p.products_quantity, 
   p.products_status, 
   p.products_image,
   p.products_model, 
   p.products_status,
   p.products_msrp,
   p.products_price, 
   pd.products_name from products p, products_to_categories ptc, products_description pd where p.products_id = ptc.products_id and p.products_id = pd.products_id and language_id = $languages_id and ptc.categories_id = '" . $HTTP_POST_VARS['cat_id'] . "'");

 while ($results = tep_db_fetch_array($sql2)) {
	   $i++;

		 echo '<td width="'. $width . '" align="left" style="padding-top: 20px;">' . tep_image(DIR_WS_CATALOG . DIR_WS_IMAGES . $results['products_image'], $results['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>';
		 echo '<span class="smallText"><a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $HTTP_POST_VARS['cat_id'] . '&pID=' . $results['products_id'] . '&action=new_product') . '">' . $results['products_name'] . '</a></span><br>';
		 echo '<table>
		 			<tr>
		 				<td><span class="smallText">Products Model#: </span></td>
						<td><span class="smallText">' . $results['products_model'] . '</span></td>
					</tr>
		 			<tr>
						<td><span class="smallText">Products Price (MSRP): </span></td>
						<td>$<input type="text" size="7" name="price_updateb[' . $results['products_id'] . ']" value="' . $results['products_msrp'] . '"></td>
					</tr>
		 			<tr>
						<td><span class="smallText">Products Price (Net): </span></td>
						<td>$<input type="text" size="7" name="price_update[' . $results['products_id'] . ']" value="' . $results['products_price'] . '"></td>
					</tr>							
					<tr>
						<td><span class="smallText">Stock:</span></td>
						<td><input type="text" size="7" name="stock_update[' . $results['products_id'] . ']" value="' . $results['products_quantity'] . '"></td>
					</tr>
					<tr>
						<td><span class="smallText">Status:</span></td>
						<td><span class="smallText">' . (($results['products_status'] == 0) ? '<font color="ff0000"><b>Not Active</b></font>' : '<font color="009933"><b>Active</b></font>') . '</span></td>
					</tr>
					<tr>
						<td></td>
						<td></td>
					</tr>
				</table>
				<i></td>';
	 	   echo '</i></td>';
	  if ($i == $max_cols) {
		   echo '</tr><tr>';
		   $i =0;
	 }
}
 echo '<input type="hidden" name="cat_id" value="' . $HTTP_POST_VARS['cat_id'] . '">';
 echo '</tr><td align="center" colspan="10">';
 echo '<input type="checkbox" unchecked="true" name="update_status"><span class="smallText">Confirm Status Change (active/not active)</span><p>';
 echo '<input type="submit" value="Update"></td></tr><td colspan="30" align="left"><font color="333333"><br><b>Last performed action:</b><br>' . $msg_stack . '</b></font></td></tr></form>';
 } //if
?>
</tr></table>


		</td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  </tr>
</table></td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Edited by golfman2006

Share this post


Link to post
Share on other sites

Great mod. I do have a request to make it even more useful. I have a client that would like to be able to change the prices of everything in a category by a percentage. At the moment we are doing this for him by using an SQL script in the database. Something like this:

 

UPDATE products,products_to_categories SET products.products_price = (products.products_price + (products.products_price * .075)) WHERE products.products_id = products_to_categories.products_id AND (products_to_categories.categories_id = '70' OR products_to_categories.categories_id = '74' OR products_to_categories.categories_id = '49' OR products_to_categories.categories_id = '47' OR products_to_categories.categories_id = '53' OR products_to_categories.categories_id = '52' OR products_to_categories.categories_id = '54' OR products_to_categories.categories_id = '64');

 

This of course handles both the top level category and any existing subcategories. If someone could incorporated something like this in the mod we and our client would be very gratefull!

Share this post


Link to post
Share on other sites

im downloaded Quick Price Updates v1.1.3

 

have a problems :

 

 

Warning: Variable passed to each() is not an array or object in C:\Programmi\xampp\htdocs\catalog\admin\quick_priceupdates.php on line 75

 

Warning: Variable passed to each() is not an array or object in C:\Programmi\xampp\htdocs\catalog\admin\quick_priceupdates.php on line 94

 

 

while (list($key, $value) = each($price_update)) {

while (list($key, $value) = each($stock_update)) {

 

dont work on php5 !

tested on php4 work !

 

you have correct code please ?

sorry for my english

Share this post


Link to post
Share on other sites

Hi

I installed this contribution which works beautifully for me!

 

However, just wondering if there was a way I can get the products to sort alphabetically by their name. I am not sure how it is sorted but I have a rather large catalog and it would make life so much easier if it was sorted alphabetically!

 

I have had a look around but not sure where to start!

 

Thanks in advance B)

Share this post


Link to post
Share on other sites
Just needs work on it to make it QTpro compatiable but can be used in its current format for basic sites.

Hey chooch,

 

Have made this work with qtpro, or do you know about another contrib or hack that have a function like this that work with qtpro?

 

//Fredrik

Share this post


Link to post
Share on other sites

Hello,

 

I am using quick price updates 1.13 and it works very well. Just one question, I installed it on an older version of OSC about one year ago and the main page I get one drop down table,

 

quickprice_old.jpg

 

The new install, I get a drop down box for every top level. How do I get it back to the single drop down box?

quickprice_new.jpg

 

Would like to get it back to the top pic version.

 

Thanks JR

Share this post


Link to post
Share on other sites

This contrib is nog working for me. I'm using php5.

 

I get the same warnings as Mauricimagnino

 

Warning: Variable passed to each() is not an array or object in C:\Programmi\xampp\htdocs\catalog\admin\quick_priceupdates.php on line 75

 

Warning: Variable passed to each() is not an array or object in C:\Programmi\xampp\htdocs\catalog\admin\quick_priceupdates.php on line 94

 

 

line 75: while (list($key, $value) = each($price_update)) {

Line 94: while (list($key, $value) = each($stock_update)) {

 

Is there anybody who can help with the code for php5?

 

thank you

 

greetings Claudia

Share this post


Link to post
Share on other sites
Hi

I installed this contribution which works beautifully for me!

 

However, just wondering if there was a way I can get the products to sort alphabetically by their name. I am not sure how it is sorted but I have a rather large catalog and it would make life so much easier if it was sorted alphabetically!

 

I have had a look around but not sure where to start!

 

Thanks in advance B)

Hi,

 

Have you managed to sort the products alphabetically? If so, can you advise how please?

 

Thanks in advance :)

 

Steve


____________________________________________________________________

____________________________________________________________________

Share this post


Link to post
Share on other sites

Hello,

 

I have been using Quick Price Updates for a while and it works great. I have one question on product drop down box. On one OSC installation I get a drop down box for every top level category, and on another I get one drop down box with all categories?? Any way to fix this so it is all under All Categories?

 

drop1.jpg

 

drop2.jpg

 

Thanks JR

Share this post


Link to post
Share on other sites

I am having the same issue as Claudia, though I am running PHP 4.3.10-22. If anyone has solved this problem-please enlighten us!


Quidquid latine dictum sit, profundum viditur.

Share this post


Link to post
Share on other sites

Hi all,

 

I have installed this contrib and it works perfectly. Is there a way to display the prices with VAT included, and the new price you enter be VAT inclusive as well?

 

Regards

Share this post


Link to post
Share on other sites

Thank you, this is really going to help me. It is really appreciated that those that can give so much so freely.

 

Les

Share this post


Link to post
Share on other sites

Hi,

 

Please could someone tell me why I am getting the following error and how to correct it, the server is running PHP version 5.2.6:

 

Warning: Variable passed to each() is not an array or object in /home/energysu/public_html/energysupplystore/admin/quick_priceupdates.php on line 75

 

Warning: Variable passed to each() is not an array or object in /home/energysu/public_html/energysupplystore/admin/quick_priceupdates.php on line 94

 

Help would really be appreciated.

 

 

Les

Share this post


Link to post
Share on other sites

This contribution working great! However i have some problem if i want to update category where is let me say over 60 product. This is what i get when i try to more products in one time "Forbidden

 

You don't have permission to access /admin/quick_stockupdate.php on this server."

 

If less product like 10 it's working great. Any idea?

 

And that new upgraded file doesn't give many any box where i can choose category etc.. old ones working great. Any idea for that?

Share this post


Link to post
Share on other sites

Hi,

 

I have added this contribution and it all seems to be up and running except when i go to change the prices to another price and click update it goes back to the original prices...

 

any one know what i have to do to get it to work???? :huh:

Share this post


Link to post
Share on other sites

YES YES YES

 

I fix this f*****g issue with php5 ! (sorry for this bad word but I am very happy now :)

 

so..for everyone with this error:

 

Warning: Variable passed to each() is not an array or object in /home/energysu/public_html/energysupplystore/admin/quick_priceupdates.php on line 75

Warning: Variable passed to each() is not an array or object in /home/energysu/public_html/energysupplystore/admin/quick_priceupdates.php on line 94

 

 

go to catalogue/admin/quick_priceupdates.php find (line 75):

 

  while (list($key, $value) = each($price_update)) {

 

and replace it with:

 

  while (list($key, $value) = each($HTTP_POST_VARS['price_update'])) {

 

also find (line 94):

 

  while (list($key, $value) = each($stock_update)) {

 

and replace it with:

 

  while (list($key, $value) = each($HTTP_POST_VARS['stock_update'])) {

 

that`s it your done!

 

What we do ?

 

$product_update and $stock_update are not an arrays so we replace them with arrays ($HTTP_POST_VARS['product_update'] and $HTTP_POST_VARS['stock_update'])

 

I don`t know is this the correct way to fix this issue but it works with php5 so... I will use it :D

Edited by netbull

I Need Money

Share this post


Link to post
Share on other sites
YES YES YES

 

I fix this f*****g issue with php5 ! (sorry for this bad word but I am very happy now :)

 

so..for everyone with this error:

 

Warning: Variable passed to each() is not an array or object in /home/energysu/public_html/energysupplystore/admin/quick_priceupdates.php on line 75

Warning: Variable passed to each() is not an array or object in /home/energysu/public_html/energysupplystore/admin/quick_priceupdates.php on line 94

 

 

go to catalogue/admin/quick_priceupdates.php find (line 75):

 

  while (list($key, $value) = each($price_update)) {

 

and replace it with:

 

  while (list($key, $value) = each($HTTP_POST_VARS['price_update'])) {

 

also find (line 94):

 

  while (list($key, $value) = each($stock_update)) {

 

and replace it with:

 

  while (list($key, $value) = each($HTTP_POST_VARS['stock_update'])) {

 

that`s it your done!

 

What we do ?

 

$product_update and $stock_update are not an arrays so we replace them with arrays ($HTTP_POST_VARS['product_update'] and $HTTP_POST_VARS['stock_update'])

 

I don`t know is this the correct way to fix this issue but it works with php5 so... I will use it :D

 

 

Thank you sooooooooooooooooooooo much!!! works now!!!! YAY!!!!!!!

 

THANKS X100000000000'S u have no idea how long i have gone over it.. and i was attemping to rego over it another million times ! lol thanks! :)

Share this post


Link to post
Share on other sites

Hello I would like to know where the files go.

I am a greenie and the text with the contribution is a tad vague to me.

 

The following files are affected by this contribution (all in the Admin section):

 

price_updater.php (new file) GOES WHERE?

price_updater.php (new file)(language file) GOES WHERE?

catalog.php (modify)

english.php (modify)

filenames.php (modify)

 

 

 

==========

New Files:

==========

 

Just drop the files into the correct location. WHICH IS WHERE?

The code file goes in your Admin directory WHAT CODE FILE?

(Actually, into whatever you have renamed your admin directory to. You have renamed it, haven't you?)

The language file goes in <admin>/includes/languages/english/.

I haven't included any translations because

I don't feel competent to translate this into any other languages. If you do, please include your

translation in an updated version of this Contribution.

 

Do I have to rename admin directory?

 

Appreciate any help

Gill A

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×