Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help, missed to fill in Manufactures for some products!


bergan

Recommended Posts

Hi there all you smart PHP people! :rolleyes:

We have a store with about 3000 products and some of them we have missed to fill in the "Manufacturer"

Then when we use contributions like "Products Update" we can´t see the products whitout "Manufacturer" inserted. How can we do to resolve this? Yes i know i could search thru all my products and fill them in ....... but plz say there is another more smoother way. Could i sort them out or something? Or inactivate ""Manufacturer" when it lists the products...??? As you understand im not that good in PHP and MySQL. Any suggestions and help are sooo welcome.

Link to comment
Share on other sites

If you can identify the products by looking at the data, you could use an admin backup and enter the manufacturers_id manually. You can do it from phpmyadmin but if you do it from the backup, you just need to restore it after.

 

Example from a stock admin backup, this is the first entry in the products table:

 

insert into products (products_id, products_quantity, products_model, products_image, products_price, products_date_added, products_last_modified, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id, products_ordered) values ('1', '32', 'MG200MMS', 'matrox/mg200mms.gif', '299.9900', '2007-04-07 02:28:36', NULL, NULL, '23.00', '1', '1', '1', '0');

 

The manufacturers_id for that product is 1 which is Matrox.

If the id wasn't entered, the last two numbers would be '0', '0'); but as it has been, they are '1', '0');

 

If you changed the manufacturer to Logitech, the id would be 5 and the complete query would read:

 

insert into products (products_id, products_quantity, products_model, products_image, products_price, products_date_added, products_last_modified, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id, products_ordered) values ('1', '32', 'MG200MMS', 'matrox/mg200mms.gif', '299.9900', '2007-04-07 02:28:36', NULL, NULL, '23.00', '1', '1', '5', '0');

 

You can find the manufacturers_id from the manufacturers table, which is before the products table.

 

Once you have manually entered the missing manufacturers_ids, you just need to restore the edited backup from admin. Or, if you just cut the products table from the backup to work with (which is what I would do) you just need to save it as products.sql into the backups directory and restore that. Although doing it this way, you have to consider you need the entire products table query - from drop table if exists products; to the very last semi-colon ;

 

Make sure you keep an unchanged copy of the database backup incase something goes wrong.

Link to comment
Share on other sites

Thank you so much for the fast reply. :thumbsup:

Huuuga, so i need to search thru my 3000 articles? For that double zeros at the end... ok :blush:

I will try what you suggest, someone said that maybe it was possible to write a question that sorted out the products that didn´t have the Manf. ID ??

Could that work?

Id better start codesearching for that double zeros ......

Thanks again

Link to comment
Share on other sites

In phpmyadmin, you can find all the products with no id with this query:

 

SELECT * FROM `products` WHERE `manufacturers_id`=0

 

But being as they all have a different products_id, it would get a little complicated altering them the same way.

 

You could dump the data from the above query, save as products.sql, make your changes then use a merge tool to put the edited queries into a backup. Then restore.

 

There are many ways to skin a cat, just needs some lateral thinking. Like I said before though, always keep an up-to-date backup to one side. Then you can jump in and play with the db and if you mess up, it doesn't matter.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...