dmikhaylov Posted June 1, 2015 Share Posted June 1, 2015 I added custom field to my Product class: class Product extends ProductCore { public $pills_per_blister; public function __construct($id_product = null, $full = false, $id_lang = null, $id_shop = null, Context $context = null) { self::$definition['fields']['pills_per_blister'] = array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'); parent::__construct($id_product, $id_lang, $id_shop, $context); } } But now I can see this field added to product only on product page, not on product list page. Link to comment Share on other sites More sharing options...
blackarma Posted June 3, 2015 Share Posted June 3, 2015 Well code you provided, would tie together database field and ensure certain validation on field.You still have to manually display it where needed. For example to display in admin product list (override/controllers/admin/AdminProductsController.php): <?php class AdminProductsController extends AdminProductsControllerCore { public function __construct() { parent::__construct(); // php >= 5.4 //$this->fields_list['pills_per_blister'] = ['title' => $this->l('My Extra Field')]; // php < 5.4 $this->fields_list['pills_per_blister'] = array('title' => $this->l('My Extra Field')); } } Link to comment Share on other sites More sharing options...
dmikhaylov Posted June 10, 2015 Author Share Posted June 10, 2015 That's not what I meant. I can't see this field in Product object when I use p() function on product list page. Only on product detail page. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now