Use custom fields in separate columns in cart

  • Posts: 202
  • Thank you received: 2
11 years 5 months ago #103265

I am using custom fields to pass information to the cart from an add-to-cart URL. The fields are an ID and a Description, using custom fields of the type "Item".

By default, the custom fields are displayed below the product name, like this image:



I would like to change the Cart layout so that each custom field has its own column, like this:


Because of the unique nature of how I am using the shop, these two fields will always exist and they will be the only fields needed in the cart. Is this possible?

Attachments:

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

  • Posts: 26151
  • Thank you received: 4027
  • MODERATOR
11 years 5 months ago #103281

Hi,

You have to edit the view "product | show_block_custom_item" (for item custom fields) or "product | show_block_custom_main" (for product custom fields).

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: 202
  • Thank you received: 2
11 years 5 months ago #103296

The views you pointed me to do not seem to contain the code I am looking for. It is in the cart during the checkout process, and those files do not seem to be what I need. I can affect changes to the screen by editing the "Cart" file in "Checkout" view. In that code I can see where it is pulling the custom fields. I just don't know how to change the file to meet my needs.

Thanks for the help so far, though!!!

Last edit: 11 years 5 months ago by momentis.

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

  • Posts: 26151
  • Thank you received: 4027
  • MODERATOR
11 years 5 months ago #103319

Hi,

The "checkout | cart" view does not display the product custom fields but you can add the code to display them.
The "item custom fields" are loaded and displayed in the view using this code:

foreach($this->extraFields['item'] as $field){
	$namekey = $field->field_namekey;
	if(empty($row->$namekey)) continue;
	echo '<p class="hikashop_cart_item_'.$namekey.'">'.$this->fieldsClass->getFieldName($field).': '.$this->fieldsClass->show($field,$row->$namekey).'</p>';
}

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.

Time to create page: 0.072 seconds
Powered by Kunena Forum