Display 'add to cart' button for free products

  • Posts: 82
  • Thank you received: 8
9 years 9 months ago #224126

-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.4.5

Hi I have Display 'add to cart' button for free products = No in the Config file however products with a price of 0.00 are still showing the add to cart button.

Is this a bug or is there some other setting I am missing?
I am trying to achieve:
If a price is set to 0.00
1. hide the price and
2. hide the add to cart button.

If I could get the "Display 'add to cart' button for free products = No" function working I can figure out how to hide the price then.

I can confirm I have no template overrides setup in my template html dir.
Thanks for any help

Please Log in or Create an account to join the conversation.

  • Posts: 82
  • Thank you received: 8
9 years 9 months ago #224169

I have used the following to hide my price value = 0.00
Got the element property from
www.hikashop.com/support/documentation/157
price_value

Made a template override for
templates/mytemplate/html/com_hikashop/product/listing_price.php

Then after line 46

<?php
	if(empty($this->row->prices)){
		echo JText::_('FREE_PRICE');
	}
Add the following
if (($this->row->prices->price_value == 0.00 )){
			
		echo JText::_('FREE_PRICE');}
I then changed the language value to "Call for Price" in the joomla Language override.

Can any of the devs shed any light as to why Hikashop is ignoring the "Display 'add to cart' button for free products = No" Setting
Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 84306
  • Thank you received: 13701
  • MODERATOR
9 years 9 months ago #224182

Hi,

It looks like there is a price for your product but with a value of 0, instead of no price.
Try deleting the price and then saving the product.

Normally, you should not have any price in $this->row->prices and thus the check should work.

Please Log in or Create an account to join the conversation.

  • Posts: 82
  • Thank you received: 8
9 years 9 months ago #224201

Ok I see that now and I can confirm the Add to Cart function no longer displays.
However as i am importing hundreds or products for future reference is there a mass action that can set the price_value field to blank.
It seems price_value requires a decimal hence all the prices on import are set to 0.0000

e.g I tried Mass Action > Update the Values > price_value = Null

I found the only way to mass remove prices from free products was to execute a dump of the table
DELETE FROM `jos_database`.`jos_hikashop_price` WHERE `jos_hikashop_price`.`price_value` = 0.0000;

Thanks for the support!

Last edit: 9 years 9 months ago by huwhuw.

Please Log in or Create an account to join the conversation.

Time to create page: 0.056 seconds
Powered by Kunena Forum