AbanteCart Community

Shopping Cart Operations => Support => Topic started by: cookie on January 06, 2014, 12:23:17 PM

Title: hide price tag if product price is zero?
Post by: cookie 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!
Title: Re: hide price tag if product price is zero?
Post by: abantecart 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
Title: Re: hide price tag if product price is zero?
Post by: cookie 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
Title: Re: hide price tag if product price is zero?
Post by: abantecart on January 07, 2014, 11:20:47 PM
Code: [Select]
<?php if ($display_price || $product['price'] == 0) { ?>
Title: Re: hide price tag if product price is zero?
Post by: cookie 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;
 } ?>
Title: Re: hide price tag if product price is zero?
Post by: maniz 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
Title: Re: hide price tag if product price is zero?
Post by: eCommerce Core 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.
Title: Re: hide price tag if product price is zero?
Post by: cookie on January 10, 2014, 07:13:55 AM
I've used the above code in the product.tpl file.
Title: Re: hide price tag if product price is zero?
Post by: henrypinks 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?
Title: Re: hide price tag if product price is zero?
Post by: yonghan on November 19, 2014, 11:43:36 PM
Hello,welcome aboard.Have you cleared the cache?

http://docs.abantecart.com/pages/tips/cache.html
Title: Re: hide price tag if product price is zero?
Post by: shawnlg777 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
Title: Re: hide price tag if product price is zero?
Post by: Basara on October 11, 2018, 01:30:05 AM
thank you, shawnlg777
Title: Re: hide price tag if product price is zero?
Post by: shawnlg777 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
Title: Re: hide price tag if product price is zero?
Post by: SonshineTN on October 09, 2023, 11:49:42 AM
I am trying to do this with bootstrap template but I can't seem to get it to work. Any ideas?