lat9 / dbio

Database Input/Output for Zen Cart
GNU General Public License v3.0
3 stars 1 forks source link

GitHub-based Additional Handler Documentation #160

Open lankeeyankee opened 4 years ago

lankeeyankee commented 4 years ago

It is problematic forcing the use of product IDs. Example: a vendor updates pricing. I cannot simply take the vendor's sheet, change the headers to match dbio and import since dbio requires product IDs. We are running into many instances of this and it severely limits dbio's functionality and usefulness.

Is it possible to stop basing functionality on the ID and use only the model?

lat9 commented 4 years ago

Since the Products handler already gives the option of using either the products_id or products_model, I'm presuming that you're referring to the attributes and specials handlers. Please advise.

lankeeyankee commented 4 years ago

Sorry, yes, was referring to the products handler. I tried to upload a sheet with only model, upc, and quantity and got an error saying products_id was required. I didn't see in the config anywhere to set import by model. Do I need to do something else to get it to work? I did not see anything related to this in the docs.

lankeeyankee commented 4 years ago

Even with v_products_id added as a header and the column being blank, the sheet is not importing, I get a log saying products.products_id, line #4: Value () is not an integer or Record at line #3 not imported; insufficient header-fields provided for a product addition. I double checked the header row and it looks fine. It has

v_products_model | v_products_upc | v_products_msrp | v_map_price | v_map_enabled | v_products_id | v_products_quantity

which all are in an exported sheet and copied from it just to make sure my eyes are not deceiving my brain

lat9 commented 4 years ago

Are these pre-existing products? The products_id, if you don't want to use it, must be set to 0 (a valid integer).

lankeeyankee commented 4 years ago

Aha, ok, that was it. Sorry. I didn't think to put 0 because I thought it would reset the ID to 0.

lat9 commented 4 years ago

I'll use this issue to start a series of handler-specific on-line FAQs.

torvista commented 4 years ago

The products_id, if you don't want to use it, must be set to 0 (a valid integer).

But, if there is an unoticed error in the model (space maybe?) so it does not match an existing model AND products_id is 0, would that not cause a new product to be created?

lat9 commented 4 years ago

What you said is true.

torvista commented 4 years ago

Does that not seem a bit "dangerous"...especially in the context of perhaps using a third party source of those models as per the OP? I'm over cautious with anything that does database stuffing, I would have erred on the side of requiring a specific command in the v_dbio_command column to permit inserts rather than updates.

lat9 commented 3 years ago

Does that not seem a bit "dangerous"...especially in the context of perhaps using a third party source of those models as per the OP? I'm over cautious with anything that does database stuffing, I would have erred on the side of requiring a specific command in the v_dbio_command column to permit inserts rather than updates.

Yes, see #180.