Jump to content

Rémi

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by Rémi

  1. Hi everyone, I need your help ! If i summarize : I have a module (MyModule) with inside a controller : class MyModuleCreationDevisModuleFrontController extends ModuleFrontController who displays mytemplate.tpl and a button with Ajax (my-button). -> I don't only display a button that's why i use ajax but i simplify for the post I would like to know how i am suppose to process if i want to display the product with mytemplate.tpl without reloading the page when i click on my-button. Should i process like this : Add the id of the product in the data of my-button Get the data when my-button is click with Jquery. Thanks to AJAX send the data to the function DisplayAjax() of the override controller ProductController.php Display the template product.tpl with the product's data <?php class ProductController extends ProductControllerCore { public function __construct() { parent::__construct(); } public function initContent() { $this->ajax = true; parent::initContent(); } public function displayAjax() { $id_product = Tools::getValue('id'); $product = new Product($id_product); ob_end_clean(); header('Content-Type: application/json'); $this->ajaxDie(Tools::jsonEncode(array( 'template' =>'catalog/product', 'product' => $product, 'entity' => 'product', 'id' => $id_product, ))); } } Or is there a cleaner way to do that ? The operation of the ProductController is hard to understand... Your help is precious to me and I would be very grateful if you could help me to find a solution. Rémi
  2. Hello, Did you find a solution ? i got similar problem. Thank you.
  3. Hi everyone, I got the same problem. I need to add attributes to an class (seller) of a module (JA MARKETPLACE). It seems logical to me that the proper way is to override the class. How i supposed to do if we can't ? What is the best solution to have a coherent and reusable structure and a durable solution ? Thank you for your answers.
×
×
  • Create New...