Once guest user click on button we are creating Product Programtically but issue is every time we click on button its creating 2 products instead of one.
form
<form action="<?php echo $this->getUrl('example/amasty/createSimpleProductAndRedirect',
array('_secure'=>(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS']==='on'),
'id' => Mage::registry('current_product')->getId())) ?>" id="ajaxlogin-login-form">
controllers
protected function _createProduct($type, $doSave=true, $originalProduct, $newImagePath="")
{
$product = Mage::getModel('catalog/product');
$product->setName($originalProduct->getName());
$product->setDescription('what ever you need here');
$customerId = Mage::getSingleton('customer/session')->getCustomerId();
$product->setCreatedByCustomerId($customerId);
if ($doSave)
$product->save();
return $product;
}
full form code : http://pasted.co/d5b63b52
Edit
Once i removed this code from "form" : id="ajaxlogin-login-form
, than its creating only one product, but after that once guest click on "save design" button, it will redirect to another page.