lat9--sorry to bug you, but I had asked these questions awhile back and doesn't look like I ever got a clear answer. Would you be able to assist? Thank you for all you do!
Printable View
1) There's not a way to simply link a product to another category. You'd need a 2-line import, the first to change the product's master category to the linked one and the second to change the master category back.
2) What's the goal of what you're trying to do? Are you overwriting a specific product-id to reflect new product content or are you creating a new product with the same model number?
Ideally I would be able to overwrite the existing product id to reflect new product content, without having to use the remove command first. For example, replace and apple under the red category with a banana under the yellow category without creating a linked product (or leaving the apple product active). Or, even if I could just replace apple 1 with apple 2 in the same category, but with different model numbers, without creating a new product (or leaving the old product there) that would work too.
I have 5,000+ products active at any given time, and the majority are unique single quantity items. Would just like to be able to clean up the database easily as they sell and replace them with new inventory. If it's not possible that's ok, just thought I'd ask.
Thanks again (any happy holidays!)
Granted, it's been a while since I've fussed with DbIo, but there's nothing I remember that prevents you from updating the model and content for a given v_products_id.
Just a side thought here.
reusing, deleting, and etc of database items can only result in problems.
A customer of 10+ years would have many items in their records that would not like having their data manipulated in such a manner.
With today's available storage, a few outdated db items hanging around should have little or no effect on operation.
IMHO, it's better for the customer to see "Sold Out" than "No Product Found".
"If it ain't broke, don't fix it"
lat9--unless I'm doing something wrong, even if I change product data in the csv file, it assigns it a new product ID on upload creating a new product and leaving the old product in place. Please let me know if there is a workaround I'm missing.
dbltoe--again, correct me if I'm wrong, but I am under the impression that a customer's order history will be saved based on the item they purchased at the time. If I update the product title, etc. I did not think that would also change the product information saved in their order history/data.
My issue is that I'm adding ~500 products a month to replace items that sold. If I just keep adding new products, I'm having to scroll through hundreds of pages in my admin to make any changes. Unless I deactivate the products, my customers will be faced with the same issue--scrolling through hundreds of pages of sold out products just to find what they're looking for--not a user friendly experience. Even doing this with DBIO creates a cumbersome (and large) file that takes longer to upload/update and more potential for error in my opinion. What I am hoping to do is essentially replace old products with new, and update the "date added" field so customers see it as a new product, but without taking up extra database space and cleaning up old products in the process.
no, you are quite correct. customers detailed order data is stored in the orders_products table.
you have a very real problem. that said, i'm not a fan of your solution. i would do modifications of the database select statement to present far less data to you. in that manner, one would not have to sort through hundreds of pages of sold out items on your admin pages. depending on what version of zc you are on would indicate where one might put said code. this is something i have done before...Quote:
My issue is that I'm adding ~500 products a month to replace items that sold. If I just keep adding new products, I'm having to scroll through hundreds of pages in my admin to make any changes. Unless I deactivate the products, my customers will be faced with the same issue--scrolling through hundreds of pages of sold out products just to find what they're looking for--not a user friendly experience. Even doing this with DBIO creates a cumbersome (and large) file that takes longer to upload/update and more potential for error in my opinion. What I am hoping to do is essentially replace old products with new, and update the "date added" field so customers see it as a new product, but without taking up extra database space and cleaning up old products in the process.
with regards to what to display to the customer, that is another tricky one that i have addressed with various solutions.
the potential problem you have, and perhaps something else could chime in, might be in some of your SEO implications in your suggested solution. depending on whether you have an URL rewriter, you may get penalized for duplicate content.
but there are more creative solutions to the problem of having a tremendous number of products in your products table.
that said, i have seen various manufacturers reuse UPN numbers; so it is not like what you are thinking about doing is unprecedented.
best.
Thanks, carl--using 1.5.8a at the moment. With an existing 1.5.4 site I have url rewriter and have been manually replacing products like what I describe above, but trying to be more efficient with the new 1.5.8a site I'm working on. At the end of the day, if the database product ID does not change, but everything else about the product is updated (model, name, price, etc.) AND url gets rewritten once updated, would this not be any different than creating a brand new product using a newer product ID? Customer order history is saved separate and can be recalled as needed. As long as I don't anticipate needing to reactivate an old product, I guess I'm failing to see the downside to what I'm proposing, but I'm not the expert and hence the reason I'm reaching out for advice. I just want to make sure if I execute on my plan using DBIO (assuming I can), I'm not overlooking something that will create problems.
Right now, when I update product information for a given product, including model, name, and category, what I hope will replace the old product with the new product just ends up creating a linked product. Is there a way to instruct DBIO to "move" the product rather than "link" it?
i do not use dbio so i can not comment on its use.
i was only commenting on your method of solving your problem.
best.
I just ran a quick Products update (using demo data) with the following CSV
The model for product-id 1 was MG200MMS prior to that import; after the import it was MG200MMS-updated.Code:v_products_id,v_products_model,v_products_quantity,v_dbio_command
1,MG200MMS-updated,28,
I must have made an error somewhere--I just tried to do the same with a different product and lo and behold it updated. But, if I change the categories, it still creates a linked product rather than moving the product altogether. I guess as long as I keep the replacement products within the same category it should work for what I'm trying to do.
Appreciate the help from everyone involved. If there is a way to move the product without linking it, please let me know.
Zencart 2.1
dbio-2.0.1
I just started using this today. I have two questions.
First is how do we add an item if its not in the system. For example I dont have a v_products_id until i add it to the website. Like it did on ep4
Also from testing when i export my products my special price goes under v_products_price_sorter. When i try and change the price nothing happens on the front end.
How could i add the special pricing into the original product upload
There's additional documentation on the plugin's GitHub repository: https://github.com/lat9/dbio/wiki
The docs for the ProductsHandler identify how to manipulate a product (like adding or removing).
DbIo's readme includes information regarding the various I/O handlers provided (see the Customization :: I/O Handlers section). There's a specific handler for Specials; it's not present in the base Products handler.
Okay i managed to get the hang of this thing. The only issue I have is Special pricing.
Is this the best way to update special pricing when adding a new item
- create product (using products handler)
- then I have to export again to get the new product ids from the product i created.
- then i have to add it to the(special handler template) (there is no id created in special field when adding a product so i have to match it up with what's on the product handler
Is there a way i can add the special price to the product handler so i dont have to do all these steps. Seems like a lot of work compared to ep4 unless I am misunderstanding.
I had some time to explore and experiment with DBIO as you can tell from all my post. The biggest challenge was adapting to the differences compared to EP4, but overall, I found DBIO to be a solid program.
One suggestion I have for improvement is to include a note in the documentation about adding new products. Specifically, mention that you need to set v_products_id to 0 when adding a new product. This detail was a bit confusing until I came across it in a forum thread.
That said, the documentation was well-written and made the learning process much easier—great job on that!
During my testing, I noticed a potential issue: when a template is created, it cannot be deleted. Attempting to do so simply refreshes the page without removing the template.
Thanks for the report that a template, once created, cannot be removed. I've created this GitHub issue for tracking: https://github.com/lat9/dbio/issues/222
Quick question regarding the date added column--I have tried updating the date using DBIO and have tried a couple different date formats, but nothing seems to work. Most formats give me an error message on upload about the invalid date format, default value being used, but the format that doesn't give me an error message doesn't actually change the date. Is there a special way I can get the date added to change? Using excel the only format DBIO import seems to allow is 12/24/2024 5:47:00 AM, but again doesn't actually update the field. I've got 4,000+ products I'm trying to "reset" date added for...don't want to manually update each one in phpmyadmin. Thanks!
To update all products' date-added to the current date:
Note that the above query will work in your Zen Cart admin's Tools / Install SQL Patches and, if your DB_PREFIX is an empty string, in phpMyAdmin.Code:UPDATE products SET products_date_added = now();
If you're running the query in phpMyAdmin and you use a DB_PREFIX (e.g. 'zen_'), you'd use
Code:UPDATE zen_products SET products_date_added = now();
Is there a guide or a set of best practices for when it comes to creating your own handler for importing?
In my case, I created a set of product types that each reads from a different table. How would I direct DBIO to import data received under one handler and send it to the necessary table?
You'd set the single handler's setHandlerConfiguration method to identify all the potential, albeit product-type-specific, tables that could be used.
On an import, I'd suggest using the handler's importCheckKeyValue method to determine which 'type' of product is being imported for the current CSV record, saving that in a method-specific class parameter which is subsequently used by the handler's importProcessField. That method would interrogate the product-type being dealt with so that it's aware of which of the possibly multiple product fields are to be used.
Awesome. One final question, is there a way to get DBIO to work together with POSM as far as setting the stock levels of the attributes? I tried to read into the table created by POSM, and it's returning a hash field of some kind so I don't know how others managed to get it to work.
For now, you'll need to 'purchase' the now-free version of POSM 5.0.0 (https://vinosdefrutastropicales.com/...products_id=46). That includes a set of DbIo handlers.
I'll be incorporating those, now that POSM's in-core, in a subsequent release of DbIo.
Just started seeing these - PHP 8.2, DbIo 2.0.1:
--> PHP Deprecated: Implicit conversion from float 2.75 to int loses precision in /home/client/public_html/store/admin/includes/classes/dbio/Encoding.php on line 238.
Ooops. Will post a full log at next occurrence (shouldn't be too long).
Two additional questions:
1) What is the best way to add new products? Is it OK to use "products_id" of 0 and assign a unique Model?
2) This probably has no overbearing on anything but what is the default scheme of the timestamp of the generated files? I know at a minimum it's : "YYYYMMDD-HHMMSS" but I can't figure out what the six digit number at the end of the filename when generated.
1) Yes, using a v_products_id of 0 and a non-blank model (the uniqueness requirement depends on the configured value for Products Import: Allow Duplicate Models?). You can also force the addition using a v_dbio_command of ADD.
2) It's just a random number, see https://github.com/lat9/dbio/blob/05...Io.php#L29-L32
Okay and lastly, what is the recommended way of bulk adding Attributes? I managed to get the templates to work with POSM Stock levels (to which I must say, THANK YOU)... but then realized I also need to set a price of the attributes. Should I be preparing two import files (one for the attributes and one for the price) or is there some kind of way that I can take one of the templates and modify it so that the price of the attribute is set by the file?
If all the attributed-products are priced-by-attributes, then all product/attribute pricing can be set using one of the ProductsAttribs*Handler handlers.
If attribute pricing affects a product's base price, then the base pricing needs to be set via the ProductsHandler and the attributes' contributions to pricing set via one of the ProductsAttribs ones.
How do I add/import a product to Specials? It doesn't accept ADD on the command.
I just installed this addon to 2.1.0
I don't get this. When I click on "Manage Option's Stock" I did everything no products to show. What am I missing here?
You're confusing Products' Options' Stock Manager (POSM) with DBIO. Instructional info for DBIO can be found at https://htmlpreview.github.io/?https...io/readme.html
Manage Option's Stock is an operation of POSM, not DBIO. The wiki for POSM can be folujnd at https://github.com/lat9/options_stock_support/wiki.
Like others have mentioned in this thread, the tool you're referencing has to do with Products' Options' Stock Manager (POSM), not DbIo. That said, POSM manages the stock of products' options ... do any of your products have attributes?
P.S. This discussion should be moved to its own thread.
Using ZC 2.1.0 w/ php 8.3. Responsive Classic
I am new to using DBIO plugin and all has been working very well, until I ran into an issue when importing Attributes Basic. I imported Names and Values without an issue, but when attempting to import attribute basic I receive an error which states: "Attributes not inserted at line number 2; one or more option-values (option value name) were either not present in the default language or are not associated with the products_options_id of 7."
Has anyone ran into this issue? Thanks!
For an attribute to be imported, each option-value needs to be created via either separate DbIo import or the admin's Catalog / Options Names Manager. The message you're receiving indicates that the option value doesn't exist or that the option-name its 'associated with' doesn't have an options_id of 7 (which is what's specified in the DbIo input record).
Okay, I see. I just had a look and it appears as though options id 7 is not associated with any option values whereas option id 0 is associated with all the values I need, so I just need to go about the best way to move em over. If I have any trouble, I may be back... Thank you.:smile:
So I believe I understand the issue, I am not sure how to resolve it.
I took a smaller sample of the basic attributes values and attempted to import, but received a similar response as follows:
✗ Attributes not inserted at line number 2; no match for option name::option_type::default_language_id (Bedroom::0::1).
✗ Attributes not inserted at line number 3; no match for option name::option_type::default_language_id (Bedroom::0::1).
✗ Attributes not inserted at line number 4; no match for option name::option_type::default_language_id (Bedroom::0::1).
The import of product options and product options values processed without an issue, however the basic attributes is still giving me trouble. I am also including a screenshot of the option values with names for reference. Any suggestion to resolve? Thanks again. Attachment 20942
How about posting the 3 lines from the CSV input that resulted in the error messages indicated above?
Sure, here is what I have on the csv files. I actually had a few more lines, but I used the first 3 as the others said the same exact thing. Thank you.
Attachment 20943
In case it's hard to zoom, here is copy and paste.
v_products_model v_products_options_type v_products_options_name v_products_options_values_name
cm4850BLK 0 Bedroom Inventory (click here)^Mirror^Base^Top Glass^Stool^Vanity with Stool^Inventory (click here)
cm4850WHT 0 Bedroom Inventory (click here)^Mirror^Base^Top Glass^Stool^Vanity with Stool^Inventory (click here)
cm5264-charcoal 0 Bedroom Queen Bed^King Bed^King/Queen Rails^Queen Headboard / Footboard^King Headboard / Footboard^Inventory (click here)
I have multiple pages of Bedroom. It's on page 2. See pic.Attachment 20944
I have an odd problem. I have a CSV that has this column. It is NOT duplicated. But yet I cannot get this import file validated.Quote:
The current import-file is missing these (v_products_id) required columns; the import is disallowed.
I seem to have fixed the issue. I am not sure WHY. It was an Excel spreadsheet saved as a UTF-8 csv. Then opened in Open Office and resaved each time. That last try got it working. Go figure.
>It was an Excel spreadsheet
Excel is total crap for import/export of third-party data/character encodings: just use Libre/Openoffice for this work.
Let me start by saying I love this feature. Hats off to all involved.
I made an error in creating my csv file. I inadvertently tried to copy a cell (products_types) and instead of copying a 1 to all cells in the column, it autoincremented from 1 to 28 and I did not noticed it until my debug logs started filling up.
I understand that this is totally on ME period. Possible suggestion: Would it be practical to only allow existing product types to be imported? Or could this be by design?
When you import a product that creates a new category there seems to be a minor issue.
When category is created using Database I/O import the SORT ORDER is being imported as a value of "null".
It needs to be "0" so the category stays in the alphabetical format
Thanks for the report. See this GitHub issue for tracking: https://github.com/lat9/dbio/issues/224
Using ZC 2.1.0 / php 8.2
I haven't given up on this working but nearly there. I am using a test site completely free of other plugins and installed DBIO from Github.
Installed Products Options - Worked, no issue
Installed Product Options Vales - Inserts all lines, however when trying to view products via Catalog > Option Value Manager - Nothing appears, just blank.
I then went to PHPMyadmin and viewed the table of Products_Options_Values and they are all there...
I also checked products_options_values_to_products_options and it was blank.
Anyone suggestions? Anyone? Thanks :)
I am including a log below. But let me better explain the issue. When I said "blank" I did not mean the entire page was a white blank page. I meant that the "field values" imported were not displayed on the catalog>option values menu. The header, footer, etc, was all there, but not the fields imported. However, when I went to PHPmyadmin all fields were imported. Here is the log..
[17-Apr-2025 03:11:13 UTC] Request URI: /xxxx/index.php?cmd=attributes_controller&products_filter=18¤t_category_id=2, IP address: 107.201.xxx.xxx, Language id 1
#0 /home/xxxx/public_html/xxxx/attributes_controller.php(1962): zen_debug_error_handler()
#1 /home/xxxx/public_html/xxxx/index.php(16): require('/home/xxxx/...')
--> PHP Warning: Undefined variable $attributes_value in /home/xxxx/public_html/xxxx/attributes_controller.php on line 1962.
That log's a known issue; see this Zen Cart PR for details: https://github.com/zencart/zencart/c...cd7ad2904ddaae
I'm still looking at the non-display of the imported option values.
I found a bug.
when importing products if your text has a characteristics it does not like it still will import. But when you go to export file it looks or distorted within the excel sheet.
The issue is 'product_desc' table
If you open in excel and trim / clean formula in the description it will solve the issue and everything import/export fine.
This can really mess things up if people forgot to clean there html during the import process.
Without further information, it sounds like a "Garbage in, garbage out" scenario.
That "characteristics" are you referring to and what is "it" that doesn't like them?
Are you using Microsoft Excel? If so, what is your setting for Configuration / Database I/O Manager Settings / CSV: Encoding? Note that for Microsoft Excel, that should be set to 'latin1'.
Just an update in effort to have DBIo working for me.. I checked the table products_options_values_to_products_options on another site then extracted the data (the products are the same) I then went to the website where I have DBIo installed for testing purposes and imported the table (this table was empty even after I initially uploaded Option values via DBIo). After the table import via phpMyadmin the fields are displaying within admin. Is there another file within DBIo I am suppose to upload for the products_options_values_to_products_options table to be populated?
Started fresh once again and downloaded the DBIo plugin w/ the recent changes made in GitHub and so far so good. My final update will be prices to attributes.
Just wanted to provide an update in case anyone else is having a similar issue. The latest GitHub files seemed to help resolve my issue. Thanks!
v2.0.2 of the Database I/O Manager (DbIo) is now available for download: https://www.zen-cart.com/downloads.php?do=file&id=2091
This release contains changes associated with these GitHub issues:
#221: E_USER_ERROR is deprecated in PHP 8.4.
#222: Can't remove a DbIo template, once created.
#223: Remove zc1.3.x-era boxes file and subdirectory.
#224: Initialize inserted categories' sort-order to 0 (was null).
#225: Correct DbIoOptionsValuesHandler, was creating uneditable option-values.
#226: Pre-define all class properties in the DbIoHandler class.
#238: Remove unwanted centered-text styling from the customization tool.
#239: Add links to the GitHub wiki in the main admin tools' instructions.