Forums / Addon Admin Tools / Database I/O Manager (DbIo) Plugin [Support Thread]

Database I/O Manager (DbIo) Plugin [Support Thread]

Views: 104,214

Results 521 to 540 of 621
24 Dec 2024, 3:19 PM
#521
lat9 avatar

lat9

Administrator

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

Database I/O Manager (DbIo) Plugin [Support Thread]

mcqueeneycoins:

Ah, bummer! Is it something I could update via sql command (and, if so, what would that command look like)? I basically want to reset the date added on all products to match the launch date of the site, when it's ready. Thanks!
To update all products' date-added to the current date:

UPDATE products SET products_date_added = now();

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.

If you're running the query in phpMyAdmin and you use a DB_PREFIX (e.g. 'zen_'), you'd use

UPDATE [B]zen_[/B]products SET products_date_added = now();
24 Dec 2024, 5:43 PM
#522
mcqueeneycoins avatar

mcqueeneycoins

Zen Follower

Join Date:
Jan 2008
Posts:
156
Plugin Contributions:
0

Re: Database I/O Manager (DbIo) Plugin [Support Thread]

lat9:

To update all products' date-added to the current date:

UPDATE products SET products_date_added = now();

> 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.
> 
> If you're running the query in phpMyAdmin and you use a DB_PREFIX (e.g. '**zen_**'), you'd use
> ```
UPDATE [B]zen_[/B]products SET products_date_added = now();

Works perfectly--thank you as always lat9! Happy holidays!

25 Dec 2024, 1:12 AM
#523
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: Database I/O Manager (DbIo) Plugin [Support Thread]

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?

25 Dec 2024, 12:41 PM
#524
lat9 avatar

lat9

Administrator

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

Re: Database I/O Manager (DbIo) Plugin [Support Thread]

retched:

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.

25 Dec 2024, 6:17 PM
#525
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: Database I/O Manager (DbIo) Plugin [Support Thread]

lat9:

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.

So is there no need to make a separate handler for each additional type?

25 Dec 2024, 8:17 PM
#526
lat9 avatar

lat9

Administrator

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

Re: Database I/O Manager (DbIo) Plugin [Support Thread]

retched:

So is there no need to make a separate handler for each additional type?
It's up to you, but I think that you could do a single version that manipulates a product based on its product-type.

26 Dec 2024, 1:24 AM
#527
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: Database I/O Manager (DbIo) Plugin [Support Thread]

lat9:

It's up to you, but I think that you could do a single version that manipulates a product based on its product-type.
If fields are missing off the CSV import will they just be skipped and ignored?

26 Dec 2024, 12:20 PM
#528
lat9 avatar

lat9

Administrator

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

Re: Database I/O Manager (DbIo) Plugin [Support Thread]

retched:

If fields are missing off the CSV import will they just be skipped and ignored?
If, by "missing", you mean that the associated column is not present, the answer is "Yes".

If a column is present, but the value is an empty string, that value will be set for the 'row'.

27 Dec 2024, 3:33 AM
#529
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: Database I/O Manager (DbIo) Plugin [Support Thread]

lat9:

If, by "missing", you mean that the associated column is not present, the answer is "Yes".

If a column is present, but the value is an empty string, that value will be set for the 'row'.

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.

27 Dec 2024, 12:44 PM
#530
lat9 avatar

lat9

Administrator

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

Re: Database I/O Manager (DbIo) Plugin [Support Thread]

retched:

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/index.php?main_page=product_info&cPath=2_7&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.

27 Dec 2024, 8:11 PM
#531
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: Database I/O Manager (DbIo) Plugin [Support Thread]

lat9:

For now, you'll need to 'purchase' the now-free version of POSM 5.0.0 (https://vinosdefrutastropicales.com/index.php?main_page=product_info&cPath=2_7&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.

Got it! And I'm going to assume that I shouldn't use the 6.0.0 version of POSM yet until you make the necessary changes?

27 Dec 2024, 8:54 PM
#532
lat9 avatar

lat9

Administrator

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

Re: Database I/O Manager (DbIo) Plugin [Support Thread]

retched:

Got it! And I'm going to assume that I shouldn't use the 6.0.0 version of POSM yet until you make the necessary changes?
There aren't any layout/processing differences between POSM 5.0.0 and 6.0.0; the in-core (6.0.0) version has a couple of minor bugfixes and makes use of the zc210 zc_plugin infrastructure.

28 Dec 2024, 1:35 PM
#533
swguy avatar

swguy

Administrator

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

Re: Database I/O Manager (DbIo) Plugin [Support Thread]

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.

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.

28 Dec 2024, 4:20 PM
#534
lat9 avatar

lat9

Administrator

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

Re: Database I/O Manager (DbIo) Plugin [Support Thread]

swguy:

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.
The full log, please, with the backtrace so that the associated handler is identified.

28 Dec 2024, 5:13 PM
#535
swguy avatar

swguy

Administrator

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

Re: Database I/O Manager (DbIo) Plugin [Support Thread]

Ooops. Will post a full log at next occurrence (shouldn't be too long).

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.

8 Jan 2025, 2:47 PM
#536
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: Database I/O Manager (DbIo) Plugin [Support Thread]

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.

8 Jan 2025, 5:29 PM
#537
lat9 avatar

lat9

Administrator

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

Re: Database I/O Manager (DbIo) Plugin [Support Thread]

retched:

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/051c51d9042c22ac4f59937f8e2f409b62782c74/YOUR_ADMIN/includes/classes/dbio/DbIo.php#L29-L32

8 Jan 2025, 6:36 PM
#538
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: Database I/O Manager (DbIo) Plugin [Support Thread]

lat9:

  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/051c51d9042c22ac4f59937f8e2f409b62782c74/YOUR_ADMIN/includes/classes/dbio/DbIo.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?

8 Jan 2025, 6:56 PM
#539
lat9 avatar

lat9

Administrator

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

Re: Database I/O Manager (DbIo) Plugin [Support Thread]

retched:

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.

20 Jan 2025, 3:56 PM
#540
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,875
Plugin Contributions:
7

Re: Database I/O Manager (DbIo) Plugin [Support Thread]

How do I add/import a product to Specials? It doesn't accept ADD on the command.

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...