Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Notification Snippet To Count Shippings? Rate Topic   - - - - -

 
  • thecigarhut
  • Advanced Member
  • Members
  • Join Date: 07-Dec 21
  • 102 posts

Posted 30 June 2022 - 06:33 PM #1

I'm trying to add a note in the customer order summary where if there are more than 1 shipping methods used in the order (bought from more than 1 supplier) the customer would get an included text that his order will be shipped in multiple packages

 

What I need to do is figure out how to count the # of entries in this variable

 

{{o.shippings_method}}

 

Currently the template will just list all methods used, is there a way to do something like this?

 

{% if o.shippings_method >1 %}
my custom text here
{% endif %}
 
this obviously does not work but how do you count the # of methods included?

osCommerce user since 2005 now upgrading to CS-Cart Ultimate.


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 23044 posts

Posted 01 July 2022 - 04:58 AM #2

Please try

 

https://twig.symfony...ers/length.html


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 1210     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 4025     CS-Cart + YOUPI      USD 1459      Multi-Vendor Ultimate       USD 7500 (6000)


 
  • thecigarhut
  • Advanced Member
  • Members
  • Join Date: 07-Dec 21
  • 102 posts

Posted 01 July 2022 - 03:24 PM #3

 

Perfect!

 

thanks so much for the help


osCommerce user since 2005 now upgrading to CS-Cart Ultimate.


 
  • thecigarhut
  • Advanced Member
  • Members
  • Join Date: 07-Dec 21
  • 102 posts

Posted 01 July 2022 - 04:58 PM #4

I thought that worked until I tested it with an order with only 1 shipping method, for those interested here is what I did that worked

{% if o.shipping.1.shipping_id %}
<p style="color: #787878; font-size: 14px; font-family: Helvetica, Arial, sans-serif; padding-bottom: 5px; margin: 0px;">{{ __("order_ships_multi_packages") }}<br /></p>
{% endif %}

what that does is look if there is a 2nd shipping id in the string, if so it displays the message text

 


osCommerce user since 2005 now upgrading to CS-Cart Ultimate.