Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

problem product quantity shopping cart


deltabiri

Recommended Posts

Posted

Hello, im problem to max quantity order,

im buy t-shirt xxx, size xxl color black, is ok, retur to t-shirt xxx and buy size xxl option color white, in to shopping cart not present 2° t-shirt.

that error can be ?

Posted

is possible errore contribution max order product?

in to shopping_cart add code:

//MAXIMUM quantity code
if(MAXIMUM_ORDERS == 'true'){
$max_order_query = tep_db_query("select p.maxorder as max_quant FROM " . TABLE_PRODUCTS . " p where p.products_id = '".$products[$i]['id']."'");
while ($max_order = tep_db_fetch_array($max_order_query))  {
	$products[$i]['max_quant']=$max_order['max_quant']; // set the cart item max var
	if (!empty($products[$i]['max_quant'])) {//add check account for if max_quant is null or '', if it is you can skip all this stuff can it's umlimited
    // okay if this product already is in basket irregardless of it's attributes selected... keep the old one
	for ($ic = 0; $ic < $i;$ic++) {
	   if (tep_get_prid($products[$i]['id']) == tep_get_prid($products[$ic]['id'])) {
	   $cart_notice .= sprintf(MAXIMUM_ORDER_DUPLICATE, $products[$i]["name"], $products[$i]["max_quant"]) . '<br />'; // notify them they can not do that
       $cart_skip_prod = true;
	   $cart->remove($products[$i]['id']); // remove this new item from the cart session
	   $cart_skip_prod = true; // set a flag so we can bypass output of the item that was already stuck into the products array before we removed it just now
	   }
	   else {
	   //$cart_notice .= ' - okay no match ';
	   }
	   $cart_notice .= '<br />';
	}

	// okay now for products that have no attributes or have identical attributes
	if ($products[$i]['quantity'] > $max_order['max_quant'] ) { //add check account for if max_quant is null or '', if so let it go through.
		$products[$i]['quantity']=$products[$i]['max_quant'];
		$cart->add_cart($products[$i]['id'],$products[$i]['quantity'],$products[$i]['attributes']); // update the qty
		$cart_notice .= sprintf(MAXIMUM_ORDER_NOTICE, $products[$i]["name"], $products[$i]["max_quant"]); // notify them they can not do that
	}
	}
}
}

if ($cart_skip_prod) { // still need to skip displaying the item still stuck in $products array even though we removed it from $cart
  break;
  }
//End MAXIMUM quantity code

Posted

I removed the piece of code posted above by shopping_cart.php , error disappears! Contribution but does not work.

as system?

thanks

Archived

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

×
×
  • Create New...