Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 /**
  * adding the category to this product
  *
  * @param ProductCategory $category
  *
  * @return Product
  */
 public function addCategory(ProductCategory $category)
 {
     Product_Category::create($this, $category);
     return $this;
 }