lat9 / dbio

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

Create a handler to import/export "Categories" information #121

Open lat9 opened 6 years ago

lat9 commented 6 years ago

Per the title, I've received a request to provide a Handler to perform I/O on the categories table.

torvista commented 2 years ago

An explanation of the need, maybe there is another way. We have many categories of brand-model-year. We have a list of products, each of which is valid for one or two categories, that need to be linked from their master category. This can be done one by one in admin->products to categories, but it's very slow. I was thinking of having a list of the categories exported from DBIO and using them in a dropdown/data validation list for each of the products, to be subsequently imported via the products handler.

torvista commented 2 years ago

I note that an EP export outputs product categories using a line per category (multiple lines per product) which provides the output I was looking for. It also can import/link products to multiple categories but requires both category names for a multi-language store.

I thought DBIO could import multiple categories per product but I don't find documentation to support that memory.

zippospeedcat commented 4 months ago

Hello torvista I'm coming over fromt he ZenCart forum, as I need some assistance with Easy Populate. I have installed EP and Open Office, and have downloaded my ZC database, and have opend the .csv file in OpenOffice. The first thing I noticed was, of course, each item is listed multiple times, depending on the Category in which it resides, which exactly what I expected. OK, So far so good.

However, I could not find the products_id field. Is that because EP doesn't deal with the products_id? Please advise.

Moving on, my plan is to add items to my ZC database using DbIo, which will of course mean assigning them to a specific Master Category, and since I can add other Categories (maybe as many as 3-5) to each item, I would need to accomplish that through EP.

This is where the rubber meets the road, so to speak. Do I create a .csv file in OO with only the items I am adding, duplicating record lines, whose only difference in all 31 fields in in field W v_categories_name_1. Or do I append the records to the file I exported and upload the whole file>

Please advise, and thank you in advance for your time! Phil

torvista commented 4 months ago

This is a somewhat off-plugin-topic thread but maybe it can offer input on the required functionality.

EP by default hinges on products_model as the unique identifier. Fine for me, as so do I. Otherwise, if you don't: change to product_id in the EP configuration.

I don't follow your suggested procedure.

I suggest you use EP only to modify existing products. Hence you create new products with DBIO, then use EP to export, add and import the linked categories.

Import/export can be extremely confusing/time-consuming when de-lousing a file so it imports without errors, requiring multiple attempts. you MUST be doing all this on a development copy of your site, where you can reset your database as many times as necessary, to confirm that what you expect to be happening, actually IS. While both these tools are long-established, that does not mean that they are error-free and correcting errors on a production db is very messy. So, repeat your testing ad-nauseam locally until you are confident all works 100% before you touch your production db, and even then always back it up first. Assume the worst will happen and plan for it.