Jump to content

Extra discount for users who chose to pay by bankwire


Recommended Posts

Hello.

I am using prestashop version 1.5.6.0. I want to add a extra discount to a payment but dont know how.
I want to add an extra 2% discount for every user that pay by banwire.
The 2% discount should be visible after they chose the bankwire payment method. So the last step in the order summary.
See picture for more details.
As you see in the picture the is now the sum of 157,87 but i want it here to be -2% of the whole sum coz it should be like a little reward if you pay by bankwire.

I am not sure how to do this but i am quite sure a have to edit some lines in the prestashop-modules-bankwire-controlers-front-payment.php.

But i cant seem to get i working.
The code in this .php is:

<?php

class BankwirePaymentModuleFrontController extends ModuleFrontController
{
	public $ssl = true;

	public function initContent()
	{
		$this->display_column_left = false;
		parent::initContent();

		$cart = $this->context->cart;
		if (!$this->module->checkCurrency($cart))
			Tools::redirect('index.php?controller=order');

		$this->context->smarty->assign(array(
			'nbProducts' => $cart->nbProducts(),
			'cust_currency' => $cart->id_currency,
			'currencies' => $this->module->getCurrency((int)$cart->id_currency),
			'total' => $cart->getOrderTotal(true, Cart::BOTH),
			'this_path' => $this->module->getPathUri(),
			'this_path_bw' => $this->module->getPathUri(),
			'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->module->name.'/'
		));
		$this->setTemplate('payment_execution.tpl');
	}
}
?>

I have tried something like:
 

<?php
$discount = "($total * 2) / 100"
?>

And changed the var in the payment_execution.tpl from

{displayPrice price=$total}

To:

{displayPrice price=$discount}

But then i dont get any number is the filed.

So does anyone have an idea how can i slove this problem?

Best regards.

post-781671-0-45170800-1397632541_thumb.png

  • Like 1
Link to comment
Share on other sites

  • 8 months later...
  • 2 weeks later...
  • 1 month later...

Dear Marino,

 

Good try here.

 

By changing to {dispalyPrice price=$total - (($total * 2) / 100)}, I think you are just manipulating the displayed value, not exactly changing the total value in backend.

 

Please kindly correct me if I am wrong.

That is absolutely correct bruce_ooi!

 

For that problem of displaying and calculating the right ammount in the back end afterwards i have a small tweek module wich searches trought the database for order that have"PayByBankWire" value and changes the price value with the same formula as used in the front-end. :)

So the Costumer sees the Extra discount price in the front and i also see the Extra discount in the back-end, so that my nubmer with sales are 100% accurate. :)

Link to comment
Share on other sites

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...