Can I add

  • Posts: 1
  • Thank you received: 0
10 years 5 months ago #158115

-- url of the page with the problem -- : amerisealusa.com/index.php/2014-02-13-17-46-43
-- HikaShop version -- : Business

Can you use Custom Field Items to add columns to a product listing table?

I setup this menu item to display a list of products in a category as a table.
I have "display custom field items" set to "yes" in every place I can find.
I also have created several custom field items that I can't get to show up next to "code". I've tried:
-adding the field items to the category
-creating the custom field items as "item," "product, " "category."
-assigned the new custom field items to the category where the products appear.

How can I make this work?

Thanks :)
Autumn

Attachments:

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 5 months ago #158187

Hi,

First you need to create custom fields of the table "product" and not "item".

Then, as there is no option to display the fields on the listing for now, you need to edit the file "listing_table" via the menu Display>Views and add the HTML for the title of the column, like the other column titles there, and then you need to add the td for each product in the table.
To display the value of a custom product field in a cell of the table, it can be done with such code:
<td>
<?php echo $this->row->COLUMN; ?>
</td>

where COLUMN is the column name of your custom field.

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

  • Posts: 15
  • Thank you received: 0
10 years 5 months ago #159505

Hi Nicolas,

Thanks, I was able to use your sample to add a column to the listing_table template for a custom product field.

Is there a way to have that column hide if there are no products in the table with data in that field?

I am attempting to build a site with multiple product tables that have different custom fields per category.

Thanks,

Dave

Last edit: 10 years 5 months ago by Soens.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 5 months ago #159509

Hi,

It's possible but it requires more cusotm coding.
Basically, you need to do a loop on the rows at the beginning of the file and check if the $this->row->COLUMN is empty. If it's not empty for at least one of the products, then you need to display the column.
I would recommend to find a developer if you're not one yourself as this starts to be more than a 2 lines of code customization.

The following user(s) said Thank You: Soens

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

Time to create page: 0.075 seconds
Powered by Kunena Forum