Jump to content

harlandraka94

Members
  • Posts

    23
  • Joined

  • Last visited

harlandraka94's Achievements

Newbie

Newbie (1/14)

4

Reputation

  1. I'm creating a PS module that will generate a PDF when an order is placed. It will then use the displayOrderDetail hook to provide the user a link to download the generated PDF. I would like to use my module for providing those PDFs, in order to manage access to documents, because if I simply link to the download folder, one could just list the folder and download all the files, while with the module I can check if the user has rights to see the file before downloading it. In my understanding, I think I need to define a new action, but I'm not sure this is the right way to do it. Is there a way to "bind" my controller method to a new action? If not, is there a way to tell prestashop to let my controller handle a url with some predefined parameters? Thank you
  2. Did you do this in prestashop 1.7? Unfortunately it doesn't work for me. Edit Nevermind, Typo. It works. Thanks!
  3. I'm trying to display a textarea in the admin extra tab in PS 1.7. This is my tpl file: <textarea id="pcpc"> {if isset($pcpcText) && !empty($pcpcText)} {$pcpcText} {/if} </textarea> And this is the hook in the controller: public function hookDisplayAdminProductsExtra($id_module) { $id_product = Tools::getValue('id_product'); file_put_contents(dirname(__FILE__).'/pid.txt', $id_product); $this->context->smarty->assign(array( 'pcpcText' => "Id product: $id_product", )); return $this->display(__FILE__, 'views/templates/admin/product_tab.tpl'); } Every website found on google says to use Tools::getValue('id_product') to get the product id, but I get an empty string instead. The product exists, it isn't a new product, I'm editing an already existing one, so I expect to get a valid ID. The textarea shows "Product id: " and the pid.txt file is blank. How do I properly get the product id in the displayAdminProductsExtra hook?
  4. Hi everyone. I'm still trying to setup my first prestashop 1.7 module. I'm following the guide here, seems to be easy but I can't get the module to work. When I try uploading it in the admin panel, prestashop says: Ooops... Upload failed, What happened? This file does not seem to be a valid module zip The module is pretty basic, it just has the module class with some empty hooks: <?php if (!defined('_PS_VERSION_')) { exit; } class MyFirstModule extends Module { public function __construct() { $this->name = 'myfirstmodule'; $this->tab = 'checkout'; $this->version = '1.0.0'; $this->author = 'First Module'; $this->need_instance = 0; $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); $this->bootstrap = true; parent::__construct(); $this->displayName = $this->l('My First Module'); $this->description = $this->l('This is my very first module.'); $this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); } public function install() { if (Shop::isFeatureActive()) Shop::setContext(Shop::CONTEXT_ALL); if ( !parent::install() || !$this->registerHook('actionPaymentConfirmation') || !$this->registerHook('actionProductSave') || !$this->registerHook('displayAdminProductsExtra') || !$this->registerHook('displayOrderDetail') || !$this->registerHook('displayFooterProduct') || !Configuration::updateValue('MYMODULE_NAME', 'My First Module') ) { return false; } else { return true; } } public function uninstall() { if ( !parent::uninstall() ) { return false; } else { return true; } } // called after a payment is confirmed public function hookActionPaymentConfirmation($id_order) { } // called after product is saved public function hookActionProductSave($id_product, $product) { // throw new PrestaShopException("message"); //prevents product from saving } // used to add a tab in admin product page public function hookDisplayAdminProductsExtra($id_module) { } // used to add a tab in admin product page public function hookDisplayOrderDetail($order) { } // used to add a tab in admin product page public function hookDisplayFooterProduct($product, $category) { } } What am I missing? The full module zip is attached to this message myfirstmodule.zip
  5. Thank you! It's weird that a complete list exists on your website and not on the official documentation Thanks, it helped a lot!
  6. Salve a tutti, Vorrei creare un modulo che riceva una notifica quando viene creato un ordine, in modo da processarlo e creare un PDF da mandare via mail al cliente. Ho letto che per questo genere di cose si utilizzano gli Hook, in particolare gli Action Hook. Non riesco a trovare da nessuna parte una lista degli action hook presenti in prestahsop 1.7, qualcuno sa dirmi se esiste e dove si trova? Magari esiste un file php nel core di prestashop con una lista degli hook disponibili? Grazie
  7. I'm about to create my very first prestashop 1.7 module. I want to have a function invoked whenever a user places an order. My understanding was that I need to use action hooks. I've read this page but I can't find a list of available hooks, does it exist?
  8. Hi all, I'm using prestashop for my own business. I need to sell some coupons whose codes must be generated at order. So, when the customer places an order, a unique code must be generated and stored for each coupon inside the order. Is this possible with prestashop? If not, is there a module (either free or paid) that does it? Is it possible to do it with a module or would I have to edit the core? Can someone point me in the right direction? Thank you
  9. I have an app running in the same domain as my prestashop shop. I would like to do something like a single sign-on: you log into prestashop, the app knows you are logged in and doesn't ask for login again. I saw this code in another thread: require_once(dirname(__FILE__).'/../config/config.inc.php'); // points to the correct file require_once(dirname(__FILE__).'/../config/settings.inc.php'); // points to the correct file $context = Context::getContext(); if (isset($context->employee) && $context->employee->id > 0) { $id_employee = $context->employee->id; echo "ID Employee: $id_employee"; } else { echo "No employee logged in."; } die(); It doesn't work, it outputs "No employee logged in.", no matter if I'm logged in or not (I'm an admin). If I print_r the context object, employee comes blank, even if I'm logged in. Is it possible to check if an employee is logged in outside prestashop? How? Thank you
  10. Hi, I'm using Prestashop 1.6, I can see a graph in the dashboard page which displays fake data. I would like to delete it to start collecting real data on my store. Is there a way to do it? I already tried clearing all data with the prestashop cleaner, but fake data is still showing in the graphs. Thank you!
  11. E' un peccato, secondo me è una delle funzionalità più importanti. In ogni caso, proverò a installare Advanced Tags, se non funziona contatterò direttamente lo sviluppatore
  12. Ciao! Non so se questa sia la sezione giusta, se non lo è chiedo scusa. Ho installato il modulo pagamento paypal dalla sezione moduli di PS 1.5, e funziona perfettamente. Il problema è che all'ultima fase del checkout (quando il modulo dice il numero dell'ordine, l'importo totale, e mostra il bottone per confermare il pagamento) tutto è scritto in inglese. Ora, non sarebbe un problema, se non fosse che il sito è rivolto a una clientela italiana, e non posso certo pretendere che tutti imparino l'inglese solo perchè ho il modulo in inglese C'è un modo di tradurre il modulo? Oppure, magari la traduzione c'è già, c'è modo di attivarla? Grazie!!
  13. Ciao a tutti. Ho un problema con l'installazione di Prestashop 1.6. Ho estratto l'archivio di prestashop dopo averlo scaricato dal sito ufficiale, e ho caricato i file dentro la root del mio spazio web con FileZilla. Ora, riesco a far partire l'installer, arrivo alla configurazione del database, si connette correttamente. Quando clicco su "avanti", crea le tabelle senza problemi ma si pianta a "Creazione del negozio e installazione lingue". Il passaggio viene evidenziato di rosso e mi chiede di tornare al passaggio precedente o di ricominciare l'installazione. Non mi dà dettagli sull'errore quindi non ho la minima idea di cosa possa essere. Come posso risolvere?
×
×
  • Create New...