Here is the working sample code part:
$_authors_product = new Mage_Catalog_Model_Product(); $_authors_product->load($_item_val_id); //echo "DELETED... ".$_POST['submit_item4sale_remove_by_entity_id']; $_item_val_id = $_POST['submit_item4sale_remove_by_entity_id']; $_item_val_id = (int)str_replace('entity_id_', '', $_item_val_id); $_authors_product = new Mage_Catalog_Model_Product(); $_authors_product->load($_item_val_id); $_current_customer_id = Mage::getSingleton('customer/session')->getCustomer()->getId(); //Allow deletion only if product is from author if($_authors_product->submited_by_author == $_current_customer_id) { //var_dump(Mage::registry('isSecureArea')); Mage::register('isSecureArea', true); //$_authors_product->delete(); echo 'ALLOWED DELETED OH YEAAAAAA....'; Mage::unregister('isSecureArea'); }
Mage::register('isSecureArea', true); echo 'ALLOWED DELETED OH YEAAAAAA....'; Mage::unregister('isSecureArea');
Hi
ReplyDeleteIt is correct code for Magento product delete from fronted template. Magento Developers.
HI,
ReplyDeleteYes the code is best..
Very nice... Very nice indeed... =)
ReplyDeleteNice, Tnhx. Love You :)
ReplyDeleteThanks a lot.
ReplyDeleteIt really helps me ;-)
it helps me a lot..thank you very much..:))
ReplyDelete