Skip to main content

Display custom fields from table "Product"

More
13 years 4 months ago - 13 years 4 months ago #102425 by alikon1
If I use <?php echo $this->row->np; ?>, it shows "Value", not "Title". How to show custom field's Title?
This custom field is used in filter and I need to have the Title displayed in the product description.



Not on Detailed product page. But on Product listing page.
Last edit: 13 years 4 months ago by alikon1.

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

More
13 years 4 months ago #102442 by alikon1
If I copy this block from Detail product page, it doesn't work on Product listing page :(
Code:
<?php if(!empty($this->fields)){ $this->setLayout('show_block_custom_main'); echo $this->loadTemplate(); } ?>

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

More
13 years 4 months ago #102444 by alikon1
And
Code:
<div id="hikashop_product_custom_info_main" class="hikashop_product_custom_info_main"> <h4><?php echo JText::_('SPECIFICATIONS');?></h4> <table width="100%"> <?php $this->fieldsClass->prefix = ''; foreach ($this->fields as $fieldName => $oneExtraField) { $value = ''; if(empty($this->element->$fieldName) && !empty($this->element->main->$fieldName))$this->element->$fieldName = $this->element->main->$fieldName; if(isset($this->element->$fieldName)) $value = trim($this->element->$fieldName); if (!empty ($value)) { ?> <tr class="hikashop_product_custom_<?php echo $oneExtraField->field_namekey;?>_line"> <td class="key"> <span id="hikashop_product_custom_name_<?php echo $oneExtraField->field_id;?>" class="hikashop_product_custom_name"> <?php echo $this->fieldsClass->getFieldName($oneExtraField);?> </span> </td> <td> <span id="hikashop_product_custom_value_<?php echo $oneExtraField->field_id;?>" class="hikashop_product_custom_value"> <?php echo $this->fieldsClass->show($oneExtraField,$value); ?> </span> </td> </tr> <?php } } ?> </table> </div>
not correct too :(

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

More
13 years 4 months ago #102450 by alikon1

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

More
13 years 4 months ago #102520 by Jerome
Hi,

A custom field contains the value, not the title. We don't want to store the title in the database, we want the useful data.
The code that you said is not correct, is correct. This is the right way to display the "title" of a custom field (using the "show" function) but it requires that the custom fields are loaded.

Where are you making your tests ?
Which version of HikaShop are you using ?

Regards,

PS: We answer to all posts in the forum, please do not post "empty" message with big crying smiley image. Thanks !

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

More
13 years 4 months ago #102790 by alikon1
Resolved by using the same values for Value and Title, but instead spacebar use Alt+255. Because with spacebar in Value filter didn't work. Crooked, but it works)

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

Time to create page: 0.182 seconds
Powered by Kunena Forum