- Posts: 40
- Thank you received: 0
Display Product Table custom fields in lis views
- simonbornhoft
-
Topic Author
- Offline
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.
To display the product custom fields in a product listing, it require some php modifications.
You have to add a code like:
Please Log in or Create an account to join the conversation.
- simonbornhoft
-
Topic Author
- Offline
- Posts: 40
- Thank you received: 0
Please Log in or Create an account to join the conversation.
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
Please Log in or Create an account to join the conversation.
The given method is only working for the product custom field, so just display a value set in backend.
> please read next post
Please Log in or Create an account to join the conversation.
I edited my last message, the given information was not correct.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
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.
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.
Please Log in or Create an account to join the conversation.
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.
<?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.
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.