Auto select default shipping method

  • Posts: 106
  • Thank you received: 5
  • Hikaserial Standard Hikashop Business
9 years 6 months ago #202201

-- HikaShop version -- : 2.4.0
-- Joomla version -- : 3.4.1
-- PHP version -- : 5.4.39

If I set "Auto select default shipping and payment methods" to Yes, it is not selecting the least expensive shipping option. I have USPS and FedEx shipping enabled, but it always selects the least expensive FedEx option, even if there is a less expensive USPS option.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 6 months ago #202211

Hi,

When you set it to yes, it selects the first one of the list.
If USPS is less expensive than FedEx, then swap their ordering via the menu System>Shipping methods and that should do it.

Please Log in or Create an account to join the conversation.

  • Posts: 106
  • Thank you received: 5
  • Hikaserial Standard Hikashop Business
9 years 6 months ago #202313

If that is the case, then it is not working correctly. I have USPS ordered to display before FedEx.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 6 months ago #202321

Hi,

Please provide screenshots of the shipping methods listing and the settings of FedEx and USPS.
This way we will be able to reproduce the issue on our end and debug that.

Please Log in or Create an account to join the conversation.

  • Posts: 106
  • Thank you received: 5
  • Hikaserial Standard Hikashop Business
9 years 6 months ago #202384

Here's the screenshots.

Last edit: 9 years 6 months ago by gpraceman.

Please Log in or Create an account to join the conversation.

  • Posts: 106
  • Thank you received: 5
  • Hikaserial Standard Hikashop Business
9 years 6 months ago #202386

Here's one more.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
9 years 6 months ago #202431

Hello,
Can you clear your browser cache and try it again to be sure that it's not coming from it ?

Please Log in or Create an account to join the conversation.

  • Posts: 106
  • Thank you received: 5
  • Hikaserial Standard Hikashop Business
9 years 6 months ago #202510

I tried it on a different browser and deleting out the browser cache. It still selects the cheapest FedEx option, which is more expensive than the cheapest USPS option.

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
9 years 6 months ago #202564

Hello,
I succeed to reproduce your issue, the solution will be to edit the code of the "components\com_hikashop\views\checkout\view.html.php" file and change these lines :

foreach($shipping_groups as $key => $shipping_group) {
	$p = reset($shipping_group->shippings);
	foreach($usable_rates as $rate) {
		if($rate->shipping_id == $p) {
			$rates[] = $rate;
			$shipping_id[] = $rate->shipping_id.'@'.$key;
			$shipping_method[] = $rate->shipping_type.'@'.$key;
			break;
		}
	}
}
To :
foreach($shipping_groups as $key => $shipping_group) {
	foreach($usable_rates as $rate) {
		if(in_array($rate->shipping_id, $shipping_group->shippings)) {
			$rates[] = $rate;
			$shipping_id[] = $rate->shipping_id.'@'.$key;
			$shipping_method[] = $rate->shipping_type.'@'.$key;
			break;
		}
	}
}
Be sure to clear your cache before testing it.

Last edit: 9 years 6 months ago by Mohamed Thelji.

Please Log in or Create an account to join the conversation.

  • Posts: 106
  • Thank you received: 5
  • Hikaserial Standard Hikashop Business
9 years 6 months ago #202592

I made that change, cleared the site cache, cleared the browser cache, cleared out the shopping cart, and still have the same problem.

I do notice a similar block of code in the &initCart() function that may also need changing.

foreach($shipping_groups as $key => $shipping_group) {
	$p = reset($shipping_group->shippings);
	foreach($usable_rates as $rate) {
		if($rate->shipping_id == $p && (!isset($rate->shipping_warehouse_id) || $rate->shipping_warehouse_id === $key)) {
			$rates[] = $rate;
			$shipping_ids[] = $rate->shipping_id.'@'.$key;
			$shipping_methods[] = $rate->shipping_type.'@'.$key;
			break;
		}
	}
}

Last edit: 9 years 6 months ago by gpraceman.

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 6 months ago #202636

Hi,

The code you're currently mentioned has been tested and validated ; it does not require modification.
The code that Mohamed mentioned might need a modification but we still need to review it in order to be sure.

Because the code line:

if($rate->shipping_id == $p && (!isset($rate->shipping_warehouse_id) || $rate->shipping_warehouse_id === $key)) {
is working and has been highly tested. And if we change that line, it will break several features (including warehouses) and a lot of working stores in the same time.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 106
  • Thank you received: 5
  • Hikaserial Standard Hikashop Business
9 years 6 months ago #202659

I was just pointing out another similar chunk of code. This is obviously a bug and as such, each place where the problem could be occurring should be examined.

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 6 months ago #202661

Hi,

That's right ; and we will examine it with Mohamed who has reproduce the issue in his website.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 106
  • Thank you received: 5
  • Hikaserial Standard Hikashop Business
9 years 5 months ago #204386

Any update on this issue?

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
9 years 5 months ago #204512

Hello,
Yes, I made a fix regarding that issue which will be available within few hours, so you'll just have to download the last Hikashop version through our website, install it and test it again.
Don't forget to clear your browser cache/session before testing it.

Please Log in or Create an account to join the conversation.

  • Posts: 106
  • Thank you received: 5
  • Hikaserial Standard Hikashop Business
9 years 5 months ago #204619

I downloaded and installed the latest package today and I am still having the same problem. I tried on two different browsers, even after clearing the browser cache.

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
9 years 5 months ago #204827

That's weird, the patch fixed that issue on my end, can you give me a temporary FTP access (through our contact form) to your website so that I can see if the patch was correctly applied.
If you're still having that issue despite the new patch, I'll be able to test it and to fix it on your end.
Thanks.

Last edit: 9 years 5 months ago by Mohamed Thelji.

Please Log in or Create an account to join the conversation.

  • Posts: 106
  • Thank you received: 5
  • Hikaserial Standard Hikashop Business
9 years 5 months ago #205081

PM sent

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
9 years 5 months ago #205138

The patch wasn't applied on the "administrator\components\com_hikashop\classes\shipping.php" file, I just added it manually, can you test it again ?
Thanks.

Please Log in or Create an account to join the conversation.

  • Posts: 106
  • Thank you received: 5
  • Hikaserial Standard Hikashop Business
9 years 5 months ago #205202

That fixed the problem. Though, I would have thought that installing the latest package would have had the updated file in it.

I was going to add a free shipping option for those that wish to pickup their order in person. However, this does end up defaulting to that option, even though the vast majority of our customers are not local. I assume that there isn't a way to get this to default to the lowest rate that isn't zero, or is there?

Please Log in or Create an account to join the conversation.

Time to create page: 0.119 seconds
Powered by Kunena Forum