Re: On Hover Cart Summary
Still not having much luck with this.
Got the below code showing how i would like when hovered on the shopping cart page however when i navigate away from this page the cart says the cart is emty.
PHP Code:
<div id="cartSummary">
<?php
if ($_SESSION[$flagHasCartContents] or $flagHasCartContents) {
?>
<?php
if ($_SESSION['cart']->count_contents() > 0) {
?>
<?php
}
?>
<?php if ($messageStack->size('shopping_cart') > 0) echo $messageStack->output('shopping_cart'); ?>
<?php echo zen_draw_form('cart_quantity', zen_href_link(FILENAME_SHOPPING_CART, 'action=update_product', $request_type)); ?>
<?php if ($flagAnyOutOfStock) { ?>
<?php if (STOCK_ALLOW_CHECKOUT == 'true') { ?>
<div class="messageStackError"><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></div>
<?php } else { ?>
<div class="messageStackError"><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></div>
<?php } //endif STOCK_ALLOW_CHECKOUT ?>
<?php } //endif flagAnyOutOfStock ?>
<table border="0" width="100%" cellspacing="0" cellpadding="0" id="cartContentsDisplay">
<tr class="tableHeading">
<th scope="col" id="scQuantityHeading"><?php echo TABLE_HEADING_QUANTITY; ?></th>
<th scope="col" id="scProductsHeading"><?php echo TABLE_HEADING_PRODUCTS; ?></th>
<th scope="col" id="scUnitHeading"><?php echo TABLE_HEADING_PRICE; ?></th>
</tr>
<!-- Loop through all products /-->
<?php
foreach ($productArray as $product) {
?>
<tr class="<?php echo $product['rowClass']; ?>">
<td class="cartQuantity">
<?php
echo $product['showFixedQuantityAmount'] . '<br /><span class="alert bold">' . $product['flagStockCheck'] . '</span><br /><br />' . $product['showMinUnits'];
?>
</td>
</td>
<td class="cartProductDisplay">
<a href="<?php echo $product['linkProductsName']; ?>"><span id="cartImage" class="back"><?php echo $product['productsImage']; ?></span><span id="cartProdTitle"><?php echo $product['productsName'] . '<span class="alert bold">' . $product['flagStockCheck'] . '</span>'; ?></span></a>
<br class="clearBoth" />
<?php
echo $product['attributeHiddenField'];
if (isset($product['attributes']) && is_array($product['attributes'])) {
echo '<div class="cartAttribsList">';
echo '<ul>';
reset($product['attributes']);
foreach ($product['attributes'] as $option => $value) {
?>
<li><?php echo $value['products_options_name'] . TEXT_OPTION_DIVIDER . nl2br($value['products_options_values_name']); ?></li>
<?php
}
echo '</ul>';
echo '</div>';
}
?>
</td>
<td class="cartUnitDisplay"><?php echo $product['productsPriceEach']; ?></td>
</td>
</tr>
<?php
} // end foreach ($productArray as $product)
?>
<!-- Finished loop through all products /-->
</table>
<div id="cartSubTotal"><?php echo SUB_TITLE_SUB_TOTAL; ?> <?php echo $_SESSION['cart']->show_Total(); ?></div>
<br class="clearBoth" />
<!--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">' . zen_image_button(BUTTON_IMAGE_VIEW_CART, BUTTON_VIEW_CART_ALT) . '</a>'; ?></div>
<br />
<br />
<!--eof shopping cart buttons-->
</form>
<br class="clearBoth" />
<?php
} else {
?>
<h2 id="cartEmptyText"><?php echo TEXT_CART_EMPTY; ?></h2>
<?php
$show_display_shopping_cart_empty = $db->Execute(SQL_SHOW_SHOPPING_CART_EMPTY);
while (!$show_display_shopping_cart_empty->EOF) {
?>
<?php
$show_display_shopping_cart_empty->MoveNext();
} // !EOF
?>
<?php
}
?>
</div>
This is what i have so far but only shows content when hovered on cart summary page.
Added the below in:
PHP Code:
<?php
if ($_SESSION[$flagHasCartContents] or $flagHasCartContents) {
?>
Which now shows the table and stops the cart is empty message when i navigate away from the cart summary page.
However the table is not populated so guessing i need to add $_SESSION around the product name and quantity somewhere however no matter what i try nothing works.
Really stuck here.
Re: On Hover Cart Summary
Right i have realised certain variables are only being loaded once on the cart page.
These come from modules/pages/shopping_cart/header_php.php
I copied these into my header template and low and behold this made the hover box work as it should.
However will there be any detrimental effects of me having this file in the header template?
Or is there a way i can load this file all the time?
Re: On Hover Cart Summary
Any idea guys?
Just need to finish these last couple of things then will be able to get the databases fully populated and get the site uploaded.