/** * @role mass */ public function processMass() { $filter = $this->getSelectFilter(); $act = $this->request->get('act'); $field = array_pop(explode('_', $act, 2)); if ('move' == $act) { new ActiveGrid($this->application, $filter, $this->getClassName()); $cat = Category::getInstanceById($this->request->get('categoryID'), Category::LOAD_DATA); $update = new ARUpdateFilter(); $update->setCondition($filter->getCondition()); $update->addModifier('Product.categoryID', $cat->getID()); $update->joinTable('ProductPrice', 'Product', 'productID AND (ProductPrice.currencyID = "' . $this->application->getDefaultCurrencyCode() . '")', 'ID'); ActiveRecord::beginTransaction(); ActiveRecord::updateRecordSet('Product', $update, Product::LOAD_REFERENCES); Category::recalculateProductsCount(); ActiveRecord::commit(); return new JSONResponse(array('act' => $this->request->get('act')), 'success', $this->translate('_move_succeeded')); } // remove design themes if ('theme' == $act && !$this->request->get('theme')) { ClassLoader::import('application.model.presentation.CategoryPresentation'); ActiveRecord::deleteRecordSet('CategoryPresentation', new ARDeleteFilter($filter->getCondition()), null, array('Product', 'Category')); return new JSONResponse(array('act' => $this->request->get('act')), 'success', $this->translate('_themes_removed')); } $params = array(); if ('manufacturer' == $act) { $params['manufacturer'] = Manufacturer::getInstanceByName($this->request->get('manufacturer')); } else { if ('price' == $act || 'inc_price' == $act) { $params['baseCurrency'] = $this->application->getDefaultCurrencyCode(); $params['price'] = $this->request->get($act); $params['currencies'] = $this->application->getCurrencySet(); $params['inc_price_value'] = $this->request->get('inc_price_value'); $params['inc_quant_price'] = $this->request->get('inc_quant_price'); } else { if ('addRelated' == $act) { $params['relatedProduct'] = Product::getInstanceBySKU($this->request->get('related')); if (!$params['relatedProduct']) { return new JSONResponse(0); } } else { if ($this->request->get('categoryID')) { $params['category'] = Category::getInstanceById($this->request->get('categoryID'), Category::LOAD_DATA); } else { if ('theme' == $act) { ClassLoader::import('application.model.presentation.CategoryPresentation'); $params['theme'] = $this->request->get('theme'); } else { if ('shippingClass' == $act) { $params['shippingClass'] = $this->request->get('shippingClass'); } else { if ('taxClass' == $act) { $params['taxClass'] = $this->request->get('taxClass'); } } } } } } } $response = parent::processMass($params); if ($this->request->get('categoryID')) { Category::recalculateProductsCount(); } return $response; }