Jump to content

Shipping Calculation Statement


Recommended Posts

Hi all,

 

I am trying to do a if statement for a text display in the shopping cart.

 

I want to do the below:

- If the value of the purchase is greater than or equal to $500 show 'Free Shipping!'

- If the value of the purchase is less than or equal to $499.99 show 'Click & Collect!'

 

The code I have is:

{if $priceDisplay == 1}
{if $priceDisplay == 500}
        {l s='Free Shipping!'}
    {/if}
{else}
    {if $priceDisplay == 499.99}
        {l s='Click & Collect'}
    {/if}
{/if}

I have also tried it via Javascript with no success:

 

{literal}
<script type="text/javascript">


<!-- 


if ($priceDisplay >= 500) 
{
        document.write("Free Shipping");
}
ifelse ($priceDisplay =< 500)
        {
document.write("Click & Collect");
}
else {
document.write("Click & Collect");
} //-->


</script>


{/literal}

Any help would be greatly appreciated!

 

Link to comment
Share on other sites

You code should be like this:

 

{if $priceDisplay >= 500}
        Free Shipping!
{else}
        Click & Collect
{/if}

 

Besides in JS, there is no "ifelse", you should use "else if", so there is syntax error. Check from the browser's developer tools, it would report the JS error.

Edited by hailong (see edit history)
Link to comment
Share on other sites

You code should be like this:

{if $priceDisplay >= 500}
        Free Shipping!
{else}
        Click & Collect
{/if}

Besides in JS, there is no "ifelse", you should use "else if", so there is syntax error. Check from the browser's developer tools, it would report the JS error.

 

Unfortunately that hasn't resolved the error either. The page loads.... just no results, the fields are blank.

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...