- Posts: 32
- Thank you received: 1
UPS Shipping Options Not Sorted by Price
-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.4.3
-- PHP version -- : 5.4.44
-- Browser(s) name and version -- : Chrome OSX
-- Error-message(debug-mod must be tuned on) -- : N/A
Hi All,
Our UPS shipping plugin is working largely as expected. However, I notice that if the customer doesn't quality for free shipping (orders > $49), the default option for UPS is Next-Day Air.
That's a very expensive shipping option and may dissuade customers from completing their order. Why is the plugin not defaulting to the cheapest option?
I am looking to the Checkout view and notice the version my client's site is using is customized (not by me). Is this where the ordering would be done and do you have a recommendation for where in 2.6.0 the shipping method details would be ordered?
Thanks!
Please Log in or Create an account to join the conversation.
- Posts: 12953
- Thank you received: 1778
In your case you'll just have to order the cheapest shipping method before our UPS shipping method via "Hikashop->System->Shipping methods". Can you do it and test it again ?
Thanks
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- Posts: 12953
- Thank you received: 1778
There is no "Sort by shipping price" option on the UPS, so the only method will be to directly edit the code of the UPS shipping plugin to add it (ups.php) like the USPS shipping method.
Please Log in or Create an account to join the conversation.
I have "Auto select default shipping and payment methods" set, which means even at the first step of checkout it tries to calculate shipping. Does the plugin use onShippingDisplay at all for this? I'm not sure how it calls my shipping methods (I use a custom shipping method that provides free shipping for >$49 orders, and UPS) get called in this step.
I'm hoping I can write this in a way that it might be integrated into UPS plugin permanently.
p.s. - why is there two copies of ups.php? One in /administrator/components/com_hikashop/extensions/plg_hikashopshipping_ups/ and another in plugins/hikashopshipping/ups/?
Please Log in or Create an account to join the conversation.
- Posts: 12953
- Thank you received: 1778
The solution will be to sort the "$new_usable_rates" variable just before these lines through the onShippingDisplay function :
The one you want to use is plugins/hikashopshipping/ups/p.s. - why is there two copies of ups.php? One in /administrator/components/com_hikashop/extensions/plg_hikashopshipping_ups/ and another in plugins/hikashopshipping/ups/?
Please Log in or Create an account to join the conversation.
Also, what would be the code needed to sort by price?
When I view the $new_usable_rates array they are actually in the proper order, but for some reason it picks "UPS Next Day" as the default. Probably because it is the first listed in the [methods] array within the shipping_params ?
Please Log in or Create an account to join the conversation.
- Posts: 12953
- Thank you received: 1778
The ups.php file is the same for both locations.
But the one in plugins/hikashopshipping/ups/ is the one that is used.
Note that the data is cached. So you'll get your debug only the first time the rates are fetched.
After that, you need to change the cart (add another product, change the quantity, etc) if you want the rates to be fetched again and thus get your debug to be displayed.
Please Log in or Create an account to join the conversation.
Could you please provide the sample code to accomplish this?
Please Log in or Create an account to join the conversation.
- Posts: 12953
- Thank you received: 1778
1.
I just tested it myself and you were right, the shipping services were sorted after the onShippingDisplay call, so to prevent it you should edit the "administrator\components\com_hikashop\classes\shipping.php" file and change that line :When I view the $new_usable_rates array they are actually in the proper order, but for some reason it picks "UPS Next Day" as the default. Probably because it is the first listed in the [methods] array within the shipping_params ?
To accomplish what you want you'll need to add these lines :
Please Log in or Create an account to join the conversation.
Warning: usort() expects parameter 2 to be a valid callback, class 'plgHikashopshippingUPS' does not have a method 'cmp' in .../plugins/hikashopshipping/ups/ups.php on line 224. Line 224 is the usort line exactly as you instructed.
Please Log in or Create an account to join the conversation.
- Posts: 12953
- Thank you received: 1778
Can you test it with that shipping plugin ? I don't have any error message with it.
Please Log in or Create an account to join the conversation.
Also, if I try to delete an item from the shopping cart - i get the following error:
Fatal error: Call to a member function get() on a non-object in F:\wamp\www\site3\administrator\components\com_hikashop\helpers\module.php on line 207
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- Posts: 12953
- Thank you received: 1778
Did you get that error message after using the custom UPS shipping plugin that I gave you ? I'll need a temporary FTP and Back-end access that you can send us through the contact form :
www.hikashop.com/support/contact-us.html
Please Log in or Create an account to join the conversation.
That error still exists using the plugin version you sent. You can test it by:
- go to the website: www.p3proswing.com/site3
- Under Shop all Products, select Accessories
- Click 'Add to Cart' on the Foam Golf Balls
- Click 'Proceed to checkout'
- Scroll to bottom
- Click the 'X' under Quantity
- VOILA - Error !!
Please Log in or Create an account to join the conversation.
- Posts: 12953
- Thank you received: 1778
We just added a fix regarding that issue, so can you download the last Hikashop version through our website, install it and test it again ?
Thanks for your feedback.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.