Page 1 of 1

Add text before Price in opencart

Posted: Fri Jan 20, 2017 1:14 am
by heeljoseph
Hello everyone,

I would like to know how do I add text before price in opencart?

I have tried to modify the following code in catalog/view/theme/journal/template/product/product.tpl (Premium Journal theme)

Default

Code: Select all

<li class="product-price"><?php echo $price; ?></li>

<li class="price-old"><?php echo $price; ?></li>
After Modified

Code: Select all

<li class="product-price"><div class="custom-price">Price:</div><?php echo $price; ?></li>

<li class="price-old"><div class="custom-price">Price:</div><?php echo $price; ?></li>
It works correctly, but when I chose the option selection such as size or colour, the "Price:" text will disappear.

http://www.ry-express.com

I apologize if this is a duplicated question.

Thank you!

Re: Add text before Price in opencart

Posted: Fri Jan 20, 2017 4:06 pm
by knowband.plugins
It happens because Journal2 theme refresh price section html whenever customer choose product option.

To be able to add your text before price even after product option change, you need to modify following file.

catalog/view/theme/journal2/js/journal.js

Search for

Code: Select all

$('.product-info .price .price-old, .product-info .price .product-price').html(json.price);
and replace it with

Code: Select all

$('.product-info .price .price-old, .product-info .price .product-price').html('Price:'+json.price);
Let us know if it doesn't work.

Re: Add text before Price in opencart

Posted: Sat Feb 05, 2022 5:01 am
by iplocker
Hello.
Can you please update this reply ? I need that info but it seems its outdated now .
Thanks

Re: Add text before Price in opencart

Posted: Sat Feb 05, 2022 5:08 am
by by mona
support.journal-theme. com

Re: Add text before Price in opencart

Posted: Sat Feb 05, 2022 6:11 am
by iplocker
Find it
File : catalog\view\theme\journal3\js\journal.js
Before: $('.product-price-group .product-price').html(['response']['price']);
After: $('.product-price-group .product-price').html('Price inclunding TAX : '+json['response']['price']);
Thanks

Re: Add text before Price in opencart

Posted: Sun Sep 08, 2024 1:21 pm
by arnocn
For me: (journal 3)
The only file i modified:
/catalog/view/theme/journal3/template/product.twig
from line 274:
code before:

Code: Select all

                 <div class="product-price">{{ price }}</div>
               {% else %}
                 <div class="product-price-new">{{ special }}</div>
                 <div class="product-price-old">{{ price }}</div>
code after:

Code: Select all

                 <div class="custom-price">Your custom text:<br></div><div class="product-price">{{ price }}</div>
               {% else %}
                 <div class="product-price-new">{{ special }}</div>
                 <div class="custom-price">Your custom text:<br></div><div class="product-price-old">{{ price }}</div>
and it's working good.