MrBaseball34 Posted June 28, 2010 Share Posted June 28, 2010 Because the way that product image links are stored in 1.3.1, we are going to have to modify our vendor product file import process. This is currently how we process the images: // ************************************** // Copy the image and create the link here // ************************************** // $line[4] contains the path to the image on // the vendor's site $image = addslashes($line[4]); $path_parts = pathinfo($image); $ext = $path_parts['extension']; /********************************************** * $partno is the value store in the feature_value_lang * table with the feature_value Part No. **********************************************/ $newname = '../img/p/'.$partno.'.'.$ext; if (!file_exists($newname)) { // we copy the image to our site and update the // image value to point to the image stored on // our site. if(@copy($image,$newname)) { // Now create the new link and set $image variable to it. $image = $partno.'.'.$ext; } else { // $image is already set to the URL of the image } // if(@copy($image,$newname)) } else { $image = $partno.'.'.$ext; } Then in our add_product function...we store the new link to the image in the hack_image column in ps_product. // Adds a new product and returns its ID // DONE function add_product($db, $categoryID, $manufacturerID, $ean13, $quantity, $cost, $weight, $active, $image){ $id = 0; require('config.php'); // contains $db class and connection paramters $sql = "insert into " . $prefix . "product(id_category_default, id_manufacturer, ". "ean13, quantity, price, weight, active, date_add, date_upd, hack_image) ". "values($categoryID, $manufacturerID, '$ean13', $quantity, $cost, ". "$weight, $active, NOW(), NOW(), '$image')"; $result = $db->query($sql) or die('error, add product failed '.$sql); $id = $db->insertId(); return $id; } How would I modify the add_product function to correctly store the imageinfo in 1.3.1? I'm not sure if this is the only problem I'm going to run in to in updating our import process to work with 1.3.1 but if you have any insights, I'd be happy to hear them. Link to comment Share on other sites More sharing options...
MrBaseball34 Posted June 29, 2010 Author Share Posted June 29, 2010 Looks like the hack_image column I was referring to was added by the original designer of the shop here.I added code at the beginning of my import that checks for the existence of the column and adds it if it isn't there.The code we have uses that column so I go no problems now. I am also trying to add the image info to ps_image but am having problems. Can someone explain the ps_image, ps_image_lang and ps_image_type tables and what should go into each? Link to comment Share on other sites More sharing options...
Recommended Posts