On my cart page, the “shipping” module is appearing between “Coupon Code” and “Gift Certificate” modules. This is in the incorrect order.
Is there any way to order the modules or change the code so that the “shipping” module is last in this block. Especially on mobile, it doesn’t look right as you want it to be the last module before the “total” module is displayed.
I found the code that’s rendering this page here:
~/catalog/view/theme/..../template/checkout/cart.twig
<div class="col-sm-7">
<div class="row cart-modules">
{% if modules %}
{% for module in modules %}
<div class="col-sm-6 margin-b30">
{{ module }}
</div>
{% endfor %}
{% endif %}
</div>
</div>
I was thinking to add some condition code to this code to bypass if it is the "shipping" module and then re-iterate again through the array again and to put it last.
However I am not sure how to test if the module is “shipping”, or if this is the best way to do it ?
Thanks in advanced.
Hi Jonathan,
Thanks for the reply, I tried that already and it doesn't work. As a double check I re-arranged it to something obvious just to prove it but it still doesn't work (reloaded the modules and theme as well).
Is there any methods available to the twig code (from the php controller) on the "module" item from the "modules" array that I can test ? For example something like:
if module.name == "shipping" ....
Thanks for the reply, I tried that already and it doesn't work. As a double check I re-arranged it to something obvious just to prove it but it still doesn't work (reloaded the modules and theme as well).
Is there any methods available to the twig code (from the php controller) on the "module" item from the "modules" array that I can test ? For example something like:
if module.name == "shipping" ....
Sorry, I thought you were talking about line items on the order, not the 3 module boxes that appear on the cart page. Try this edit and see if it works:
------------------------------------------------------------------------------
IN:
/catalog/controller/checkout/cart.php
BEFORE:
if ($files) {
ADD:
$files = array('coupon', 'voucher', 'shipping');
------------------------------------------------------------------------------
Don't forget to refresh your ocMod cache in Extensions > Modifications and your Twig cache (using the gear icon in the main admin dashboard). Otherwise you may not see any results from the edit.
------------------------------------------------------------------------------
IN:
/catalog/controller/checkout/cart.php
BEFORE:
if ($files) {
ADD:
$files = array('coupon', 'voucher', 'shipping');
------------------------------------------------------------------------------
Don't forget to refresh your ocMod cache in Extensions > Modifications and your Twig cache (using the gear icon in the main admin dashboard). Otherwise you may not see any results from the edit.
Who is online
Users browsing this forum: adycobra2003, OSWorX, paulfeakins and 417 guests