Hi is there any posibility to get this working?

{exp:cartthrob:arithmetic expression="{option_price_numeric} -({option_price_numeric} * {exp:low_variables:single var='early_bird_discount'} / 100)"}

In {exp:low_variables:single var='early_bird_discount'} is 30 in this example I'm getting an "undefined variable" error and I know this is correct but I don't know how exactly get the right result for this


Using the first option Rob Sanchez suggests gives me the following error: Unparsed EE tags in expression, check parse order. Perhaps it is important for you that the tag is nested into several tags in an embed template:

{exp:channel:entries channel="events" require_entry="yes" entry_id="{embed:entry_id}"}
  {exp:cartthrob:item_options entry_id="{entry_id}"}
    {categories show_group="24"}
        {if option_value == "{embed:option}"}

          {if category_id =="160"}
            {if "{event_early_bird_date format='%U'}" >= "{current_time format='%U'}" && "{exp:low_variables:single var='siteA:early_bird_discount'}" >"{embed:another_discount}"}
{!-- ##### --}
              {exp:cartthrob:arithmetic expression="{option_price_numeric} -({option_price_numeric} * {early_bird_discount} / 100)"}
{!-- ##### --}
              {exp:cartthrob:arithmetic expression="{option_price_numeric} -({option_price_numeric} * {embed:another_discount} / 100) + {embed:membrr_price}"}
          {if:elseif category_id =="161"}


Update 2

I figured out the problem I think. early_bird_discount is a low variable of siteA but I'm trying use this variable on siteB so using {early_bird_discount} does not work here. Is there any possibility to get the global variable from siteA on siteB?


You could try two things:

One is to set this particular Low Variable as Early Parsed (in the variable settings). Then you can call it like this:

{exp:cartthrob:arithmetic expression="{option_price_numeric} -({option_price_numeric} * {early_bird_discount} / 100)"}

Or you could try adding parse="inward" to the arithmetic tag:

{exp:cartthrob:arithmetic parse="inward" expression="{option_price_numeric} -({option_price_numeric} * {exp:low_variables:single var='early_bird_discount'} / 100)"}
| improve this answer | |
  • Yep. And I'd recommend the first option. – Low Feb 11 '14 at 13:26
  • I have updated the description because there is still an error. Thanks for helping me out! – Pibble Feb 11 '14 at 14:41
  • You should open up cartthrob/libraries/Math.php and var_dump($expression); in the evaluate function. If you do that, you should be able to see which unparsed tag is the culprit. – Rob Sanchez Feb 11 '14 at 15:15
  • You can also enable template debugging and look up the cartthrob:arithmetic tag, to see what the actual opening tag looks like. If the LV is parsed, you can rule that out as the culprit. – Low Feb 12 '14 at 7:24
  • if I use {early_bird_date} this is the culprit. If I use {exp:low_variables:single var='siteA:early_bird_discount'} I get the following expression: 199.00 -(199.00 * M20o93H7pQ09L8X1t49cHY01Z5j4TT91fGfr / 100) – Pibble Feb 12 '14 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.