/var/www/vhosts/ihelp.ro/httpdocs/src/View/Cell
NameSizeModeActions
Admin/-0755rm
AchievementsCell.php14220644editdlrm
AddAddressCell.php19490644editdlrm
CountFavoritesCell.php15960644editdlrm
CountItemsCartCell.php18450644editdlrm
ListCategoriesCell.php5100644editdlrm
ListCausesCell.php5440644editdlrm
ListProductsCell.php34750644editdlrm
Edit: /var/www/vhosts/ihelp.ro/httpdocs/src/View/Cell/CountItemsCartCell.php (1845B)
loadModel('Carts'); $conditions_cart_product = []; $session = $this->request->getSession(); $countItemsCart = 0; if (!empty($session->check('Auth.id'))) { $userAuthId = $session->read('Auth.id'); } // daca este user logat if (!empty($userAuthId) && $userAuthId) { $cart = $this->Carts->find() ->where(['Carts.user_id' => $userAuthId, 'Carts.is_active' => true]) ->first(); } else { // nu este logat $session = $this->request->getSession(); if ($session->check('cart_identifier')) { $cart_identifier = $session->read('cart_identifier'); $cart = $this->Carts->find() ->where(['Carts.uuid' => $cart_identifier, 'Carts.is_active' => true]) ->first(); } } if (!empty($cart)) { $conditions_cart_product = ['CartProducts.cart_id' => $cart->id]; $countItemsCart = $this->Carts->CartProducts->find() ->contain(['Carts']) ->where($conditions_cart_product) ->count(); } $this->set(compact('countItemsCart')); } }