Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Fatal error: Call to a member function?


erbanfootwearInc

Recommended Posts

Posted

I have added the "Must Select Attribute" contribution and all appears to be working fine until I get this error message:

 

" Fatal error: Call to a member function on a non-object in C:\Inetpub\wwwroot\erbanfootwear.com\includes\application_top.php on line 363 "

 

I get this when trying to Proceed to checkout. Line 363 is in CAPS and /// commented out for your convenience for your convenience.

 

 

APPLICATION_TOP.PHP

// Shopping cart actions
 if (isset($HTTP_GET_VARS['action'])) {
// redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled
if ($session_started == false) {
  tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));
}

  // BOF CB add 'mustselect' as a parameter to ignore
 if (DISPLAY_CART == 'true') {
 $goto =  FILENAME_SHOPPING_CART;
 $parameters = array('action', 'cPath', 'products_id', 'pid','mustselect');
  } else {
 $goto = basename($PHP_SELF);
 if ($HTTP_GET_VARS['action'] == 'buy_now') {
   $parameters = array('action', 'pid', 'products_id','mustselect');
 } else {
   $parameters = array('action', 'pid','mustselect');
 }
  }
 // EOF CB add 'mustselect' as a parameter to ignore
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'])) {

//BoF CB Enforce attribute selection
						   if (is_array($HTTP_POST_VARS['id']) ) {
///////////LINE 363///////////$messageStack->reset();	<br>///////////LINE 363///////////							  
							 while (list($option, $value) = each($HTTP_POST_VARS['id'])) {
							  //if (($value == 17) or ($value == 10) or ($value == 999) ) {
							  // 9 is the value for "-select-"
							  if ($value == 17) {
								 tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id'] . '&mustselect=product_info'));
								 break;
							  }
							 }
						   } elseif (tep_has_product_attributes($HTTP_POST_VARS['products_id'])) {
							   tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_POST_VARS['products_id']));
							   break;
						   } 
						   //EoF CB

 

Any help would be greatly appreciated.

 

Thanks,

Tim

Archived

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

×
×
  • Create New...