giwrgos88 Posted April 19, 2018 Share Posted April 19, 2018 (edited) Hello, I'm working on a module and I want to extend the product class in order to add an extra attribute to the class. I want this attribute to be available on product list page, category page, product page etc. Basically I want to add a boolean attribute if the product is preorder or not Does anyone knows how i can do it? PRestashop 1.7 and 1.6 Edited May 9, 2018 by giwrgos88 (see edit history) Link to comment Share on other sites More sharing options...
jgamio Posted April 20, 2018 Share Posted April 20, 2018 Depend on your Prestashop version on 1.6 you can use something like these http://nemops.com/new-customer-address-fields-prestashop/ On 1,7 you need use the hooks to be able to got information on your module to after show on the tpls Link to comment Share on other sites More sharing options...
giwrgos88 Posted April 24, 2018 Author Share Posted April 24, 2018 On 4/20/2018 at 7:12 AM, jgamio said: Depend on your Prestashop version on 1.6 you can use something like these http://nemops.com/new-customer-address-fields-prestashop/ On 1,7 you need use the hooks to be able to got information on your module to after show on the tpls I don't want to add extra fields, I just want to extend the existing Product class with my module and add an extra attribute called preorder(boolean) Link to comment Share on other sites More sharing options...
hhennes Posted April 25, 2018 Share Posted April 25, 2018 Hi, You can check this tutorial ( in french ) which add 3 new fields.https://www.h-hennes.fr/blog/2017/10/19/prestashop-1-7-ajouter-des-champs-produit/ Regards, Link to comment Share on other sites More sharing options...
giwrgos88 Posted May 9, 2018 Author Share Posted May 9, 2018 Hello @hhennes @jgamio it looks like on prestashop 1.7 is not working. any other suggestions? Link to comment Share on other sites More sharing options...
jgamio Posted May 9, 2018 Share Posted May 9, 2018 A workaroud can be On your module use the hooks o handle the extra data check on http://doc.prestashop.com/display/PS17/Hooks+in+PrestaShop+1.7.x the available ones or create your own and put on the theme Link to comment Share on other sites More sharing options...
hhennes Posted May 10, 2018 Share Posted May 10, 2018 Do not forget to clear the cache if it is not working. The problems are often linked to that Link to comment Share on other sites More sharing options...
giwrgos88 Posted May 15, 2018 Author Share Posted May 15, 2018 (edited) I found out how to override the product class but the issue is that the attribute always has the value 1 even if i add false or a date as a value. any ides? here is my code https://pastebin.com/nesKN8iW does anyone know what i'm doing wrong? basically I want to make a module where the admin can set a date to a product if it is preorder and I want each product to have this extra attribute, in the checkout process for example, on single page or on the home page where you display the products. Note: I don't want to store this attribute inside the product table Edited May 15, 2018 by giwrgos88 (see edit history) 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