- Posts: 178
- Thank you received: 5
Display custom fields from table "Product"
13 years 4 months ago - 13 years 4 months ago #102425
by alikon1
Display custom fields from table "Product" was created by alikon1
Last edit: 13 years 4 months ago by alikon1.
Please Log in or Create an account to join the conversation.
13 years 4 months ago #102442
by alikon1
Replied by alikon1 on topic Display custom fields from table "Product"
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.
13 years 4 months ago #102444
by alikon1
Replied by alikon1 on topic Display custom fields from table "Product"
And
not correct too
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>
Please Log in or Create an account to join the conversation.
13 years 4 months ago #102450
by alikon1
Replied by alikon1 on topic Display custom fields from table "Product"
Please Log in or Create an account to join the conversation.
13 years 4 months ago #102520
by Jerome
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.
Replied by Jerome on topic Display custom fields from table "Product"
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 !
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.
13 years 4 months ago #102790
by alikon1
Replied by alikon1 on topic Display custom fields from table "Product"
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