How to add custom information to the products?

  • Posts: 175
  • Thank you received: 0
11 years 9 months ago #125315

Hello..
i would like to ask, how do you add additional information to products?

for example, for items in hard disk category, i would like to add another field in the product information containing it's capacity, it's size, etc..

or for items in mobile devices category, i would like to add a field containing it's RAM, it's screen size, it's storage size. etc..

that later on could be used as a parameter in filter field..
[example: display mobile devices that have 1GB of RAM ]

also these additional information must be displayed when comparing the product to other product

i've tried using custom field but i got confused..

i tried to add custom field under products table but it displayed at bottom of the product form [which i hope can be moved into main information of the products] also it didn't displayed in the product's information page

thanks...

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

  • Posts: 84079
  • Thank you received: 13635
  • MODERATOR
11 years 9 months ago #125365

Hi,

You can indeed do that by creating custom fields of the table "product".
You will only see them on the product information page if the "frontend" option of the field is turned on.
If you want to move the display of the fields somewhere else on the product page, you will have to edit the file "form" of the view "product" via the menu Display>Views and move where you need the code

if(!empty($this->fields)){?>
						<table class="admintable table" width="100%">
						<?php foreach($this->fields as $fieldName => $oneExtraField){
							if(!$oneExtraField->field_backend){
								if($oneExtraField->field_type != "customtext"){?>
							<tr><td><input type="hidden" name="data[product][<?php echo $fieldName; ?>]" value="<?php echo $this->element->$fieldName; ?>" /></td></tr>
							<?php }
							}else{ ?>
							<tr id="hikashop_product_<?php echo $fieldName; ?>">
								<td class="key">
									<?php echo $this->fieldsClass->getFieldName($oneExtraField);?>
								</td>
								<td>
									<?php
										if(!isset($this->element->$fieldName))
											$this->element->$fieldName = $oneExtraField->field_default;
									?>
									<?php $onWhat='onchange'; if($oneExtraField->field_type=='radio') $onWhat='onclick'; ?>
									<?php echo $this->fieldsClass->display($oneExtraField,$this->element->$fieldName,'data[product]['.$fieldName.']',false,' '.$onWhat.'="hikashopToggleFields(this.value,\''.$fieldName.'\',\'product\',0);"'); ?>
								</td>
							</tr>
							<?php }
						} ?>
						</table>
					<?php }

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

Time to create page: 0.034 seconds
Powered by Kunena Forum