Jump to content

Edit History

Chill_user

Chill_user

Yes it's possible.

You can change currency for example, if customer has choosen the Paypal method.

You don't have hook for this. It's not so fast, but you can create some kind of "Payment module"

Your steps:

1. Go to https://validator.prestashop.com/generator

2. Create !payment module!, you have all steps describe with previous link.

3. In your payment module you need to create controller. This controller will manage all data user entered.  Something like this:

class your_module_nameValidationModuleFrontController extends ModuleFrontController
{
	public $ssl = true;

	public function initContent()
	{
		parent::initContent();
		$cart = $this->context->cart;
		//getting values from form
		$billing_address = Tools::getValue('same_address');
		//manage stuff here you like to change
	}
}

4. In previously created controller you can pass an "action" before user goes to checkout and than programmatically redirect him to paypal landing page.

5. Change the template of payment step in .tpl and create the custom "payment" button whick redirects to your controller you created.

OR

Modify the paypal module, but pay attention to some code errors; I recommend you to create a function outside the Paypal module that modifies some info.

Than just call this fuction inside paypal module.

With this method you will modify only 1 line of code inside paypal module as all lines of code will be stored outside  = easy dubug 

Chill_user

Chill_user

Yes it's possible.

You can change currency for example, if customer has choosen the Paypal method.

You don't have hook for this. It's not so fast, but you can create some kind of "Payment module"

Your steps:

1. Go to https://validator.prestashop.com/generator

2. Create !payment module!, you have all steps describe with previous link.

3. In your payment module you need to create controller. This controller will manage all data user entered.  Something like this:

class your_module_nameValidationModuleFrontController extends ModuleFrontController
{
	public $ssl = true;

	public function initContent()
	{
		parent::initContent();
		$cart = $this->context->cart;
		//getting values from form
		$billing_address = Tools::getValue('same_address');
		//manage stuff here you like to change
	}
}

4. In previously created controller you can pass an "action" before user goes to checkout and than programmatically redirect him to paypal landing page.

5. Change the template of payment step in .tpl and create the custom "payment" button whick redirects to your controller you created.

×
×
  • Create New...