keithg

How to add the validation before submit the payment – prestashop 1.7

Payment Hook public function hookPaymentOptions($params) { if (!$this->active) { return; } $newOption = new PaymentOption(); $paymentForm = $this->fetch(‘module:’.$this->name.’/views/templates/hook/payment.tpl’); $newOption->setCallToActionText($this->trans(‘ PAY ‘, array(), ‘Modules.MyModule.Shop’)) ->setModuleName($this->name) ->setForm($paymentForm) ->setAdditionalInformation($paymentForm) ->setAction($this->context->link->getModuleLink($this->name, ‘xyz’,array(“confirmation”=>”1”), true)); return [$newOption]; }   Validation Process add in js or tpl file <script type=”text/javascript”> $( document ).ready(function() { $(‘#payment-confirmation > .ps-shown-by-js...Read more …
keithg

remove all items from cart in prestashop 1.7

<a class="btn btn-primary" style="float:right" id="removeAll" href="javascript:void(0)">   Empty Cart </a> in js file $(document).ready(function() { if(prestashop.page.page_name == ‘cart’) { $(‘#removeAll’).click(function(e) { e.preventDefault() $.ajax({ type: ‘POST’, headers: { “cache-control”: “no-cache” }, url: prestashop.urls.base_url + “cart”, async: true, cache: false, data: ‘deleteAll=1&token=’ + prestashop.token + ‘&ajax=true’, success: function(data){ window.location.reload(); } }) }); }...Read more …
keithg

Create Url (short url) in prestashop 1. 7

With Module you can make a link in tpl. spstepcheckout is the module name ane ajax is front controller . old way : {$link->getModuleLink(‘spstepcheckout’,’ajax’)} new way : {url entity=’module’ name=’spstepcheckout’ controller=’ajax’ params=[‘edited’ => 1, ‘id’ => $id]} Without Module make a controller link. cart is the controller name and pass parameter...Read more …