Custom Fields
13 years 5 months ago - 13 years 5 months ago #106333
by Wings
Custom Fields was created by Wings
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
piekiec.eu/en/ipc-j-std-001es-space/product/listing.html
How can I add them?
Thanks
Last edit: 13 years 5 months ago by Wings.
Please Log in or Create an account to join the conversation.
13 years 5 months ago #106343
by Eliot
Replied by Eliot on topic Custom Fields
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:
and then display it with:
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:
Code:
$itemFields = $this->fieldsClass->getFields('frontcomp',$this->row,'product','checkout&task=state');
and then display it with:
Code:
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.
13 years 5 months ago #106837
by Wings
Replied by Wings on topic Custom Fields
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
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.
13 years 5 months ago #106848
by Eliot
Replied by Eliot on topic Custom Fields
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
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.074 seconds