Item Custom field radio on product listing

  • Posts: 216
  • Thank you received: 10
  • Hikashop Multisite
9 years 7 months ago #225646

-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.4.8
-- PHP version -- : 5.4
-- Browser(s) name and version -- : firefox

Hi,

I would like to display a custom field Radio selection on the product listing, so customers can select the size of the product (all products have same price)

I have added to the listing_table.php:
<?php echo $this->row->size; ?>
But it only shows the default value.

Can you tell me how to create a radio selection on this page?
Thanks in advance.
Jeroen

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

  • Posts: 26264
  • Thank you received: 4043
  • MODERATOR
9 years 7 months ago #225648

Hi,

www.hikashop.com/support/support/documen...-display.html#layout

You should take a look at the view "show_block_custom_item".
Like it is explained in the mentioned documentation page ; that view display the item custom fields in the product page.

Regards,


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.

  • Posts: 216
  • Thank you received: 10
  • Hikashop Multisite
9 years 7 months ago #225676

--Sorry, now i see this is posted in de wrong category but i can't move it.

Thanks,

When i copy the code to the listing i see:
Notice: Undefined property: ProductViewProduct::$itemFields in C:\xampp\htdocs\dev\templates\yoo_master2\html\com_hikashop\product\listing_table.php on line 169

Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\dev\templates\yoo_master2\html\com_hikashop\product\listing_table.php on line 169

Thanks in advance,
Jeroen

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

  • Posts: 12953
  • Thank you received: 1778
9 years 7 months ago #225693

Hello Jeroen,

Can you tell me which fill of which view did you edit ? And also show how you have edited it so that I can understand why it's displaying a warning ?

Thank you.

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

  • Posts: 216
  • Thank you received: 10
  • Hikashop Multisite
9 years 7 months ago #225754

Hi Mohamed,

I edited the "listing_table" file and add this lines to it:

<div id="hikashop_product_custom_item_info" class="hikashop_product_custom_item_info">
	<table width="100%">
<?php
	foreach ($this->itemFields as $fieldName => $oneExtraField) {
		$itemData = JRequest::getString('item_data_' . $fieldName, $this->element->$fieldName);
?>
		<tr id="hikashop_item_<?php echo $oneExtraField->field_namekey; ?>" class="hikashop_item_<?php echo $oneExtraField->field_namekey;?>_line">
			<td class="key">
				<span id="hikashop_product_custom_item_name_<?php echo $oneExtraField->field_id;?>" class="hikashop_product_custom_item_name"><?php
					echo $this->fieldsClass->getFieldName($oneExtraField);
				?></span>
			</td>
			<td>
				<span id="hikashop_product_custom_item_value_<?php echo $oneExtraField->field_id;?>" class="hikashop_product_custom_item_value"><?php
					$onWhat='onchange';
					if($oneExtraField->field_type=='radio')
						$onWhat='onclick';
					$oneExtraField->product_id = $this->element->product_id;
					echo $this->fieldsClass->display(
						$oneExtraField,
						$itemData,
						'data[item]['.$oneExtraField->field_namekey.']',
						false,
						' '.$onWhat.'="hikashopToggleFields(this.value,\''.$fieldName.'\',\'item\',0);"'
					);
				?></span>
			</td>
		</tr>
<?php
	}
?>
	</table>
</div>

I attached a screenshot below.

Thanks in advance.

Attachments:
Last edit: 9 years 7 months ago by Joomill.

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

  • Posts: 84233
  • Thank you received: 13674
  • MODERATOR
9 years 7 months ago #225820

Hi,

I don't see why you would change any code.
Just create a custom field of the table "item" and set it to display on the frontend and it will display automatically.
If you don't see it on the listing, it just means that you have the "show item fields" setting turned off in the product options tab of the menu item so edit it via the Joomla menu manager and change that.

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

  • Posts: 216
  • Thank you received: 10
  • Hikashop Multisite
9 years 7 months ago #225828

Hi Nicolas,

It sounds like a great solution, but i couldn't get it to work.
All show item fields options are set to yes, and also the frontend display of the field is enabled.

I found out that it works (with the same settings) in Hikashop 2.5.0 which i have downloaded 2015-07-02, but it don't work on any of my 2.6.0 downloads. Can it be a bug?

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

  • Posts: 84233
  • Thank you received: 13674
  • MODERATOR
9 years 7 months ago #225902

Hi,

No, it works fine for everyone else on 2.6.0 so you must be missing something.
It's either a problem with the settings of your field (please provide a screenshot) or the settings of your products listing (please provide a screenshot) or with your Joomla template (try with the default template of Joomla).

The following user(s) said Thank You: Joomill

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

  • Posts: 216
  • Thank you received: 10
  • Hikashop Multisite
9 years 7 months ago #225907

Hi,

I found it in my custom field settings, but there is stillsomething i dont understand.

I use only 1 category, product category (the default one)

In the custom field settings when i set:
- Categories as empty --> The custom field is NOT on the listing / The custom field shows on the detailpage.
- Categories = product category (including sub directories set to NO) --> The custom field shows on the listing / The custom field shows on the detailpage.
- Categories = product category (including sub directories set to YES) --> The custom field is NOT on the listing / The custom field shows on the detailpage.

But for now the problem is solved. THANKS for all your help.

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

Time to create page: 0.118 seconds
Powered by Kunena Forum