Marius05 Posted September 15, 2016 Share Posted September 15, 2016 (edited) Hi! I created a module for payment with credit card, trought credit europe bank. This bank offer option to select the number off installments for payment Everithing is ok, except one problem. User can select the number of installments for payment. To select the number of installments I have created a drop down menu. To save the value off selected number for installments I use cookies. If I delete all cookie from my laptop in confirmation page everithing is ok. The problem apear when i tourn back and change another value for number of installments in confirmation page i have the old value, not the new one. If i refrash the page CTRL+F5 then the value selected from drop down menu apear OK. Somebody ken help mee with some ideea ... Thank you! Edited September 15, 2016 by Marius05 (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted September 16, 2016 Share Posted September 16, 2016 It's hard to tell what's wrong since you developed the customization. You are probably not retrieving the value from the cookie before it's displayed on the page. WHat if you refresh the page with the wrong value? You must also make sure it's properly saving to the cookie again, when you set it Link to comment Share on other sites More sharing options...
Marius05 Posted September 17, 2016 Author Share Posted September 17, 2016 In crediteurope.php file i have fucntion function setUserNumarRate( $numar_de_rate ){ global $cookie; $context = Context::getContext(); $context->cookie->__set('numar_rate_cookie',$numar_de_rate); $cookie->write(); } In ajax.php file i have this require_once(dirname(__FILE__).'../../../config/config.inc.php'); require_once(dirname(__FILE__).'../../../init.php'); include_once(dirname(__FILE__).'/crediteurope.php'); $numar_de_rate = Tools::getValue('numar_rate'); CreditEurope::setUserNumarRate($numar_de_rate); In validation.tpl to get cookie value {$cookie->numar_rate_cookie} Every time is displayed the old value, not the current selected value from payment installments option module. If i refrash the page using CTRL+F5 everithing is ok... I do not know what's the problem... Link to comment Share on other sites More sharing options...
Marius05 Posted September 17, 2016 Author Share Posted September 17, 2016 I put this js code in validation.tpl. <script type="text/javascript"> $(document).ready(function(){ //Check if the current URL contains '#' if(document.URL.indexOf("#")==-1){ // Set the URL to whatever it was plus "#". url = document.URL+"#"; location = "#"; //Reload the page location.reload(true); } }); </script> After page is refrashed everithing is ok. The value selected in the instalment menu is displayed in payment validation page. So the problem is browser load temporary page. How to load the real page , please help! Link to comment Share on other sites More sharing options...
Marius05 Posted September 19, 2016 Author Share Posted September 19, 2016 Nobody !? Link to comment Share on other sites More sharing options...
Marius05 Posted September 22, 2016 Author Share Posted September 22, 2016 Anyone ?! Link to comment Share on other sites More sharing options...
guilhermedemellokich Posted August 7, 2017 Share Posted August 7, 2017 Hi. I am looking for a module to show the installments. I have already a local payment module which allows buying in installments but it is not shown on product page. The payment module calls Mercado Pago. I am from Brazil. Could you share your module? Does it work for other countries? Thank you! Link to comment Share on other sites More sharing options...
guilhermedemellokich Posted August 7, 2017 Share Posted August 7, 2017 Is there a way to declare the variable cookie outside the function or clear the cookie before the new value is set? Like: $cookie->clear() ? Is there a way to declare the variable cookie outside the function or clear the cookie before the new value is set? Like: $cookie->clear() ? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now