There are some great ZenCart addons to be able to track your stock by attributes and enhance the checkout process for customers while doing so. My suggestions below are based on personal experience and require very little effort to get up and going.
I suggest installing the following three add-ons: Stock by Attributes, Dynamic Drop Downs for Stock by Attributes, and Bulk Attribute Creator.
Install and make modifications in the order below. Please make sure to backup and log any changes you make to any files. This is important in case you run into any issues. I suggest taking a snapshot of the database and all of your files before installing each modification.
- Install Stock by Attributes: Download and install the “Stock by Attributes” add on. Just follow the step by step instructions provided with the add on.
- Install Dynamic Drop Downs: Download and install the “Dynamic Drop Downs” add on. Again just follow the step by step instructions provided with the add on.
- Install Bulk Attribute Creator: Download and install the “Bulk Attribute Creator” add on. This one is super easy by uploading one file replacement.
- Modify pad_base.php: You need to modify this file that was added by the Dynamic Drop Downs mod if you want the “option name” sort order to work. The option name sort order allows you to switch the order in which your attributes are shown to customers. So if you want a customer to choose size before color you can do that. All you have to do is modify line 315 of the pad_base.php file located in /includes/classes.
Change from this:
[quickcode:noclick] $products_options_name = $db->Execute(“select distinct popt.products_options_id, popt.products_options_name, popt.products_options_track_stock from ” . TABLE_PRODUCTS_OPTIONS . ” popt, ” . TABLE_PRODUCTS_ATTRIBUTES . ” patrib where patrib.products_id='” . (int)$this->products_id . “‘ and patrib.options_id = popt.products_options_id and popt.language_id =”. (int)$_SESSION[‘languages_id’] .” ” . $stocked_where . ” order by popt.products_options_id”);
[/quickcode] To this:
[quickcode:noclick] $products_options_name = $db->Execute(“select distinct popt.products_options_id, popt.products_options_name, popt.products_options_track_stock from ” . TABLE_PRODUCTS_OPTIONS . ” popt, ” . TABLE_PRODUCTS_ATTRIBUTES . ” patrib where patrib.products_id='” . (int)$this->products_id . “‘ and patrib.options_id = popt.products_options_id and popt.language_id =”. (int)$_SESSION[‘languages_id’] .” ” . $stocked_where . ” order by popt.products_options_sort_order”);[/quickcode]Notice the only change is with the “order by” statement.
These changes will now allow you to track your product stock by attributes which is important for almost any store. For instance if you are selling T-Shirts then you need to know how many of each size you have not how many total you have unless you are only selling one size! Zencart is a powerful open source ecommerce store that is very easy to modify and hook into any merchant account.