Contributions

Other (Category Index)
Search: 

Add Shopping Cart Info to Your Header

Simple modification to add the item count and merchandise total to your header.

Expand All / Collapse All

Updated To Work With STS PLUS bluecivic21 22 Jun 2006

Updated to work with STS PLUS

This is just a little usercode to allow you to use this contribution in your STS layout.
Add this to your includes/modules/sts_inc/sts_user_code.php file, before the ?> at the end of the file is fine.


$sts->start_capture();
$productno = $cart->count_contents();
$totalprice = $currencies->format($cart->show_total());

if ($productno > 1) {
echo ENTRY_HCART_CONTAINS;
echo " ";
echo $productno;
echo " ";
echo ENTRY_HCART_ITEMS;
echo " "; echo " ";
echo ENTRY_HCART_PRICE;
echo " ";
echo $totalprice;
} elseif ($productno == 0) {
echo ENTRY_HCART_EMPTY;
} else {
echo ENTRY_HCART_CONTAINS;
echo " ";
echo $productno;
echo " ";
echo ENTRY_HCART_ITEM;
echo " "; echo " ";
echo ENTRY_HCART_PRICE;
echo " ";
echo $totalprice;
}
$sts->stop_capture ('headcart');

Add this to your includes/languages/english.php file, before the ?> at the end of the file is fine.

define('ENTRY_HCART_EMPTY', 'Your cart is empty.');
define('ENTRY_HCART_CONTAINS', 'Your cart contains:');
define('ENTRY_HCART_ITEM', 'item.');
define('ENTRY_HCART_ITEMS', 'items.');
define('ENTRY_HCART_PRICE', 'Total price:');

Thats it! Now use $headcart anywhere you want in your STS template files.


works with STS v2 yoyoint 9 Nov 2005
Updated to work with STS Shawn Moons 31 May 2005
Updated for Gift Voucher compatibility George Burke 3 Mar 2005
Cart In Header v2 Oai C Ngu 2 Feb 2005
simple upgrade v1.1 Carine Bruyndoncx 7 Nov 2004
Add Shopping Cart Info to Your Header Kim Elliott-BirdBrain 16 Mar 2003

Note: Contributions are used at own risk.