VirtueMart CurrencyDisplay Outside VirtueMartI need to get Rows calculations out

Started by bishnupanikar, August 18, 2018, 14:21:01 PM

Previous topic - Next topic

bishnupanikar

I need to get Rows calculations outside VirtueMart. It can be done by:

  shopFunctionsF::calculateProductRowsHeights($products,$currency,$products_per_row);
I got $products, $products_per_row but don't know how to get $currency. If I print out $currency at templates/My template/html/com_virtuemart/sublayouts/products.php I get CurrencyDisplay Object.

And class CurrencyDisplay can't be reached from outside. Any ideas what to send instead CurrencyDisplay Object. Or how to get it outside?


Studio 42

What you mean "outside" ?
If you are in Joomla, you can get it as a module do.
$currency = CurrencyDisplay::getInstance();
In the poorest case, you need to use
defined('DS') or define('DS', DIRECTORY_SEPARATOR);
if (!class_exists( 'VmConfig' )) require(JPATH_ROOT.DS.'administrator'.DS.'components'.DS.'com_virtuemart'.DS.'helpers'.DS.'config.php');
VmConfig::loadConfig();
if (!class_exists('CurrencyDisplay'))
require(VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php');
$currency = CurrencyDisplay::getInstance();