public function getPromotionsForCategories()
 {
     $promotions = $this->db->getAllEntities(self::PROMO_CATEGORIES_TABLENAME, 'promotedAt');
     $categoriesPromos = [];
     foreach ($promotions as $promo) {
         $promoCategory = new PromoCategory($promo);
         if ($promo['isInPromotion'] == '1') {
             array_push($categoriesPromos, $promoCategory);
         }
     }
     return $categoriesPromos;
 }
示例#2
0
 public static function registerDbConfigurations()
 {
     \EShop\Core\Database::setInstance(\EShop\Config\DatabaseConfig::DB_INSTANCE, \EShop\Config\DatabaseConfig::DB_DRIVER, \EShop\Config\DatabaseConfig::DB_USER, \EShop\Config\DatabaseConfig::DB_PASSWORD, \EShop\Config\DatabaseConfig::DB_NAME, \EShop\Config\DatabaseConfig::DB_HOST);
 }
 public function changePassword($userId, $newPassword)
 {
     $isChanged = $this->db->updateEntityById(self::USERS_TABLENAME, array("password" => password_hash($newPassword, AppConfig::PASSWORD_CRYPT_METHOD)), $userId);
     return $isChanged;
 }
 public function remove($id)
 {
     $isDeleted = $this->db->updateEntityById(self::PRODUCTS_TABLENAME, array("is_sold" => 1), $id);
     return $isDeleted;
 }
 public function removeProductsFromCart($cartId, $productId)
 {
     $isRemoved = $this->db->deleteProductFromCart($cartId, $productId);
     return $isRemoved;
 }