How can I get the id of the just duplicated product programmatically in Magento ?
(or the last inserted product id, if the first solution don’t exits)
Thanks for help.
[EDIT]
Here is the code that I have used to duplicate my product:
$sku = '123456';
$product = Mage::getModel('catalog/product')
->loadByAttribute('sku',$sku);
$newProduct = $product->duplicate();
$newProduct->setStatus(1);
$newProduct->setSku($sku.'-v2');
$newProduct->save();
Thanks for help.
you can find the new prodect ID in:
This is available just after calling :
FYI: to get the last insertedId (in general) you can use: