Skip to content

Commit

Permalink
Merge pull request #6245 from devansh-webkul/currency-symbol-and-prod…
Browse files Browse the repository at this point in the history
…uct-listing-issue

Currency Symbol #6244 And Product Listing Fixed #6246
  • Loading branch information
jitendra-webkul committed Apr 6, 2022
2 parents 0da87c7 + 1308341 commit 0c5cb7e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
6 changes: 5 additions & 1 deletion packages/Webkul/Admin/src/DataGrids/ProductDataGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,11 @@ public function addColumns()
'sortable' => true,
'filterable' => true,
'closure' => function ($row) {
return "<a href='" . route('shop.productOrCategory.index', $row->url_key) . "' target='_blank'>" . $row->product_name . "</a>";
if (! empty($row->url_key)) {
return "<a href='" . route('shop.productOrCategory.index', $row->url_key) . "' target='_blank'>" . $row->product_name . "</a>";
}

return $row->product_name;
},
]);

Expand Down
13 changes: 7 additions & 6 deletions packages/Webkul/Core/src/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ public function __construct(
protected LocaleRepository $localeRepository,
protected CustomerGroupRepository $customerGroupRepository,
protected CoreConfigRepository $coreConfigRepository
)
{
) {
}

/**
Expand Down Expand Up @@ -246,7 +245,7 @@ public function getAllLocalesByRequestedChannel()

return $data = [
'channel' => $channel,
'locales' => $channel->locales()->orderBy('name')->get()
'locales' => $channel->locales()->orderBy('name')->get(),
];
}

Expand Down Expand Up @@ -598,11 +597,13 @@ public function currency($amount = 0)
/**
* Return currency symbol from currency code.
*
* @param float $price
* @param string|\Webkul\Core\Contracts\Currency $currency
* @return string
*/
public function currencySymbol($code)
public function currencySymbol($currency)
{
$code = $currency instanceof \Webkul\Core\Contracts\Currency ? $currency->code : $currency;

$formatter = new \NumberFormatter(app()->getLocale() . '@currency=' . $code, \NumberFormatter::CURRENCY);

return $formatter->getSymbol(\NumberFormatter::CURRENCY_SYMBOL);
Expand Down Expand Up @@ -1206,7 +1207,7 @@ public function getAdminEmailDetails()
* @param array $array2
* @return array
*/
protected function arrayMerge(array &$array1, array &$array2)
protected function arrayMerge(array&$array1, array&$array2)
{
$merged = $array1;

Expand Down

0 comments on commit 0c5cb7e

Please sign in to comment.