Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

quantity_mod shopping cart error


trexznl

Recommended Posts

Dear members,

 

I'm working on a web shop for my neighbors, and because they will be using a lot of product attributes I've installed the quantity_mod which can be found here: http://addons.oscommerce.com/info/3302

 

This works brilliantly for the main purpose: it checks stock for the product attributes and warns if the product with the selected attribute is out of stock.

 

However, when adding a product which hasn't got an attribute, it gives the following error:

 

Warning: reset() [function.reset]: Passed variable is not an array or object in /home/<name>/domains/<domain name>/public_html/Final/<storename>/shopping_cart.php on line 139

 

Warning: Variable passed to each() is not an array or object in /home/<name>/domains/<domain name>/public_html/Final/<storename>/shopping_cart.php on line 140

 

These are the lines 139/140 in shopping_cart.php:

reset($products[$i]['attributes']);
	while (list($option, $value) = each($products[$i]['attributes'])) {

 

And the whole piece of code looks like this:

 

if (STOCK_CHECK == 'true') {
// Yuval - Start - Fix a bug:: check stock per product attribute quantity
//		$stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']);
	reset($products[$i]['attributes']);
	while (list($option, $value) = each($products[$i]['attributes'])) {
	  $stock_check = tep_check_stock($products[$i]['id'], $products[$i][$option]['products_attributes_id'], $products[$i]['quantity']);
// Yuval - End - Fix a bug:: check stock per product attribute quantity
	  if (tep_not_null($stock_check)) {
		$any_out_of_stock = 1;

		$products_name .= $stock_check;
					}
	}
  }

 

Now, unfortunately, I'm not yet a php genius, and I've tried some kinds of things, and I've done a lot of googling around, but I haven't been able to find any solution for this problem.

 

However, I'm thinking myself that the code in the shopping cart just checks the stock for attributes, and then when adding a product which hasn't got any attribute, it'll freak out and give the warning because it can't run the commands anymore. Of course I could be completely wrong on this one.

 

I would really appreciate it if anyone here could give me a solution.

 

Kind regards,

Theo

Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...