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
    • 531
    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

      public function deletcatAction(){
          Mage::register('isSecureArea', 1);
          $categoryId = $_REQUEST['id'];
          $category   = Mage::getModel('catalog/category')->load($categoryId);
          try{
          $category->delete();
          }
          catch (Exception $e){
              echo $e->getMessage();
              }
          }
    • Deleting Products:

    • send category id with Query String to controller such as

      #
    • Then write the controller as

      public function deletprdctAction(){
          Mage::register('isSecureArea', 1);
          $productId = $_REQUEST['id'];
          $product   = Mage::getModel('catalog/product')->load($productId);
          try{
          $product->delete();
          $this->_redirect('manager/account/dashboardedit');
          }
          catch (Exception $e){
              echo $e->getMessage();
              }
          }

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: