display good currency in template
This commit is contained in:
@@ -31,6 +31,7 @@ use Thelia\Core\Template\ParserContext;
|
||||
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
|
||||
use Thelia\Model\CategoryQuery;
|
||||
use Thelia\Model\ContentQuery;
|
||||
use Thelia\Model\CurrencyQuery;
|
||||
use Thelia\Model\FolderQuery;
|
||||
use Thelia\Model\Product;
|
||||
use Thelia\Model\ProductQuery;
|
||||
@@ -132,6 +133,24 @@ class DataAccessFunctions extends AbstractSmartyPlugin
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* currency global data
|
||||
*
|
||||
* @param $params
|
||||
* @param $smarty
|
||||
*/
|
||||
public function currencyDataAccess($params, $smarty)
|
||||
{
|
||||
$currency = $this->request->getSession()->getCurrency();
|
||||
|
||||
if ($currency) {
|
||||
$currencyQuery = CurrencyQuery::create()
|
||||
->filterById($currency->getId());
|
||||
|
||||
return $this->dataAccessWithI18n("Currency", $params, $currencyQuery, array("NAME"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $objectLabel
|
||||
* @param $params
|
||||
@@ -231,6 +250,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin
|
||||
new SmartyPluginDescriptor('function', 'category', $this, 'categoryDataAccess'),
|
||||
new SmartyPluginDescriptor('function', 'content', $this, 'contentDataAccess'),
|
||||
new SmartyPluginDescriptor('function', 'folder', $this, 'folderDataAccess'),
|
||||
new SmartyPluginDescriptor('function', 'currency', $this, 'currencyDataAccess'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user