gPowerHost Posted November 9, 2014 Share Posted November 9, 2014 Hello, I'm having an issue adding more than one field to be editable from the backend shop. I can easily read new fields from the db, but I can't get the "public function __construct" to accept more than the first new field (for validation and writing). In the examples below, only the first 'show_member_price' is editable from front end and if I switch the order say making 'show_srp_price' first in the __construct then only that is editable. Additionally, I will next be wanting to update values in columns of the same name in ps_product_attribute table. Would the construct remain "__construct($id_product" or would it, perhaps, change to "__construct($id_product_attribute"? FILE: override/classes/Product.php <?php // ADD A RETAIL PRICE FIELD AND FIELDS TO ALLOW/OVERRIDE SHOWING THE MEMBER OR SRP PRICE TO THE PUBLIC (OR NOT) class Product extends ProductCore { public $srp; public $show_member_price; public $show_srp_price; public function __construct($id_product = null, $full = false, $id_lang = null, $id_shop = null, Context $context = null) { self::$definition['fields']['show_member_price'] = array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml'); parent::__construct($id_product, $full, $id_lang, $id_shop, $context); self::$definition['fields']['show_srp_price'] = array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml'); parent::__construct($id_product, $full, $id_lang, $id_shop, $context); self::$definition['fields']['srp'] = array('type' => self::TYPE_FLOAT, 'validate' => 'isCleanHtml'); parent::__construct($id_product, $full, $id_lang, $id_shop, $context); } } ?> have also tried: <?php // ADD A RETAIL PRICE FIELD AND FIELDS TO ALLOW/OVERRIDE SHOWING THE MEMBER OR SRP PRICE TO THE PUBLIC (OR NOT) class Product extends ProductCore { public $srp; public $show_member_price; public $show_srp_price; public function __construct($id_product = null, $full = false, $id_lang = null, $id_shop = null, Context $context = null) { self::$definition['fields']['show_member_price'] = array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml'); self::$definition['fields']['show_srp_price'] = array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml'); self::$definition['fields']['srp'] = array('type' => self::TYPE_FLOAT, 'validate' => 'isCleanHtml'); parent::__construct($id_product, $full, $id_lang, $id_shop, $context); } } ?> Thanks for any assistance anyone may provide. I was basing this on: http://nemops.com/prestashop-rrp-price/#.VF4Gw4eIfwU Thanks, Nemo! and liked it because it involves overriding very little in: classes/Product.php -Edie Link to comment Share on other sites More sharing options...
gPowerHost Posted November 10, 2014 Author Share Posted November 10, 2014 My apologies, the issue was unrelated to the function __construct. This works just fine: class Product extends ProductCore { public $srp; public $show_member_price; public $show_srp_price; public function __construct($id_product = null, $full = false, $id_lang = null, $id_shop = null, Context $context = null) { self::$definition['fields']['srp'] = array('type' => self::TYPE_FLOAT, 'validate' => 'isCleanHtml'); self::$definition['fields']['show_member_price'] = array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml'); self::$definition['fields']['show_srp_price'] = array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml'); parent::__construct($id_product, $full, $id_lang, $id_shop, $context); } } I will attempt to mark this as resolved. 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