VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: bishnupanikar on August 18, 2018, 14:21:01 PM

Title: VirtueMart CurrencyDisplay Outside VirtueMartI need to get Rows calculations out
Post by: bishnupanikar on August 18, 2018, 14:21:01 PM
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?

Title: Re: VirtueMart CurrencyDisplay Outside VirtueMartI need to get Rows calculations out
Post by: Studio 42 on August 18, 2018, 15:12:57 PM
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();