0

Guest user enters details and click on "submit" to register. It's working fine for below code :

<form action="<?php echo $this->getUrl('example/amasty/create1'........> 

Here we are using the following controller action : getUrl('example/amasty/create1

Instead of this, if we change the controller as below and change the form, then the registration is not working anymore.

<form action="<?php echo $this->getUrl('example/amasty/createSimpleProductAndRedirect1'....>

Controllers

public function createSimpleProductAndRedirect1Action()
    {
        $originalProductId = $this->getRequest()->getParam("id");
        $newImagePath      = $this->getRequest()->getParam("image");
        $originalProduct   = Mage::getModel('catalog/product')->setStoreId(Mage::app()->getStore()->getId())->load($originalProductId);

        if ($product = $this->_create1(Mage_Catalog_Model_Product_Type::TYPE_SIMPLE, true, $originalProduct, $newImagePath)) {
            $this->getResponse()->setBody(Mage::helper('core')->jsonEncode("Your Image Saved"));
        }        
    }

protected function _create1Action()

Here we replaced controller action to example/amasty/createSimpleProductAndRedirect1

update

:

Fatal error: Call to undefined method Amasty_Example_AmastyController::_create1()` in 

if ($product = $this->_create1(Mage_Catalog_Model_Product_Type::TYPE_SIMPLE, true, $originalProduct, $newImagePath))

1

Just rename _create1Action to _create1 and that'll fix your issue.

NB: try to avoid using numbers in method names for good practice ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.