Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2015
    Location
    Gloucestershire
    Posts
    24
    Plugin Contributions
    0

    Default On Hover Cart Summary

    Hi

    I am creating a custom template, almost finished.

    As part of this i want to create a cart summary.

    Currently i have a cart symbol, checkout button and items in cart total all working alongside the ez pages navbar.

    I would like to show a cart summary (qty item title, model price and total) like a mini shopping cart summary when the above cart symbol is hovered.

    So far i have this working to an extent.

    I copied the tpl_shopping_cart_deafult to the div in the header which i want to show when hovered. All working fine.

    However unless i am actually on the shopping cart page this shows as no items in the cart, where if i navigate to the cart page and then hover it shows exactly the same in the summary window when hovered.

    How do i get this to display when i am not just on the shopping cart page?

    Sorry no link developing via localhost.

  2. #2
    Join Date
    Feb 2015
    Location
    Gloucestershire
    Posts
    24
    Plugin Contributions
    0

    Default 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_CHECKOUTBUTTON_CHECKOUT_ALT) . '</a>'?></div>


    <div class="buttonRow back"><?php echo '<a href="index.php?main_page=shopping_cart">' zen_image_button(BUTTON_IMAGE_VIEW_CARTBUTTON_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.

  3. #3
    Join Date
    Feb 2015
    Location
    Gloucestershire
    Posts
    24
    Plugin Contributions
    0

    Default 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?

  4. #4
    Join Date
    Feb 2015
    Location
    Gloucestershire
    Posts
    24
    Plugin Contributions
    0

    Default 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.

 

 

Similar Threads

  1. Making cart summary not show on cart page.
    By robbie269 in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 1 Dec 2010, 04:55 AM
  2. Echo Cart Summary?
    By philip937 in forum General Questions
    Replies: 4
    Last Post: 17 Nov 2009, 11:45 PM
  3. Eliminate Cart Summary Page
    By ntaggart in forum Managing Customers and Orders
    Replies: 1
    Last Post: 11 Sep 2009, 05:16 PM
  4. Shopping Cart Summary Sidebox
    By mrmrsg in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 26 Apr 2007, 07:59 AM
  5. cart summary displayed in sidebox
    By marslizard in forum Basic Configuration
    Replies: 3
    Last Post: 8 Dec 2006, 05:44 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR