Jump to content

shipping modules and Prestashop - what is the "is_module" attribute?


codegrunt

Recommended Posts

Howdy. I am currently working through implementing a custom shipping scenario for a customer where orders associated with a specific carrier will get placed on hold until the shipping costs are known and added to the order via the backoffice. Part of this requires adding a large set of weight tiers for use with the carriers and to avoid having to do this by hand via the backoffice interface (tedious and error prone) I was digging around in the db to find which table this data is stored in.

While in there I noticed that the table "ps_carrier" includes a column called "is_carrier". This flag only gets referenced in two spots in Prestashop 1.2.5:

- in Carrier::getCarriers() where if set, the carrier will not be returned in the list

- in AdminOrders.php:

/* Carrier module */
           if ($carrier->is_module == 1)
           {
               $module = Module::getInstanceByName($carrier->name);
               echo call_user_func(array($module, 'displayInfoByCart'), $order->id_cart);
           }



It looks like this is intended for use with custom shipping modules but I am unclear how a custom shipping module would get integrated into the order flow - anyone know if this is an orphaned, unused feature or what specifically this is for? Looking at order.php and the Carrier class it does not appear anything with "is_module" set will ever appear as an option.

Cheers

Link to comment
Share on other sites

It is a new feature that was added in Prestashop v1.3, but there is no documentation on what it is for or how to use it. From that code, it would appear that if you tick "Module" for the carrier, it searches the modules directory for a module with the same name as the carrier. If it finds one, it calls the "displayInfoByCart" function and passes in the order's cart ID as the parameter. It then displays whatever is returned from this module in the "Shipping Info" section of the order's page in the Back Office.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...