Jump to content

daniele m

New Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by daniele m

  1. Thank you so much ­čśŹ I'll try it your suggestion as soon as possible. I evaluated this option. I think it is cleaner and more correct. Because I'm moving my first steps on Prestashop i choose (maybe wrongly) the short way ...
  2. Hello elburgl69, to use the Hooks paradigm could this be the right direction? 1 - instead override the custome class with its extension I'll include it defining a new class as extension of Customer, using it to manage the "admin side forms" 2 - I need to intercept "actionCustomerAccountAdd" 3 - get the field value for my custom field (someting like $mycustom = Tools::getValue('mycustom') 4 - I need to implement my own mysql setter for the mycostum column could be?
  3. Salve a tutti. Ricorro al forum non avendo trovato tutorial online esaustivi (o pi├╣ semplicemente che sono stato in grado di comprendere). Ho creato 2 moduli per aggiungere dei campi custom ai form "costumer" sia lato cliente che lato amministratore. Per farlo ho semplicemente aggiunto le colonne che mi servivano a DB e ho aggiornato la rappresentazione del dato facendo l'override della classe "Customer" /** * Override Class CustomerCore */ class Customer extends CustomerCore { public $mycustom; public function __construct($id = null){ self::$definition['fields']['mycustom'] = [ 'type' => self::TYPE_STRING, 'lang' => false, 'required' => true, 'size' => 255, 'validate' => 'isString' ]; parent::__construct($id); } } ├ł stato necessario "mergiare" gli override dei rispettivi moduli per evitare conflitti. Ho percepito che quella da me usata sia una metodologia "vecchia" e che possa evitare l'override utilizzando gli hooks. Non riesco per├▓ a capire come adattare il mio codice. Nessuno potrebbe fornirmi indicazioni o codici esemplificativi a riguardo? Grazie mille in anticipo, Daniele M
  4. I created 2 modules, both using an override on the same class ( Customer ) to add DB extra data representation. The second module gives me an error because the class is overridden already by the first module. Both modules have an "/override/classes/" path. I solved merging all the overrides on the first module and stripping it out form the second. I noticed that in a modern structure I should avoid overrides for hooks, but how reply the same structure? My module is pretty easy, it add a new column "mycustom" on costumer table then override the Costumer class to explain the new data to the controller: /** * Override Class CustomerCore */ class Customer extends CustomerCore { public $mycustom; public function __construct($id = null){ self::$definition['fields']['mycustom'] = [ 'type' => self::TYPE_STRING, 'lang' => false, 'required' => true, 'size' => 255, 'validate' => 'isString' ]; parent::__construct($id); } } I tried (following some tuts) to include the file in my module main class but it doesn't works as expected (err500). I'm not able to use hooks instead of override and i'm in trouble to find documentation about. I hope someone can share a code strip/example to let me to understand. Thanks in advance Daniele M
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More