Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

a really easy one...set_quantity


iperez_genius

Recommended Posts

Posted

this is going to be a really easy question to solve for some people.

 

There is a get_quantity function already in OScommerce

 

  function get_quantity($products_id) {
  if ($this->contents[$products_id]) {
	return $this->contents[$products_id]['qty'];
  } else {
	return 0;
  }
}

 

if need a SET function

 

can anyone help out here

 

Ilan

Posted

this is what i have so far

 

	function deduct_quantity($products_id) {

	   $this->contents[$products_id] = array('qty' => $qty-1);

}

 

and the call to this function is made in the application_top.php

 

 $cart->deduct_quantity($HTTP_POST_VARS['products_id'][$i]);

 

so firstly i hope my function is correct and secondly i receive the following error when i try to run the function

Fatal error: Call to undefined method shoppingCart::deduct_quantity() in includes/.../application_top.php on line 531

 

Ilan

Posted

your function has to be a member function of the cart class in the shopping_cart.php file. As of the set quantity it is done with the add_cart member function of the cart class. Look in the same file.

Archived

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

×
×
  • Create New...