Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Hide price in one category

Hide price in one category

Views: 5,889

Results 21 to 29 of 29
14 Jul 2016, 7:07 PM
#21
congerman avatar

congerman

Zen Follower

Join Date:
Oct 2008
Posts:
392
Plugin Contributions:
0

Hide price in one category

Brilliant, thank you so much

created c_3.css and in it
.product-price span.sale-price {
display:none;
}

seemed to work like a charm

Thank you, thank you

15 Jul 2016, 5:32 PM
#22
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Hide price in one category

Congerman:

Brilliant, thank you so much

created c_3.css and in it
.product-price span.sale-price {
display:none;
}

seemed to work like a charm

Thank you, thank you
As long as the product is configured to disallow being added to cart, this CSS fix may be sufficient.
You might want to test to be sure that EVERY time that product is ever displayed that the URL contains a &cPath= value that ends in _3 else that CSS won't fire.

15 Jul 2016, 5:40 PM
#23
congerman avatar

congerman

Zen Follower

Join Date:
Oct 2008
Posts:
392
Plugin Contributions:
0

Re: Hide price in one category

DrByte:

As long as the product is configured to disallow being added to cart, this CSS fix may be sufficient.
You might want to test to be sure that EVERY time that product is ever displayed that the URL contains a &cPath= value that ends in _3 else that CSS won't fire.

Thanks, They are only in there with a quantity of "0" so a sold button shows instead of add to cart

Would be great to get your code to work on my template as that should sort out the source code problem still showing the price.

Can yours be adapted to show an image instead of price on listing and info pages in specified category?

15 Jul 2016, 5:51 PM
#24
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Hide price in one category

I haven't tested it, but you could try replacing this:

return '';

with returning the HTML for the image.

return zen_image(whatever relevant parameters here);

or

return '<img src="/your/server/images/folder/and/filename.jpg">';
15 Jul 2016, 5:59 PM
#25
congerman avatar

congerman

Zen Follower

Join Date:
Oct 2008
Posts:
392
Plugin Contributions:
0

Re: Hide price in one category

ok so functions prices

$product_check = $db->Execute("select master_categories_id, products_tax_class_id, products_price, products_priced_by_attribute, product_is_free, product_is_call, products_type from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'" . " limit 1");

if ($product_check->fields['master_categories_id'] == 10) { // change '10' here to the category number
return '<img src="/your/server/images/folder/and/filename.jpg">';
}

15 Jul 2016, 6:36 PM
#26
congerman avatar

congerman

Zen Follower

Join Date:
Oct 2008
Posts:
392
Plugin Contributions:
0

Re: Hide price in one category

dam did not work

if ($product_check->fields['master_categories_id'] == 3) { // change '10' here to the category number
return '<img src="http://www.artofrecycling.co.uk/images/8x8trans.gif" />';
}

15 Jul 2016, 7:04 PM
#27
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Hide price in one category

When you say did not work. Please elaborate. Errors in logs directory? If you view the source code for the page is there a broken image or path? Etc...

15 Jul 2016, 7:07 PM
#28
congerman avatar

congerman

Zen Follower

Join Date:
Oct 2008
Posts:
392
Plugin Contributions:
0

Re: Hide price in one category

still just shows £0.00 in price field instead of the gif I directed it to in the return command

I know it can be done with the css file but if I can get this function to work it should care the source code problem still showing the price

15 Jul 2016, 7:21 PM
#29
congerman avatar

congerman

Zen Follower

Join Date:
Oct 2008
Posts:
392
Plugin Contributions:
0

Re: Hide price in one category

source code says

<a class="product-name" href="http://artofrecycling.co.uk/shop/index.php?main_page=product_info&products_id=7">Library Armchairs.</a>

<div class="product-price" itemprop="offers" itemscope itemtype="http://schema.org/Offer"> <span class="sale-price" itemprop="price">£0.00</span> </div>