Change Message Dependent On Product Price

Hi

I have a prices_block_override in place which changes any product with a value of 0.00 to display a customer message. code below.

What I want to do is have the ability to display alternative messaged dependent on what value I would put the product at.

So for product of value 0.00 it would display message 1

for product with a value of 0.01 it would display message 2 and so forth



This is my current code



{if $product.price|floatval == 0.00}

This product may require consultation, Please add to your basket and we will contact you.



{else}{if $product.price|floatval || $product.zero_price_action == “P” || ($hide_add_to_cart_button == “Y” && $product.zero_price_action == “A”)}

{if $details_page}{/if}{include file=“common/price.tpl” value=$product.price span_id=“discounted_price_$obj_prefix``$obj_id” class=“price-num”}

{elseif $product.zero_price_action == “A”}

{assign var=“base_currency” value=$currencies[$smarty.const.CART_PRIMARY_CURRENCY]}

{(“enter_your_price”)}: {if $base_currency.after != “Y”}{$base_currency.symbol}{/if}

{if $base_currency.after == “Y”}{$base_currency.symbol}{/if}


{elseif $product.zero_price_action == “R”}

{
(“contact_us_for_price”)}

{assign var=“show_qty” value=false}

{/if}{/if}



Thanks for the help in advance



Alan

Alan,

You need to use 'code' tags when posting code. Use separate language variables for each message and adjust your code appropriately. I.e. msg1, msg2, msg3…

[quote name='tbirnseth' timestamp='1389148300' post='174689']

Alan,

You need to use 'code' tags when posting code. Use separate language variables for each message and adjust your code appropriately. I.e. msg1, msg2, msg3…

[/quote]

tbirnseth

Thank you for the reply and the pointer on posting code, but I am not a programmer and do not really understand your answer.



Alan

If you're not a programmer, then I'd strongly suggest that you not adjust code. I.e. you should hire the help you need. Rates/quality vary widely. Language/communication can also be an issue. Find a developer you can work with who does quality work and the cost will pay for itself over the long haul. You can always find cheaper, but they may not be around 6 months from now when someone needs to understand what/why the did something.

[quote name='tbirnseth' timestamp='1389391140' post='174892']

If you're not a programmer, then I'd strongly suggest that you not adjust code. I.e. you should hire the help you need. Rates/quality vary widely. Language/communication can also be an issue. Find a developer you can work with who does quality work and the cost will pay for itself over the long haul. You can always find cheaper, but they may not be around 6 months from now when someone needs to understand what/why the did something.

[/quote]

tbirnseth

Thanks for the reply, when I said I am not a programmer, this is true. but I do understand a lot of things in relation to the code structure, file structure.etc

I prefer to try and ask how to do things so I can learn, it is very unlikely that I will break the site as the contents of the code I posted is in a hook file so I can revert quite simply. I also do before and after backups on all code changed files.

Why I do this is as you have pointed out,

if I get someone else to make a change that I do not understand and they are gone in six months time. I have a problem.



Alan

Make the changes you want and then for each condition you want to handle, use a separate language variable.