private function _updateCategories(Product &$product, $param)
 {
     //update categories
     if (isset($param->CallbackParameter->categoryIds) && count($categoryIds = $param->CallbackParameter->categoryIds) > 0) {
         Product_Category::deleteByCriteria('productId = ?', array(trim($product->getId())));
         foreach ($categoryIds as $categoryId) {
             if (!($category = ProductCategory::get($categoryId))) {
                 continue;
             }
             Product_Category::create($product, $category);
         }
     }
     return $this;
 }
Beispiel #2
0
 /**
  * clearing all the categories to this product
  *
  * @param ProductCategory $category
  *
  * @return Product
  */
 public function clearAllCategory()
 {
     Product_Category::deleteByCriteria('productId = ?', array($this->getId()));
     return $this;
 }