Page 1 of 19 12311 ... LastLast
Results 1 to 10 of 181
  1. #1
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Shoppingcart/Freeship in Header support

    Shoppingcart/Freeship in Header has been submitted to Free Addons and should be available soon.

    This mod will give you a box in your header which shows the number of items in the cart, the total amount if any items in cart, the amount required to qualify for free shipping, and a checkout button if any items in cart.

    You can set its position and style by editing your stylesheet with rules suggested in the readme.

    Compatible with multiple languages.

  2. #2
    Join Date
    Jun 2009
    Posts
    617
    Plugin Contributions
    0

    Default Re: Shoppingcart/Freeship in Header support

    Very cool mod! Great, absolutely great readme file with clear and precise instructions and info - and here is the bonus, its not a text file!

    The only thing that I would like to customize about it is, I would like to format it into 2 columns. The first column being the # of items on the first row and the second row, the Total Price. On the second column on the first row is where I want to place the View Cart button.

    Can I do that via css? How? I'm a bit of a novice when it comes to css, so if someone can provide some example code, awesome!
    Thank you,
    autoace

  3. #3
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Shoppingcart/Freeship in Header support

    Rearranging the box layout into columns as you describe, and adding a separate View Cart button that is always on instead of a link on the count when full, is beyond the capacities of CSS and will require a bit of restructuring of code.

    Find this section in tpl_cart_header.php
    PHP Code:
    <div id="cartCount">
    <?php
    $cart_count 
    $_SESSION['cart']->count_contents();
    if (
    $cart_count) { 
      
    $_SESSION['cart']->get_products(); 
      
    $basket_total $_SESSION['cart']->show_total();
      echo 
    '<span id="cartTotal">' CART_HEADER_TOTAL $currencies->format($basket_total) . '</span>' 
    }
    echo (
    $cart_count'<a href="' zen_href_link(FILENAME_SHOPPING_CART'''SSL') . '" title="' CART_HEADER_TITLE '">':'') . CART_HEADER_IN_CART_PRE $cart_count . (($cart_count == 1)? CART_HEADER_IN_CART_SINGULARCART_HEADER_IN_CART_PLURAL) . ($cart_count'</a>''');
    ?>
    </div>
    Add

    echo '<a id="cartButton" href="' . zen_href_link(FILENAME_SHOPPING_CART, '', 'SSL') . '" title="' . CART_HEADER_TITLE . '"><img src="yourimagesource.gif" /></a>': '');

    to get
    PHP Code:
    <div id="cartCount">
    <?php
    $cart_count 
    $_SESSION['cart']->count_contents();
    if (
    $cart_count) { 
      
    $_SESSION['cart']->get_products(); 
      
    $basket_total $_SESSION['cart']->show_total();
      echo 
    '<span id="cartTotal">' CART_HEADER_TOTAL $currencies->format($basket_total) . '</span>' 
    }
    echo (
    $cart_count'<a href="' zen_href_link(FILENAME_SHOPPING_CART'''SSL') . '" title="' CART_HEADER_TITLE '">':'') . CART_HEADER_IN_CART_PRE $cart_count . (($cart_count == 1)? CART_HEADER_IN_CART_SINGULARCART_HEADER_IN_CART_PLURAL) . ($cart_count'</a>''');
    ?>
    </div>
    <?php echo '<a id="cartButton" href="' zen_href_link(FILENAME_SHOPPING_CART'''SSL') . '" title="' CART_HEADER_TITLE '"><img src="yourimagesource.gif" /></a>'''); ?>
    You would also want more <span> elements to control the qty and total.

    Then style as required:
    Code:
    /*Shoppingcart/Freeship in Header*/
    #headerWrapper {position: relative;}
    
    #cartHeader {
        width: 30em;/*17em*/
        position: absolute;
        top: 0.1em;/*4.0em*/
        right: 2.0em;
    	/*bottom:0.1em;/*added*/
        background: #cacaca;
        color: #000000;
        border: 1px solid #888888;
        }
    	
    #cartHeader h3 {
    	display: none;/*added*/
        /*text-align: center;*/
    	/*color: #005599;/*added*/
    	/*margin:0.1em 0;/*added*/
        }
    #cartCount {
        /*border-top: 1px solid #999999;*/ 
        text-align: left;/*center*/
    	padding: 0.5em 0;/*added*/
        float: left;
        }
    #cartCount a {)
    #cartTotal {}
    #cartFreeShip {
        margin: 0 0.3em;
        }
    #cartCheckout {
        float: left;/*right*/
        margin: 0.3em;
        }
    
    #cartButton {
        display: block;
        float: right;
        width: 123px; /*adjust to fit*/
        }
    I do think it's better not to have links to the cart and checkout if there is nothing in the cart.
    Last edited by gjh42; 30 Nov 2009 at 05:09 PM.

  4. #4
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Shoppingcart/Freeship in Header support

    PHP Code:
    <div id="cartCount">
    <?php
    $cart_count 
    $_SESSION['cart']->count_contents();

    echo (
    $cart_count'<a href="' zen_href_link(FILENAME_SHOPPING_CART'''SSL') . '" title="' CART_HEADER_TITLE '">':'') . CART_HEADER_IN_CART_PRE $cart_count . (($cart_count == 1)? CART_HEADER_IN_CART_SINGULARCART_HEADER_IN_CART_PLURAL) . ($cart_count'</a>''');
    ?>
    </div>
    if ($cart_count) { 
      $_SESSION['cart']->get_products(); 
      $basket_total = $_SESSION['cart']->show_total();
      echo '<div id="cartTotal">' . CART_HEADER_TOTAL . $currencies->format($basket_total) . '</div>' ; 
    }
    <?php echo '<a id="cartButton" href="' zen_href_link(FILENAME_SHOPPING_CART'''SSL') . '" title="' CART_HEADER_TITLE '"><img src="yourimagesource.gif" /></a>'''); ?>
    Code:
    #cartTotal {
        float: left;
        }

  5. #5
    Join Date
    Jun 2009
    Posts
    617
    Plugin Contributions
    0

    Default Re: Shoppingcart/Freeship in Header support

    Thanks for the reply.

    I copied that line of code and put it at the bottom of my tpl_cart_header page and then refreshed FF and the page came up blank, all it shows is my header background color and my logo image at the left corner. Everything under the header area is gone.

    It seems in your post that extra line of code is to be placed at the bottom of the file, correct?

    The reason why I know its this particular line of code causing the problem is that my site was fine before, any help is greatly appreciated!
    Thank you,
    autoace

  6. #6
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Shoppingcart/Freeship in Header support

    Oops - forgot to wrap php tags around the relocated code. Since its new location is outside the original php section, it needs those for itself.
    PHP Code:
    <div id="cartCount">
    <?php
    $cart_count 
    $_SESSION['cart']->count_contents();

    echo (
    $cart_count'<a href="' zen_href_link(FILENAME_SHOPPING_CART'''SSL') . '" title="' CART_HEADER_TITLE '">':'') . CART_HEADER_IN_CART_PRE $cart_count . (($cart_count == 1)? CART_HEADER_IN_CART_SINGULARCART_HEADER_IN_CART_PLURAL) . ($cart_count'</a>''');
    ?>
    </div>
    <?php if ($cart_count) { 
      
    $_SESSION['cart']->get_products(); 
      
    $basket_total $_SESSION['cart']->show_total();
      echo 
    '<div id="cartTotal">' CART_HEADER_TOTAL $currencies->format($basket_total) . '</div>' 
    ?>
    <?php 
    echo '<a id="cartButton" href="' zen_href_link(FILENAME_SHOPPING_CART'''SSL') . '" title="' CART_HEADER_TITLE '"><img src="yourimagesource.gif" /></a>'''); ?>
    I have attached the zip file here until the mod is activated in Free Addons.
    Last edited by gjh42; 16 Feb 2010 at 08:06 AM.

  7. #7
    Join Date
    Sep 2008
    Posts
    97
    Plugin Contributions
    0

    Default Re: Shoppingcart/Freeship in Header support

    Glenn,

    I love the idea. I tried your last piece of code but no luck... "500 - Internal server error" is was i get.
    The original code works, it's the mod above that crashes the page.
    Not sure why, my php skills are still close to none.

    It's that part that cause the error:
    PHP Code:
    <?php echo '<a id="cartButton" href="' zen_href_link(FILENAME_SHOPPING_CART'''SSL') . '" title="' CART_HEADER_TITLE '"><img src="whatever.png" /></a>'''); ?>
    Any idea on what's missing?

    Thanks for your help and support on Zen Cart. Love your "Smart Background" add-on btw.

  8. #8
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Shoppingcart/Freeship in Header support

    Ack! I was typing in a hurry and missed the last bit that needed to be removed:
    : ''
    at the end of the statement. This will work:
    PHP Code:
    <?php echo '<a id="cartButton" href="' zen_href_link(FILENAME_SHOPPING_CART'''SSL') . '" title="' CART_HEADER_TITLE '"><img src="whatever.png" /></a>'); ?>

  9. #9
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

  10. #10
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Shoppingcart/Freeship in Header support

    "I have also the slovenian language, wich don't have only singular and plural.

    Should be like that:

    1 item in card- Izdelek
    2 items in card- Izdelka
    3 items in card- Izdelki
    4 items in card- Izdelki
    5 items in card- Izdelkov
    6 items in card- Izdelkov
    7 items in card- Izdelkov.......( and so on, the same)"

    What would be the word for zero or no items in cart?

    Edit /includes/templates/your_template/templates/tpl_cart_header.php.

    PHP Code:
    echo ($cart_count'<a href="' zen_href_link(FILENAME_SHOPPING_CART'''SSL') . '" title="' CART_HEADER_TITLE '">':'') . CART_HEADER_IN_CART_PRE $cart_count . (($cart_count == 1)? CART_HEADER_IN_CART_SINGULARCART_HEADER_IN_CART_PLURAL) . ($cart_count'</a>'''); 
    Replace
    (($cart_count == 1)? CART_HEADER_IN_CART_SINGULAR: CART_HEADER_IN_CART_PLURAL)
    with
    $cart_header_number
    PHP Code:
    echo ($cart_count'<a href="' zen_href_link(FILENAME_SHOPPING_CART'''SSL') . '" title="' CART_HEADER_TITLE '">':'') . CART_HEADER_IN_CART_PRE $cart_count $cart_header_number . ($cart_count'</a>'''); 
    Add just above that
    PHP Code:
    switch ($cart_count){
      case 
    '0':
        
    $cart_header_number CART_HEADER_IN_CART_QTY_0;
        break;
      case 
    '1':
        
    $cart_header_number CART_HEADER_IN_CART_QTY_1;
        break;
      case 
    '2':
        
    $cart_header_number CART_HEADER_IN_CART_QTY_2;
        break;
      case 
    '3':
        
    $cart_header_number CART_HEADER_IN_CART_QTY_3_4;
        break;
      case 
    '4':
        
    $cart_header_number CART_HEADER_IN_CART_QTY_3_4;
        break;
      default:
        
    $cart_header_number CART_HEADER_IN_CART_QTY_5;
        break;

    Then in cart_header_defines.php, add these lines:
    PHP Code:
    define{'CART_HEADER_IN_CART_QTY_0','Izdelek');//???word to use here???
    define{'CART_HEADER_IN_CART_QTY_1','Izdelek');
    define{'CART_HEADER_IN_CART_QTY_2','Izdelka');
    define{'CART_HEADER_IN_CART_QTY_3_4','Izdelki');
    define{'CART_HEADER_IN_CART_QTY_5','Izdelkov'); 
    Last edited by gjh42; 8 Jan 2010 at 09:16 AM.

 

 
Page 1 of 19 12311 ... LastLast

Similar Threads

  1. Shoppingcart question
    By arbmil in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 29 Nov 2011, 06:34 PM
  2. freeship after discounts - code
    By makenoiz in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 7 Feb 2011, 09:50 PM
  3. Shopping Cart Totals in Header Support
    By georgiepants in forum All Other Contributions/Addons
    Replies: 5
    Last Post: 8 Feb 2010, 04:23 PM
  4. Trying to Add Live Support to my Header
    By CoolCarPartsOnline in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 26 Sep 2008, 02:41 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