Jump to content

EriKK

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by EriKK

  1. Thank for your help. I founded an help in other thread by Razaro but I can't get the value with Tool::getValue () the result is empty
  2. Hi Razaro, I try your response to Ruman but I don't see the value in in view... I have: - JS in root->modules->modulename->views->js->namejsfile.js - CONTROLLER in root->modules->modulename->controllers->front->controllername.php - VIEW in root->modules->modulename->views->templates->front->filename.tpl in js file $('#send').click(function(){ var ciao = 'cioaa'; var myUrl = prestashop.urls.base_url + 'index.php?fc=module&module=configuratore&controller=task'; $.ajax({ type: 'get', cache:false, url: myUrl, data: { ajax: true, datas:ciao, action: 'fromAjax', }, }) .done(function() { console.log('Success!'); }) .fail(function() { console.log('error'); }); }); in php file class ConfiguratoreTaskModuleFrontController extends ModuleFrontController { public function __construct() { parent::__construct(); } public function init() { parent::init(); } public function initContent() { parent::initContent(); $this->setTemplate('module:configuratore/views/templates/front/task.tpl'); } $this->fromAjax(); } public function fromAjax() { $mVar = Tools::getValue('datas'); return $this->context->smarty->assign(array('var'=>$mVar)); } and in tpl {$var} in console log I receive success as a answer but I can't see in view? What I'm doing wrong?
  3. Hi guys,😀 My name is Enrico and I'm newbie in Prestashop (and surely the problem will be stupid) but I'll talk about what I'm doing and the problem I have. Yesterday I created my first module. This module will serve to customize product after some selections and fields to fill out. To make selection end fill field I have a structure in tabs... First Tab -> first selection from three Second Tab -> second selection from other three ecc ecc..... and so far so good In separate js I've the function that every click to change tabs the variables records the user's chooses and I generate an array with all chooses. I should pass the array via ajax from this js file stored in (root->modules->configuratore->views->js->configuratore.js) to my php file that stored in (root->modules->configuratore->controller->front->configuratore.php) but...I don't understund why ajax url give me 404 var ciao = 'ciao'; $.ajax({ url: ????, // I've try different urls but every url with 404 in console type: 'GET', dataType: 'json', data: {ciao: ciao}, }) I accept any advice thanks😉
×
×
  • Create New...