Hi,
I'd like to display a Shopping Cart icon (either empty or full based on whether user has added anything) at the top of the page... similar to http://www.macromedia.com/ site (take a look at the top of the page). This is a very popular way of displaying the status of a shopping cart and I'd like to emulate it. Basically, Shopping cart block already does everything that I need but I'd like to "extract" that info out of it.
So, which variable holds the status and how do I call it from PHP inside the page.tpl.php? :) Here's the code of the block...
Thanks!!!
Mel
<?php
function theme_cart_display_block() {
global $user;
$output = '';
/**
* Until Drupal can handle partial page caching, We should only display a
* View Cart link for anonymous users and the full fancy items and total cart
* for authenticated users since those pages aren't cached.
*/
if ($user->uid == 0 && variable_get('cache', 0)) {
$output .= l(t('View your cart'), 'cart/view');
}
else {
$item = cart_get_items();
$item_count = count($item);
$item_suffix = ($item_count == 1) ? t('item') : t('items');
$output .= '
'. t("%item_count %item_suffix in %your_cart", array("%item_count" => $item_count, "%item_suffix" => $item_suffix, "%your_cart" => l(t("your cart"), "cart/view"))). "
\n";
if (!empty($item)) {
$output .= "
";
foreach ($item as $i) {
$node = node_load(array("nid" => $i->nid));
$total += product_adjust_price($node) * $i->qty;
$output .= l("$i->qty x $node->title", "node/$node->nid"). "