Merge pull request #2546 from rahulshukla-webkul/development
Development
This commit is contained in:
commit
c52e19d53d
|
|
@ -50,6 +50,8 @@ class ProductDataGrid extends DataGrid
|
|||
|
||||
if ($this->locale !== 'all') {
|
||||
$queryBuilder->where('locale', $this->locale);
|
||||
} else {
|
||||
$queryBuilder->whereNotNull('product_flat.name');
|
||||
}
|
||||
|
||||
if ($this->channel !== 'all') {
|
||||
|
|
|
|||
|
|
@ -353,13 +353,28 @@ class Core
|
|||
*
|
||||
* @param float $amount
|
||||
* @param string $targetCurrencyCode
|
||||
* @param string $orderCurrencyCode
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function convertPrice($amount, $targetCurrencyCode = null)
|
||||
public function convertPrice($amount, $targetCurrencyCode = null, $orderCurrencyCode = null)
|
||||
{
|
||||
if (! isset($this->lastCurrencyCode))
|
||||
if (! isset($this->lastCurrencyCode)) {
|
||||
$this->lastCurrencyCode = $this->getBaseCurrency()->code;
|
||||
}
|
||||
|
||||
if ($orderCurrencyCode) {
|
||||
if (! isset($this->lastOrderCode)) {
|
||||
$this->lastOrderCode = $orderCurrencyCode;
|
||||
}
|
||||
|
||||
if (($targetCurrencyCode != $this->lastOrderCode) &&
|
||||
($targetCurrencyCode != $orderCurrencyCode) &&
|
||||
($orderCurrencyCode != $this->getBaseCurrencyCode()) &&
|
||||
($orderCurrencyCode != $this->lastCurrencyCode)) {
|
||||
$amount = $this->convertToBasePrice($amount, $orderCurrencyCode);
|
||||
}
|
||||
}
|
||||
|
||||
$targetCurrency = ! $targetCurrencyCode
|
||||
? $this->getCurrentCurrency()
|
||||
|
|
@ -439,27 +454,37 @@ class Core
|
|||
return $formatter->getSymbol(\NumberFormatter::CURRENCY_SYMBOL);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Format and convert price with currency symbol
|
||||
*
|
||||
* @param float $price
|
||||
* @param float $price
|
||||
* @param string $currencyCode
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function formatPrice($price, $currencyCode)
|
||||
{
|
||||
if (is_null($price))
|
||||
$code = $this->getCurrentCurrency()->code;
|
||||
|
||||
if (is_null($price)) {
|
||||
$price = 0;
|
||||
} else {
|
||||
if ($code != $currencyCode) {
|
||||
$price = $this->convertPrice($price, $code, $currencyCode);
|
||||
}
|
||||
}
|
||||
|
||||
$formater = new \NumberFormatter(app()->getLocale(), \NumberFormatter::CURRENCY);
|
||||
$symbol = $this->getCurrentCurrency()->symbol;
|
||||
|
||||
if ($symbol) {
|
||||
|
||||
if ($symbol = $this->getCurrentCurrency()->symbol) {
|
||||
if ($this->currencySymbol($currencyCode) == $symbol) {
|
||||
return $formater->formatCurrency($price, $currencyCode);
|
||||
} else {
|
||||
$formater->setSymbol(\NumberFormatter::CURRENCY_SYMBOL, $symbol);
|
||||
|
||||
return $formater->format($this->convertPrice($price));
|
||||
return $formater->format($price); // $this->convertPrice($price, $code)
|
||||
}
|
||||
} else {
|
||||
return $formater->formatCurrency($price, $currencyCode);
|
||||
|
|
|
|||
|
|
@ -68,13 +68,13 @@
|
|||
<td data-value="{{ __('shop::app.customer.account.order.view.SKU') }}">
|
||||
{{ $item->getTypeInstance()->getOrderedItem($item)->sku }}
|
||||
</td>
|
||||
|
||||
|
||||
<td data-value="{{ __('shop::app.customer.account.order.view.product-name') }}">
|
||||
{{ $item->name }}
|
||||
|
||||
|
||||
@if (isset($item->additional['attributes']))
|
||||
<div class="item-options">
|
||||
|
||||
|
||||
@foreach ($item->additional['attributes'] as $attribute)
|
||||
<b>{{ $attribute['attribute_name'] }} : </b>{{ $attribute['option_label'] }}</br>
|
||||
@endforeach
|
||||
|
|
|
|||
Loading…
Reference in New Issue