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'));
}
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?
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.
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...
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'));
}