I am trying to display a summary of the shopping cart in a header drop down menu (tpl_header.php). I have searched high and low for this capability. I even tried installing the "Cart Summary Sidebox" plugin, but I couldn't get it to work. I am not sure if it would suit my needs if it did work.
So what I have done is copied the tpl_shopping_cart_default.php code and inserted it into a div in the header drop down menu. I then removed all of the code that I did not need, or think I need. I would remove some code and then upload the file to check if it was broken. If it was broken I would go back and replace the relevant code. The remaining code is below.
I modified and rearranged the shopping cart summary in the dropdown menu with some divs and css. It looks just how I want, and it is functional. It displays the product name, quantity, unit price, product image and cart subtotal with a view cart button and checkout button.
The problem is it only shows in the dropdown menu on the shopping cart page. It does not show on any other page. The dropdown works on the other pages but it only displays "TEXT_CART_EMPTY" (without quotation marks).
I thought that I was onto something good here, but after doing some research I am starting to think that this is a larger php issue. Does this issue need some major php modification or am I missing some minor php code to call the shopping cart contents into the other pages.
I am using version 1.5.1 with only ZX Slideshow installed.
Here is the link to my live site http://4twentee.com. Here is a link to a test product to add to the shopping cart to test http://4twentee.com/index.php?main_p...&products_id=3
Thank you in advance for any assistance.
The code below is placed in a div in the dropdown menu. I did not include all of the other code from tpl_header.php
<?php
?>
<div class="header-cart-wrapper">
<?php
if ($flagHasCartContents) {
?>
<h1 id="header-cart-title"><?php echo HEADING_TITLE; ?></h1>
<table border="0" width="100%" cellspacing="0" cellpadding="0" id="cartContentsDisplay">
<!-- Loop through all products /-->
<?php
foreach ($productArray as $product) {
?>
<tr class="<?php echo $product['rowClass']; ?>">
<td><div class="header-cart-products-name"><a href="<?php echo $product['linkProductsName']; ?>"><span id="cartProdTitle"><?php echo $product['productsName'] . '<span class="alert bold">' . $product['flagStockCheck'] . '</span>'; ?></span></a></div>
<br />
<div class="header-cart-item-info">
<div class="header-cart-item-count ">
<?php
if ($product['flagShowFixedQuantity']) {
echo $product['showFixedQuantityAmount'] . '<br /><span class="alert bold">' . $product['flagStockCheck'] . '</span><br /><br />' . $product['showMinUnits'];
} else {
echo $product['showFixedQuantityAmount'] . '<br /><span class="alert bold">' . $product['flagStockCheck'] . '</span><br /><br />' . $product['showMinUnits'];
}
?>
</div>
<div class="header-cart-item-spacer"> x </div>
<div class="header-cart-item-cost"><?php echo $product['productsPriceEach']; ?></div>
</div></td>
<td><a href="<?php echo $product['linkProductsName']; ?>"><span id="header-cartImage"><?php echo $product['productsImage']; ?></span></a></td>
</tr>
<?php
} // end foreach ($productArray as $product)
?>
<!-- Finished loop through all products /-->
</table>
<div id="header-cart-subtotal"><?php echo SUB_TITLE_SUB_TOTAL; ?> <?php echo $cartShowTotal; ?></div>
<!--bof shopping cart buttons-->
<div class="buttonRow forward"><?php echo '<a href="' . zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_CHECKOUT, BUTTON_CHECKOUT_ALT) . '</a>'; ?></div>
<div class="buttonRow back"><?php echo '<a href="index.php?main_page=shopping_cart" class="drop">' . zen_image_button(BUTTON_IMAGE_VIEW_CART, BUTTON_VIEW_CART_ALT) . '</a>'; ?></div>
<!--eof shopping cart buttons-->
<br class="clearBoth" />
<!-- ** BEGIN PAYPAL EXPRESS CHECKOUT ** -->
<?php // the tpl_ec_button template only displays EC option if cart contents >0 and value >0
if (defined('MODULE_PAYMENT_PAYPALWPP_STATUS') && MODULE_PAYMENT_PAYPALWPP_STATUS == 'True') {
include(DIR_FS_CATALOG . DIR_WS_MODULES . 'payment/paypal/tpl_ec_button.php');
}
?>
<!-- ** END PAYPAL EXPRESS CHECKOUT ** -->
<?php
} else {
?>
<h2 id="cartEmptyText"><?php echo TEXT_CART_EMPTY; ?></h2>
<?php
}
?>


Reply With Quote
