コード例 #1
0
 /**
  * Returns product info
  *
  * @param stdClass $queryParameters
  * @param array $fieldMap
  * @param string $id
  * @return mixed
  */
 public function getProductInfo(stdClass $queryParameters, array $fieldMap, $id)
 {
     if (!$id) {
         header('HTTP/1.0 404 Not Found');
         return false;
     }
     $productIds = explode('_', $id);
     $specials = $this->config->getSpecials();
     $this->config->setLanguage($queryParameters->lang);
     $this->config->setCurrencyParam($queryParameters->currency);
     $this->config->setStatus($queryParameters->condition);
     $query = $this->config->getQuery($queryParameters->language, $productIds[0]);
     $result = tep_db_query($query);
     if ($row = tep_db_fetch_array($result)) {
         if (isset($specials[$row['products_id']])) {
             $row = array_merge($row, $specials[$row['products_id']]);
         }
         if ($combinations = $this->config->getCombinationsOfAttributes($row)) {
             foreach ($combinations as $key => $values) {
                 $response = $productIds[0];
                 foreach ($values as $value) {
                     $response .= '_' . $value['products_options_value_id'];
                 }
                 if ($id == $response) {
                     $row['attribute'] = $combinations[$key];
                     $article = $this->config->getFeedRow($fieldMap, $row);
                     return $article;
                 }
             }
         } elseif (count($productIds) == 1) {
             $article = $this->config->getFeedRow($fieldMap, $row);
             return $article;
         }
         header('HTTP/1.0 404 Not Found');
         return false;
     } else {
         header('HTTP/1.0 404 Not Found');
         return false;
     }
 }