public function applyToItem(BusinessRuleProductInterface $item)
 {
     $taxClassID = $this->getFieldValue('taxClassID', -1);
     if ($taxClassID > 0) {
         $product = $item->getProduct();
         if ($product instanceof Product) {
             // ff('setting custom tax class ID: '.$taxClassID);
             $product->setTemporaryTaxClass(TaxClass::getInstanceByID($taxClassID));
         }
     }
 }
Esempio n. 2
0
 /**
  * @role update
  */
 public function sort()
 {
     foreach ($this->request->get($this->request->get('target'), array()) as $position => $key) {
         $class = TaxClass::getInstanceByID((int) $key);
         $class->position->set((int) $position);
         $class->save();
     }
     return new JSONResponse(false, 'success');
 }