Jump to content

Help with PHP


Recommended Posts

hi all!!!

 

I am trying to add a discount if costumer choose to use payment by bank wire, like 5% of discount on final price.

 

so what i did.

 

I modified bankwire.php

 

function execPayment($cart)
{
	global $cookie, $smarty;
	$precofinal = number_format($cart->getOrderTotal(true, 3), 2, '.', '');
	$percentual = 5.0/100.0;
	$calculo = $precofinal - ($percentual*$precofinal);
	$currencies = Currency::getCurrencies();
	$authorized_currencies = array_flip(explode(',', $this->currencies));
	$currencies_used = array();
	foreach ($currencies as $key => $currency)
		if (isset($authorized_currencies[$currency['id_currency']]))
			$currencies_used[] = $currencies[$key];
	$smarty->assign(array(
		'currency_default' => new Currency(Configuration::get('PS_CURRENCY_DEFAULT')),
		'currencies' => $currencies_used,
		'total' => $calculo,
		'isoCode' => Language::getIsoById(intval($cookie->id_lang)),
		'bankwireHome' => nl2br2($this->home),
		'bankwireOwner' => $this->owner,
		'bankwireIban' => implode('-', array($this->iban_1, $this->iban_2, $this->iban_3)),
		'bankwireBic' => $this->bic,
		'this_path' => $this->_path
	));

	return $this->display(__FILE__, 'payment_execution.tpl');
}

 

well... its working here. but then prestashop use old price in order history.

 

and how to ADD a new information at bankwire mail like {price_to_pay} ?

 

thx

Link to comment
Share on other sites

I'm no help with your question exactly because I have a similar problem.

 

I have thought about working around it by offering a discount code instead.  This is easily set up in the back office.  For example, create a discount code "BANKWIRE" and invite customers to use this code for a 5% discount if paying by bankwire. 

 

Of course, if a customer cheats and uses the code when paying by CC or whatever, then you have a problem.

Link to comment
Share on other sites

×
×
  • Create New...