Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Number of Items in Cart

Number of Items in Cart

Locked

Views: 1,957

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
1 Mar 2009, 8:17 PM
#1
asolman avatar

asolman

New Zenner

Join Date:
Aug 2006
Posts:
7
Plugin Contributions:
0

Number of Items in Cart

I want to add to the header "Number of Items in Cart " function to show: shopping cart: 0 items $0.00. Please advise

1 Mar 2009, 8:22 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Number of Items in Cart

There is already a setting for the shopping_cart page to show totals ...

Check your setting in the Configuration ... Layout Settings ...

Shopping Cart - Show Totals
Show Totals Above Shopping Cart?
0= off
1= on: Items Weight Amount
2= on: Items Weight Amount, but no weight when 0
3= on: Items Amount

1 Mar 2009, 8:30 PM
#3
asolman avatar

asolman

New Zenner

Join Date:
Aug 2006
Posts:
7
Plugin Contributions:
0

Re: Number of Items in Cart

I am not talking about the side box, I want the script to add to site_header file that will include the items in cart function

1 Mar 2009, 8:36 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Number of Items in Cart

That is not for the sidebox that is for the shopping cart page ...

The header_php.php file for the shopping_cart has the following information in how it builds the totals that are displayed at the top of that page that may help you ...

/*
  $shipping_weight = 0;
  require(DIR_WS_CLASSES . 'order.php');
  $order = new order;
  require_once('includes/classes/http_client.php'); // shipping in basket
  $total_weight = $_SESSION['cart']->show_weight();
  $total_count = $_SESSION['cart']->count_contents();
  require(DIR_WS_CLASSES . 'shipping.php');
  $shipping_modules = new shipping;
  $quotes = $shipping_modules->quote();
*/
$totalsDisplay = '';
switch (true) {
  case (SHOW_TOTALS_IN_CART == '1'):
  $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . TEXT_TOTAL_WEIGHT . $shipping_weight . TEXT_PRODUCT_WEIGHT_UNIT . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
  break;
  case (SHOW_TOTALS_IN_CART == '2'):
  $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . ($shipping_weight > 0 ? TEXT_TOTAL_WEIGHT . $shipping_weight . TEXT_PRODUCT_WEIGHT_UNIT : '') . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
  break;
  case (SHOW_TOTALS_IN_CART == '3'):
  $totalsDisplay = TEXT_TOTAL_ITEMS . $_SESSION['cart']->count_contents() . TEXT_TOTAL_AMOUNT . $currencies->format($_SESSION['cart']->show_total());
  break;
}
1 Mar 2009, 8:44 PM
#5
asolman avatar

asolman

New Zenner

Join Date:
Aug 2006
Posts:
7
Plugin Contributions:
0

Re: Number of Items in Cart

Again I ma not talking about the shopping cart page itself, but the header of the site, If you look at the attached image you'll see in the header right below the search a line that says:

shopping cart: 0 items $0.00

That is the function I want to add to my header, thanks again

1 Mar 2009, 8:54 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Number of Items in Cart

And I just gave you the code that is used on the shopping_cart page that you could use in the header of your shop and customize it to always show the shopping cart totals ...

Other than write all the code for you and load it to your site ... what is missing here? :unsure:

1 Mar 2009, 9:14 PM
#7
asolman avatar

asolman

New Zenner

Join Date:
Aug 2006
Posts:
7
Plugin Contributions:
0

Re: Number of Items in Cart

I am sorry, I did not make myself clear. In the admin portion there is a space under: Design-> Upload Design Date called Design Banner 1: I need the actual script that will pull the info I wanted as in the image to show the items in cart etc. I entered a script for the search box and I need one for the cart items one.

1 Mar 2009, 9:15 PM
#8
asolman avatar

asolman

New Zenner

Join Date:
Aug 2006
Posts:
7
Plugin Contributions:
0

Re: Number of Items in Cart

The script you gave me I have already, but I need a way to pull that info and present it in the header

1 Mar 2009, 9:24 PM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Number of Items in Cart

I posted the code above that contains the explination of the code and 3 different methods to display the Shopping Cart Totals ...

Pick one of the methods that you like, or build your own line of totals from what is in the code, and add it to your customized templates and overrides so it shows in the header file where you want to see it ...