public function service()
 {
     $item_id = intval($this->secure($_REQUEST['item_id']));
     $itemManager = new ItemManager($this->config, $this->args);
     $itemsForOrder = $itemManager->getItemsForOrder($item_id, $this->getUserId(), $this->getUserLevel(), true);
     $header = array("Content-type: multipart/form-data");
     /* $filePath = IMAGE_ROOT_DIR . "/items/" . $item_id . "_1_800_800.jpg";
         $post = array('file' => '@' . $filePath, "size" => filesize($filePath), "name" => $item_id . "_1_800_800.jpg");
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, 'http://www.list.am/img/upload.php');
         curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
         $result = curl_exec($ch);
         curl_close($ch);
        */
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
     curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0');
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_POSTFIELDS, array('price' => $itemManager->exchangeFromUsdToAMD($itemsForOrder->getCustomerItemPrice()), 'location' => $this->getCmsVar('listam_post_location_id'), 'your_email' => $this->getCmsVar('listam_post_email'), 'password' => $this->getCmsVar('listam_account_password'), 'phone_numbers' => $this->getCmsVar('listam_post_phone_number_1'), 'phone_numbers__2' => $this->getCmsVar('listam_post_phone_number_2'), 'title' => 'New ' . substr($itemsForOrder->getDisplayName(), 0, 75) . ' Warranty ' . $itemsForOrder->getWarranty() . ' Months', 'agree' => 1, '_form_confirm' => 1, 'verification_numberetoken' => 'S1ZOxa9+DvSOVrtE5fP9K0WlK6241Q2XQ+UL3em9AW0=', 'verification_number' => '75183', 'currency' => '0', 'ad_type' => '0', '_form_action' => 'Post', 'post_form_visited' => '1', 'ufiles[]' => $item_id . "_1_800_800.jpg", 'description' => substr($itemsForOrder->getDisplayName() . '<br><br>' . $itemsForOrder->getFullDescription(), 0, 16383)));
     curl_setopt($ch, CURLOPT_URL, 'http://www.list.am/add/8');
     $result = curl_exec($ch);
     var_dump($result);
     exit;
     curl_close($ch);
     //$captchaImgSrcStartPos = strpos($result, '<img')+10;
     //$captchaImgSrcEndPos = strpos($result, '"', $captchaImgSrcStartPos + 1);
     //echo substr($result, $captchaImgSrcStartPos, $captchaImgSrcEndPos-$captchaImgSrcStartPos);
     if (strpos($result, 'Հայտարարությունը ավելացված է') !== false) {
         $this->ok();
     } else {
         $this->error();
     }
 }
 public function getItem()
 {
     if (!$this->item) {
         $manager = new ItemManager($this->database);
         $this->item = $manager->findById($this->id_item);
     }
     return $this->item;
 }
Exemplo n.º 3
0
 public function load()
 {
     $item_id = intval($_REQUEST['item_id']);
     $itemManager = ItemManager::getInstance($this->config, $this->args);
     $itemDto = $itemManager->selectByPK($item_id);
     $this->addParam('itemDto', $itemDto);
 }
Exemplo n.º 4
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     parent::__construct('leads_entry_data');
     $this->addProperty('entry', 'int');
     $this->addProperty('name', 'varchar');
     $this->addProperty('value', 'varchar');
 }
Exemplo n.º 5
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     parent::__construct('youtube_group_membership');
     $this->addProperty('id', 'int');
     $this->addProperty('group', 'int');
     $this->addProperty('video', 'int');
 }
Exemplo n.º 6
0
 public function load()
 {
     $dealsManager = DealsManager::getInstance($this->config, $this->args);
     $itemManager = ItemManager::getInstance($this->config, $this->args);
     $this->addParam("itemManager", $itemManager);
     //today deals
     $todayDealDto = $dealsManager->getTodayDeal();
     if ($todayDealDto) {
         $itemId = $todayDealDto->getItemId();
         $todayItem = $itemManager->getItemsForOrder($itemId, $this->getUserId(), $this->getUserLevel(), true);
         if (isset($todayItem) && ($todayItem->getIsDealerOfThisCompany() == 0 || $this->getUserLevel() === UserGroups::$ADMIN)) {
             $totalDurationSeconds = intval($todayDealDto->getDurationMinutes()) * 60;
             $currentTimeInSeconds = time();
             $dealStartTimeInSeconds = strtotime($todayDealDto->getDate() . ' ' . $todayDealDto->getStartTime());
             $dealEndTimeInSeconds = strtotime($todayDealDto->getDate() . ' ' . $todayDealDto->getStartTime()) + $totalDurationSeconds;
             $dealIsEnable = $currentTimeInSeconds > $dealStartTimeInSeconds && $currentTimeInSeconds < $dealEndTimeInSeconds - 10;
             if ($dealIsEnable) {
                 $this->addParam("todayItem", $todayItem);
                 $this->addParam("today_deal_seconds_to_end", $dealEndTimeInSeconds - $currentTimeInSeconds);
                 $this->addParam('today_deal_promo_code', $todayDealDto->getPromoCode());
                 $this->addParam('today_deal_fixed_price', $todayDealDto->getPriceAmd());
             }
         }
     }
     //lighting deals
     /* $lightingDeals = $dealsManager->getLightingDeals();
               if (!empty($lightingDeals)) {
     
               $this->addParam("lightingDeals", $lightingDeals);
               } */
 }
Exemplo n.º 7
0
 public function service()
 {
     $customer = $this->getCustomer();
     $customerEmail = strtolower($customer->getEmail());
     $customerCartManager = CustomerCartManager::getInstance($this->config, $this->args);
     if (isset($_REQUEST['update_basket_count'])) {
         $totalCount = $customerCartManager->getCustomerCartTotalCount($customerEmail);
         $jsonArr = array('status' => "ok", "cart_items_count" => $totalCount);
         echo json_encode($jsonArr);
         return true;
     }
     $add_count = 1;
     if (isset($_REQUEST['add_count'])) {
         $add_count = $this->secure($_REQUEST['add_count']);
     }
     if (isset($_REQUEST['item_id'])) {
         $item_id = $this->secure($_REQUEST['item_id']);
     }
     $itemManager = ItemManager::getInstance($this->config, $this->args);
     if (isset($item_id)) {
         $itemDto = $itemManager->selectByPK($item_id);
         if (!isset($itemDto)) {
             $jsonArr = array('status' => "err", "errText" => "Item is no more available!");
             echo json_encode($jsonArr);
             return false;
         }
         $last_dealer_price = $itemDto->getDealerPrice();
     }
     $customerCartManager->addToCart($customerEmail, $item_id, 0, $last_dealer_price, $add_count);
     $totalCount = $customerCartManager->getCustomerCartTotalCount($customerEmail);
     $jsonArr = array('status' => "ok", "cart_items_count" => $totalCount);
     echo json_encode($jsonArr);
     return true;
 }
Exemplo n.º 8
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     parent::__construct('delivery_intervals');
     $this->addProperty('id', 'int');
     $this->addProperty('days', 'char');
     $this->addProperty('enabled', 'boolean');
 }
Exemplo n.º 9
0
 /**
  * Initializes DB mappers
  *
  * @param object $config
  * @param object $args
  * @return
  */
 function __construct($config, $args)
 {
     $this->mapper = BundleItemsMapper::getInstance();
     $this->config = $config;
     $this->args = $args;
     $this->itemManager = ItemManager::getInstance($this->config, $this->args);
 }
 public function load()
 {
     if (isset($_REQUEST["item_id"])) {
         $item_id = $_REQUEST["item_id"];
         if (strpos($item_id, ',') !== false) {
             $item_id = explode(',', $item_id);
         }
         $itemManager = ItemManager::getInstance($this->config, $this->args);
         $userLevel = $this->getUserLevel();
         $userId = $this->getUserId();
         if (is_array($item_id)) {
             $itemDto = array();
             foreach ($item_id as $key => $itemId) {
                 $itemD = $itemManager->getItemsForOrder($itemId, $userId, $userLevel);
                 if ($itemD != null) {
                     $itemDto[] = $itemD;
                 }
             }
             $itemPicturesCount = 0;
         } else {
             $itemDto = $itemManager->getItemsForOrder($item_id, $userId, $userLevel);
             if ($itemDto == null) {
                 //TODO tell user about that IMPORTANT
                 return;
             }
             $itemPicturesCount = $itemDto->getPicturesCount();
         }
         $this->addParam("item_id", $item_id);
         $this->addParam("item", $itemDto);
         $this->addParam("item_pictures_count", $itemPicturesCount);
         $this->addParam("itemManager", $itemManager);
     }
 }
Exemplo n.º 11
0
 /**
  * Returns an singleton instance of this class
  *
  * @param object $config
  * @param object $args
  * @return
  */
 public static function getInstance($config, $args)
 {
     if (self::$instance == null) {
         self::$instance = new ItemManager($config, $args);
     }
     return self::$instance;
 }
 /**
  * Initializes DB mappers
  *
  * @param object $config
  * @param object $args
  * @return
  */
 function __construct($config, $args)
 {
     $this->config = $config;
     $this->args = $args;
     $this->itemManager = ItemManager::getInstance($this->config, $this->args);
     $this->pcComponentValidatorManager = PcComponentValidatorManager::getInstance($this->config, $this->args);
 }
 /**
  * Constructor
  */
 protected function __construct()
 {
     parent::__construct('shop_item_size_values');
     $this->addProperty('id', 'int');
     $this->addProperty('definition', 'int');
     $this->addProperty('value', 'ml_varchar');
 }
Exemplo n.º 14
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     parent::__construct('license_modules');
     $this->addProperty('id', 'int');
     $this->addProperty('license', 'int');
     $this->addProperty('module', 'varchar');
 }
Exemplo n.º 15
0
 public function load()
 {
     $company_id = $_REQUEST['company_id'];
     $used_columns_indexes_array = array(2, 1, 9, 3, 4, 5, 6, 7);
     //explode(',', $_REQUEST['used_columns_indexes']);
     $importItemsTempManager = ImportItemsTempManager::getInstance($this->config, $this->args);
     $categoryHierarchyManager = CategoryHierarchyManager::getInstance($this->config, $this->args);
     $categoryManager = CategoryManager::getInstance($this->config, $this->args);
     $customerLogin = $this->getCustomerLogin();
     $priceRowsDtos = $importItemsTempManager->getUserCurrentPriceChangedRows($customerLogin);
     $columnNames = ImportPriceManager::getColumnNamesMap($used_columns_indexes_array);
     $rootDto = $categoryManager->getRoot();
     $firstLevelCategoriesHierarchyDtos = $categoryHierarchyManager->getCategoryChildren($rootDto->getId());
     $firstLevelCategoriesNamesDtos = $categoryHierarchyManager->getCategoriesNamesByParentCategoryId($rootDto->getId());
     $firstLevelCategoriesIds = array();
     foreach ($firstLevelCategoriesHierarchyDtos as $key => $category) {
         $firstLevelCategoriesIds[] = $category->getChildId();
     }
     $firstLevelCategoriesNames = array();
     foreach ($firstLevelCategoriesNamesDtos as $key => $category) {
         $firstLevelCategoriesNames[] = $category->getDisplayName();
     }
     $itemManager = ItemManager::getInstance($this->config, $this->args);
     $companyAllItems = $itemManager->getCompanyItems($company_id, true);
     $convertDtosArrayToArrayMapById = $this->convertDtosArrayToArrayMapById($companyAllItems);
     $this->addParam('stockItemsDtosMappedByIds', $convertDtosArrayToArrayMapById);
     $this->addParam('columnNames', $columnNames);
     $this->addParam('priceRowsDtos', $priceRowsDtos);
     $this->addParam('firstLevelCategoriesNames', $firstLevelCategoriesNames);
     $this->addParam('firstLevelCategoriesIds', $firstLevelCategoriesIds);
     list($changedRowIds, $changedFields) = $this->findChanges($priceRowsDtos, $convertDtosArrayToArrayMapById, $columnNames);
     $this->addParam('changedRowsIds', $changedRowIds);
     $this->addParam('changedFields', $changedFields);
 }
Exemplo n.º 16
0
 public function load()
 {
     $companyManager = CompanyManager::getInstance($this->config, $this->args);
     $customer = $this->sessionManager->getUser();
     $userLevel = $customer->getLevel();
     if ($userLevel == UserGroups::$ADMIN) {
         $allCompaniesDtos = $companyManager->getAllCompanies(true, true);
     } else {
         $allCompaniesDtos = array($companyManager->selectByPK($customer->getId()));
     }
     $allCompaniesNames = array();
     $allCompaniesIds = array();
     foreach ($allCompaniesDtos as $key => $company) {
         $allCompaniesNames[] = $company->getName();
         $allCompaniesIds[] = $company->getId();
     }
     if (isset($_REQUEST["company_id"])) {
         $selectedCompanyId = $this->secure($_REQUEST["company_id"]);
     } else {
         $selectedCompanyId = $allCompaniesIds[0];
     }
     $this->addParam('selectedCompanyId', $selectedCompanyId);
     $this->addParam('allCompaniesNames', $allCompaniesNames);
     $this->addParam('allCompaniesIds', $allCompaniesIds);
     $itemManager = ItemManager::getInstance($this->config, $this->args);
     $allCompanyItems = $itemManager->getCompanyItems($selectedCompanyId, true);
     $this->addParam('company_items', $allCompanyItems);
     if (isset($_COOKIE['copied_item_id'])) {
         $this->addParam('copied_item_id', $_COOKIE['copied_item_id']);
     }
     $this->addParam('itemManager', $itemManager);
 }
Exemplo n.º 17
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     parent::__construct('shop_discounts');
     $this->addProperty('id', 'int');
     $this->addProperty('discount', 'int');
     $this->addProperty('item', 'int');
 }
Exemplo n.º 18
0
 public function load()
 {
     //Load First Level Categories from DB
     $categoryManager = CategoryManager::getInstance($this->config, $this->args);
     $categoryHierarchyManager = CategoryHierarchyManager::getInstance($this->config, $this->args);
     $rootDto = $categoryManager->getRoot();
     $firstLevelCategoriesHierarchyDtos = $categoryHierarchyManager->getCategoryChildren($rootDto->getId());
     $firstLevelCategoriesNamesDtos = $categoryHierarchyManager->getCategoriesNamesByParentCategoryId($rootDto->getId());
     $firstLevelCategoriesIds = array();
     foreach ($firstLevelCategoriesHierarchyDtos as $key => $category) {
         $firstLevelCategoriesIds[] = $category->getChildId();
     }
     $firstLevelCategoriesNames = array();
     foreach ($firstLevelCategoriesNamesDtos as $key => $category) {
         $firstLevelCategoriesNames[] = $category->getDisplayName();
     }
     $this->addParam('firstLevelCategoriesNames', $firstLevelCategoriesNames);
     $this->addParam('firstLevelCategoriesIds', $firstLevelCategoriesIds);
     $item_warranty_options = explode(',', $this->getCmsVar('item_warranty_options'));
     $this->addParam('item_warranty_options', $item_warranty_options);
     $itemManager = ItemManager::getInstance($this->config, $this->args);
     if (isset($_REQUEST['item_id'])) {
         $itemId = $this->secure($_REQUEST['item_id']);
         $itemDto = $itemManager->selectByPK($itemId);
         $this->addParam('item_pictures_count', $itemDto->getPicturesCount());
         $this->addParam('item_id', $itemDto->getId());
         $this->addParam('item_title', $itemDto->getDisplayName());
         $this->addParam('item_available', $itemManager->isItemAvailable($itemDto));
         $this->addParam('short_description', $itemDto->getShortDescription());
         $this->addParam('full_description', $itemDto->getFullDescription());
         $this->addParam('dealer_price', $itemDto->getDealerPrice());
         $this->addParam('vat_price', $itemDto->getVatPrice());
         $this->addParam('dealer_price_amd', $itemDto->getDealerPriceAmd());
         $this->addParam('vat_price_amd', $itemDto->getVatPriceAmd());
         $this->addParam('selected_warranty_option', $itemDto->getWarranty());
         $this->addParam('item_model', $itemDto->getModel());
         $this->addParam('item_brand', $itemDto->getBrand());
         $this->addParam('order_index_in_price', $itemDto->getOrderIndexInPrice());
         $this->addParam('item_available_till_date', $itemDto->getItemAvailableTillDate());
         $itemCategoriesIds = $itemDto->getCategoriesIds();
         $itemCategoriesIds = trim($itemCategoriesIds, ',');
         assert(!empty($itemCategoriesIds));
         $itemCategoriesIds = explode(',', $itemCategoriesIds);
         $selectedRootCategoryId = $itemCategoriesIds[0];
         $subCategoriesIdsArray = array_slice($itemCategoriesIds, 1);
         $this->addParam('selectedRootCategoryId', $selectedRootCategoryId);
         $this->addParam('sub_categories_ids', join(',', $subCategoriesIdsArray));
     } else {
         $selectedRootCategoryId = $firstLevelCategoriesHierarchyDtos[0]->getChildId();
         $this->addParam('selected_warranty_option', $item_warranty_options[12]);
         $this->addParam('selectedRootCategoryId', $selectedRootCategoryId);
         $this->addParam('sub_categories_ids', '');
     }
     $item_availability_options_names = array("Today", "2 days", "3 days", "1 week", "2 weeks", "1 month");
     $item_availability_options_values = array(0, 1, 2, 6, 13, 29);
     $this->addParam('item_availability_options_names', $item_availability_options_names);
     $this->addParam('item_availability_options_values', $item_availability_options_values);
     $this->addParam('item_availability_selected', $item_availability_options_values[3]);
     $this->addParam('company_id', intval($this->secure($_REQUEST["company_id"])));
 }
 /**
  * Constructor
  */
 protected function __construct()
 {
     parent::__construct('gallery_group_membership');
     $this->addProperty('id', 'int');
     $this->addProperty('group', 'int');
     $this->addProperty('container', 'int');
 }
 /**
  * Constructor
  */
 protected function __construct()
 {
     parent::__construct('sapphire_waves_statistics');
     $this->addProperty('id', 'int');
     $this->addProperty('user', 'int');
     $this->addProperty('usage', 'int');
     $this->addProperty('timestamp', 'date');
 }
Exemplo n.º 21
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     parent::__construct('faq');
     $this->addProperty('id', 'int');
     $this->addProperty('question', 'ml_text');
     $this->addProperty('answer', 'ml_text');
     $this->addProperty('visible', 'boolean');
 }
Exemplo n.º 22
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     parent::__construct('shop_manufacturers');
     $this->addProperty('id', 'int');
     $this->addProperty('name', 'ml_varchar');
     $this->addProperty('web_site', 'varchar');
     $this->addProperty('logo', 'int');
 }
Exemplo n.º 23
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     parent::__construct('contact_form_submission_fields');
     $this->addProperty('id', 'int');
     $this->addProperty('submission', 'int');
     $this->addProperty('field', 'int');
     $this->addProperty('value', 'text');
 }
 public function service()
 {
     $itemManager = ItemManager::getInstance($this->config, $this->args);
     $itemManager->UpdateAllAmdItemsPrices();
     $jsonArr = array('status' => "ok");
     echo json_encode($jsonArr);
     return true;
 }
Exemplo n.º 25
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     parent::__construct('user_page_items');
     $this->addProperty('id', 'int');
     $this->addProperty('page', 'int');
     $this->addProperty('type', 'int');
     $this->addProperty('item', 'int');
 }
Exemplo n.º 26
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     parent::__construct('sapphire_waves_trial');
     $this->addProperty('id', 'int');
     $this->addProperty('address', 'varchar');
     $this->addProperty('times_used', 'int');
     $this->addProperty('timestamp', 'int');
 }
Exemplo n.º 27
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     parent::__construct('licenses');
     $this->addProperty('id', 'int');
     $this->addProperty('license', 'varchar');
     $this->addProperty('domain', 'varchar');
     $this->addProperty('active', 'boolean');
 }
Exemplo n.º 28
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     parent::__construct('delivery_times');
     $this->addProperty('interval', 'int');
     $this->addProperty('start', 'time');
     $this->addProperty('end', 'time');
     $this->addProperty('amount', 'decimal');
 }
Exemplo n.º 29
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     parent::__construct('gallery_containers');
     $this->addProperty('id', 'int');
     $this->addProperty('text_id', 'varchar');
     $this->addProperty('name', 'ml_varchar');
     $this->addProperty('description', 'ml_text');
 }
Exemplo n.º 30
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     parent::__construct('shop_stock');
     $this->addProperty('id', 'int');
     $this->addProperty('item', 'int');
     $this->addProperty('size', 'int');
     $this->addProperty('amount', 'int');
 }