Beispiel #1
0
 public static function getStoreInfo($storeId)
 {
     $doctrine = self::$servicelocator->get('doctrine');
     $storeModel = new menuStoreModel($doctrine);
     $store = $storeModel->findOneBy(array('id' => $storeId));
     if ($store) {
         return $store;
     }
     return new MenuStore();
 }
 public static function checkAndSendNotifyEmail()
 {
     $config = Utility::getConfig();
     $translator = Utility::translate();
     $doctrine = self::$servicelocator->get('doctrine');
     $menuStoreModel = new menuStoreModel($doctrine);
     $menuStore = $menuStoreModel->findAll();
     foreach ($menuStore as $store) {
         $store = $menuStoreModel->findOneBy(array('id' => $store->getId()));
         if ($store->getOutOfStock() == -1) {
             $outOfStock = $config['out_of_stock'];
         } else {
             $outOfStock = $store->getOutOfStock();
         }
         $compare = self::getMenuItemQuantityInStore($store->getId());
         $data = array('name' => $store->getName(), 'inStore' => $compare, 'unit' => $store->getUnit());
         $subject = $translator->translate('Out of stock');
         $receiveEmail = $config['emailId'];
         if ($compare < $outOfStock) {
             Utility::sendEmail('emptystore', $data, $subject, $receiveEmail, true);
         }
     }
 }