display good currency in template

This commit is contained in:
Manuel Raynaud
2013-09-09 21:17:01 +02:00
parent bf46a937c0
commit 1bf2d02477
2 changed files with 23 additions and 3 deletions

View File

@@ -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'),
);
}
}