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