Author Topic: Suggestion for Payment plugin display of 0 price  (Read 1519 times)

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3172
  • VirtueMart Version: 3.8.2
Suggestion for Payment plugin display of 0 price
« on: December 06, 2013, 18:14:28 pm »
The payment plugin returns nothing for the $costDisplay when a price is "0"

It is not possible to style a price in the display of the checkout

I am aware that returning a price of 0.00 will have a negative affect on existing uers and is therefore not a first choice option.

My suggestion is to return a <span> class element that could be manipulated using css

administrator\components\com_virtuemart\plugins\vmpsplugin.php

Code: [Select]
protected function getPluginHtml ($plugin, $selectedPlugin, $pluginSalesPrice) {

$pluginmethod_id = $this->_idName;
$pluginName = $this->_psType . '_name';
if ($selectedPlugin == $plugin->$pluginmethod_id) {
$checked = 'checked="checked"';
} else {
$checked = '';
}

if (!class_exists ('CurrencyDisplay')) {
require(JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php');
}
$currency = CurrencyDisplay::getInstance ();
$costDisplay = "";
if ($pluginSalesPrice) {
$costDisplay = $currency->priceDisplay ($pluginSalesPrice);
$costDisplay = '<span class="' . $this->_type . '_cost"> (' . JText::_ ('COM_VIRTUEMART_PLUGIN_COST_DISPLAY') . $costDisplay . ")</span>";
//new custom element to deal with shipping free over a specified value.
        } else {
            $costDisplay = '<span class="zero_' . $this->_type . '_cost"></span>';
        }


$html = '<input type="radio" name="' . $pluginmethod_id . '" id="' . $this->_psType . '_id_' . $plugin->$pluginmethod_id . '"   value="' . $plugin->$pluginmethod_id . '" ' . $checked . ">\n"
. '<label for="' . $this->_psType . '_id_' . $plugin->$pluginmethod_id . '">' . '<span class="' . $this->_type . '">' . $plugin->$pluginName . $costDisplay . "</span></label>\n";

return $html;
}
regards
A

Joomla 3.9.18
php 7.3