Post by heeljoseph » Fri Jan 20, 2017 1:14 am

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!

Newbie

Posts

Joined
Thu Jan 19, 2017 11:17 pm

Post by knowband.plugins » Fri Jan 20, 2017 4:06 pm

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.

Regards,
Knowband Team

Opencart Plugins: Knowband Store
Email: support@knowband.com


User avatar
Active Member

Posts

Joined
Thu Aug 04, 2016 2:56 pm


Post by iplocker » Sat Feb 05, 2022 5:01 am

Hello.
Can you please update this reply ? I need that info but it seems its outdated now .
Thanks

Active Member

Posts

Joined
Sun May 26, 2013 6:39 pm


Post by by mona » Sat Feb 05, 2022 5:08 am

support.journal-theme. com

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by iplocker » Sat Feb 05, 2022 6:11 am

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

Active Member

Posts

Joined
Sun May 26, 2013 6:39 pm


Post by arnocn » Sun Sep 08, 2024 1:21 pm

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.

Newbie

Posts

Joined
Sat Jul 08, 2017 4:40 pm
Who is online

Users browsing this forum: No registered users and 7 guests