Jump to content

[SOLVED] Custom field not reflecting in product.list and home featured. Need Help.


Recommended Posts



I have searched around several places to get the new custom field on product list and home featured page, but in vain. I used this http://nemops.com/prestashop-products-new-tabs-fields/ tutorial to create this field in database and back office. Also, I did receive the expected value for the field in product detail page (Front end) using below code;


added below one liner under class ProductCore extends ObjectModel
public $custom_field;


<p class="custom_field">
<a href="{$product->custom_field|escape:'htmlall':'UTF-8'}">My Field</a> </p>
In order to make use of this field in product listing, I tried the below code in product-list.tpl, but the custom field is blank, though it holds value in database and works very well in product detail page. This code did not work in homefeatured.tpl as well.
<p class="custom_field">
	 <a href="{$product.custom_field|escape:'htmlall':'UTF-8'}">My Field</a>    </p>

I know I am missing something here. Can someone shed light on this please?



Link to comment
Share on other sites

  • 2 weeks later...



you have to modify category class and include new field to SELECT clause in getProducts() function

$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, MAX(product_attribute_shop.id_product_attribute) id_product_attribute, product_attribute_shop.minimal_quantity AS product_attribute_minimal_quantity, pl.`description`, pl.`description_short`, pl.`available_now`,
					pl.`available_later`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, MAX(image_shop.`id_image`) id_image,
					il.`legend`, m.`name` AS manufacturer_name, cl.`name` AS category_default,
					DATEDIFF(product_shop.`date_add`, DATE_SUB(NOW(),
					INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).'
Link to comment
Share on other sites

Hello Vekia, 


Thanks for your response. I figured it out days after I posted. I did the same as mentioned in your reply and it worked. Pls mark this resolved.


thank you for information 

thread marked as solved as you suggested

with regards,


Link to comment
Share on other sites

  • 1 year later...

Can anyone expand on exactly how to modify category class? I've tried adding pl.`author` (author being my custom field) and this just results in no products being displayed at all on home page ("No featured products at this time."). As with OP, I have the custom field working fine in the actual product page. Am I missing something?



Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...