コード例 #1
0
ファイル: import_products.php プロジェクト: romuland/khparts
 function process($data, $categories, $manufacturer, $warehouse)
 {
     $html = "";
     $session_id = mt_rand();
     $buffer = new Products_Buffer();
     $buffer->init($this->db, $this->table_prefix, $this->buffer_id, $session_id);
     $buffer_result = 0;
     if (count($categories) > 0) {
         foreach ($categories as $category) {
             $html .= $this->manageBuffer($buffer, $data, $categories, $category, $manufacturer, $warehouse, $session_id);
         }
     } else {
         $html .= $this->manageBuffer($buffer, $data, '', '', $manufacturerId, $warehouse, $session_id);
     }
     return $html;
 }
コード例 #2
0
ファイル: import_products.php プロジェクト: romuland/khparts
 function process($data, $categoryId, $parentCategoryId, $manufacturerId, $warehouse)
 {
     $buffer = new Products_Buffer();
     $buffer->init($this->link, $this->table_prefix, $this->buffer_id);
     $buffer_result = 0;
     $buffer_result = $buffer->processRecord($data, $this->product_id, $categoryId, $manufacturerId, $warehouse);
     //Задача по управлению обновлением/добавлением запчастей лежит на классе буффер, здесь только принимаем результат, и выполняем его
     if ($buffer_result > 0) {
         //обновление
         $this->updateExist($data, $buffer_result);
     } elseif ($buffer_result == 0) {
         //добавление
         $this->newProduct($data, $categoryId, $parentCategoryId, $manufacturerId, $warehouse);
     } else {
         //обновление, но обновлять не требуется
     }
     $this->product_id = $this->product_id + 1;
     $this->buffer_id = $this->buffer_id + 1;
 }