owebia / magento2-module-advanced-shipping

Other
90 stars 28 forks source link

Sort order #64

Closed gewaechshaus closed 5 years ago

gewaechshaus commented 5 years ago

Hey @owebia,

sorry for this stupid question, but how can we sort the defined methods?

Tried it like

'sort_order'        => 2,

without success.

Thanks!

Cheers, Jan

owebia commented 5 years ago

Hi,

This is not possible with this extension, Magento does not provide a way to sort shipping methods.

Best Regards, A.L.

gewaechshaus commented 5 years ago

Hi @owebia - ok, many thanks...

So the sort order configured in xml is related to shipping carriers only? What is the default sort order? I guess it ain't random...

If I would extend the checkout shipping method html in a custom template/ ko observable array, and would set my attribute called my_sort_order like it is explained in the documentation, it should work or do you see any problems?

addMethod('id_038', [
    'title'       => "My Shipping Method",
    'price'       => 10,
]) // No semicolon after closing parenthesis
->set('my_sort_order', 1);

Cheers Jan

owebia commented 5 years ago

Hi,

So the sort order configured in xml is related to shipping carriers only? What is the default sort order? I guess it ain't random...

Magento is sorting by carrier's sort order:
https://github.com/magento/magento2/blob/2.3.2/app/code/Magento/Quote/Model/Quote/Address.php#L841-L876

If I would extend the checkout shipping method html in a custom template/ ko observable array, and would set my attribute called my_sort_order like it is explained in the documentation, it should work or do you see any problems?

It should work.

Best Regards,
A.L.