Suggestion for Payment plugin display of 0 price

Started by AH, December 06, 2013, 18:14:28 PM

Previous topic - Next topic

AH

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


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.10.11
php 8.0