- Posts: 32
- Thank you received: 0
Custom field display in category view
12 years 4 months ago #154643
by drock
Custom field display in category view was created by drock
-- HikaShop version -- : Essential 2.3.0
-- Joomla version -- : 3.3
Hi,
Is there a way I can display custom field into category view. I have pasted this code from views/product/tmpl/show.php to listing_image_title.php
Leads me to error:
Please help.
Thanks
-- Joomla version -- : 3.3
Hi,
Is there a way I can display custom field into category view. I have pasted this code from views/product/tmpl/show.php to listing_image_title.php
Code:
<table width="100%">
<?php
$this->fieldsClass->prefix = '';
foreach ($this->fields as $fieldName => $oneExtraField) {
if(empty($variant->$fieldName) && !empty($this->element->main->$fieldName)){
$variant->$fieldName = $this->element->main->$fieldName;
}
if(!empty($variant->$fieldName)) $variant->$fieldName = trim($variant->$fieldName);
if (!empty ($variant->$fieldName)) {
?>
<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;?>_<?php echo $variant_name;?>" 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;?>_<?php echo $variant_name;?>" class="hikashop_product_custom_value">
<?php echo $this->fieldsClass->show($oneExtraField,$variant->$fieldName); ?>
</span>
</td>
</tr>
<?php
}
}
?>
</table>
Leads me to error:
Code:
Notice: Undefined property: ProductViewProduct::$fields in C:\xampp\htdocs\...\components\com_hikashop\views\product\tmpl\listing_img_title.php on line 90Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\...\components\com_hikashop\views\product\tmpl\listing_img_title.php on line 90
Please help.
Thanks
Please Log in or Create an account to join the conversation.
12 years 4 months ago #154701
by drock
Replied by drock on topic Custom field display in category view
Also tried
in listing_img_title.php
Leads to error:
Code:
<span class='hikashop_product_pure_list'>
<?php if ($this->config->get('show_code')) { ?>
<?php if($this->params->get('link_to_product_page',1)){ ?>
<a href="<?php echo $link;?>">
<?php }
echo $this->get($oneExtraField,$value);
if($this->params->get('link_to_product_page',1)){ ?>
</a>
<?php } ?>
<?php } ?>
</span>
in listing_img_title.php
Leads to error:
Code:
Notice: Undefined variable: oneExtraField in C:\xampp\htdocs\...\components\com_hikashop\views\product\tmpl\listing_img_title.php on line 90 Notice: Undefined variable: value in C:\xampp\htdocs\...\components\com_hikashop\views\product\tmpl\listing_img_title.php on line 90
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 12953
- Thank you received: 1778
12 years 4 months ago #154650
by Mohamed Thelji
Replied by Mohamed Thelji on topic Custom field display in category view
Hello,
Can you show me how did you configured the custom field that you want to display and where you exactly want to display it through some screenshots ?
Thanks.
Can you show me how did you configured the custom field that you want to display and where you exactly want to display it through some screenshots ?
Thanks.
Please Log in or Create an account to join the conversation.
12 years 4 months ago #154820
by drock
Replied by drock on topic Custom field display in category view
Hi,
I have attached the screenshots.
Thanks
I have attached the screenshots.
Thanks
Please Log in or Create an account to join the conversation.
12 years 4 months ago #154830
by Xavier
Replied by Xavier on topic Custom field display in category view
Hi,
So you just have to edit the view "product / listing_img_title" and add code like:
between PHP tags at the desired place.
So you just have to edit the view "product / listing_img_title" and add code like:
Code:
echo $this->row->putity;
The following user(s) said Thank You: drock
Please Log in or Create an account to join the conversation.
12 years 4 months ago #154963
by drock
Replied by drock on topic Custom field display in category view
It worked, Thanks
Please Log in or Create an account to join the conversation.
Time to create page: 0.188 seconds