Exemplo n.º 1
0
 public function getProductPriceByProduct($objID, $selectField = '*')
 {
     $selectField = $selectField ? $selectField : '*';
     $strSQL .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, self::TBL_SL_PRODUCT_PRICE, 'WHERE ProductID = \'' . $objID . '\' '));
     //echo '<br>SQL:'.$strSQL;
     $arrResult = $this->_objConnection->selectCommand($strSQL);
     if (!$arrResult) {
         global_common::writeLog('get sl_product_price ByID:' . $strSQL, 1, $_mainFrame->pPage);
         return null;
     }
     $objStatus = new Model_Status($this->_objConnection);
     $allStatus = $objStatus->getAllStatus();
     $statuses = array();
     foreach ($allStatus as $key => $info) {
         $statuses[$info[global_mapping::StatusID]] = $info;
         unset($allStatus[$key]);
     }
     //print_r($statuses);
     $count = count($arrResult);
     for ($index = 0; $index < $count; $index++) {
         //print_r($statuses[$arrResult[$index][global_mapping::TypeID]]);
         if ($statuses[$arrResult[$index][global_mapping::TypeID]]) {
             $pathCode = $statuses[$arrResult[$index][global_mapping::TypeID]][global_mapping::ExtraInfo];
             //echo$arrResult[$index][global_mapping::ProductLink];
             try {
                 $arrResult[$index][global_mapping::Price] = global_common::getPriceFromURL($arrResult[$index][global_mapping::ProductLink], $pathCode);
             } catch (Exception $ex) {
                 //$arrResult[$index]
             }
         }
     }
     //print_r($arrResult);
     return $arrResult;
 }