giuseppe lauricella Posted May 4, 2017 Share Posted May 4, 2017 Hi.For my website, I'm developing a script that scrapes some website to insert product on my shop.For stuff like dimensions, names, descriptions and so on, it's all fine, but when I insert (into File System, firstly, and into the DB, later) the images, I see them in the backend but not in the previews of the products, even if I do the thumbnail refresh. This is the relevant Python code: try: sql = "INSERT INTO psz1_image (id_product, position, cover) VALUES (%i, %i, %s);" % ( pid, i, "1" if i == 1 else "NULL") cur.execute(sql) except IntegrityError: pass conn.commit() try: sql = "SELECT id_image FROM psz1_image ORDER BY id_image DESC LIMIT 1;" cur.execute(sql) img_id = str(cur.fetchone()[0]) sql = "INSERT INTO psz1_image_lang (id_image, id_lang, legend) VALUES (%s, %i, '');" % (img_id, 1) cur.execute(sql) conn.commit() sql = "INSERT INTO psz1_image_lang (id_image, id_lang, legend) VALUES (%s, %i, '');" % (img_id, 2) cur.execute(sql) conn.commit() sql = "INSERT INTO psz1_image_lang (id_image, id_lang, legend) VALUES (%s, %i, '');" % (img_id, 3) cur.execute(sql) conn.commit() except: pass How could I solve the problem and see the images on the website?Thank you in advance. Link to comment Share on other sites More sharing options...
musicmaster Posted May 6, 2017 Share Posted May 6, 2017 You are forgetting the ps_image_shop table. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now