remove old cookie function && update currency method

This commit is contained in:
vedatakd 2020-01-15 13:02:51 +03:00
parent 947f03dc69
commit 393f50f04e
4 changed files with 5 additions and 17 deletions

View File

@ -2,7 +2,7 @@
{% if blocks('ad-item-details-block-area') is null %}
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 offered-field offered-row">
<h3 class="ad-price">
<b>{{ adv.price.format() }}</b> {{ adv.currency }}
<b>{{ currency_symbol(adv.currency) }}{{ adv.price.format() }}</b>
<!-- priceField with Block -->
{{ addBlock('ad-detail/priceField',{'adv':adv})|raw }}

View File

@ -219,14 +219,9 @@ class AdvModel extends AdvsAdvsEntryModel implements AdvInterface
public function addCart($item, $quantity = 1)
{
if (Auth::user()) {
$cart = $this->dispatch(new GetCart());
$cart->add($item, $quantity);
return $this->dispatch(new GetCart());
} else {
setcookie("cart[" . $item->id . "]", $quantity, time() + 3600, '/', NULL, 0);
}
$cart = $this->dispatch(new GetCart());
$cart->add($item, $quantity);
return $this->dispatch(new GetCart());
}

View File

@ -1014,7 +1014,7 @@ class AdvsController extends PublicController
$point = ".";
$response['newPrice'] = number_format($response['newPrice'], $decimals, $point, str_replace('&#160;', ' ', $separator));
$symbol = config('streams::currencies.supported.' . strtoupper(setting_value('streams::currency')) . '.symbol');
$symbol = config('streams::currencies.supported.' . strtoupper($adv->currency) . '.symbol');
$response['newPrice'] = $symbol . $response['newPrice'];
$response['status'] = $status;

View File

@ -103,13 +103,6 @@ class UserAuthenticator
if ($response = $this->authenticate($credentials)) {
if ($response instanceof UserInterface) {
$this->login($response, $remember);
if (isset($_COOKIE['cart'])) {
foreach ($_COOKIE['cart'] as $adv => $quantity) {
$advs = new AdvsController();
$advs->advAddCart($adv, $quantity);
setcookie("cart[" . $adv . "]", null, -1, '/');
}
}
return Redirect::back();
}
}