Jump to content

[SOLVED] set default carrier


Recommended Posts

[sOLVED]i located the bug report on this one -- the solution is to download & install the SVN version of order.php. instructions for obtaining the SVN version are at the bottom of the main download page (below the language packs), here: http://www.prestashop.com/en/downloads/ REMEMBER to backup your old order.php, especially if you've manually modified it in the past. Thanks to all who posted possible solutions -- knowing it was a bug helped me to solve this.

i've configured the following carriers:

United States Post Office
United States Post Office AK/HI
UPS 2nd Day Air
UPS 2nd Day Air AK/HI
UPS Next Day
UPS Next Day AK/HI
UPS Saturday Delivery
UPS Saturday Delivery AK/HI

in backoffice >> shipping >> carrier, under carrier option, i've set United States Post Office as the default carrier. this method is available to buyers in the continental u.s.; buyers in AK or HI do not have this option (they have United States Post Office AK/HI, which has the same rates, but longer delivery time).

when i login with either my california or oklahoma test account, both of which have the default method available (continental u.s., remember?), and i reach the 'choose shipping method' page, the radio button for UPS 2nd day air is selected. i have tried setting other carriers as default, as well, but none seem to override this behaviour.

additional info: the backoffice doesn't overwrite carrier entries in the sql database when you update or delete them -- instead, it makes a new entry, incrementing up the index by 1, and marks the old entry as 'deleted' (1 instead of 0). i manually deleted some of the redundant entries; could that be affecting it?

also possibly pertinent: i have modified my classes/cart.php to apply free shipping for orders over a certain amount for 2 specific carriers only (United States Post Office [id=20] and United States Post Office AK/HI [id=21])

// Added Default carrier only Free Shipping --cjz

if (isset($configuration['PS_SHIPPING_FREE_PRICE']) AND (($id_carrier==20) || ($id_carrier==21)) AND $orderTotal >= floatval($configuration['PS_SHIPPING_FREE_PRICE']) AND floatval($configuration['PS_SHIPPING_FREE_PRICE']) > 0)
           return $shipping_cost;

if (isset($configuration['PS_SHIPPING_FREE_WEIGHT']) AND (($id_carrier==20) || ($id_carrier==21)) AND $this->getTotalWeight() >= floatval($configuration['PS_SHIPPING_FREE_WEIGHT']) AND floatval($configuration['PS_SHIPPING_FREE_WEIGHT']) > 0)
           return $shipping_cost;



and i've modified classes/product.php as follows:

// Moved to end of price calculation so tax gets applied to discounted price -- see below! -- cjz
       // Exclude tax
//        $tax = floatval(Tax::getApplicableTax(intval($result['id_tax']), floatval($result['rate'])));
//        if ($forceAssociatedTax)
//            $tax = floatval($result['rate']);
//        if (Tax::excludeTaxeOption() OR !$tax)
//            $usetax = false;
//        if ($usetax)
//            $price *= (1 + ($tax / 100));

// End moved block

       // Attribute price
       $attribute_price = $usetax ? $result['attribute_price'] : ($result['attribute_price'] / (1 + (($tax ? $tax : $result['rate']) / 100)));
       if (isset($result['attribute_price']))
           $price += $attribute_price;
       $reduc = self::getReductionValue($result['reduction_price'], $result['reduction_percent'], $result['reduction_from'], $result['reduction_to'],
               $price, $usetax, floatval($result['rate']));

       // Only reduction
       if ($only_reduc)
           return $reduc;

       // Reduction
       if ($usereduc)
           $price -= $reduc;

       // Quantity discount
       if ($quantity > 1 AND ($qtyD = QuantityDiscount::getDiscountFromQuantity($id_product, $quantity)))
           $price -= QuantityDiscount::getValue($price, $qtyD->id_discount_type, $qtyD->value);

       // Group reduction
       if ($id_customer)
           $price *= ((100 - Group::getReduction($id_customer))/100);

       // Exclude tax
       $tax = floatval(Tax::getApplicableTax(intval($result['id_tax']), floatval($result['rate'])));
       if ($forceAssociatedTax)
           $tax = floatval($result['rate']);
       if (Tax::excludeTaxeOption() OR !$tax)
           $usetax = false;
       if ($usetax)
           $price *= (1 + ($tax / 100));



thanks,

--cz

Link to comment
Share on other sites

I can't remember where, but I found a post stating this was a bug. The last carrier you edit, will become your default. Just go into the one you want to be default after you're done editing and make a change and save it. This worked for me at least, and my pick up in store is showing up as selected every time I do any testing.

Link to comment
Share on other sites

that makes sense, since UPS Saturday Delivery is the last carrier on the list, which is because it has the highest ID -- highest ID = last item edited.

unfortunately, editing the carrier I want as default would also have the unwanted effect of moving it to the bottom of the list of available carriers -- not a desirable outcome.

has this been reported as a bug so the developers can start on a fix?

thanks,

--cz

Link to comment
Share on other sites

I have no idea, I just remember seeing it when I was looking for something else and tried it.

I have had zero issues with the placement. I'm a graphic designer first, so the placement did bug me.

BUT - it doesn't bother my customers. We have a closed site right now, and I've asked each customer. They comment was, if I want to change it I can change it right?

I said yeah, and they said well that's all we need to do, so I've just left it for now.

You might try checking the bug forum to see if it's been posted, it doesn't matter on our site as I said, so I never took it any further.

Link to comment
Share on other sites

nope. i tried changing this:



to this:



and also to this:



neither change has any discernable effect.

any PHP gurus out there know of another change that might reorder the carriers to display the highest ID first, and the lowest IDs last?

--cz

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...