How to use Custom Field in Product Listing page

  • Posts: 34
  • Thank you received: 1
11 years 6 months ago #131703

Hi, i setup "table view" for product listing page.
I have some custom fields and it's showing on product detail page,
But i need those custom field to show on products listing page,

Here is the code i tried to add within a <td></td>

<?php}
if(!empty($this->fields)){?>
<?php
$this->fieldsClass->prefix = '';
foreach($this->fields as $fieldName => $oneExtraField) {
if(!empty($this->element->$fieldName)){ ?>
<p class="hikashop_category_custom_<?php echo $oneExtraField->field_namekey;?>_line">
<span id="hikashop_category_custom_name_<?php echo $oneExtraField->field_id;?>" class="hikashop_category_custom_name">
<?php echo $this->fieldsClass->getFieldName($oneExtraField);?>
</span>
<span id="hikashop_category_custom_value_<?php echo $oneExtraField->field_id;?>" class="hikashop_category_custom_value">
<?php echo $this->fieldsClass->show($oneExtraField,$this->element->$fieldName); ?>
</span>
</p>
<?php }
}?>
(There i removed div and other table from original code)
It's not showing any data and breaking the default table style. i also tried to add by overwriting an existing field like price

Please help.

Last edit: 11 years 6 months ago by sifur.

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

  • Posts: 83779
  • Thank you received: 13567
  • MODERATOR
11 years 6 months ago #131706

Hi,

What kind of custom fields are you trying to display there ? Could you do a screenshot of the options of the custom field as the code will change based on that ?

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

  • Posts: 34
  • Thank you received: 1
11 years 6 months ago #131707

Here is the product details screenshot :



Here is the product listing screenshot and marked where i want to show those custom field,



I want to custom fields with one paragraph like :

"Compatible Browsers: IE8, IE9, IE10, Firefox, Safari, Opera, Chrome. Software Version: Joomla 3.1.x, Joomla 2.5.x. Documentation: Well Documented"

Attachments:

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

  • Posts: 83779
  • Thank you received: 13567
  • MODERATOR
11 years 6 months ago #131709

Hi,

Here is a thread which explains how to do that :
www.hikashop.com/forum/4-how-to/48273-solved-costum-fields.html

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

  • Posts: 34
  • Thank you received: 1
11 years 6 months ago #131715

Thanks, got more than i expected!

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

  • Posts: 34
  • Thank you received: 1
11 years 6 months ago #131719

But one think i still don't understand or not sure how to apply-

There 5 fields may be, and i will add all field code with a "Title"
and now if i fill 3 fields from 5, so other 2 fields title will display without the value.

I understand this, <?php if ($this->config->get('show_code')){ ?>
but how it will for custom fields, such as my custom field in the database table : 'compatiblebrowsers'

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

  • Posts: 34
  • Thank you received: 1
11 years 6 months ago #131724

I made this
<?php if(!empty($this->row->compatiblebrowsers))

and it's working good so

The following user(s) said Thank You: nicolas

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

Time to create page: 0.074 seconds
Powered by Kunena Forum