cinolas Posted April 27, 2017 Share Posted April 27, 2017 Hi, I'm on 2.34 Bootstrap Gold and I'm using an old Canada Post XML shipping module that doesn't have a sort order field (or configuration entry). Right now the module gets sorted on top and I'd like to change that, but I don't fully understand how the sorting of shipping modules works. The module doesn't create a SORT_ORDER entry on the configuration table during install, so I tried creating one manually but I don't know how to connect that row to the actual module so that the sort order value is summoned with the module. I've looked at the chekckout_shipping page but saw nothing about sorting, so I thought maybe it was being done in the class but I don't see anything about sorting the modules there either. I'm pretty sure this is easy if you know what you're doing, but I do not. I don't need a field on the admin interface, just some way of giving it a sort order. Also, the shipping options show up from most expensive to least expensive on my checkout_shipping page, it selects the right one automatically, but I'd like to show the cheapest on top. How do I do that? (if I could only find where these things are being sorted...) Thanks! Link to comment Share on other sites More sharing options...
beerbee Posted April 28, 2017 Share Posted April 28, 2017 Hi Nicolas, if you open catalog/includes/modules/shipping/flat.php and look for MODULE_SHIPPING_FLAT_SORT_ORDER this might give you a hint how it works. Best regards Christoph Link to comment Share on other sites More sharing options...
cinolas Posted April 28, 2017 Author Share Posted April 28, 2017 I did. My apologies for being dense here. I can see the configuration entries being created in the install function of shipping modules, and I can see that the CanadaPost shipping module doesn't create a row for the SORT_ORDER. So I went and created an entry in the Configuration table manually, but that doesn't change anything. How, or where, does that value get pulled to sort the modules on the checkout_shipping page? Link to comment Share on other sites More sharing options...
beerbee Posted April 28, 2017 Share Posted April 28, 2017 And did you change the module accordingly? There are three instances in example flat.php. on line 23 $this->sort_order = MODULE_SHIPPING_FLAT_SORT_ORDER; on 79 (this is for installing to db with sort order) tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_FLAT_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())"); and 87 return array('MODULE_SHIPPING_FLAT_STATUS', 'MODULE_SHIPPING_FLAT_COST', 'MODULE_SHIPPING_FLAT_TAX_CLASS', 'MODULE_SHIPPING_FLAT_ZONE', 'MODULE_SHIPPING_FLAT_SORT_ORDER'); You could try to add an adaption of the first and last instance to your shipping module (as you entered a sort order already manually) and see what happens. Best regards Christoph Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.