__fabrice Posted June 15, 2010 Share Posted June 15, 2010 Hi all,I posted two messages that were left unanswered, here and here. We would say that it's too complicated ...Is it possible in this case, to do a module that manages a date (field) in the management of extra shopping cart and orders.This is just to manage a date in the order. Not the date of the order, but a date related to the product (eg a trip).Thank you for your help.Fabrice Link to comment Share on other sites More sharing options...
yodapt Posted June 15, 2010 Share Posted June 15, 2010 It is possible, but I think a hook would be more suitable than a module. Link to comment Share on other sites More sharing options...
__fabrice Posted June 15, 2010 Author Share Posted June 15, 2010 Hi,Thanks, but can you explain the differences between a hook and a module, please. ?Fabrice Link to comment Share on other sites More sharing options...
yodapt Posted June 15, 2010 Share Posted June 15, 2010 A hook is an overrider for the default system behaviour. In other words, it's changing the core functionallity of Prestashop.A module is something that works kind of standalone, given the Prestashop API or basic funcionality.Be aware that a hook, if not well done, would make it hard to upgrade Prestashop in the future. Link to comment Share on other sites More sharing options...
__fabrice Posted June 15, 2010 Author Share Posted June 15, 2010 ok, thank you to explain. I my case; i don't think it's appropriate to create a module. I just want to add a field in the product table, a date field, that i could retreive in the shopping cart and in the order.Regards,Fabrice Link to comment Share on other sites More sharing options...
UK-Canuck-in-Paris Posted February 16, 2011 Share Posted February 16, 2011 Anyone solve this?I think what is needed is the list of files and tables that need modified to add a new product field of type date.Or the possibility of changing a current product field which is not being used from a text field to a date field and then changing the display name. Link to comment Share on other sites More sharing options...
Paul C Posted February 17, 2011 Share Posted February 17, 2011 In 1.4 you would override the Product class to add fields to it, for example. Then you get all the joy of the standard object facilities without the pain of hacking around with adding hooks or modules etc.For example to add a mandatory "Title" field to use instead of radio buttons for gender you could do: class Customer extends CustomerCore { /** @var string Title */ public $title; public function __construct($id = NULL, $id_lang = NULL) { $this->fieldsRequired[] = 'title'; parent::__construct(); } public function getFields() { parent::validateFields(); $fields = parent::getFields(); $fields['title'] = pSQL(Tools::strtoupper($this->title)); return $fields; } } You would then probably write some member functions to manipulate/query the value. Simple Paul Link to comment Share on other sites More sharing options...
UK-Canuck-in-Paris Posted February 17, 2011 Share Posted February 17, 2011 Thank you! That sounds amazing. But... when is 1.4 official? I need to deploy it with the next week or two.I am busy coding on 1.3.6 but these things about 1.4 sound like even starting from scratch it may save me more time and less hacks as you say. Link to comment Share on other sites More sharing options...
Paul C Posted February 17, 2011 Share Posted February 17, 2011 Well it will be ready when it's ready, so why not start working on it and contributing to the bug tracker and it will get there that little bit quicker Paul 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