Skip to main content

Custom field display in category view

More
12 years 4 months ago #154643 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
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.

More
12 years 4 months ago #154701 by drock
Also tried
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.

More
12 years 4 months ago #154650 by Mohamed Thelji
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.

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

More
12 years 4 months ago #154820 by drock
Hi,

I have attached the screenshots.

Thanks

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

More
12 years 4 months ago #154830 by Xavier
Hi,

So you just have to edit the view "product / listing_img_title" and add code like:
Code:
echo $this->row->putity;
between PHP tags at the desired place.
The following user(s) said Thank You: drock

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

More
12 years 4 months ago #154963 by drock
It worked, Thanks :)

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

Time to create page: 0.188 seconds
Powered by Kunena Forum