Paypal Showing a wrong percentual amount at checkout vm3.0.4
Posted: Thu Feb 12, 2015 4:42 pm
Hello friends, we just discovered a small bug with Paypal payment in case you are using percentual fees within your checkout. The Paypal is not capable of calculating the percentual fee within the rendred payment's method output.
to fix this problem, open your:
\plugins\vmpayment\paypal\paypal.php
find this function:
public function plgVmDisplayListFEPayment(VirtueMartCart $cart, $selected = 0, &$htmlIn) {
the problem is caused by these lines:
now update whole function so it looks like this (per standard payment method specifications):
enjoy, best regards, stan
to fix this problem, open your:
\plugins\vmpayment\paypal\paypal.php
find this function:
public function plgVmDisplayListFEPayment(VirtueMartCart $cart, $selected = 0, &$htmlIn) {
the problem is caused by these lines:
- Code: Select all
$cart_prices = array();
$cart_prices['withTax'] = '';
$cart_prices['salesPrice'] = '';
now update whole function so it looks like this (per standard payment method specifications):
- Code: Select all
/**
* * List payment methods selection
* @param VirtueMartCart $cart
* @param int $selected
* @param $htmlIn
* @return bool
*/
public function plgVmDisplayListFEPayment(VirtueMartCart $cart, $selected = 0, &$htmlIn) {
if ($this->getPluginMethods($cart->vendorId) === 0) {
if (empty($this->_name)) {
$app = JFactory::getApplication();
$app->enqueueMessage(vmText::_('COM_VIRTUEMART_CART_NO_' . strtoupper($this->_psType)));
return false;
} else {
return false;
}
}
$method_name = $this->_psType . '_name';
$htmla = array();
foreach ($this->methods as $this->_currentMethod) {
if ($this->checkConditions($cart, $this->_currentMethod, $cart->cartPrices)) {
$html = '';
if (empty($cart->cartPrices))
{
$cart_prices = array();
$cart_prices['withTax'] = '';
$cart_prices['salesPrice'] = '';
}
else
$cart_prices= $cart->cartPrices;
$methodSalesPrice = $this->setCartPrices($cart, $cart_prices, $this->_currentMethod);
$this->_currentMethod->$method_name = $this->renderPluginName($this->_currentMethod);
$html .= $this->getPluginHtml($this->_currentMethod, $selected, $methodSalesPrice);
if ($this->_currentMethod->paypalproduct == 'api') {
if (empty($this->_currentMethod->creditcards)) {
$this->_currentMethod->creditcards = PaypalHelperPaypal::getPaypalCreditCards();
} elseif (!is_array($this->_currentMethod->creditcards)) {
$this->_currentMethod->creditcards = (array)$this->_currentMethod->creditcards;
}
$html .= $this->renderByLayout('creditcardform', array('creditcards' => $this->_currentMethod->creditcards,
'virtuemart_paymentmethod_id' => $this->_currentMethod->virtuemart_paymentmethod_id,
'method' => $this->_currentMethod,
'sandbox' => $this->_currentMethod->sandbox,
'customerData' => $this->customerData));
}
if ($this->_currentMethod->payment_type == '_xclick-auto-billing' && $this->_currentMethod->billing_max_amount_type == 'cust') {
$html .= $this->renderByLayout('billingmax', array("method" => $this->_currentMethod, "customerData" => $this->customerData));
}
if ($this->_currentMethod->payment_type == '_xclick-subscriptions') {
$paypalInterface = $this->_loadPayPalInterface();
$html .= '<br/><span class="vmpayment_cardinfo">' . $paypalInterface->getRecurringProfileDesc() . '</span>';
}
if ($this->_currentMethod->payment_type == '_xclick-payment-plan') {
$paypalInterface = $this->_loadPayPalInterface();
$html .= '<br/><span class="vmpayment_cardinfo">' . $paypalInterface->getPaymentPlanDesc() . '</span>';
}
$htmla[] = $html;
}
}
$htmlIn[] = $htmla;
return true;
}
enjoy, best regards, stan