Show custom fields in the front end

  • Posts: 104
  • Thank you received: 0
11 years 8 months ago #91808

I have created some custom fields for a specific category but they don't show correctly in the front end.

I have a product with diferent colors and sizes (characteristics) and some custom fields. Some of them are required and other fields are not required.

When I open this product (for example Size:XL & Color: red) custom fields shows correctly but when I choose another color like blue I see all the custom fields, required or not and some of them are empty because they are a checkbox and the box is empty.

I do not want to see custom fields that are not required and the checkbox is empty.

How can I do?

Thanks.

Last edit: 11 years 8 months ago by dyvymtvar. Reason: Sorry I have had a mistake and this is not the correct forum. Please some moderator move it to the correct. Thanks.

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

  • Posts: 12953
  • Thank you received: 1778
11 years 8 months ago #91999

Hi,

Firstly, can you give us a link to your product page, then we'll maybe be able to figure out what the problem really is ?

Thank you.

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

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 8 months ago #92282

Hi,

Please add the code:
if(!empty($variant->$fieldName)) $variant->$fieldName = trim($variant->$fieldName);

before the line:
if (!empty ($variant->$fieldName)) {

in the file 'show' of the view 'product' for your frontend template via the menu Display->Views and that should fix that problem.

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

  • Posts: 104
  • Thank you received: 0
11 years 8 months ago #92440

Thanks nicolas now it works.

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

Time to create page: 0.071 seconds
Powered by Kunena Forum