Jump to content

mikimoto

Members
  • Posts

    5
  • Joined

  • Last visited

Profile Information

  • Activity
    Project Owner

mikimoto's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Well, finaly we are going to bypass the problem using this module http://addonspresta.com/en/free-modules/48-ship-to-pay.html Thanks!
  2. Buh! Lo estoy mirando, y de momento vamos a tirar claramente con esto. Muchas gracias!
  3. Bueno, en principio es un módulo que debe llevar todas las funcionalidades integradas en él. De todas formas, miro el módulo que me dices por si pudiera ser de ayuda.
  4. Hi! I'm programming a module that add's an special kind of carrier. I need to prevent selecting "defered" payment methods such as "cash on delivery" "transference", etc, when this carrier is selected. I have implemented the solution via javascript, but i'm beeing unable to load the tpl file in the payment hook. Does anybody have any idea? Here is where the module registers the hooks: $id_carrier = $this->installExternalCarrier($carrierConfig); Configuration::updateValue('TENLOAHORA_CARRIER_ID', (int)$id_carrier); Configuration::updateValue('TENLOAHORA_GATEWAY_URL', 'urlServidor'); if (!parent::install() OR !$this->runSql($sql) OR !$this->registerHook('backBeforePayment') OR !$this->registerHook('extraCarrier') OR !$this->registerHook('orderConfirmation') OR !$this->registerHook('payment') OR !$this->registerHook('updateCarrier')) return false; return true; Here where the tpl is loaded: public function hookPayment($params){ global $smarty; $ps_module_dir = str_replace($_SERVER['DOCUMENT_ROOT'], "", _PS_MODULE_DIR_); $smarty->assign(array( 'tenloahora_carrier_id' => Configuration::get('TENLOAHORA_CARRIER_ID'), 'tenloahora_id_address' => $params['cart']->id_address_delivery, 'ps_module_dir' => $ps_module_dir, )); return $this->display(__FILE__, 'views/frontend/payment.tpl'); And this is the tpl that is loaded: {assign var="tenloahora_selected" value="{$tenloahora_carrier_id},"} {assign var="id_delivery_option" value="{Tools::getValue('id_delivery_option')}"} {if TRUE} <div class="tenloahora_check_payment"> <p class="payment_module"> <h2>HOLAAAAA</h2> </p> {literal} <script id="tenloahora_check_payment" versionjs="4"> (function () { function loadScript(url, callback) { var script = document.createElement("script") script.type = "text/javascript"; if (script.readyState) { //IE script.onreadystatechange = function () { if (script.readyState == "loaded" || script.readyState == "complete") { script.onreadystatechange = null; callback(); } }; } else { //Others script.onload = function () { callback(); }; } script.src = url; document.getElementsByTagName("head")[0].appendChild(script); } if (typeof jqTA === 'undefined') { loadScript("https://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js", function () { //jQuery loaded console.log('jquery loaded'); loadScript("modules/apprenticeshipping/views/frontend/js/tenloahora.js", function () { //TenloAhora.js loaded from same server console.log('TenloAhora.js loaded, enjoy :D'); tenloahora.desactivarPagoDiferido(); }); }); } else { try { tenloahora.desactivarPagoDiferido(); } catch(err) { console.log('TenloAhora no se inicio :S'); } } })(); </script> {/literal} </div> {/if} Thanks!
  5. Hola, estoy programando un módulo que integra un transportista un poco especial. El caso es que necesito que si se ha seleccionado ese transportista, los métodos de pago "diferidos", es decir, pago con cheque, transferencia, etc.. queden desactivados. En un principio lo he integrado por con un javascript, pero no consigo que se cargue en el hook de payment. Alguna idea? Pego el código por si puede servir de ayuda. $id_carrier = $this->installExternalCarrier($carrierConfig); Configuration::updateValue('TENLOAHORA_CARRIER_ID', (int)$id_carrier); Configuration::updateValue('TENLOAHORA_GATEWAY_URL', 'urlServidor'); if (!parent::install() OR !$this->runSql($sql) OR !$this->registerHook('backBeforePayment') OR !$this->registerHook('extraCarrier') OR !$this->registerHook('orderConfirmation') OR !$this->registerHook('payment') OR !$this->registerHook('updateCarrier')) return false; return true; Aquí cargo el tpl en el que cargo el js: public function hookPayment($params){ global $smarty; $ps_module_dir = str_replace($_SERVER['DOCUMENT_ROOT'], "", _PS_MODULE_DIR_); $smarty->assign(array( 'tenloahora_carrier_id' => Configuration::get('TENLOAHORA_CARRIER_ID'), 'tenloahora_id_address' => $params['cart']->id_address_delivery, 'ps_module_dir' => $ps_module_dir, )); return $this->display(__FILE__, 'views/frontend/payment.tpl'); Y este es el tpl que se carga: {assign var="tenloahora_selected" value="{$tenloahora_carrier_id},"} {assign var="id_delivery_option" value="{Tools::getValue('id_delivery_option')}"} {if TRUE} <div class="tenloahora_check_payment"> <p class="payment_module"> <h2>HOLAAAAA</h2> </p> {literal} <script id="tenloahora_check_payment" versionjs="4"> (function () { function loadScript(url, callback) { var script = document.createElement("script") script.type = "text/javascript"; if (script.readyState) { //IE script.onreadystatechange = function () { if (script.readyState == "loaded" || script.readyState == "complete") { script.onreadystatechange = null; callback(); } }; } else { //Others script.onload = function () { callback(); }; } script.src = url; document.getElementsByTagName("head")[0].appendChild(script); } if (typeof jqTA === 'undefined') { loadScript("https://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js", function () { //jQuery loaded console.log('jquery loaded'); loadScript("modules/apprenticeshipping/views/frontend/js/tenloahora.js", function () { //TenloAhora.js loaded from same server console.log('TenloAhora.js loaded, enjoy :D'); tenloahora.desactivarPagoDiferido(); }); }); } else { try { tenloahora.desactivarPagoDiferido(); } catch(err) { console.log('TenloAhora no se inicio :S'); } } })(); </script> {/literal} </div> {/if} Muchas gracias!
×
×
  • Create New...