/** * Populate model object properties by the passed data * * @param array $data Data to set * * @return void */ protected function setModelProperties(array $data) { $data['useCustomOG'] = $this->getPostedData('useCustomOG'); $nonFilteredData = \XLite\Core\Request::getInstance()->getNonFilteredData(); $data['ogMeta'] = isset($nonFilteredData['postedData']['ogMeta']) ? $nonFilteredData['postedData']['ogMeta'] : ''; parent::setModelProperties($data); }
/** * Update product categories * * @param \XLite\Model\Product $model Product model * @param array $categoryIds List of IDs of new categories * * @return void */ protected function updateProductCategories($model, $categoryIds) { $categoriesToRemoveCache = array(); // List of old category IDs $oldCategoryIds = array(); // Get old category IDs list $oldCategoryProducts = $model->getCategoryProducts()->toArray(); if (!empty($oldCategoryProducts)) { foreach ($oldCategoryProducts as $cp) { $oldCategoryIds[] = $cp->getCategory()->getCategoryId(); if (!in_array($cp->getCategory()->getCategoryId(), $categoryIds)) { $categoriesToRemoveCache[] = $cp->getCategory()->getCategoryId(); } } } $categoriesToRemoveCache = array_merge($categoriesToRemoveCache, array_diff($categoryIds, $oldCategoryIds)); if ($categoriesToRemoveCache) { \XLite\Core\Database::getRepo('XLite\\Model\\Category')->removeProductFilterCache($categoriesToRemoveCache); } parent::updateProductCategories($model, $categoryIds); }
/** * Populate model object properties by the passed data. * Specific wrapper for setModelProperties method. * * @param array $data Data to set * * @return void */ protected function updateModelProperties(array $data) { if ($data['freeShip']) { $data['freeShip'] = 'Y' == $data['freeShip']; } parent::updateModelProperties($data); }
/** * Populate model object properties by the passed data * * @param array $data Data to set * * @return void */ protected function setModelProperties(array $data) { $participateSale = $this->getPostedData('participateSale'); $data['participateSale'] = false; if ($participateSale) { $data['participateSale'] = true; $data['discountType'] = $this->getPostedData('discountType'); $data['salePriceValue'] = doubleval($this->getPostedData('salePriceValue')); } parent::setModelProperties($data); }