Post by tantrinh » Fri Jan 18, 2019 12:40 pm

Hi guys
Im from Vietnam . Im newby in opencart and coding .
I ve been finding how to change price value to text value when price equal = 0 but found nothing or wrong instructions or commercial copyright modules
After thinking and trying , I find a solution that is very easy and simple to do .
I show you guys how to do that
- List all the extensions and common modules you use on your page .

In my site , I use Feature.twig , latest.twig , special.twig , category.twig , recent _ product.twig and product.twig

- Go and edit every file and find the value {{ product.price }} and replace with the code below

Code: Select all

            {% if product.price == 0%}
               put the text you need to show here for example I put "Xin Lien He" in Vietnamese , it means "Contact us" in English
            {% else %}
               {{ product.price }}
            {% endif %}
- Particulary it's different in the product.twig , you have to find the value <h2>{{ price }}</h2> and replace with this code

Code: Select all

             {% if price == 0 %}  
                <h2>put the text you need to show here for example I put "Xin Lien He" in Vietnamese , it means "Contact us" in English</h2>
              {% else %}
                <h2>{{ price }}</h2>
              {% endif %}
After that , Plz refresh modication in Extension and clear Cache in Dashboard

I m new and I have no chance to use previous Opencart version like 1.xxx 2.xxx but I think it s the same rule but instead the .twig files , you try to edit .tpl files
Hope this will help you guys .
Sorry for my very very bad English coz Im too old to learn English .
Image

Newbie

Posts

Joined
Fri Nov 02, 2018 9:26 pm

User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România
Who is online

Users browsing this forum: jainyvardhman and 19 guests