Custom field display in category view

  • Posts: 32
  • Thank you received: 0
11 years 1 day ago #154643

-- 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

<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:
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.

  • Posts: 32
  • Thank you received: 0
11 years 23 hours ago #154701

Also tried

<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:
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.

  • Posts: 12953
  • Thank you received: 1778
11 years 15 hours ago #154650

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.

  • Posts: 32
  • Thank you received: 0
11 years 4 hours ago #154820

Hi,

I have attached the screenshots.

Thanks

Attachments:

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

  • Posts: 13201
  • Thank you received: 2322
10 years 11 months ago #154830

Hi,

So you just have to edit the view "product / listing_img_title" and add code like:

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.

  • Posts: 32
  • Thank you received: 0
10 years 11 months ago #154963

It worked, Thanks :)

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

Time to create page: 0.096 seconds
Powered by Kunena Forum