Page 18 of 19 FirstFirst ... 816171819 LastLast
Results 171 to 180 of 181
  1. #171
    Join Date
    Apr 2008
    Posts
    446
    Plugin Contributions
    1

    Default Re: Shoppingcart/Freeship in Header support

    Yes, it's going to get a little complicated, but if it helps others, that's all it matters.
    I'll post the final once I know it works.
    Thanks for the help! =o)

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

    Default Re: Shoppingcart/Freeship in Header support

    Assuming you have constants for freeoptions and its clones like
    MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN
    MODULE_SHIPPING_FREEOPTIONS2_TOTAL_MIN
    MODULE_SHIPPING_FREEOPTIONS3_TOTAL_MIN
    you could do something like
    PHP Code:
     <?php 
    $free_ship_on 
    MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING;
    if (
    $free_ship_on == 'false') {
      echo 
    '<div id="cartFreeShip">';
      
    $free_limit MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN//mi
      
    $free_limit2 MODULE_SHIPPING_FREEOPTIONS2_TOTAL_MIN//cont
      
    $free_limit3 MODULE_SHIPPING_FREEOPTIONS3_TOTAL_MIN//canada
          
    $diff_to_free = ($free_limit $cart_total); 
          
    $diff_to_free2 = ($free_limit2 $cart_total); 
          
    $diff_to_free3 = ($free_limit3 $cart_total); 
      
    //if ($cart_count) { //hopefully this is not needed in order to evaluate $_SESSION['cart']->show_total() which can == 0 for this code
       // $_SESSION['cart']->get_products(); //this was leftover from old code and has no current function in any case, so just delete it
        
    $cart_total $_SESSION['cart']->show_total(); 
        if (
    $cart_total >= $free_limit3) { 
          echo 
    CART_HEADER_QUALIFIES;
        } elseif (
    $cart_total >= $free_limit2) {
          echo 
    CART_HEADER_QUALIFIES_MI_CONT $currencies->format($diff_to_free3) . CART_HEADER_DIFF_POST_CANADA;
        } elseif (
    $cart_total >= $free_limit) {
          echo 
    CART_HEADER_QUALIFIES_MI $currencies->format($diff_to_free2) . CART_HEADER_DIFF_POST_CONT $currencies->format($diff_to_free3) . CART_HEADER_DIFF_POST_CANADA;
        } else {
          echo 
    CART_HEADER_DIFF_PRE $currencies->format($diff_to_free) . CART_HEADER_DIFF_POST CART_HEADER_DIFF_PRE_CONT $currencies->format($diff_to_free2) . CART_HEADER_DIFF_POST_CONT CART_HEADER_DIFF_PRE_CANADA $currencies->format($diff_to_free3) . CART_HEADER_DIFF_POST_CANADA
        }
      
    //} else { //doesn't work for 3 zones
      //  echo CART_HEADER_FREE_LIMIT_PRE . $currencies->format($free_limit) . CART_HEADER_FREE_LIMIT_POST; 
      //} //if need to use $cart_count, expand the above like the previous else case substituting $free_limit/2/3 for $diff_to_free/2/3
      
    echo '</div>';
    ?>

  3. #173
    Join Date
    Apr 2008
    Posts
    446
    Plugin Contributions
    1

    Default Re: Shoppingcart/Freeship in Header support

    You're a genius!!!
    Thank you!! It works perfectly!

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

    Default Re: Shoppingcart/Freeship in Header support

    Good to hear that. So the commented-out if() is not needed, I take it?

  5. #175
    Join Date
    Apr 2008
    Posts
    446
    Plugin Contributions
    1

    Default Re: Shoppingcart/Freeship in Header support

    Correct. Not needed. It actually breaks the page.

    In the spirit of sharing, I made some other changes that work for my case. I wanted so display Free Shipping Over $XXX when shopping cart is 0 instead of the whole message "add $xx for free shipping etc."

    So I added a conditional if the cart is 0 which triggers a different message
    PHP Code:
     <?php 
    $free_ship_on 
    MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING;
    if (
    $free_ship_on == 'false') {
      echo 
    '<div id="cartFreeShip">';
      
    $free_limit MODULE_SHIPPING_FREEOPTIONS_MICHIGAN_TOTAL_MIN//mi
      
    $free_limit2 MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN//continental us
      
    $free_limit3 MODULE_SHIPPING_FREEOPTIONSINT_TOTAL_MIN//canada
          
    $diff_to_free = ($free_limit $cart_total); 
          
    $diff_to_free2 = ($free_limit2 $cart_total); 
          
    $diff_to_free3 = ($free_limit3 $cart_total); 
      
    //if ($cart_count) { //hopefully this is not needed in order to evaluate $_SESSION['cart']->show_total() which can == 0 for this code
       // $_SESSION['cart']->get_products(); //this was leftover from old code and has no current function in any case, so just delete it
        
    $cart_total $_SESSION['cart']->show_total(); 
        if (
    $cart_total >= $free_limit3) { 
          echo 
    CART_HEADER_QUALIFIES_CANADA;
        } elseif (
    $cart_total >= $free_limit2) {
          echo 
    CART_HEADER_QUALIFIES_CONT CART_HEADER_DIFF_PRE $currencies->format($diff_to_free3) . CART_HEADER_DIFF_POST_CANADA;
        } elseif (
    $cart_total >= $free_limit) {
          echo 
    CART_HEADER_QUALIFIES CART_HEADER_DIFF_PRE $currencies->format($diff_to_free2) . CART_HEADER_DIFF_POST_CONT $currencies->format($diff_to_free3) . CART_HEADER_DIFF_POST_CANADA;
        } elseif (
    $cart_total == '0') { 
          echo 
    CART_HEADER;
        } else {
          echo 
    CART_HEADER_DIFF_PRE $currencies->format($diff_to_free) . CART_HEADER_DIFF_POST CART_HEADER_DIFF_PRE_CONT $currencies->format($diff_to_free2) . CART_HEADER_DIFF_POST_CONT CART_HEADER_DIFF_PRE_CANADA $currencies->format($diff_to_free3) . CART_HEADER_DIFF_POST_CANADA;     }

      
    //} else { //doesn't work for 3 zones
      //  echo CART_HEADER_FREE_LIMIT_PRE . $currencies->format($free_limit) . CART_HEADER_FREE_LIMIT_POST; 
      //} //if need to use $cart_count, expand the above like the previous else case substituting $free_limit/2/3 for $diff_to_free/2/3
      
    echo '</div>';
    ?>
    The define CART_HEADER can be any shorter message. In my case it just displays "Free Continental Shipping over $85"

  6. #176
    Join Date
    Nov 2010
    Posts
    64
    Plugin Contributions
    0

    Default Re: Shoppingcart/Freeship in Header support

    Hello everyone,

    Has anyone suggestions on how to exclude certain category id's and product id's from being calculated in the free shipping header?

    // bof This is to remove Category from free shipping always
    if (!IS_ADMIN_FLAG) {
    global $cart;
    $chk_cat = 0;
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id', '9');
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id', '21');
    if ($chk_cat > 0) {
    $this->enabled = false;
    }
    }
    // eof This is to remove Category from free shipping always

    The above code works in freeoptions.php but not in the freeship header.

    Thanks

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

    Default Re: Shoppingcart/Freeship in Header support

    That code appears to be part of a class file, and will not work as is outside of the class.
    $this->enabled = false;
    is not applicable or meaningful in the shoppingcart/freeship files. You would have to rework the action based on the test and the new file context.

  8. #178
    Join Date
    Dec 2005
    Posts
    44
    Plugin Contributions
    0

    Default Re: Shoppingcart/Freeship in Header support

    I'd like to hide the header cart unless there is something in the cart. Any ideas on the code for that? Thank you in advance. Limey

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

    Default Re: Shoppingcart/Freeship in Header support

    That is pretty easy. Find this at the top of tpl_cart_header.php:
    PHP Code:
    $cart_count $_SESSION['cart']->count_contents();
    ?>
    <div id="cartHeader"> 
    and change to
    PHP Code:
    $cart_count $_SESSION['cart']->count_contents();
    if (
    $cart_count) { //only show if something in cart
    ?>
    <div id="cartHeader"> 
    At the bottom of the file, find this:
    PHP Code:
    }  ?>
    </div> 
    and change to
    PHP Code:
    }  ?>
    </div>
    <?php // /only show
    ?>
    If you want the wrapper div to remain as a placeholder for the layout, move the test inside the div, like this
    PHP Code:
    $cart_count = $_SESSION['cart']->count_contents();
    ?>
    <div id="cartHeader">
    <?php if ($cart_count) { //only show if something in cart
    ?>

    //body of file

    }
    } // /only show  
    ?>
    </div>

  10. #180
    Join Date
    Dec 2005
    Posts
    44
    Plugin Contributions
    0

    Default Re: Shoppingcart/Freeship in Header support

    Thanks Glenn - that works a treat. Appreciate appreciate.

    Limey

 

 
Page 18 of 19 FirstFirst ... 816171819 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