Marino1988 Posted April 16, 2014 Share Posted April 16, 2014 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. 1 Link to comment Share on other sites More sharing options...
Marino1988 Posted April 16, 2014 Author Share Posted April 16, 2014 Problem solved, just need to add the percentage formula after the {dispalyPrice price=$total - (($total * 2) / 100)}. 1 Link to comment Share on other sites More sharing options...
3msweb Posted January 9, 2015 Share Posted January 9, 2015 Hi!Good Work! But if i want to add discount to CreditCard?how can i do? Link to comment Share on other sites More sharing options...
Marino1988 Posted January 20, 2015 Author Share Posted January 20, 2015 Do the same. Take the CreditCard module find where the final calculation is being done and add the mathematical equation. 1 Link to comment Share on other sites More sharing options...
bruce_ooi Posted February 27, 2015 Share Posted February 27, 2015 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. Link to comment Share on other sites More sharing options...
Marino1988 Posted February 27, 2015 Author Share Posted February 27, 2015 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 More sharing options...
bruce_ooi Posted February 28, 2015 Share Posted February 28, 2015 Dear Marino1988, Congratulation to you for successfully finding the way to sync the front end figure with back end. That is really an effort there, I must say. Do you mind to share how you do it here in the forum so that everyone benefits from it? I really appreciate your effort, thank you. 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