Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

I spent hours installing this contribution only to have it error out... I did back up my database, but I'm rather stuck on modifying additional items in case I have to revert to my old catalog if this problem can't be fixed.

 

Installed on this: http://familymemoriesandmore.com/cart/prod...;products_id=28

 

After I change the quantity and add to cart, it defaults to 2, 3, 4, 5, etc., depending on how many times I've tried... if I change the number in the cart and click to update, I get this error:

 

Fatal error: Unsupported operand types in /home/garysgal/public_html/cart/includes/application_top.php on line 355

 

Here is my line 355:

 

$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id'])) + $HTTP_POST_VARS['cart_quantity'], $HTTP_POST_VARS['id']);

 

WHAT is happening? Please help! Thank you!

Posted
I spent hours installing this contribution only to have it error out...

 

I get this error:

 

Fatal error: Unsupported operand types in /home/garysgal/public_html/cart/includes/application_top.php on line 355

 

Here is my line 355:

 

$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id'])) + $HTTP_POST_VARS['cart_quantity'], $HTTP_POST_VARS['id']);

 

WHAT is happening? Please help! Thank you!

A Double and triple postings are not allowed according to forum rules.

B If it took you hours to install a contribution that takes 15 minutes or about, you are probably not an expert. Double checking the install is wise.

C When you update the quantity in the shopping cart the code in application top that should be executed is under case 'update_product' (the first option and the code add to cart that in there is:

$cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false);

The code you show belongs to case 'add_product' so you didn't install this contribution well. The error refers to getting an array instead of a single variable. The post variables of product_id's on the shopping cart page are in an array, so that explains it.

Posted (edited)

Thank you. No, I'm not an expert, or I wouldn't have asked for help. I spent about 15 minutes installing it, but hours looking for the error. I believed I followed the instructions to the letter, I have the printout in front of me and apparently I messed up. I apologize for asking for help and taking your time.

Edited by garysgal
Posted
I believed I followed the instructions to the letter, I have the printout in front of me and apparently I messed up.
Most likely you changed the wrong section of code. I'm pretty sure it should like this in application_top.php (but you might have added another contribution so I'm not 100% sure):

	switch ($HTTP_GET_VARS['action']) {
  // customer wants to update the product quantity in their shopping cart
  case 'update_product' : for ($i=0, $n=sizeof($HTTP_POST_VARS['products_id']); $i<$n; $i++) {
							if (in_array($HTTP_POST_VARS['products_id'][$i], (is_array($HTTP_POST_VARS['cart_delete']) ? $HTTP_POST_VARS['cart_delete'] : array()))) {
							  $cart->remove($HTTP_POST_VARS['products_id'][$i]);
							} else {
							  if (PHP_VERSION < 4) {
								// if PHP3, make correction for lack of multidimensional array.
								reset($HTTP_POST_VARS);
								while (list($key, $value) = each($HTTP_POST_VARS)) {
								  if (is_array($value)) {
									while (list($key2, $value2) = each($value)) {
									  if (ereg ("(.*)\]\[(.*)", $key2, $var)) {
										$id2[$var[1]][$var[2]] = $value2;
									  }
									}
								  }
								}
								$attributes = ($id2[$HTTP_POST_VARS['products_id'][$i]]) ? $id2[$HTTP_POST_VARS['products_id'][$i]] : '';
							  } else {
								$attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : '';
							  }
							  $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false);
							}
						  }
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break;
  // customer adds a product from the products page
  case 'add_product' :	if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
//	original			   $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);
// for price-break-1.11.3
							 $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id'])) + $HTTP_POST_VARS['cart_quantity'], $HTTP_POST_VARS['id']);
						  }
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break;
  // performed by the 'buy now' button in product listings and review page

Posted

Something else, that product 28 has a weird pricing structure:

$1.40
26+  $0.10
51+  $0.20
76+  $0.30
101+ $0.40

One costs $1.40 and if you buy 26 or more it suddenly costs only 10 cents. But then when you buy more again the price goes up again?

Posted
Something else, that product 28 has a weird pricing structure:

$1.40
26+  $0.10
51+  $0.20
76+  $0.30
101+ $0.40

One costs $1.40 and if you buy 26 or more it suddenly costs only 10 cents. But then when you buy more again the price goes up again?

I plugged in play numbers to see if it would work... haven't tweaked it yet.

 

Again, I'm sorry if this appeared to be a stupid question or if I was off base. I'm a little frustrated with this contribution, I've gotten so many others to work well without errors.

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...