Page 1 of 1

Sort order of Royal Mail shipping options

Posted: Sun Jan 01, 2017 8:57 pm
by yorkshireboy
I am running OC2.0.3.1 and use the in-built Royal Mail shipping module as I'm based in the UK.

The module works fine, however I get some customers who don't pay enough attention to whats on the screen and just select the first available shipping option in the list - which happens to also be the most expensive.

The default display order seems to be:
1) Special Delivery
2) First Class
3) Second Class

I want to change the display order to be 3-2-1 so that the lowest priced shipping option is shown at the top.

I'd also like to set (3) as the default - at the moment (1) shows as the default

Can anyone help me locate where this is defined so that I can adjust it

Thanks

The site is https://shop.angeldancewear.co.uk/

Re: Sort order of Royal Mail shipping options

Posted: Sun Jan 01, 2017 9:13 pm
by opencartmart
In the file catalog/model/extension/shipping/royal_mail.php, find following line:

Code: Select all

$method_data = array();
Now add following lines of code after that line:

Code: Select all

        $price_order = array();
        foreach ($quote_data as $key => $value) {
            $price_order[$key] = $value['cost'];
        }

      array_multisort($price_order, SORT_ASC, $quote_data);
Good luck!

Re: Sort order of Royal Mail shipping options

Posted: Sun Jan 01, 2017 9:56 pm
by yorkshireboy
Thanks for your help.

Don't know if its a version thing (I'm on 2.0.3.1) but I don't have catalog/model/extension/shipping/royal_mail.php

I do have catalog/model/shipping/royal_mail.php and in that file at the very bottom there is:

$method_data = array();
if ($quote_data) {
$method_data = array(
'code' => 'royal_mail',
'title' => $this->language->get('text_title'),
'quote' => $quote_data,
'sort_order' => $this->config->get('royal_mail_sort_order'),
'error' => false
);
}
return $method_data;

If I'm in the right place, this would seem to suggest to me that there is a 'royal_mail_sort_order' configuration somewhere??

Any idea's

Re: Sort order of Royal Mail shipping options

Posted: Sun Jan 01, 2017 11:57 pm
by opencartmart
Yes you are right. In OC 2.0.3.1 file location is catalog/model/extension/shipping/royal_mail.php

Just insert codes after the following line:

Code: Select all

$method_data = array();

Re: Sort order of Royal Mail shipping options

Posted: Mon Jan 02, 2017 1:04 am
by yorkshireboy
Worked perfectly - thanks for your help

Re: Sort order of Royal Mail shipping options

Posted: Mon Jan 02, 2017 2:03 am
by opencartmart
Glad to hear. Thanks!

Re: Sort order of Royal Mail shipping options

Posted: Mon Jan 02, 2017 5:46 am
by yorkshireboy
Hi - before I followed the instructions and made this change to the postage order, I had set up Paypal Express checkout

(I just opened another thread for it)

Is there any chance this postage mod could have affected the Paypal Express checkout process??

Basically the product 'option' criteria is being lost when the Paypal Express Checkout is used

Thanks

Re: Sort order of Royal Mail shipping options

Posted: Mon Jan 02, 2017 2:05 pm
by opencartmart
Nope, apparently it should not. Seems different issue.

Re: Sort order of Royal Mail shipping options

Posted: Tue Jan 03, 2017 1:12 am
by yorkshireboy
Thanks - didn't think so, but worth checking

Any idea's on my Paypal Express option problem? - i think it might have been a known issue, which I'm sure there must be a simple solution for

Re: Sort order of Royal Mail shipping options

Posted: Tue Jan 03, 2017 2:09 pm
by opencartmart
I need to know more details. What is the thread URL that you have created for that issue?