Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Cart item count by manufacturer...


Recommended Posts

I'm attemping to build a function that counts items in the shopping cart by manufacturer. This is similar to the count_contents() function in includes>classes>shopping_cart.


Here's the concept:


	function count_ms_contents() {  // get total number of MS items in cart 
  $total_msitems = 0;
  if (is_array($this->contents)) {
	while (list($products_id, ) = each($this->contents)) 
	  $total_msitems += $this->get_msquantity($products_id);

  return $total_msitems;


This would rely on:


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


The shopping_cart.php page calls the function return, which is always '0' right now...probably because there needs to be some modification to the $products_id array. What are my next steps to getting this function to work properly? Am I on the right track?


Thanx for your help!

Link to comment
Share on other sites


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

  • Create New...