Forums / All Other Contributions/Addons / Shopping Cart Totals in Header Support

Shopping Cart Totals in Header Support

Locked

Views: 2,012

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
28 Jan 2010, 6:49 PM
#1
georgiepants avatar

georgiepants

New Zenner

Join Date:
Jan 2010
Posts:
36
Plugin Contributions:
0

Shopping Cart Totals in Header Support

the given code for the **Shopping Cart Totals in Header Add-On **displays the number of products in the cart and not the total quantity of products.

Example, shopper has 1 qty of (product A) and 2 qty of (product B) but "My Cart" shows (2) items, not the total quantity of 3.
Likewise a qty of 1 or 30 of Product A still shows 1 item.

Its a little misleading to the shopper when qty of items and products mean different things.

How can this be adjusted?

<li><span class="style1">My Cart: 
	<?php echo sizeof($_SESSION['cart']->get_products()); 

 ?>  items  
 	<?php $header_cart = $currencies->format($_SESSION['cart']->show_total());  
	echo $header_cart;
	?>
</span>
<br class="clearBoth" />
</li>
28 Jan 2010, 9:28 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Shopping Cart Totals in Header Support

That mod uses an incorrect source for its count. The Shoppingcart/Freeship in Header mod, and the "Cart Sidebox with Free Shipping Qualifier and Checkout Button" mod it is based on, use a different method for getting the item count. I just tested it, and it does account for two items of one product.```php
$cart_count = $_SESSION['cart']->count_contents();

29 Jan 2010, 3:28 PM
#3
georgiepants avatar

georgiepants

New Zenner

Join Date:
Jan 2010
Posts:
36
Plugin Contributions:
0

Re: Shopping Cart Totals in Header Support

Thank you! It took me a few tries to properly adjust the code but this is what finally worked for me:

<li><span class="style1">My Cart: 
	<?php echo ($_SESSION['cart']->count_contents()); 

 ?>  items  
 	<?php $header_cart = $currencies->format($_SESSION['cart']->show_total());  
	echo $header_cart;
	?>
</span>
<br class="clearBoth" />
</li>
29 Jan 2010, 4:10 PM
#4
georgiepants avatar

georgiepants

New Zenner

Join Date:
Jan 2010
Posts:
36
Plugin Contributions:
0

Re: Shopping Cart Totals in Header Support

georgiepants:

the given code for the **Shopping Cart Totals in Header Add-On **displays the number of products in the cart and not the total quantity of products.

Example, shopper has 1 qty of (product A) and 2 qty of (product B) but "My Cart" shows (2) items, not the total quantity of 3.
Likewise a qty of 1 or 30 of Product A still shows 1 item.

Its a little misleading to the shopper when qty of items and products mean different things.

How can this be adjusted?

<li><span class="style1">My Cart: <?php echo sizeof($_SESSION['cart']->get_products());

?>  items  
<?php $header_cart = $currencies->format($_SESSION['cart']->show_total()); echo $header_cart; ?>
</span>
<br class="clearBoth" />

</li> ```

gjh42:

That mod uses an incorrect source for its count. The Shoppingcart/Freeship in Header mod, and the "Cart Sidebox with Free Shipping Qualifier and Checkout Button" mod it is based on, use a different method for getting the item count. I just tested it, and it does account for two items of one product.```php
$cart_count = $_SESSION['cart']->count_contents();


> **georgiepants:**
>
> Thank you! It took me a few tries to properly adjust the code but this is what finally worked for me:
> 
> ```
<li><span class="style1">My Cart: 
	<?php echo ($_SESSION['cart']->count_contents()); 

 ?>  items  
 	<?php $header_cart = $currencies->format($_SESSION['cart']->show_total());  
	echo $header_cart;
	?>
</span>
<br class="clearBoth" />
</li>

just posting all together to print solution, thanks!

29 Jan 2010, 4:14 PM
#5
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Shopping Cart Totals in Header Support

I have submitted a corrected version (1.1) of the mod to Free Addons. Until it is activated, I will attach it here. I do not intend to further support this mod, but refer anyone with questions to the Shoppingcart/Freeship in Header mod and its support thread.