Пример #1
0
 //return;
 $storeRefID = '7009-' . $store['Id'];
 $storeName = $store['Name'];
 $checkExisted = $objStore->getStoreByRefID($storeRefID);
 //print_r($checkExisted); ;
 if (!$checkExisted) {
     $cityName = $store['City'];
     $city = $objCity->getCityByName($cityName);
     //print_r($city);
     if ($city) {
         $cityID = $city[global_mapping::CityID];
     } else {
         $cityID = $objCity->insert($cityName);
     }
     $districtName = $store['District'];
     $district = $objDistrict->getDistrictByName($districtName);
     //print_r($district);
     if ($district) {
         $districtID = $district[global_mapping::DistrictID];
     } else {
         $districtID = $objDistrict->insert($districtName, $cityID);
     }
     echo 'DistricID:' . $districtID . '<br>';
     echo 'Adding...' . $storeName . '<br>';
     $result = $objStore->insert($storeName, $store['Address'], $districtID, $cityID, '', '', $store['Latitude'], $store['Longitude'], '', $store['MainCategoryId'], $store['PicturePath'], $store['PicturePath'], '', $createdBy, global_common::nowSQL(), $updatedBy, global_common::nowSQL(), null, null, $storeRefID);
     if ($result) {
         $categoryID = 0;
         foreach ($allCats as $cat) {
             if ($cat[global_mapping::Status] == $store['MainCategoryId']) {
                 $categoryID = $cat[global_mapping::ArticleTypeID];
                 break;