Originally Posted by
CaroleAs
Just to clarify, how do I do that "manual SQL" instruction?
I apologize if this is made more basic than desired, expected, or necessary; however, based on the question I'm nearly starting at the beginning...
Okay, so there appear to be four product that are to be reassigned from a product_general to a document_general product type. First need to identify the products_id for each of the four product.
This can be found in a number of ways: navigation of the store side of the site and noting the uri for each of the four product (contains products_id=XXX where XXX is the products_id) when using a standard ZC installation, navigating the admin side in the catalog->Products/categories section and navigating to the category that contains the product the products_id will be on the left side of the listing, there are yet other ways to identify the products_id within the admin and otherwise.
Anyways, now that the products_id is in hand, one for each product, the goal is to now change the products_type from product_general to document_general...
Now, to do this requires executing a sql statement. ZC has been written to include a sql statement executor that doesn't require the datatable prefix, because it applies it automatically now. What this means is that a "generic" SQL statement can be written and when executed in the tools->Install SQL Patches section that SQL statement will "work" for any store. (Quoted work because there are some obvious reasons that a SQL statement may not work such as a modification of a field that exists only in a plugin and the plugin is not installed on the system, or in the case of security a select statement doesn't display information, etc...)
So if we assume that the products_id of the first of four product to modify is say 31, then when in the admin screen, select tools->Install SQL patches
In the text block that appears, place the following therein. It must end with a semi-colon as provided.
Code:
UPDATE products SET products_type = 3 WHERE products_id = 31;
Then repeat for the other three replacing 31 with the next/each products id to modify.
Another way to do this slightly "faster" is to identify all four products_id in a single statement:
Code:
UPDATE products SET products_type = 3 WHERE products_id in (31, num_two, num_three, num_four);
Where the actual number replaces each of num_two, num_three, and num_four.
An added "safety" to each of those statements would be to include a sort of validation/prevention of changing the products_type of a product that has otherwise already been modified, such as:
Code:
UPDATE products SET products_type = 3 WHERE products_type = 1 AND products_id = 31;
So, does that make it clearer and/or executable?
Bookmarks