ghiyas
January 31, 2018, 12:00am
1
Hi,
Is there a way I can add text before the price on all of my product pages?
I have looked in the language variables section and cannot find anything, and have tried the "Edit content on-site" but neither worked.
Is this possible? Perhaps I need to edit a .tpl file somewhere for this to work?
Many thanks!
SDAD
February 1, 2018, 12:00am
2
Hi,
Is there a way I can add text before the price on all of my product pages?
I have looked in the language variables section and cannot find anything, and have tried the "Edit content on-site" but neither worked.
Is this possible? Perhaps I need to edit a .tpl file somewhere for this to work?
Many thanks!
Hello!
You need to edit this code in design/themes/YOUR_THEME/templates/common/product_data.tpl file:
{capture name="price_`$obj_id`"}
{if $show_price_values}
{if $show_price}
{hook name="products:prices_block"}
{if $product.price|floatval || $product.zero_price_action == "P" || ($hide_add_to_cart_button == "Y" && $product.zero_price_action == "A")}
{include file="common/price.tpl" value=$product.price span_id="discounted_price_`$obj_prefix``$obj_id`" class="ty-price-num" live_editor_name="product:price:{$product.product_id}" live_editor_phrase=$product.base_price}
{elseif $product.zero_price_action == "A" && $show_add_to_cart}
{assign var="base_currency" value=$currencies[$smarty.const.CART_PRIMARY_CURRENCY]}
{__("enter_your_price")}:
{if $base_currency.after != "Y"}{$base_currency.symbol nofilter}{/if}
{if $base_currency.after == "Y"}{$base_currency.symbol nofilter}{/if}
{elseif $product.zero_price_action == "R"}
{__("contact_us_for_price")}
{assign var="show_qty" value=false}
{/if}
{/hook}
{/if}
{elseif $settings.General.allow_anonymous_shopping == "hide_price_and_add_to_cart" && !$auth.user_id}
{__("sign_in_to_view_price")}
{/if}
{/capture}
Please note that there is a hook {hook name="products:prices_block"} so you can use it.
Your text will appear on the product list too, if you want to show it only on the product detail page, add such condition {if $runtime.mode == 'view'}.
ghiyas
February 1, 2018, 12:00am
3
Hi,
Thanks for the guidance! So if I just wanted to add something before the price, so instead of "£100" it says "Offer £100", what line would I edit?
Many thanks!
SDAD
February 1, 2018, 12:00am
4
Hi,
Thanks for the guidance! So if I just wanted to add something before the price, so instead of "£100" it says "Offer £100", what line would I edit?
Many thanks!
Right after { hook name = "products:prices_block" } line.