Reputation: 317
My checkout Subtotal and grandtotal shows doubles the item price in cart.
I set "Allow Shipping to Multiple Addresses" as "No" and "Maximum Qty Allowed for Shipping to Multiple Addresses" as "0"
Also i have updated the code in cart.php file.
But still i am getting the subtotal wrong.
EDIT:
I have updated the below code in app/code/core/Mage/Checkout/Model/cart.php file.
$addresses = $this->getQuote()->getAllAddresses();
if (count($addresses) > 2) {
for($i = 2; $i < count($addresses); $i++) {
$address = $addresses[$i]; $address->isDeleted(true);
}
}
But still i am getting the subtotal incorrect
Thanks
Upvotes: 1
Views: 1081
Reputation: 31
It appears that it is only multiple shipping addresses that cause this issue. You can have multiple billing addresses and only one shipping and the totals don't seem to double. So there is a possibility that a customer could have two shipping records in the sales_flat_quote_address table and no billing address (probably extremely rare). Or two shipping address in the first two spots (lower address_id) and a billing in the last. In either case the code you have listed will not fix the doubling issue. In the first case because there are only two records so the 2nd shipping address will not be removed. In the second case, because the 3rd record is a billing address it will be removed, still leaving the two shipping addresses. To make this fix work for these rare cases and because it just seems to be more appropriate fix, I changed the code to look like this:
$addresses = $this->getQuote()->getAllShippingAddresses();
if (count($addresses) > 1) {
for($i = 1; $i < count($addresses); $i++) {
$address = $addresses[$i];
$address->isDeleted(true);
}
}
This code will only pull the shipping addresses for the quote entity in question. Then it will remove any additional records after the 1st one.
Upvotes: 3