Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Delete Category and Products by ids in magento Programming

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 640
    Comment on it

    Delete category and Products By Ids in Magento by following the steps:

    1 - Deleting Category: send category id with Query String to controller such as

    • Then write the controller as

      1. public function deletcatAction(){
      2. Mage::register('isSecureArea', 1);
      3. $categoryId = $_REQUEST['id'];
      4. $category = Mage::getModel('catalog/category')->load($categoryId);
      5. try{
      6. $category->delete();
      7. }
      8. catch (Exception $e){
      9. echo $e->getMessage();
      10. }
      11. }
    • Deleting Products:

    • send category id with Query String to controller such as

    • Then write the controller as

      1. public function deletprdctAction(){
      2. Mage::register('isSecureArea', 1);
      3. $productId = $_REQUEST['id'];
      4. $product = Mage::getModel('catalog/product')->load($productId);
      5. try{
      6. $product->delete();
      7. $this->_redirect('manager/account/dashboardedit');
      8. }
      9. catch (Exception $e){
      10. echo $e->getMessage();
      11. }
      12. }

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Reset Password
Fill out the form below and reset your password: