Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2012
    Posts
    16,799
    Plugin Contributions
    17

    Default 1.5.3 and 1.5.4, removal of shipped product with free shipping item remaining

    If a customer has a cart with a free shipping item included after previously getting to the checkout_payment screen with an item that is to be shipped, the cost of shipping is not reset to 0.00 when returning to checkout with only free shipping (no cost shipping) other than store pickup.


    In includes/modules/pages/checkout_shipping/header_php.php

    the following code:
    Code:
    // if the order contains only virtual products, forward the customer to the billing page as
    // a shipping address is not needed
    if ($order->content_type == 'virtual') {
    $_SESSION['shipping']['id'] = 'free_free';
    $_SESSION['shipping']['title'] = 'free_free';
    $_SESSION['sendto'] = false;
    zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
    }
    Doesn't clear the cost before redirecting to the Checkout_payment page..

    Add the following to correct this:
    $_SESSION['shipping']['cost'] = '0.00'; to read:

    Code:
     // if the order contains only virtual products, forward the customer to the billing page as
    // a shipping address is not needed
    if ($order->content_type == 'virtual') {
    $_SESSION['shipping']['id'] = 'free_free';
    $_SESSION['shipping']['title'] = 'free_free';
    $_SESSION['shipping']['cost'] = '0.00';
    $_SESSION['sendto'] = false;
    zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
    }
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  2. #2
    Join Date
    Jan 2004
    Posts
    66,419
    Blog Entries
    7
    Plugin Contributions
    81

    Default Re: 1.5.3 and 1.5.4, removal of shipped product with free shipping item remaining

    You say this affects only v1.5.3 and v1.5.4 .... but ... the line you're suggesting to add wasn't something that was ever removed.

    So, before accepting this as the fix to a problem, I must ask: what would be the root cause for the issue appearing in v153 but not being in v151 also?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jan 2004
    Posts
    66,419
    Blog Entries
    7
    Plugin Contributions
    81

    Default Re: 1.5.3 and 1.5.4, removal of shipped product with free shipping item remaining

    Hmmm ... I suppose the difference is that v1.5.1 was setting $_SESSION['shipping'] to a text string 'free_free', which also effectively removed the whole set of sub-array elements, including ['cost'], which thus made cost be 0 implicitly.

    Might be further side-effects to research here before a final solution is engaged ... need to determine whether unset($_SESSION['shipping']) should be run before setting any of those elements at all.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #4
    Join Date
    Jul 2012
    Posts
    16,799
    Plugin Contributions
    17

    Default Re: 1.5.3 and 1.5.4, removal of shipped product with free shipping item remaining

    Thank you for looking into that difference already... I began a comparison of 1.5.3 and 1.5.1; however, currently only have my eyes to do so. Agree that a larger review would be necessary for the final proper fix; however, setting the cost to 0.00 seemed to fall in line with the other "resets" in the "newer" code..

    Perhaps the assignment of shipping to free_free had a positive unintended result, whereas what seems to be a more implicitly called change of the id to free_free fell in line with only modifying the id, but the potentially unintended bonus was missed.. :) Certainly makes one wonder if there are other "keys" that are being generated by other programmers that are desired to be kept (in 1.5.2 and beyond), but that wouldn't have been considered in core 1.5.1 code as the shipping session was cleared/reset...

    I also considered the possibility that maybe the shipping quote from the free_free id be captured instead of assigning to 0.00; somewhat maintaining a more object oriented calculation in the event someone has reworked the free_free id shipping module to return an other than 0.00 value... :/

    But for the intended individual, they were looking for 0.00 and perhaps there are more areas than the shipping module's quote that would need to be modified to support an other than 0.00 response...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    Jan 2004
    Posts
    66,419
    Blog Entries
    7
    Plugin Contributions
    81

    Default Re: 1.5.3 and 1.5.4, removal of shipped product with free shipping item remaining

    I think the most backward-compatible solution is this:

    In includes/modules/pages/checkout_shipping/header_php.php
    Code:
    // if the order contains only virtual products, forward the customer to the billing page as
    // a shipping address is not needed
    if ($order->content_type == 'virtual') {
      $_SESSION['shipping'] = array();
      $_SESSION['shipping']['id'] = 'free_free';
      $_SESSION['shipping']['title'] = 'free_free';
      $_SESSION['shipping']['cost'] = 0;
      $_SESSION['sendto'] = false;
      zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
    }
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. Discount coupon with free shipping and free shipping if purchasing additional product
    By webmiss in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 4 May 2012, 02:04 PM
  2. Free shipping on one item in USA and with purchase of another item
    By jendera in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 30 Dec 2009, 01:00 AM
  3. free shipping item combined with non free item
    By gsdcypher in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 23 Jan 2008, 02:48 AM
  4. $XX.XX remaining until free shipping, continued
    By arcanesanctuary in forum Basic Configuration
    Replies: 21
    Last Post: 26 May 2007, 04:21 PM
  5. $XX.XX remaining until free shipping
    By glock in forum Basic Configuration
    Replies: 7
    Last Post: 6 Jan 2007, 12: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