Jump to content

Credt card payment module with installments


Recommended Posts

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 by Marius05 (see edit history)
Link to comment
Share on other sites

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

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

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

  • 10 months later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...