function editAction()
 {
     $version = new Elite_Vafinstall_Migrate();
     if ($version->needsUpgrade()) {
         echo 'Please run the upgrade-vaf.php script as per the documentation. Your database is out of date.';
         exit;
     }
     return parent::editAction();
 }
 /**
  * Initialize product before saving
  */
 protected function _initProductSave()
 {
     /**
      * Init maintainer links
      */
     $links = $this->getRequest()->getPost('links');
     $product = parent::_initProductSave();
     if (isset($links['maintainer'])) {
         $maintainerIds = $this->_decodeInput($links['maintainer']);
         $product->setMaintainerIds($maintainerIds);
     }
     return $product;
 }
 protected function _initProduct($block = null)
 {
     static $product = null;
     if ($block === false) {
         $product = null;
         return;
     }
     if (!$product) {
         $r = parent::_initProduct();
         if ($block === true) {
             $product = $r;
         }
         return $r;
     } else {
         return $product;
     }
 }
 /**
  * Test for Mage_Adminhtml_Catalog_ProductController::quickCreateAction
  */
 public function testQuickCreateActionWithDangerRequest()
 {
     $data = array('entity_id' => 234);
     $this->_request->expects($this->any())->method('getParam')->will($this->returnValue($data));
     $typeInstance = $this->getMockBuilder('Mage_Catalog_Model_Product_Type')->setMethods(array('getConfigurableAttributes', 'getEditableAttributes'))->getMock();
     $typeInstance->expects($this->any())->method('getEditableAttributes')->will($this->returnValue(array()));
     $typeInstance->expects($this->any())->method('getConfigurableAttributes')->will($this->returnValue(array()));
     $productMock = $this->getMockBuilder('Mage_Catalog_Model_Product')->setMethods(array('getIdFieldName', 'save', 'getSku', 'isConfigurable', 'setStoreId', 'load', 'setTypeId', 'setAttributeSetId', 'getAttributeSetId', 'getTypeInstance', 'getWebsiteIds'))->disableOriginalConstructor()->getMock();
     $productMock->expects($this->any())->method('getIdFieldName')->will($this->returnValue('entity_id'));
     $productMock->expects($this->any())->method('isConfigurable')->will($this->returnValue(true));
     $productMock->expects($this->any())->method('setStoreId')->will($this->returnSelf());
     $productMock->expects($this->any())->method('load')->will($this->returnSelf());
     $productMock->expects($this->any())->method('setTypeId')->will($this->returnSelf());
     $productMock->expects($this->any())->method('setAttributeSetId')->will($this->returnSelf());
     $productMock->expects($this->any())->method('getTypeInstance')->will($this->returnValue($typeInstance));
     $productMock->expects($this->never())->method('save');
     $this->_response->expects($this->once())->method('setBody')->with('{"attributes":[],"error":{"message":"Unable to create product"}}');
     $helper = $this->getMockBuilder('Mage_Core_Helper_Data')->setMethods(array('jsonEncode'))->getMock();
     $helper->expects($this->once())->method('jsonEncode')->with(array('attributes' => array(), 'error' => array('message' => 'Unable to create product', 'fields' => array('sku' => ''))))->will($this->returnValue('{"attributes":[],"error":{"message":"Unable to create product"}}'));
     $this->_objectManager->expects($this->any())->method('create')->with('Mage_Catalog_Model_Product', array(), true)->will($this->returnValue($productMock));
     $this->_objectManager->expects($this->any())->method('get')->with('Mage_Core_Helper_Data', array())->will($this->returnValue($helper));
     $this->_controller->quickCreateAction();
 }
Example #5
0
 public function gridAction()
 {
     parent::gridAction();
     $this->_redirect("*/*/index");
 }