Jump to content

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

If Statement In Invoice And Packing Slip Rate Topic   - - - - -

 

Posted 21 August 2018 - 01:00 PM #1

I am sure this is super simple, but so is my brain. :)

 

On the invoice and packing slip templates, I would like the QUANTITY variable to be formatted in BOLD and RED if it is greater than 1.

 

The variable is p.amount

 

Lil' Help?

 

THANKS!!!!



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

Posted 21 August 2018 - 01:51 PM #2

If I understand you correctly, go to the Products table tab and change Qty value from

<p style="text-align: center; font-family: Helvetica, Arial, sans-serif;"><strong style="font-weight:600;">{{ p.amount }}</strong>
</p>

to

<p style="text-align: center; font-family: Helvetica, Arial, sans-serif;"><strong style="font-weight:600;{% if p.amount> 1 %}color: red{% endif %}">{{ p.amount }}</strong>
</p>

Do not forget to switch WYSIWYG editor to the source code mode


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 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 

Posted 21 August 2018 - 04:00 PM #3

Thanks so much.  To simplify a bit, let's just look at:

{% if p.amount> 1 %}color: red{% endif %}">{{ p.amount }}

I have switched to NO WYSIWYG editor and it still returns this error: 

 

Error Unexpected character "&" at line 1.

 

It also changes the code to:

<p style="text-align: center; font-family: Helvetica, Arial, sans-serif;"><strong style="font-weight: 600; {% if p.amount&gt; 1 %}color: red{% endif %};">{{ p.amount }}</strong></p>

It seems to not like the > greater than symbol.  WTH?



 

Posted 21 August 2018 - 04:01 PM #4

Sorry....last message was confusing.  Forget the code simplification reference.  Using the code you offered, the error is still there.



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

Posted 22 August 2018 - 05:44 AM #5

The example works for me on the clean installation. Try to use WYSIWYG, but switch it to the source code mode ( < > )

 

http://prntscr.com/klhhn0


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 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.