If Registered user click on button, we are creating Product Programatically. but when guest user click on button , its creating product with empty product name
button :
<button onclick="return setproductlogin(\'<?php echo 
Mage::registry("current_product")->getId()?>\',
event);setrequestlogin();" 
id="submit-editorApply-{{rand}}" >SAVE DESIGN</button>
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;
 }
I tried below code, but didt worked for me
if($_category instanceof Mage_Catalog_Model_Category && $_category->getId()):
 $product->setName($originalProduct->getName()); 
 endif;
full controllers : https://pastebin.com/Gn6iMwug
Edit
when Registered user upload image or text and click on "Save Design" button in link , than Product creating with "Product Name".
When Guest user upload image or text and click on "Save Design" button in link , it will ask to login, once Guest login/register , Product is creating with empty Product name
After clicking save design, it redirect to another page :
- 
 Can you add your login popup phtml code?Jaimin Sutariya– Jaimin Sutariya2017年04月11日 06:46:44 +00:00Commented Apr 11, 2017 at 6:46
- 
 @JaiminSutariya please check : pastebin.com/GR5eyFwKBaby in Magento– Baby in Magento2017年04月11日 06:48:29 +00:00Commented Apr 11, 2017 at 6:48
2 Answers 2
This will only resolve your product Name issue.
Update your form action code to below.
<?php echo $this->getUrl('example/amasty/createSimpleProductAndRedirect', array('_secure'=>(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS']==='on'), 'id' => Mage::registry('current_product')->getId())) ?>
The product is being created without name is because you are not passing variable id which is required in your createSimpleProductAndRedirect function.
- 
 I thought when we pass :example/amasty/createSimpleProductAndRedirect, than thats going to be enough..... thanks a lot.....Baby in Magento– Baby in Magento2017年04月11日 07:01:28 +00:00Commented Apr 11, 2017 at 7:01
I looked through your code and this is normal behavior.
Your $_category variable is never assigned.
This means that the condition $_category instanceof Mage_Catalog_Model_Category will always return false.
Because of that, your line $product->setName($originalProduct->getName()); will never get executed and you end up with a product without a name.
I'm not sure what you are trying to do, because you code looks fuzzy, but I'm sure that's why the problem appears. 
- 
 thanks , I will dig deeper on this & come back to you....Baby in Magento– Baby in Magento2017年04月11日 06:14:01 +00:00Commented Apr 11, 2017 at 6:14
- 
 updated question, when you get free time, please check once.....Baby in Magento– Baby in Magento2017年04月11日 06:30:09 +00:00Commented Apr 11, 2017 at 6:30
- 
 you added nothing relevant. I already told you what the problem is. Enable your error reporting and you will see your coding errors on the screen. This is basic PHP. You are using a variable that is not initialized.Marius– Marius2017年04月11日 06:32:28 +00:00Commented Apr 11, 2017 at 6:32
- 
 oh sorry, i will check it.....Baby in Magento– Baby in Magento2017年04月11日 06:33:00 +00:00Commented Apr 11, 2017 at 6:33