Displaying custom field on product page

  • Posts: 6
  • Thank you received: 1
10 years 1 month ago #147658

-- 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?

Attachments:

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

  • Posts: 12953
  • Thank you received: 1778
10 years 1 month ago #147662

Hi,
I think that you'll probably find your answer through that thread :).

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

  • Posts: 6
  • Thank you received: 1
10 years 1 month ago #147729

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

else{
echo '<span class="hikashop_product_price_per_unit">'.JText::_('PER_UNIT').'</span>';
}

and replace it with
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.

  • Posts: 12953
  • Thank you received: 1778
10 years 1 month ago #147773

Thanks for your feedback :).

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

Time to create page: 0.071 seconds
Powered by Kunena Forum