mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-13 00:36:04 -06:00
commit
e548ab5af3
@ -197,10 +197,16 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -812,9 +812,8 @@ class AdvsController extends PublicController
|
||||
}
|
||||
}
|
||||
|
||||
public function advAddCart($id)
|
||||
public function advAddCart($id, $quantity = 1)
|
||||
{
|
||||
$quantity = 1;
|
||||
$thisModel = new AdvModel();
|
||||
$adv = $thisModel->isAdv($id);
|
||||
$response = array();
|
||||
@ -825,7 +824,7 @@ class AdvsController extends PublicController
|
||||
$response['status'] = "error";
|
||||
$response['msg'] = trans('visiosoft.module.advs::message.error_added_cart');
|
||||
}
|
||||
return redirect('/cart/');
|
||||
return back();
|
||||
}
|
||||
|
||||
public function addCart(Request $request)
|
||||
|
||||
@ -2711,7 +2711,6 @@ a.verified i {
|
||||
}
|
||||
|
||||
.user-account input {
|
||||
height: 44px;
|
||||
margin-bottom: 30px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
@ -119,6 +119,7 @@
|
||||
|
||||
|
||||
{% if entries('advs').isEnabled('carts') %}
|
||||
{% if auth_check() %}
|
||||
{% set cart_items = entries('carts').getCart() %}
|
||||
{% set cart = entries('carts').get()[0] %}
|
||||
<li class="dropdown">
|
||||
@ -156,6 +157,10 @@
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
{% else %}
|
||||
{% include "visiosoft.module.carts::nav" %}
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
<li class="new-ads-navigation-field"><a href="/advs/create_adv"
|
||||
|
||||
@ -9,6 +9,9 @@ use Anomaly\UsersModule\User\Event\UserWasLoggedIn;
|
||||
use Anomaly\UsersModule\User\User;
|
||||
use Anomaly\UsersModule\User\UserPassword;
|
||||
use Visiosoft\AdvsModule\Adv\AdvModel;
|
||||
use Visiosoft\AdvsModule\Http\Controller\AdvsController;
|
||||
use Visiosoft\CartsModule\Saleitem\Command\ProcessSaleitem;
|
||||
use Visiosoft\CartsModule\Saleitem\SaleitemModel;
|
||||
use Visiosoft\CloudsiteModule\Site\Event\CreateSite;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
@ -99,6 +102,15 @@ 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();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user