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\Core\Template\Smarty\SmartyPluginDescriptor;
|
||||||
use Thelia\Model\CategoryQuery;
|
use Thelia\Model\CategoryQuery;
|
||||||
use Thelia\Model\ContentQuery;
|
use Thelia\Model\ContentQuery;
|
||||||
|
use Thelia\Model\CurrencyQuery;
|
||||||
use Thelia\Model\FolderQuery;
|
use Thelia\Model\FolderQuery;
|
||||||
use Thelia\Model\Product;
|
use Thelia\Model\Product;
|
||||||
use Thelia\Model\ProductQuery;
|
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 $objectLabel
|
||||||
* @param $params
|
* @param $params
|
||||||
@@ -231,6 +250,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin
|
|||||||
new SmartyPluginDescriptor('function', 'category', $this, 'categoryDataAccess'),
|
new SmartyPluginDescriptor('function', 'category', $this, 'categoryDataAccess'),
|
||||||
new SmartyPluginDescriptor('function', 'content', $this, 'contentDataAccess'),
|
new SmartyPluginDescriptor('function', 'content', $this, 'contentDataAccess'),
|
||||||
new SmartyPluginDescriptor('function', 'folder', $this, 'folderDataAccess'),
|
new SmartyPluginDescriptor('function', 'folder', $this, 'folderDataAccess'),
|
||||||
|
new SmartyPluginDescriptor('function', 'currency', $this, 'currencyDataAccess'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,10 +130,10 @@ URL: http://www.thelia.net
|
|||||||
|
|
||||||
<div class="currency-switch" aria-labelledby="currency-label">
|
<div class="currency-switch" aria-labelledby="currency-label">
|
||||||
<span id="currency-label" class="dropdown-label">{intl l="Currency"}:</span>
|
<span id="currency-label" class="dropdown-label">{intl l="Currency"}:</span>
|
||||||
<a class="current dropdown-toggle" data-toggle="dropdown" href="currency.html">USD</a>
|
<a class="current dropdown-toggle" data-toggle="dropdown" href="currency.html">{currency attr="code"}</a>
|
||||||
<ul class="select dropdown-menu">
|
<ul class="select dropdown-menu">
|
||||||
{loop type="currency" name="currency_available" }
|
{loop type="currency" name="currency_available" exclude="{currency attr="id"}" }
|
||||||
<li><a href="?cur=euro">{#SYMBOL} - {#NAME}</a></li>
|
<li><a href="?currency={#ISOCODE}">{#SYMBOL} - {#NAME}</a></li>
|
||||||
{/loop}
|
{/loop}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user