Author Topic: hide price tag if product price is zero?  (Read 5061 times)

Offline cookie

  • Jr. Member
  • **
  • Posts: 65
  • Karma: +10/-0
    • View Profile
hide price tag if product price is zero?
« on: January 06, 2014, 12:23:17 PM »
Hi,

I have an other question...

I am setting up a product where the price is given based on options and combinations only, so the initial product price is actually zero...

How can I hide that price tag that appears near the image on the top part of the product layout if the price is zero?

Even better would be to have the final price show there, the way it us bui,t with one price on the top one at bottom is confusing for the users who may not know anymore which is what...

Thank you!
« Last Edit: January 08, 2014, 06:16:09 AM by cookie »

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4078
  • Karma: +243/-9
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: hide price tag if product price is zero?
« Reply #1 on: January 07, 2014, 11:11:48 AM »
Look at the template file: storefront/view/default_html5/template/pages/product/product_listing.tpl
Assuming you use HTML5 template

here:
Code: [Select]
<?php if ($display_price) { ?>
<div class="pricetag">

You can add to if condition for check the price of 0
We need your help to build better free open source eCommerce platform for everyone.
See how you can help

Offline cookie

  • Jr. Member
  • **
  • Posts: 65
  • Karma: +10/-0
    • View Profile
Re: hide price tag if product price is zero?
« Reply #2 on: January 07, 2014, 07:41:19 PM »
Thanks a lot for the tip !
I tried, but I don't really know how to actually use the conditional ...

I tried this:

<?php if ($display_price == "0,00EUR") { ?> ...
but than the price vanishes for all products, not only those with a zero price tag ...

Can you help?
THx

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4078
  • Karma: +243/-9
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: hide price tag if product price is zero?
« Reply #3 on: January 07, 2014, 11:20:47 PM »
Code: [Select]
<?php if ($display_price || $product['price'] == 0) { ?>
We need your help to build better free open source eCommerce platform for everyone.
See how you can help

Offline cookie

  • Jr. Member
  • **
  • Posts: 65
  • Karma: +10/-0
    • View Profile
Re: hide price tag if product price is zero?
« Reply #4 on: January 08, 2014, 06:15:42 AM »
Thank you!

Actually after playing around a bit got it working with smth. like:

<?php if ($price == 0) {
echo "olala";
} else {
 echo $price;
 } ?>

Offline maniz

  • Newbie
  • *
  • Posts: 15
  • Karma: +4/-0
    • View Profile
Re: hide price tag if product price is zero?
« Reply #5 on: January 08, 2014, 08:35:35 PM »
Thank you!

Actually after playing around a bit got it working with smth. like:

<?php if ($price == 0) {
echo "olala";
} else {
 echo $price;
 } ?>
Very interest i like to use in my shop to

Can we have more details
« Last Edit: January 08, 2014, 08:37:07 PM by maniz »

Offline eCommerce Core

  • Administrator
  • Hero Member
  • *****
  • Posts: 1596
  • Karma: +92/-1
    • View Profile
Re: hide price tag if product price is zero?
« Reply #6 on: January 09, 2014, 11:25:31 AM »
Thank you!

Actually after playing around a bit got it working with smth. like:

<?php if ($price == 0) {
echo "olala";
} else {
 echo $price;
 } ?>

It can be $price variable or $product['price'] array. All depends on the template you look at. You need to read code above in the template you edit.
“If you’re in the luckiest one per cent of humanity, you owe it to the rest of humanity to think about the other 99 per cent.”
― Warren Buffett

Offline cookie

  • Jr. Member
  • **
  • Posts: 65
  • Karma: +10/-0
    • View Profile
Re: hide price tag if product price is zero?
« Reply #7 on: January 10, 2014, 07:13:55 AM »
I've used the above code in the product.tpl file.

Offline henrypinks

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: hide price tag if product price is zero?
« Reply #8 on: November 19, 2014, 11:20:47 PM »
 :'(Not working for me, I just add the code you provide to hide price if zero, price is still there any idea?

yonghan

  • Guest
Re: hide price tag if product price is zero?
« Reply #9 on: November 19, 2014, 11:43:36 PM »
Hello,welcome aboard.Have you cleared the cache?

http://docs.abantecart.com/pages/tips/cache.html
« Last Edit: November 01, 2016, 08:21:57 AM by Basara »

Offline shawnlg777

  • Newbie
  • *
  • Posts: 20
  • Karma: +3/-0
    • View Profile
    • Lite House Media
Re: hide price tag if product price is zero?
« Reply #10 on: October 10, 2018, 05:40:09 PM »
For the Product page in the Default Template for 1.2.13 in the

storefront/view/default/template/pages/product/product.tpl

FIND
<div class="productfilneprice">
<?php echo $price . $tax_message; ?>
</div>
                        
REPLACE WITH

<div class="productfilneprice">
<?php if ($displayprice == 0) {
echo "Call for Price";
} else {
 echo $price . $tax_message;
 } ?>
</div>

AND
For the Product listing page in the Default Template for 1.2.13
product_listing.tpl

FIND

<div class="oneprice"><?php echo $product['price'] . $tax_message; ?></div>

REPLACE WITH

<div class="oneprice">
<?php if ($displayprice == 0) {
echo "Call for Price";
} else {
 echo $price . $tax_message;
 } ?>
</div>

Featured and latest is done essentially the same way just change it from a div class to a span class. For the featured and lates on the home page change the product_list all in the block section
« Last Edit: October 10, 2018, 07:33:47 PM by shawnlg777 »

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 3825
  • Karma: +185/-0
    • View Profile
Re: hide price tag if product price is zero?
« Reply #11 on: October 11, 2018, 01:30:05 AM »
thank you, shawnlg777
“Chuck Norris is so amazing.”
― Mother Teresa

Offline shawnlg777

  • Newbie
  • *
  • Posts: 20
  • Karma: +3/-0
    • View Profile
    • Lite House Media
Re: hide price tag if product price is zero?
« Reply #12 on: October 30, 2018, 01:36:55 AM »
Glad I could help. Its nice when I can give back a little. Many of you have been great when I needed help!

Shawn Larson