Skip to main content

Display Product Table custom fields in lis views

More
13 years 1 week ago #123613 by simonbornhoft
Hi,

I have some products that have custom fields. I need to display then in the product list views, if they are present.

Does this need some customisation of the template, or am I missing a configuration option? I found the config option for the item custom fields, but not for product custom fields.

Many Thanks

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

More
13 years 1 week ago #123696 by Xavier
Hi,

To display the product custom fields in a product listing, it require some php modifications.
You have to add a code like:
Code:
if(isset($this->row->custom_field_column_name) && !empty($this->row->custom_field_column_name)){ echo $this->row->custom_field_column_name; }
For each product custom field.
The following user(s) said Thank You: simonbornhoft, epma-website

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

More
13 years 1 week ago #123782 by simonbornhoft
That's perfect! Thank you Xavier

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

More
11 years 10 months ago - 11 years 10 months ago #180158 by mediax
Hi Xavier,

I am trying to add a custom field to the product listing. I need the customer to choose a SIM type, one of two options.

I have tried the suggested code to add the custom field to the product listing view, but no success. This is what I have added to product / listing_img_title.php

<?php if(isset($this->row->sim_type) && !empty($this->row->sim_type)){
echo $this->row->sim_type;
} ?>

The custom field type is Item, and I have checked that the right category is assigned - it does appear in the product view. What else can I look at to accomplish this?

//UPDATE

I have also done a var_dump on the listing page - I can see the sim_type variable and value, but it is not displaying.

//UPDATE

I have now moved the echo statement to lower down in the view file, and have managed to display some data. It does however only display the one option of the custom field as a string and not as a radio button option. Please could you assist me in reference to how to display the radio button or drop down list to have both options
Last edit: 11 years 10 months ago by mediax. Reason: Update

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

More
11 years 10 months ago - 11 years 10 months ago #180166 by Xavier
Hi,

The given method is only working for the product custom field, so just display a value set in backend.

> please read next post
Last edit: 11 years 10 months ago by Xavier.

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

More
11 years 10 months ago #180468 by Xavier
Sorry, to display the custom item field in the listing, you just have to enable the option "Display custom item fields" in the menu / module which is listing the products. ;)

I edited my last message, the given information was not correct.

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

More
11 years 10 months ago #180491 by mediax
Thanks Xavier, that fixed the issue for me :)

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

More
11 years 9 months ago #182695 by deank
What if you want to display custom fields based upon category groups?

For instance lets say I have 4 product categories, each of them contain different products, but each product has its own set of custom products fields which are common within its group. Now I want to display all the categories at once, but grouped by category with the category custom fields in the table header for each category based upon the custom fields associated with the products in each group.

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

More
11 years 9 months ago #182703 by nicolas
Hi,

Well, you need to add a condition on the current category before displaying the fields then. It's a bit more complex as you'll have to edit both the listing file to pass the current category to the products listing, and the listing_table file where the display of the products table is done for each category, but if you're a developer it shouldn't be a problem.

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

More
11 years 9 months ago #182903 by deank
So if I am understanding this correctly I will have to edit the category>listing.php to pass the category groups to the products>listing_table?

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

More
11 years 9 months ago #183021 by Xavier
Hi,

Yes, from the listing view set the current category to get it from the listing_table one.

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

More
11 years 7 months ago #188544 by Geoffc
I've added this to "order / listing.php" and it doesn't display. Is the code correct? It is using code from the top of this thread:

<?php
if(isset($this->row->ordername) && !empty($this->row->ordername)){
echo $this->row->ordername; } ?>

Geoff

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

More
11 years 7 months ago #188579 by Xavier
Hi,

The code previously given was for a product custom field in a product view.
But if you want to display an order custom field, so yes the code is correct.

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

Time to create page: 0.315 seconds
Powered by Kunena Forum