Skip to main content

Displaying custom field on product page

More
12 years 6 months ago #147658 by apeelapan
-- HikaShop version -- : Essential 2.2.3
-- Joomla version -- : 3.2.1
-- PHP Version 5.3.27

I have recreated 2 custom fields (column name: country_of_origin & unit_of_measurement) showing additional information of products. Hikashop displays them in a table under the "add to cart" button on the product detail page.

I would like to move the content of the unit_of_measurement to replace the word "each" that is located after the price. How can I do that?

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

More
12 years 6 months ago #147662 by Mohamed Thelji
Hi,
I think that you'll probably find your answer through that thread :).

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

More
12 years 6 months ago #147729 by apeelapan
Hi,

The thread is useful, thank you. The way I solve my problem is that:

Create a "Custom field" in Hikashop > Display > Custom fields with the table "Product" with the column name "unit_of_measurement";

The unit_of_measurement custom field can now be edited in the product configuration page of each product.

Then in Hikashop > Display > Views, edit the view: "product / listing_price.php" in the good template.
Find the below code at about line 162
Code:
else{ echo '<span class="hikashop_product_price_per_unit">'.JText::_('PER_UNIT').'</span>'; }

and replace it with
Code:
else if($this->element->unit_of_measurement==null){ echo '<span class="hikashop_product_price_per_unit">'.JText::_('PER_UNIT').'</span>'; } else{ echo '<span class="hikashop_product_price_per_unit">'.$this->element->unit_of_measurement.'</span>'; }
The following user(s) said Thank You: Mohamed Thelji

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

More
12 years 6 months ago #147773 by Mohamed Thelji
Thanks for your feedback :).

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

Time to create page: 0.167 seconds
Powered by Kunena Forum