Jump to content



Photo
- - - - -

Quickly Update Product Stock


  • Please log in to reply
184 replies to this topic

#161   aquatyer

aquatyer
  • Members
  • 63 posts
  • Real Name:Aquatyer :-)

Posted 27 December 2009 - 22:55

Hi Great contrib thanks for all the work. I get the following error

Warning: reset() [function.reset]: Passed variable is not an array or object in \admin\quick_stockupdate.php on line 205

Warning: Variable passed to each() is not an array or object in admin\quick_stockupdate.php on line 206

The relevant code is below and it appears that it is the manufacturers field that's the problem, however I don't know what to do about it. I don't have any manufacturers in my shop so I guess it could be the cause.

Help any suggestions

$result = '<select name="stock_update[' .$cat_id . '][manufacturer]" onChange="changed(\'stock_update[' . $cat_id . '][changed]\');" title="'. QUICK_MANUFACTURER_ID . $default_id.'"><option value=></option>';
	
//This is line 205 below
reset($manufacturers_list);
	
//This is line 206 below
while (list($key, $value) = each ($manufacturers_list)) {
		if($default_id==$key){
		  $result .= '<option value="' . $key . '" selected="selected">' . $value . '</option>';
		} else {
		  $result .= '<option value="' . $key . '">' . $value . '</option>';
		}
	}   
	$result .= '</select>';
	return $result;

Thanks
Aquatyer

#162   aquatyer

aquatyer
  • Members
  • 63 posts
  • Real Name:Aquatyer :-)

Posted 29 December 2009 - 19:04

Anyone?

I would add that everything appears to work okay however if it lists 100 products in a category I get these two errors listed 100 times on the page first. for 200 products == 200 errors 300 == 300 errors and so on a real pain.

Warning: reset() [function.reset]: Passed variable is not an array or object in \admin\quick_stockupdate.php on line 205

Warning: Variable passed to each() is not an array or object in admin\quick_stockupdate.php on line 206
Thanks
Aquatyer

#163   webart

webart
  • Members
  • 58 posts
  • Real Name:Ron
  • Gender:Male
  • Location:Sydney

Posted 09 March 2010 - 06:54

Oop's, that's kind of how I meant I do it. Qty = 0 = Back Order, Status = Inactive = Not listed in catalog. [img]http://forums.oscommerce.com/public/style_emoticons/default/blush.gif[/img]


Apologies in advance if this is an inappropriate place to ask my question which deals with the number of items in the cart. The cart actually works, but the display is rather weird, it has an extra zero in it, when empty the cart displays 0 0 items They are both zero's.

When you add an item to the cart it increments correctly but displays 1 0 items, add another item and it displays 2 0 items and so on. The help I need is in which file controls this and hopefully which piece of code to modify to correct it. All help will be appreciated, thank you.
Regards Ron

#164   fishing man

fishing man
  • Members
  • 1 posts
  • Real Name:Nigel

Posted 14 April 2010 - 09:44

I figured it out and it works well.


Hi TropicalWebDesign,

I am facing this problem currently. Need to modify the product name and description in the quick stock updater.
Appreciate if you can post the code need to modify. I got the product name and description into the page. but unable to update.

Thank you

#165   smalto

smalto
  • Members
  • 20 posts
  • Real Name:jp
  • Location:Switzerland, Grandvaux

Posted 28 August 2010 - 11:41

I figured it out and it works well.


Hello TropicalWEbDesign,

I am facing the same problem and would like to know if you could share your solution in order to edit and update the name of the product and also the product description.
Many thank,

smalto
oscommerce 2.2 ms1 with contrib - lilibikini.com - 2005

#166   smalto

smalto
  • Members
  • 20 posts
  • Real Name:jp
  • Location:Switzerland, Grandvaux

Posted 28 August 2010 - 13:06

Hello everybody,

One more question if someone could help me out with this. I would also update the Manufacturer for the product because some time I dit a miskate when I entered the product.
How to implement this since we have the drop down list of the manufacturer showing for each product but it doesn't update.

Thanks a lot,

smalto
oscommerce 2.2 ms1 with contrib - lilibikini.com - 2005

#167   famaca

famaca
  • Members
  • 52 posts
  • Real Name:Fátima

Posted 10 February 2011 - 11:32

Hi,
I've installed Quick-Stock-Updater V3.8.1, but doesn't work for me, everything I do (if I change, for example, products stock) and I update, the products price change as well ( if the price is 58.47, for example, it changes to 5,847.00)and I don't know why. My currency is the € only. If someone knows how to solve it and can help me I'll be very grateful.

Thanks,

#168   oopsie

oopsie
  • Members
  • 2 posts
  • Real Name:Stu

Posted 28 February 2011 - 22:08

Hi,
If you're getting this error :
Warning: reset() [function.reset]: Passed variable is not an array or object in \admin\quick_stockupdate.php on line 205
Warning: Variable passed to each() is not an array or object in admin\quick_stockupdate.php on line 206

The reason is you have no manufacturers on your site set up. To get around this problem, change this code at line 205
		reset($manufacturers_list);
		while (list($key, $value) = each ($manufacturers_list)) {
			if($default_id==$key){
			  $result .= '<option value="' . $key . '" selected="selected">' . $value . '</option>';
			} else {
			  $result .= '<option value="' . $key . '">' . $value . '</option>';
			}
		}

To this
	if (sizeof($manufacturers_list) > 0)
	{
		
		reset($manufacturers_list);
		while (list($key, $value) = each ($manufacturers_list)) {
			if($default_id==$key){
			  $result .= '<option value="' . $key . '" selected="selected">' . $value . '</option>';
			} else {
			  $result .= '<option value="' . $key . '">' . $value . '</option>';
			}
		}
	}

I hope this helps, it worked on mine

#169   famaca

famaca
  • Members
  • 52 posts
  • Real Name:Fátima

Posted 20 May 2011 - 11:29

Hi,
If you're getting this error :
Warning: reset() [function.reset]: Passed variable is not an array or object in \admin\quick_stockupdate.php on line 205
Warning: Variable passed to each() is not an array or object in admin\quick_stockupdate.php on line 206

The reason is you have no manufacturers on your site set up. To get around this problem, change this code at line 205

		reset($manufacturers_list);
		while (list($key, $value) = each ($manufacturers_list)) {
			if($default_id==$key){
			  $result .= '<option value="' . $key . '" selected="selected">' . $value . '</option>';
			} else {
			  $result .= '<option value="' . $key . '">' . $value . '</option>';
			}
		}

To this
	if (sizeof($manufacturers_list) > 0)
	{
		
		reset($manufacturers_list);
		while (list($key, $value) = each ($manufacturers_list)) {
			if($default_id==$key){
			  $result .= '<option value="' . $key . '" selected="selected">' . $value . '</option>';
			} else {
			  $result .= '<option value="' . $key . '">' . $value . '</option>';
			}
		}
	}

I hope this helps, it worked on mine /biggrin.gif' class='bbc_emoticon' alt=':D' />


Thank you for your answer. I'm sorry but I've red your message today I thought I didn't have any answers to my problem.
I had the the error you say and I've solved it, but my problem continues if I change for example the product's quantity and I update the product's price changes as well, as I told in my previous message.

#170   fmr

fmr
  • Members
  • 22 posts
  • Real Name:Frank

Posted 09 July 2011 - 12:17

Been trying to add the date available to the quick_stockupdate.php, I have added the date available to the sql queries, but I have run into a problem on the input box.
When I update a product qty or any update, instead of the date available staying null, it updates to 00-00-00, I don't know how to specify that if there's no change, use null. the input is pasted below

<td class="dataTableContent" align="left"><input type="text" size="20" name="stock_update[<?php echo $results['products_id'] ?>][date_available]" value="<?php echo $results['products_date_available'] ?>" onChange="<?php echo $doChange?>" /></td>

#171   cbonnar

cbonnar
  • Members
  • 24 posts
  • Real Name:Colin Bonnar

Posted 05 September 2011 - 23:45

Hi,

I have installed this on 2.3.1 and noticed that the config menu gets screwed up when you select the stock-updater from the catalogs menu. Anyone have a fix for this. Running latest version?
Thanks
Colin

#172   kvadre

kvadre
  • Members
  • 55 posts
  • Real Name:jesper emborg

Posted 11 December 2011 - 09:16

Hi

I'm having a problem when i'm trying to move products. Sometimes all the marked products are moved, and sometime they are not. I have not been able to find a pattern in when it dosn't work.
Anyone with an idea to what is wrong?

/Jesper

#173   jhaugen

jhaugen
  • Members
  • 30 posts
  • Real Name:Jerry Haugen

Posted 13 April 2012 - 22:10

I just installed the April 8, 2012 version on osC 2.3.1 with php 5.3.10. I got the following error:

“Deprecated: Function eregi() is deprecated in . . . admin/quick_stockupdate.php on line 147”

Here is the fix:

OLD LINE:

if ( (eregi('alter ', $next)) || (eregi('update', $next)) || (eregi('create', $next)) || (eregi('insert', $next)) || (eregi('delete', $next)) || (eregi('drop t', $next)) ) {

NEW LINE:

if ( (preg_match('/alter/i ', $next)) || (preg_match('/update/i', $next)) || (preg_match('/create/i', $next)) || (preg_match('/insert/i', $next)) || (preg_match('/delete/i', $next)) || (preg_match('/drop t/i', $next)) ) {

Just replace the old line with the new line. It now seems to be working fine.

-Jerry-

#174   ryder

ryder
  • Members
  • 4 posts
  • Real Name:Ryder
  • Gender:Male

Posted 24 July 2012 - 11:37

Hi,
I've installed Quick-Stock-Updater V3.8.1, but doesn't work for me, everything I do (if I change, for example, products stock) and I update, the products price change as well ( if the price is 58.47, for example, it changes to 5,847.00)and I don't know why. My currency is the € only. If someone knows how to solve it and can help me I'll be very grateful.

Thanks,


I got the same problem that the price changes like 58.47 to 5,847.00 when update the stock for the item. I don't get any error message, however when I then change the price from 5,847.00 to 58.47 it updates price value correctly to 58.47. Using Quick-Stock-Updater V3.8.5
Someone have idea how to solve it?

Thanks,

#175   famaca

famaca
  • Members
  • 52 posts
  • Real Name:Fátima

Posted 20 September 2012 - 08:37

Hi,

At last!!! I've solved the problem i had with Quick-Stock-Updater V3.8.1, and it's so simple. The problem is the unit separador we use when we define the currency, in my case the euro. The settings in currency have to be: use a dot (.) for decimals and nothing for thousands. Then, everithing works well. I hope this can help.

#176   dudikpal

dudikpal
  • Members
  • 1 posts
  • Real Name:Dudik Pal

Posted 11 November 2012 - 18:22

Its possible to show a thumbnail images in ID column?

#177   surf55

surf55
  • Members
  • 12 posts
  • Real Name:tarmo

Posted 10 March 2013 - 11:06

Hi

Thanks for this amazing contribution, it makes all so much easyer and faster.

I'm also using a new stock notifyer contribution: http://addons.oscommerce.com/info/3152

it works when editing quantities in categories.php. It requires editing categories.php like this:
FIND this:
		    tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$products_id . "', '" . (int)$current_category_id . "')");
		  } elseif ($action == 'update_product') {
Insert this directly AFTER it:
// BEGIN Automatic Stock Notification
   $current_stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . (int)$_GET['pID'] . "'");
   $current_stock = tep_db_fetch_array($current_stock_query);
   if ($current_stock['products_quantity'] < 1) {
	 if ($_POST['products_quantity'] > 0) {
    $audience = array();
    $products_query = tep_db_query("select distinct pn.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c, " . TABLE_PRODUCTS_NOTIFICATIONS . " pn where c.customers_id = pn.customers_id and pn.products_id in ( '" . (int)$products_id . "')");
    while ($products = tep_db_fetch_array($products_query)) {
	  $audience[$products['customers_id']] = array('firstname' => $products['customers_firstname'],
				  'lastname' => $products['customers_lastname'],
				  'email_address' => $products['customers_email_address']);
    }
    $product_query_raw = tep_db_query("select p.products_id, pd.language_id, pd.products_name, pd.products_description, pd.products_url, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and p.products_id = '" . (int)$_GET['pID'] . "'");
    $product = tep_db_fetch_array($product_query_raw);
    $customers_query_raw = tep_db_query("select distinct pn.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c, " . TABLE_PRODUCTS_NOTIFICATIONS . " pn where c.customers_id = pn.customers_id and pn.products_id in ( '" . (int)$products_id . "')");
    $customer = tep_db_fetch_array($customers_query_raw);
    reset($audience);
    while (list($key, $value) = each ($audience)) {
	  $mimemessage = new email(array('X-Mailer: osCommerce System Mailer'));
	  // add the message to the object
	  if (EMAIL_USE_HTML == 'true') {
	 $mimemessage->add_html(HTML_NOTIFICATION1 . $value['firstname'] . ' ' . $value['lastname'] . HTML_NOTIFICATION2 . STORE_NAME . HTML_NOTIFICATION3 . $products_id . '">' . $product['products_name'] . HTML_NOTIFICATION4 . '">' . STORE_NAME . HTML_NOTIFICATION5 . $product['products_name'] . HTML_NOTIFICATION6 . $product['products_name'] . HTML_NOTIFICATION7 . STORE_NAME . HTML_NOTIFICATION8 . $products_id . '">' . $product['products_name'] . HTML_NOTIFICATION9 . STORE_NAME);
	  } else {
	 $mimemessage->add_text(TEXT_NOTIFICATION1 . $value['firstname'] . ' ' . $value['lastname'] . TEXT_NOTIFICATION2 . STORE_NAME . TEXT_NOTIFICATION3 . $product['products_name'] . TEXT_NOTIFICATION4 . $product['products_name'] . TEXT_NOTIFICATION5 . $product['products_name'] . TEXT_NOTIFICATION6 . STORE_NAME . TEXT_NOTIFICATION7 . $product['products_name'] . TEXT_NOTIFICATION8 . STORE_NAME);
	  }
	  $mimemessage->build_message();
	  $mimemessage->send($value['firstname'] . ' ' . $value['lastname'], $value['email_address'], STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT . $product['products_name'], $email_order);
	  // the following line deletes the customer notification so that that after the email is sent, the customer will have to visit the product page and select the notification button in order to receive future email stock notifications
	  tep_db_query("delete from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $products_id . "' ");
    }
	 }
   }
// END Automatic Stock Notification

So I presume I would have to add same code into quick_stockupdate.php too? But where to insert it?
<?php
/*
  $Id: quick_stockupdate.php 1739 2009-05-05 00:52:16Z Azrin Aris $
  Quick Product update - V3.8.1

ChangeLog:

v3.8.1   05/06/09 Version by: Azrin Aris
Summary :
  1. Add "Title" tag to Category/Manufacture selector to show its category/manufacture id - requested by Jim Hande <img src='http://forums.oscommerce.com/public/style_emoticons/<#EMO_DIR#>/wink.png' class='bbc_emoticon' alt=';)' />
 
BugFix:
  1. MySQL not updating if manufactures_id is not set when MySQL is configures as 'STRICT' - Fixed by Steve (Jimbob_pooley)
 
v3.8   05/05/09 Version by: Azrin Aris
Summary :
1. Minor Redesign on UI:
  + added Top/Bottom Action Bar
2. Added Update/Copy/Move/Delete Function
3. Added Numeric Input filtering
4. Added quick_stockupdate.css file for easier table customization

BugFix:
  - if a value is more than a thousand, using autoupdate will make the price to 1.00 - Fixed
v3.7   01/25/09 Version by: Azrin Aris
Summary :
1. Add Language filter

v3.6   01/23/09 Version by: Azrin Aris
Summary :
1. Remove the need to use /tmp directory
2. Add Search by Category or By Manufacture

 
v3.5   12/16/08 Version by: Azrin Aris
Summary :
1. Add Quick Stock Updater Configuration page (Configuration->Quick Stock Updater)
   - Enable/Disable Add to stock option (value entered in 'New Stock' will be added to existing stock - Default = Enable)
   - Enable/Disable Update Process time (Default = Enable)
   - Set Max input character for 'Model' field (Default = 8)
   - Set Max input character for 'Weight' field (Default = 4)
   - Set Max input character for 'New Stock' field (Default = 4)
   - Set Max input character for 'Price' field (Default = 6)
   - Set decimal point for 'Price' field (Default = 2)
2. SQL installation script for configuration page QuickStock_sql_install.sql is included
3. SQL uninstallation script for configuration page QuickStock_sql_uninstall.sql is included


v3.2   12/12/08 Version by: Azrin Aris
Summary :
1. Remove Server loading checking
2. Remove Row-By-Row SQL Update method
3. Change update method to SQL import method
4. Add update time display
 
v3.1   12/1/08 Version by: Azrin Aris
Summary :
1. Added serverload checking to avoid server bogging if items are too many
2. Added Data changed event to update only changed record(s) to minimize server load
3. Added Message notification
4. Added Screen shot <img src='http://forums.oscommerce.com/public/style_emoticons/<#EMO_DIR#>/wink.png' class='bbc_emoticon' alt=';)' />
5. Added MoSoft German Translation - but addition Variable still need translation

v3.0   12/1/08 Version by: Azrin Aris
Summary :
Rewrite the quick_stokupdate.php in admin/include - solved the > 40 items problem (at least on my online store <img src='http://forums.oscommerce.com/public/style_emoticons/<#EMO_DIR#>/wink.png' class='bbc_emoticon' alt=';)' />). I've tested on FireFox, please let me know if it works on other browsers.

 
 
*/
  require('includes/application_top.php');
  require('includes/classes/currencies.php');
//--------------------------------------------------------------------------------------------------------------------------------------------------

//Function to return time in seconds.
function microtime_float(){
   list($usec, $sec) = explode(" ", microtime());
   return ((float)$usec + (float)$sec);
}
//--------------------------------------------------------------------------------------------------------------------------------------------------


  //Credit to surfalot (Run SQL Script)
function qs_db_query($query, $link = 'db_link') {
    global $$link;
    return mysql_query($query, $$link);
  }
//--------------------------------------------------------------------------------------------------------------------------------------------------
//Credit to surfalot (Run SQL Script)
//Modified for Quick Stock Update - 2008-12-12 Azrin Aris
function qs_update_db_file($qs_file){

  if (file_exists($qs_file)) {
   $fd = fopen($qs_file, 'rb');
   $restore_query = fread($fd, filesize($qs_file));
   fclose($fd);
   qs_upsate_db($restore_query);
  } else {
   return false;
  }
}

function qs_update_db($qs_sql){
  $sql_array = array();
  $sql_length = strlen($qs_sql);
  $pos = strpos($qs_sql, ';');
  for ($i=$pos; $i<$sql_length; $i++) {
   if ($qs_sql[0] == '#' || $qs_sql[0] == '-') {
    $qs_sql = ltrim(substr($qs_sql, strpos($qs_sql, "\n")));
    $sql_length = strlen($qs_sql);
    $i = strpos($qs_sql, ';')-1;
    continue;
   }
   if ($qs_sql[($i+1)] == "\n") {
    for ($j=($i+2); $j<$sql_length; $j++) {
	 if (trim($qs_sql[$j]) != '') {
	  $next = substr($qs_sql, $j, 6);
	  if ($next[0] == '#' || $next[0] == '-') {
// find out where the break position is so we can remove this line (#comment line)
	   for ($k=$j; $k<$sql_length; $k++) {
	    if ($qs_sql[$k] == "\n") break;
	   }
	   $query = substr($qs_sql, 0, $i+1);
	   $qs_sql = substr($qs_sql, $k);
// join the query before the comment appeared, with the rest of the dump
	   $qs_sql = $query . $qs_sql;
	   $sql_length = strlen($qs_sql);
	   $i = strpos($qs_sql, ';')-1;
	   continue 2;
	  }
	  break;
	 }
    }
    if ($next == '') { // get the last insert query
	 $next = 'insert';
    }
    if ( (eregi('alter ', $next)) || (eregi('update', $next)) || (eregi('create', $next)) || (eregi('insert', $next)) || (eregi('delete', $next)) || (eregi('drop t', $next)) ) {
	 $next = '';
	 $sql_array[] = substr($qs_sql, 0, $i);
	 $qs_sql = ltrim(substr($qs_sql, $i+1));
	 $sql_length = strlen($qs_sql);
	 $i = strpos($qs_sql, ';')-1;
    }
   }
  }
  for ($i=0; $i<sizeof($sql_array); $i++) {
   if (!qs_db_query($sql_array[$i])) {
    $db_error = mysql_error();
    $i = sizeof($sql_array);
   }
  }
  return true;
  }
//--------------------------------------------------------------------------------------------------------------------------------------------------
 
// Function to query Manufacturer List from DB - Added 2008/12/30 Azrin Aris
function tep_quickstock_get_manufacturer_list(){
  //get manufacture id and name
  $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
  $manufacturers_array;
  while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
   $manufacturers_array[$manufacturers['manufacturers_id']] = $manufacturers['manufacturers_name'];
  }
 
  return $manufacturers_array;
  }
//--------------------------------------------------------------------------------------------------------------------------------------------------
 
// Function to create drop down list for manufacturer selection - Added 2009/01/21 Azrin Aris
function tep_quickstock_manufacturer_selector($manufacturers_list){
global $mfg_id;

$result = '<select name="mfg_id" onchange="this.form.submit();" title="'. QUICK_MANUFACTURER_ID . $mfg_id.'"><option value=0>--NONE--</option>';
reset($manufacturers_list);

while (list($key, $value) = each ($manufacturers_list)) {
  if($mfg_id==$key){
    $result .= '<option value="' . $key . '" selected="selected">' . $value . '</option>';
  } else {
    $result .= '<option value="' . $key . '">' . $value . '</option>';
  } }  
$result .= '</select>';
return $result;
  }
//--------------------------------------------------------------------------------------------------------------------------------------------------
// Function to create drop down list for manufacturer selection - Added 2008/12/30 Azrin Aris
function tep_quickstock_manufacturer_selectorEx($manufacturers_list,$cat_id,$default_id){


$result = '<select name="stock_update[' .$cat_id . '][manufacturer]" onchange="changed(\'stock_update[' . $cat_id . '][changed]\');" title="'. QUICK_MANUFACTURER_ID . $default_id.'"><option value=></option>';
reset($manufacturers_list);
while (list($key, $value) = each ($manufacturers_list)) {
  if($default_id==$key){
    $result .= '<option value="' . $key . '" selected="selected">' . $value . '</option>';
  } else {
    $result .= '<option value="' . $key . '">' . $value . '</option>';
  }
}  
$result .= '</select>';
return $result;
  }
//--------------------------------------------------------------------------------------------------------------------------------------------------

// Function to query language List from DB - Added 2008/12/30 Azrin Aris
  function tep_quickstock_get_language_list(){
  //get manufacture id and name
  $languages_query = tep_db_query("select languages_id, name from " . TABLE_LANGUAGES . " order by languages_id");
  $languages_array;
  while ($languages = tep_db_fetch_array($languages_query)) {
   $languages_array[$languages['languages_id']] = $languages['name'];
  }
 
  return $languages_array;
  }
//--------------------------------------------------------------------------------------------------------------------------------------------------

// Function to create drop down list for language selection - Added 2009/01/21 Azrin Aris
function tep_quickstock_language_selector(){
global $lang_id;

$languages_list =tep_quickstock_get_language_list();

$result = '<select name="lang_id" onchange="this.form.submit();">';
reset($languages_list);

while (list($key, $value) = each ($languages_list)) {
  if($lang_id==$key){
    $result .= '<option value="' . $key . '" selected="selected">' . $value . '</option>';
  } else {
    $result .= '<option value="' . $key . '">' . $value . '</option>';
  } }  
$result .= '</select>';
return $result;
  }
//--------------------------------------------------------------------------------------------------------------------------------------------------
   
 
  // Function to create drop down list for category selection - Added 2008/12/30 Azrin Aris
function tep_quickstock_category_selectorEx($cat_id,$default_id,$enabled = true){
  $disabled = $enabled?"":" disabled";
  $select_name = 'stock_update[' .$cat_id . '][category]';
  $select_onchange = 'onchange="changed(\'stock_update[' . $cat_id . '][changed]\');"';
 
  $tree = tep_get_category_tree();


  $dropdown= tep_draw_pull_down_menu($select_name, $tree, $default_id, $select_onchange . ' title="'. QUICK_CATEGORY_ID . $default_id.'"' . $disabled); //single
  return $dropdown;
  }
//--------------------------------------------------------------------------------------------------------------------------------------------------

  // Function to create drop down list for category selection - Added 2008/12/30 Azrin Aris
  function tep_quickstock_category_selector(){
  global $cat_id;
 
  $tree = tep_get_category_tree();

  $dropdown= tep_draw_pull_down_menu('cat_id', $tree, '', 'onchange="this.form.submit();" title="'. QUICK_CATEGORY_ID . $cat_id.'"'); //single
  return $dropdown;
  }

//--------------------------------------------------------------------------------------------------------------------------------------------------

  // Function to create list of products base on selected category/manufacturer - Added 2008/12/30 Azrin Aris
  function tep_quickstock_product_listing($sel_id){
  global $lang_id;
  global $manufacturers_list;
  global $filter_type;
 
 
  if (tep_not_null($sel_id)) {
   if($filter_type==1){
    $sql2 = tep_db_query("SELECT p.products_model, p.products_id, p. products_quantity, p.products_status, p.products_weight, p.products_price, p.manufacturers_id, pd.products_name, pd.language_id, ptc.categories_id 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 ptc.categories_id = '" . $sel_id . "' and pd.language_id = '" . (int)$lang_id . "' order by pd.products_name");
    }
    else{
    $sql2 = tep_db_query("SELECT p.products_model, p.products_id, p. products_quantity, p.products_status, p.products_weight, p.products_price, p.manufacturers_id, pd.products_name, pd.language_id, ptc.categories_id 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 p.manufacturers_id = '" . $sel_id . "' and pd.language_id = '" . (int)$lang_id . "' order by pd.products_name");
    }
   

  
	  while ($results = tep_db_fetch_array($sql2)) {
  
	 //check the item status
	 $active = ($results['products_status'] == 1) ? ' checked="CHECKED"' : '';
	 $inactive = ($results['products_status'] == 0) ? ' checked="CHECKED"' : '';


	 //create mannufacture select statement
	 if($filter_type==1){
    $catman_select = tep_quickstock_manufacturer_selectorEx($manufacturers_list, $results['products_id'],$results['manufacturers_id']);
   }
   else {
    $catman_select = tep_quickstock_category_selectorEx($results['products_id'],$results['categories_id'],false);
   }
  
	 $doChange = 'changed(\'stock_update[' . $results['products_id'] . '][changed]\');';
    $doValidate_flt = 'javascript: this.value = validate (this.value, 2, 0);';
    $doValidate_int = 'javascript: this.value = validate (this.value, 0, 1);';
	
	 ?>
	 <tr class="dataTableRow">
   <td class="dataTableContent" align="center"><input type="CHECKBOX" name="stock_update[<?php echo  $results['products_id'] ?>][changed]">
		 <input type="HIDDEN" name="stock_update[<?php echo  $results['products_id'] ?>][ptc]" value="<?php echo $results['categories_id'] ?>"></td>
	    <td class="dataTableContent" align="center"><?php echo $results['products_id'] ?></td>
		 <td class="dataTableContent" align="center"><input type="text" size="<?php echo QUICK_STOCK_MODELSIZE ?>" name="stock_update[<?php echo  $results['products_id'] ?>][model]" value="<?php echo $results['products_model'] ?>" onchange="<?php echo $doChange?>"></td>
		 <td class="dataTableContent" align="center"><?php echo $catman_select?></td>
		 <td class="dataTableContent" align="left" ><?php echo $results['products_name'] ?></td>
		 <td class="dataTableContent" align="center"><input type="text" size="<?php echo QUICK_STOCK_WEIGHTSIZE ?>" name="stock_update[<?php echo $results['products_id'] ?>][weight]" value="<?php echo $results['products_weight'] ?>" onchange="<?php echo $doChange?>" onblur="<?php echo $doValidate_flt?>"></td>
		 <td class="dataTableContent" align="center"><input type="text" size="<?php echo QUICK_STOCK_PRICESIZE ?>" name="stock_update[<?php  echo $results['products_id'] ?>][price]" value="<?php echo number_format($results['products_price'],QUICK_STOCK_PRICEDEC,'.',','); ?>" onchange="<?php echo $doChange?>" onblur="<?php echo $doValidate_flt?>"></td>
		 <td class="dataTableContent" align="center"><?php echo $results['products_quantity'] ?><input type="hidden" size="4" name="stock_update[<?php echo $results['products_id'] ?>][oldstock]" value="<?php echo $results['products_quantity'] ?>" onchange="<?php echo $doChange?>"></td>
		 <td class="dataTableContent" width = "50px" align="center"><input type="text" size="<?php echo QUICK_STOCK_STOCKSIZE ?>" name="stock_update[<?php echo $results['products_id'] ?>][newstock]" value="0" onchange="<?php echo $doChange?>" onblur="<?php echo $doValidate_int?>"></td>
		 <td class="dataTableContent" align="center" ><input type="radio" name="stock_update[<?php echo $results['products_id'] ?>][active]" value="1" <?php echo $active ?> onclick="<?php echo $doChange?>"></td>
		 <td class="dataTableContent" align="center" ><input type="radio" name="stock_update[<?php echo $results['products_id'] ?>][active]" value="0" <?php echo $inactive ?> onclick="<?php echo $doChange?>"></td>
	    </tr>
	   
	   
	  <?php
	  }
  }
}
//--------------------------------------------------------------------------------------------------------------------------------------------------
  // Function to create Action Bar - Added 2009/04/01 Azrin Aris
  function draw_action_bar($action_id){
  global $action_type;
  global $dest_id;
  global $auto_status;
  ?>		 
    <tr class="alt">
	    <th scope="col" align="left" colspan="9" >
		 Action :
		 <select name="action_type[]" id="select_action" onchange="showElement(this)">
			    <option value="0"<?php if($action_type==0){echo ' selected="selected"';}?>><?php echo QUICK_UPDATE?></option>
			    <option value="1"<?php if($action_type==1){echo ' selected="selected"';}?>><?php echo QUICK_COPY  ?></option>
			    <option value="2"<?php if($action_type==2){echo ' selected="selected"';}?>><?php echo QUICK_MOVE  ?></option>
			    <option value="3"<?php if($action_type==3){echo ' selected="selected"';}?>><?php echo QUICK_DELETE?></option>
			    </select>
		 <?php
		    $cat_tree = tep_get_category_tree();
		    echo tep_draw_pull_down_menu('dest_id[]', $cat_tree, $dest_id, 'onchange="updateDest(this)"'); //single
		 ?>
	    </th>
	    <th scope="col" colspan="2" align="center">
		  <input type="CHECKBOX" name="auto_status[]" onchange="updateAutoStatus(this)" ><?php echo QUICK_AUTOSTATUS?>		 
	    </th>
    </tr>
  <?php
  }

//--------------------------------------------------------------------------------------------------------------------------------------------------
// Function to remove formatted number - Added 2009/05/05 Azrin Aris
function number_unformat ($input)
{
  $curr = new currencies();
 
  $thousands_sep = $curr->currencies[DEFAULT_CURRENCY]['thousands_point'];
  $decimal_point = $curr->currencies[DEFAULT_CURRENCY]['decimal_point'];
 
   if ($thousands_sep == chr(160)) {

	 // change non-breaking space into ordinary space

	 $thousands_sep = chr(32);

   } // if

  

   $count = count_chars($input, 1);

   if ($count[ord($decimal_point)] > 1) {

	 // too many decimal places

	 return $input;

   } // if

  

   // split number into 2 distinct parts

   list($integer, $fraction) = explode($decimal_point, $input);

  

   // remove thousands separator

   $integer = str_replace($thousands_sep, NULL, $integer);

  

   // join the two parts back together again

   $number = $integer .'.' .$fraction;

  

   return $number;
  

} // number_unformat
//--------------------------------------------------------------------------------------------------------------------------------------------------

  //Check if cat_id is set by user selection
  $cat_id = (isset($HTTP_POST_VARS['cat_id']) ? $HTTP_POST_VARS['cat_id'] : '');
  //Check if stock_update is set
  $stock_update = (isset($HTTP_POST_VARS['stock_update']) ? $HTTP_POST_VARS['stock_update'] : '');
 
  //Check if update_status is set
  $update_status = (isset($HTTP_POST_VARS['update_status']) ? $HTTP_POST_VARS['update_status'] : '');
 
  //Check if filter_type is set
  $filter_type = (isset($HTTP_POST_VARS['filter_type']) ? $HTTP_POST_VARS['filter_type'] : '1');
 
//Check if mfg_id is set
  $mfg_id = (isset($HTTP_POST_VARS['mfg_id']) ? $HTTP_POST_VARS['mfg_id'] : '0');
//Check if lang_id is set
  $lang_id = (isset($HTTP_POST_VARS['lang_id']) ? $HTTP_POST_VARS['lang_id'] : '1');
//Check if action_type is set
  $action_array = array();
  $action_array = (isset($HTTP_POST_VARS['action_type']) ? $HTTP_POST_VARS['action_type'] : '');
  $action_type = $action_array[1];
 
//Check if dest_id is set
  $dest_array = array();
  $dest_array = (isset($HTTP_POST_VARS['dest_id']) ? $HTTP_POST_VARS['dest_id'] : '');
  $dest_id = $dest_array[1];
//Check if auto_status is set
  $auto_status_array = array();
  $auto_status_array = (isset($HTTP_POST_VARS['auto_status']) ? $HTTP_POST_VARS['auto_status'] : '');
  $auto_status = $auto_status_array[1]=="on"?1:0;
 
 
  $manufacturers_list[] = array();
  $manufacturers_list = tep_quickstock_get_manufacturer_list();
 
//--------------------------------------------------------------------------------------------------------------------------------------------------

  if(tep_not_null($stock_update)){
  
   $update_count = 0;
   $busy_count = 0;
   $qs_sql = '';
  

   while (list($key, $items) = each($stock_update)){
   
	 $changed = $items['changed'];
	 $categories_id = $items['oldstock'];
	

	 $items_price = number_unformat($items['price']);
  
	 if ($items['manufacturer'] == '') {$items['manufacturer']=0;}// Credit to Jimbob_pooley for this fix
	
	 if($action_type==0)
	 {
	
	 if(QUICK_STOCK_ADDTOSTOCK == 'true'){
	  $current_stock = $items['newstock'] + $items['oldstock'];
	 } else {
	  $current_stock = $items['newstock'];
	 }
	
	 if(tep_not_null($auto_status)){
    $new_status = $current_stock>0?"1":"0";
	  if($items['active']!=$new_status)
	  {
	   $items['active'] = $new_status;
	   $changed = 1;
	  }
	 }//End if(tep_not_nul...
  
	 
		
	 if($changed){
	 
	  //Begin Validation Code
	 
	  //End of Validation Code
	  $update_count++;
	  
	  if($filter_type==1){
	   $sql = "UPDATE products SET products_quantity = '".$current_stock."', products_model = '".$items['model']."', products_price = '".$items_price."', products_weight = '".$items['weight']."', manufacturers_id = '".$items['manufacturer']."', products_status = '".$items['active']."' WHERE products_id = $key";
	  
	   $qs_sql .= "$sql;\n";
	  }
	  else {
	   $sql = "UPDATE products SET products_quantity = '".$current_stock."', products_model = '".$items['model']."', products_price = '".$items_price."', products_weight = '".$items['weight']."', products_status = '".$items['active']."' WHERE products_id = $key";
	  
	   $qs_sql .= "$sql;\n";
	  
	  }
	 
	 }//End if($changed)
	 }//End if($action_type==0)
	 else if($action_type==1)
	 {
	  if($changed)
	  {
	    $update_count++;
	 $sql = "INSERT into products_to_categories (products_id, categories_id) values ('$key', '$dest_id')";
	 $qs_sql .= "$sql;\n";
	  }
	 }
	 else if($action_type==2)
	 {
	 if($changed)
	  {
	    $update_count++;
	    $sql = "UPDATE products_to_categories SET categories_id = '".$dest_id."' WHERE products_id = $key";
	    $qs_sql .= "$sql;\n";
	  }
	 }
	 else if($action_type==3)
	 {
	 if($changed)
	  {
	    $update_count++;
	    $sql = "DELETE FROM products_to_categories where products_id = $key AND categories_id ='" . $items['ptc'] ."'";
	    $qs_sql .= "$sql;\n";
	
	  }
  
	 }  
  }//End while($list...

  if($update_count){
 
   $time_start = microtime_float();
   $update_status = qs_update_db($qs_sql);
  
   $time_end = microtime_float();
   $time = $time_end - $time_start;   
  
   if($update_status){
    $msg_str = sprintf(QUICK_MSG_ITEMSUPDATED,$update_count);
    $messageStack->add(QUICK_MSG_SUCCESS . ' ' . $msg_str,'success'); 
   
    if(QUICK_STOCK_SHOWELAPSETIME == 'true'){
	 $msg_str = sprintf(QUICK_MSG_UPDATETIME,$time);
	 $messageStack->add(QUICK_MSG_SUCCESS . ' ' . $msg_str,'success'); 
    }
		   
   } else {
    $messageStack->add(QUICK_MSG_ERROR . ' ' . QUICK_MESSAGE_UPDATEERROR,'error');		 
   }//End if(qd_update_db(...

  } else {
   $messageStack->add(QUICK_MSG_WARNING . ' ' . QUICK_MSG_NOITEMUPDATED ,'warning');
  }//End if($update_count) 
  }//End Of stock update
//this line puts in the proper menu column on left in admin for OSC 2.3
  require('includes/template_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><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<link rel="stylesheet" type="text/css" href="quick_stockupdate.css">
<script language="javascript" src="includes/general.js"></script>
<SCRIPT TYPE="text/javascript">
<!--
function changed(a){
var allElements = document.getElementsByName(a);

for (var i=0; i < allElements.length; i++) {
	 allElements[i].value = 1;
	 allElements[i].checked = true;
  
}
}

function checkall(a){
var forms = document.QuickUpdate_Form;

for(i=0; i<forms.elements.length;i++)
{
  if(forms.elements[i].type=="checkbox" && forms.elements[i].name!="auto_status[]")
  {
   forms.elements[i].checked=a.checked;
  }
}
}
function updateAutoStatus(a){
var ds = document.getElementsByName(a.name);
var st = document.getElementsByName("status_txt");
for (b=0; b < ds.length; b++) {
	 ds[b].checked = a.checked;
  
}

st[0].style.visibility = a.checked?"visible":"hidden";
}
function updateDest(a){
var ds = document.getElementsByName(a.name);


for (b=0; b < ds.length; b++) {
	 ds[b].value = a.value;
  
}
}
function showElement(a){
do_showElement(a.value);
}

function do_showElement(a){
var action_select = document.getElementsByName("action_type[]");
var dest_select = document.getElementsByName("dest_id[]");
var auto_status = document.getElementsByName("auto_status[]");
var st = document.getElementsByName("status_txt");

var showelement = (a>0 && a<3);

st[0].style.visibility = auto_status[0].checked?"visible":"hidden";


for (var j=0; j < 2; j++) {
  action_select[j].value = a;
 
  if(showelement==true)
  {
	  dest_select[j].style.visibility = "visible";
  }
  else
  {
	  dest_select[j].style.visibility = "hidden";
  }
 
  if(a==0)
  {
	  auto_status[j].disabled = "";
  }
  else
  {
   auto_status[j].disabled = "disabled";
  }
}
}
function validate (str, dec, bNeg)
{ // auto-correct input - force numeric data based on params.
var cDec = '.'; // decimal point symbol
  var bDec = false; var val = "";
  var strf = ""; var neg = ""; var i = 0;
  if (str == "")
  return parseFloat ("0").toFixed (dec);
  if (bNeg && str.charAt (i) == '-')
  {
  neg = '-';
  i++;
}
  for (i; i < str.length; i++)
  {
    val = str.charAt (i);
    if (val == cDec)
    {
	  if (!bDec)
   {
    strf += val;
    bDec = true;
   }
    }
    else if (val >= '0' && val <= '9')
	 {
   strf += val;
  }
  }

  strf = (strf == "" ? 0 : neg + strf);
  return parseFloat (strf).toFixed (dec);
}
//-->
</SCRIPT>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">
<!-- 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 //-->
<!-- left_navigation_eof //-->
    </table></td>
<!-- body_text //-->
    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="2" cellpadding="2">
	 <tr>
	  <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	    <tr>
		 <td class="pageHeading"><?php echo QUICK_HEAD1; ?></td>
		 <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
	    </tr>
	   </table></td>
	 </tr>
	 <tr>
	  <form action="quick_stockupdate.php" method="post" name="SearchCriteria_Form">
	  <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
		 <!--<tr>
		  <td class="main" colspan="3"><?php //echo QUICK_HEAD2; ?></td>
		 </tr>-->
		 <tr>
		  <td class="main" colspan="2" align="left"><?php echo 'Search by'; ?></td>
		  <td class="main" colspan="2" align="left"><?php echo $filter_type==1?'Select Category':'Select Manufacturer'; ?></td>
		  <td class="main" colspan="2" align="left"><?php echo 'Select Language'; ?></td>
		 </tr>
		  <!--START OF SEARCH CRITERIA BOX-->   
		 <tr>
		  <td class="main" align="left" width="50px">
		   <select name="filter_type" id="select" onchange="this.form.submit();">
	    <option value="1"<?php if($filter_type==1){echo ' selected="selected"';}?>><?php echo QUICK_CATEGORY  ?></option>
	    <option value="2"<?php if($filter_type==2){echo ' selected="selected"';}?>><?php echo QUICK_MANUFACTURER?></option>
	  </select>
		  </td>
		  <td class="main" width="10px"></td>
		  <td class="main" align="left" width="100px"><p><?php if($filter_type==1){ echo tep_quickstock_category_selector();} else{echo tep_quickstock_manufacturer_selector($manufacturers_list);} ?></p></td>
		  <td class="main" width="10px"></td>
		  <td class="main" align="left" width="100px"><p><?php echo tep_quickstock_language_selector(); ?></p></td>
		  <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
		 </tr>
		 <!--/END OF SEARCH CRITERIA BOX-->	   
		 </table></td>
	  </form>	 
	 </tr>
	 <tr>
	    <td><table border="0" width="100%" cellspacing="2" cellpadding="2">
	    <form action="quick_stockupdate.php" method="post" name="QuickUpdate_Form">
		 <tr>
		  <td valign="top">
		   <table class="QuickTable" border="0" width="100%" cellspacing="2" cellpadding="2">
		    <!--/START OF ACTION BOX--> 
   <?php draw_action_bar(1);?>
		    <!--/END OF ACTION BOX-->			 
		    <tr>
			 <th scope="col" width="1%" align="center"><input type="checkbox" name="check_all" onclick="checkall(this);"></th>
			 <th scope="col" width="3%" align="center"><?php echo QUICK_ID; ?></th>
			 <th scope="col" width="7%" align="center"> <?php echo QUICK_MODEL; ?></th>
			 <th scope="col" width="10%" align="center"> <?php echo $filter_type==1?QUICK_MANUFACTURER:QUICK_CATEGORY; ?></th>
			 <th scope="col" width="40%" align="left"><?php echo QUICK_NAME; ?></th>
			 <th scope="col" width="3%" align="center"><?php echo QUICK_WEIGHT; ?></th>
			 <th scope="col" width="8%" align="center"><?php echo QUICK_PRICE; ?></th>
			 <th scope="col" width="4%" align="center"><?php echo QUICK_STOCK; ?></th>
			 <th scope="col" width="4%" align="center"><?php echo QUICK_NEW_STOCK; ?></th>
			 <th scope="col"  width="15%" align="center" colspan="2"><?php echo QUICK_STATUS; ?><br> <?php echo '<font color="009933">' .QUICK_ACTIVE . '</font> / <font color="ff0000">' . QUICK_INACTIVE . '</font>';?></th>
		    </tr>
	 <?php tep_quickstock_product_listing($filter_type==1?$cat_id:$mfg_id); ?>
		    <!--/START OF ACTION BOX--> 
   <?php draw_action_bar(2);?>
		    <!--/END OF ACTION BOX-->
	 </table>
		  </td>
		 </tr>
		 <tr>
	    <td align="center" colspan="10" class="smallText">
		   <input type="hidden" name="cat_id" value="<?php echo $cat_id;?>">
		   <input type="hidden" name="mfg_id" value="<?php echo $mfg_id;?>">		  
		   <input type="hidden" name="lang_id" value="<?php echo $lang_id;?>">		  
		   <input type="hidden" name="filter_type" value="<?php echo $filter_type;?>">
	   <?php echo '<p name="status_txt">' . QUICK_TEXT . '</p>'; ?>		  
		   <input type="submit" value="Update">
		  
		
		 
			    <SCRIPT TYPE="text/javascript">
			    <!--
							 
	   do_showElement("<?php echo $action_type; ?>");
			    //-->
			    </SCRIPT>
		  </td>
		 </tr>
	    </form>
	   </table></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 . 'template_bottom.php');
  require(DIR_WS_INCLUDES . 'application_bottom.php');
?>


#178   ryder

ryder
  • Members
  • 4 posts
  • Real Name:Ryder
  • Gender:Male

Posted 06 January 2014 - 14:01

using quck-stock-updaer 3.8.5 and worked fine until upgrade OSC to 2.3.3.4 (maybe already after 2.3.3.3) where I cant update any product properties now. I receive following message Warning: mysql_query() expects parameter 2 to be resource, object given in /shop/admin/quick_stockupdate.php on line 82

//Credit to surfalot (Run SQL Script)
function qs_db_query($query, $link = 'db_link') {
global $$link;
return mysql_query($query, $$link);
}

Anyone that haven idea wht cause this and how to fix it?

Thanks

#179   srirahandcraft

srirahandcraft
  • Members
  • 42 posts
  • Real Name:Gerhard
  • Gender:Male
  • Location:Banglamung, Thailand

Posted 11 January 2014 - 02:36

Hi ryder,

using quck-stock-updaer 3.8.5 and worked fine until upgrade OSC to 2.3.3.4 (maybe already after 2.3.3.3) where I cant update any product properties now. I receive following message Warning: mysql_query() expects parameter 2 to be resource, object given in /shop/admin/quick_stockupdate.php on line 82

//Credit to surfalot (Run SQL Script)
function qs_db_query($query, $link = 'db_link') {
global $$link;
return mysql_query($query, $$link);
}

Anyone that haven idea wht cause this and how to fix it?

Thanks


I had the same problem and added the following line to the function:

if ( is_null($link) ) {

}

So now the function looks like this:

 //Credit to surfalot (Run SQL Script)
function qs_db_query($query, $link = 'db_link') {
global $$link;
if ( is_null($link) ) {
return mysql_query($query, $$link);
}
}


The warning has gone, but now i still have the problem that qsu isn't updating. When pushing the update button, it refreshes and gives the green message that the product has been updated. However database and file aren't updated. After refreshing, I still have the same information.
I think this is part of the same problem. Some of the other funtions might have to be updated as well, but I don't know which ones and how to do it.

I hope anyone can help with this.
Thanks.

Gerhard
Addons installed on my website:

- Addons Installed
- Advanced Special Offer Discounts
- AJAX-Attribute Manager for osc 2.3.1
- Banner box v1.1.1
- Dutch Language Pack
- Extra Pages-info box with admin for OSC2.3
- German Language Pack
- Login Box
- Multi-language Support for Configuration
- Multiple products manager
- Order Editor
- OSC PDF Catalogue 2.1
- PDF-Datasheet
- product Field Groups
- Quickly Update Product Stock
- Unit of weight
- YAG (Yet another Guestbook)

#180   joli1811

joli1811

    Anybody seen this leprechaun say yeah !!

  • Community Sponsor
  • 2,245 posts
  • Real Name:john dunlop
  • Gender:Male
  • Location:Ireland

Posted 11 January 2014 - 08:11

Hi not sure but sounds like below

Add-Ons that use the mysql_* or mysqli_* functions should use the tep_db_* functions instead.

return tep_db_query($query, $$link);

Interesting thread may help

http://forums.oscomm...lem-with-v2332/

Regards
Joli
To improve is to change; to be perfect is to change often.