Forums / Setting Up Categories, Products, Attributes / generate product model, is it possible

generate product model, is it possible

Views: 2,224

Results 21 to 23 of 23
27 Apr 2016, 6:35 PM
#21
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

generate product model, is it possible

Again, if the model # is pre-known for each such "attribute", Stock By Attributes supports pre-populating the "model #" in a customid field that can be different for each such product/attribute combination, no additional coding needed once the model # is pre-known for whatever combination of options exist.

So either of two ways proposed to address the problem. Generate on the fly based on selection(s) (and store in a field from which to be retrieved) or pre-generate all combinations and populate a table to have that information.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

27 Apr 2016, 6:53 PM
#22
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,720
Plugin Contributions:
56

Re: generate product model, is it possible

If he doesn't need stock tracking, he shouldn't use SBA. SBA is very heavyweight and changes a ton of core files.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

1 May 2016, 6:09 PM
#23
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,111
Plugin Contributions:
56

Re: generate product model, is it possible

swguy:

No need. He's using attributes, so we know enough to direct him.

@Haggis, the products_model field is a single-valued field per model. What you'll need to do is create a new field in your database (suggest using the orders_products table) and populate your computed "model number" based on attribute settings when an order is placed (or perhaps nightly as a cron job). You'll have to write the logic that maps the product and its attributes to one of your model numbers.
Just a cautionary note, if @Haggis is using the "Edit Orders" plugin: Since EO currently re-generates an order each time the "Update" or "Add Product" button is clicked, adding a field to the orders_products table might require additional "work".