MAGENTO 1.X – USEFUL MAGENTO CODE SNIPPETS


Those are many code snippets that could be helpful for you on shell scripts, standalone scripts, or in different situations of your market flow.

  • Iterate through all products, and add a prefix on its names:
  • Update product attribute according to a particular store (or the default one).
  • Move a Category inside another one:
  • Move every product from a category to another one:
  • Assign product to a category:
  • Remove products from a category:
  • Change base image / small image / thumbnail for a product, between all its gallery images:
  • Create a custom log file:
  • Change product stock inventory items data (Qty + Is in stock):
  • Display and show apache errors on screen:
  • Get at order from its increment id:
  • Get orders from increment id starting with (LIKE):
  • Format and show a number with 2 decimals and comma separated despite its actual format ( 2 and comma, are examples, you can use whatever you want instead):
  • Get stock information from a product when you are iterating:
  • Get logged in customer(for frontend purposes):
  • Load product by attribute:
  • Get product ID by SKU:
  • Remove product:
  • Show product parents sku’s from child id:
  • Load first occurrence of a model object:
  • Get Store:
  • Iterate through all folder files: