Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

SQL question - Simple if you know how I suppose!?


mrjeff

Recommended Posts

Firstly, hello, ive been looking at this site for some time and its great to see people sharing all this info, I hope to help some one soon, but this time, I have a question for the SQL masters that lurk in this site...

 

We used Easy Populate to upload our products in bulk, however, this is a good hack but this has caused us a little problem and I think an SQL line of code will help us to put it right, but I am not sure how to write the code as I no nothing about SQL. If there is a way of resolving this using SQL, could some one please help otherwise I am going to have to edit every single product online one at a time.

 

This is the problem

The easy populate file asked for one image reference per product, but the shop, has a small, medium and large image option. After uploading all the products, the images worked fine, however, when we edit a product manually through the shop control panel, the shop detects that there is no image reference for the medium image and therefore will not display the image for that product anymore.

 

So what we are asking... Is there a way using an SQL text file and relevant sql instructions to simply copy the products_image to the products_mimage rows on the data base? If so can somebody please supply it? If this is not even possible, does any one else have these issues?

What was done other than manually copying and pasting the product image url to revert the situation?

 

I appreciate all comments.

 

Mr Jeff

Link to comment
Share on other sites

This could be done with a php script I think:

 

1) SELECT - all product_id's in to an array

2) WHILE - loop through the array and

3) SELECT - select the image path where product_id = the one in the array loop

4) INSERT - insert into that product_id the image_path

 

Something like that..

 

Mattice

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

Please forgive me... How do you mean? I get this error, I am using phpmyadmin but I am unsure where I am suppossed to run this file.

 

Thanks again

 

---------------------

 

Error

 

SQL-query :

 

UPDATE products SETproduct_bimage = product_image

 

MySQL said:

 

 

Unknown column 'product_bimage' in 'field list'

Link to comment
Share on other sites

Well.....keeping it up front is a waste of band width and against the forum rules.

 

We are all volunteers....We get tired and go to bed, we stop to eat, and we have families and lives......be patient. If you don't get a response after a day or two, then repost your question again with some additional information. In the meantime....try the search function or just read the forums......You'll be amazed at what you'll find. :D

Link to comment
Share on other sites

I would abide by rules if I was made aware of them??? I am trying to help others also, its not a waste of bandwidth, I am not the only person suffering from this issue... I have searched, i have hit my head against the wall. I have also given stacks of detailed info...

 

I will honour the rules when I know what they are of course :)

Link to comment
Share on other sites

This snippet entered into the SQL area of phpMyAdmin should work.

You can also save this snippet as a file called change.sql

then from a command prompt

mysql catalog <./change.sql

 

 

SELECT *

FROM `products` ;

UPDATE products SET products_mimage=products_image;

 

 

I hope this does it for you.

 

-Matt Stone

Allegro Consultants LTD

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...