add 'from' before cheapest price display

  • Posts: 51
  • Thank you received: 0
10 years 1 day ago #214124

-- HikaShop version -- : 2.3.5
-- Joomla version -- : 3.2.4
-- PHP version -- : 5.3.3
-- Browser(s) name and version -- : firefox 40.0.3

I have products without variants and products with variants.
I am currently displaying the price as 'cheapest price' but I would like to display the word 'From' before the price but only for the products with variants.
I managed to override the PRICE_BEGINNING constant in the language file but this shows for all products.
Could you help me with the piece of code I need to add to listing_price.php so I can get it to show only for products with variants?

Thanks

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

  • Posts: 12953
  • Thank you received: 1778
10 years 1 day ago #214128

Hello,
In your case the solution will be to directly edit the "listing_price" file of the "product" view of your front-end template via "Hikashop->Display->Views", You'll have to check that your product have variants and then display the "From" text but some development skills will be required.
You'll find more information about your product through the "$this->row" PHP variable.

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

  • Posts: 51
  • Thank you received: 0
9 years 11 months ago #214609

I'm finding this really tricky as there doesn't seem to be any indication in the product row (in the database) to tell me that the product has variants.

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

  • Posts: 12953
  • Thank you received: 1778
9 years 11 months ago #214630

Hello,
The "$this->row->has_options" will tell you if your product have a variant/option/item custom field.
So in your case a solution can be to edit the "listing_price" file of the "Product" view of your front-end template via "Hikashop->Display->Views", and change the line :

echo JText::_('PRICE_BEGINNING');
By :
if(isset($this->row->has_options))
	echo 'From ';
echo JText::_('PRICE_BEGINNING');

Last edit: 9 years 11 months ago by Mohamed Thelji.

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

Time to create page: 0.065 seconds
Powered by Kunena Forum