Okay, so I don't know which version you have installed, but Version 4.0.22 - Beta 6-10-2012 includes Detailed Products Attributes (detailed multi-line) option which downloads the data I was referring to: v_products_attributes_id, v_products_id, v_options_id, v_options_values_price
The version of Stock by Attributes that I ended up installing (still not sure if it was a Creinold version or more recent, has a data table called:
products_with_attributes_stock (of course need to consider any prefix when addressing table names).
This table has 5 columns to include data:
stock_id
products_id
stock_attributes
quantity , and
sort
stock_id is autogenerated and is the key for the data table. That means that if an item is not already tracked by products_with_attributes_stock then adding a new item to the list will give it a new stock_id. If the item and its intended attributes is already tracked than the stock_id would be needed to be able to revise the stock for that set of attributes. (I would suggest for your situation that the new stock of items not have any existing stock quantities assigned through products_with_attributes to simplify the following process.)
Now regarding the import of all of your items, here is how I would suggest the quickest (also dirtiest) method of populating it.
I believe you could use easy populate to add all possible/anticipated attributes to the items you are adding. (ie color and size if those are the two attributes in question), it also may be easiest when adding those attributes to incorporate the price associated with the different sizes, and if "color" (aluminum, wood, painted, etc...) have different prices, then when adding those attributes to include those costs as part of populating them.
Then, use easypopulate to export the Detailed Products Attributes. Take this data and place it into your preferred spreadsheet (essentially removing the delimiters throughout). Then to populate the products_with_attributes, you will need to pull out the attributes numbers (v_products_attributes_id) that when grouped together identify the attributes applicable to a single item and concatenate them with a comma. Place that information into a single row of data such that you have product_id and stock_attributes adjacent to each other, then the next column would be your stock (quantity), and if desired a sort order. (I'm not entirely sure that the sort order is respected, but I have made efforts to assign one as desired.
Then you can create a generic SQL statement that concatenates with the data to the left of it. This sql statement would be to populate the products_with_attributes_stock data table.
Next would be to either export just that column or copy the column to a new sheet and export it so that the delimiter is a return/carriage return/enter.
Then import/paste that file into either your mySQL admin panel or Zen-Cart's admin panel->Tools->Install SQL Patches and voila, your data table is populated.
A similar process could likely be used to plus up any quantity, with the appropriate SQL statement to add to instead of replace or create a new value. The only thing there, is that I think the stock_id would need to be known/obtained so that there is only one line item of stock by attributes for each set of attributes for the stock.
So, regarding the concatenation of the applicable attributes: if there were two products having two attribute types, each with two attributes:
(X,Y), (A, B) and (1, 2) respectively, then it would make sense to have stock in X-A1B1, X-A2B1, X-A1B2, X-A2B2, Y-A1B1, Y-A2B1, Y-A1B2, and Y-A2B2; however, not X-A1A2, X-B1B2, Y-A1A2, Y-B1B2, etc...
The attributes data dump shows each attribute type that is assigned to each product. So the data dump would contain something similar to:
X A 1
X A 2
X B 1
X B 2
Y A 1
Y A 2
Y B 1
Y B 2
By creating a new column that would associate the line to attribute 1, and attribute 2, it may be easier to identify the rows that contain attributes to be concatenated and then iterate through all products and combinations of ids that would identify a line item that would support import into the products_with_attributes table.
That's essentially what I was referring to before about building on other data.
In converse, if the products with attributes table is populated with all of the combinations of attributes after the attributes have been added to all of the products, then the products_with_attributes table could be exported, populated with the quantities, then reimported either by sql statement or straight table update with the new data (stock_id would be exported and therefore the quantities could be replaced.) That would address modification of quantities of items "in bulk".
Several ways to approach, depends on where you are at, how much work is involved to get you where you want to go, experience, etc...
Some things discussed above may be different depending on the implementation of stock by attributes that is used. For example, I seem to recall that the sequence of numbers associated with stock_attributes can be important in that the first attribute(s) are such that they are the ones that offer choices, while the remaining attributes may be just input blocks.
Bookmarks