Custom Fields

  • Posts: 12
  • Thank you received: 0
11 years 5 months ago #106333

Custom fields are not visible in any listing, not in list, not in table and not in div.

piekiec.eu/en/ipc-j-std-001es-space/product/listing.html

How can I add them?

Thanks

Last edit: 11 years 5 months ago by Wings.

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

  • Posts: 2334
  • Thank you received: 403
11 years 5 months ago #106343

Hi there,

Product listing don't display custom field by default.
If you want to do so, you'll have to add some code to one of this view (Display>View). For example in product/listing_div, you can load the customs fields with:

$itemFields = $this->fieldsClass->getFields('frontcomp',$this->row,'product','checkout&task=state');

and then display it with:
foreach($itemFields as $fieldName => $oneExtraField) {
	if(!isset($this->row->$fieldName)) continue;
	echo $this->fieldsClass->show($oneExtraField,trim($this->row->$fieldName));
}

The following user(s) said Thank You: Wings

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

  • Posts: 12
  • Thank you received: 0
11 years 5 months ago #106837

Ok, Thanks! Now I get the fields back, not the label... piekiec.eu/en/ipc-j-std-001es/product/listing.html

Can you point me to an example so I can get the custom fields block like here? piekiec.eu/en/hikashop/product/171-10-06...erlands-english.html

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

  • Posts: 2334
  • Thank you received: 403
11 years 5 months ago #106848

The way custom fields are generated depends of the view show_block_custom_main of product (in Display>Views).
Just replace the foreach() I gave you by something similar to this view and it should display fine.
If you make a copy/paste, don't forget to replace $this->fields by $itemFields in the foreach

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

Time to create page: 0.070 seconds
Powered by Kunena Forum