protected function _beforeApplyEditedFieldValue($type, $config, $params, $entity, &$value) { if (Mage::helper('customgrid')->isMageVersionGreaterThan(1, 5, 0) && in_array($config['id'], array('sitemap_filename', 'sitemap_path'))) { $fileName = $config['id'] == 'sitemap_filename' ? $entity->getSitemapFilename() : $value; $path = $config['id'] == 'sitemap_path' ? $entity->getSitemapPath() : $value; if (!empty($fileName) && !empty($path)) { $resultPath = rtrim($path, '\\/') . DS . $fileName; $helper = Mage::helper('adminhtml/catalog'); $validator = Mage::getModel('core/file_validator_availablePath'); $validator->setPaths($helper->getSitemapValidPaths()); if (!$validator->isValid($resultPath)) { Mage::throwException(implode("\n", $validator->getMessages())); } } } if (Mage::helper('customgrid/config_editor')->getSitemapDeleteFile() && $entity->getSitemapFilename() && file_exists($entity->getPreparedFilename())) { unlink($entity->getPreparedFilename()); } return parent::_beforeApplyEditedFieldValue($type, $config, $params, $entity, $value); }
protected function _beforeApplyEditedFieldValue($type, $config, $params, $entity, &$value) { $entity->addData(array('tax_customer_class' => array_unique($entity->getCustomerTaxClasses()), 'tax_product_class' => array_unique($entity->getProductTaxClasses()), 'tax_rate' => array_unique($entity->getRates()))); return parent::_beforeApplyEditedFieldValue($type, $config, $params, $entity, $value); }
protected function _beforeApplyEditedFieldValue($type, $config, $params, $entity, &$value) { if ($config['id'] == 'request_path') { Mage::helper('core/url_rewrite')->validateRequestPath($value); } return parent::_beforeApplyEditedFieldValue($type, $config, $params, $entity, $value); }