Skip to content

LiteCommerce module: disable inventory tracking for new products

beatnbite edited this page Aug 11, 2011 · 6 revisions

When a new product is added, LiteCommerce enables inventory tracking for the product unless the merchant opens another tab and disables it manually.

To disable inventory tracking for new products you can develop a simple LiteCommerce module as follows:

  1. Create a blank LiteCommerce module beneath the directory where your shop is installed.

  2. Create the "classes/XLite/Module/<your developer ID>/<your module ID>/Model/Inventory.php" file. Edit it as follows:

     <?php
    
     namespace XLite\Module\<your developer ID>\<your module ID>\Model;
    
     /**
      * Product inventory
      *
      * @since 1.0.5
      */
     class Inventory extends \XLite\Model\Inventory implements \XLite\Base\IDecorator
     {
         /**
          * Is inventory tracking enabled or not
          *
          * @var   boolean
          * @since 1.0.5
          *
          * @Column (type="boolean")
          */
         protected $enabled = false;
     }
    
  3. Re-build the LiteCommerce classes cache (the shop back-end -> "Maintenance" tab -> "Re-Build cache" page) to get the new module listed among other modules on the "Manage add-ons" page (the shop back-end -> "Add-ons" tab -> "Manage add-ons" page). Enable the module on this page (this will re-build the cache once again).

  4. Now inventory tracking will be disabled for all new products you add

Clone this wiki locally