Search the Community
Showing results for tags 'import images'.
-
Hi, when I want to programmatically add a product, it will not show me the product name. The product is uploaded, but it does not have the name, url and prices, the number of stock. How do I enter the product name to make it work? How do I write code for multistores? Thanks . ini_set('display_errors', 1); error_reporting(E_ALL); header('Content-Type: text/html; charset=utf-8'); define('_PS_ADMIN_DIR_', getcwd()); include(_PS_ADMIN_DIR_.'/../config/config.inc.php'); require_once('../classes/stock/StockAvailable.php'); include('/init.php'); function NewProduct(){ $product = new Product(); $product->reference = $product_code; // 1234A - 25 $product->name = array((int)(Configuration::get('PS_LANG_DEFAULT')) => $name_product); // Unicode ěščřžý , éůú $product->link_rewrite = array((int)Configuration::get('PS_LANG_DEFAULT') => Tools::str2url($name_product)); $product->description_short = array((int)(Configuration::get('PS_LANG_DEFAULT')) => $sh_description); // unicode $product->description = array((int)(Configuration::get('PS_LANG_DEFAULT')) => $description); // unicode $product->id_category_default = 12; $product->category = 12; $product->redirect_type = '404'; $product->minimal_quantity = 1; $product->show_price = 1; $product->on_sale = 0; $product->online_only = 1; $price = round(($mo_price / '1.25'),6); // '1.25' is VAT $product->price = $price; $product->wholesale_price = '0.000000'; $product->ean13 = $ean13; $product->quantity = $quantity; // 30 $product->Add(); $product->addToCategories(array(2)); $shops = Shop::getShops(true, null, true); $image = new Image(); $image->id_product = $id_product; $image->position = Image::getHighestPosition($id_product) + 1; $image->cover = true; if (($image->validateFields(false, true)) === true && ($image->validateFieldsLang(false, true)) === true && $image->add()) { $image->associateTo($shops); if (!copyImg2($id_product, $image->id, $image_url, 'products', false)) { $image->delete(); } } } function copyImg2($id_entity, $id_image, $url, $entity = 'products', $regenerate = true) { $tmpfile = tempnam(_PS_TMP_IMG_DIR_, 'ps_import'); $watermark_types = explode(',', Configuration::get('WATERMARK_TYPES')); switch ($entity) { default: case 'products': $image_obj = new Image($id_image); $path = $image_obj->getPathForCreation(); break; case 'categories': $path = _PS_CAT_IMG_DIR_ . (int) $id_entity; break; case 'manufacturers': $path = _PS_MANU_IMG_DIR_ . (int) $id_entity; break; case 'suppliers': $path = _PS_SUPP_IMG_DIR_ . (int) $id_entity; break; } $url = str_replace(' ', '%20', trim($url)); // Evaluate the memory required to resize the image: if it's too much, you can't resize it. if (!ImageManager::checkImageMemoryLimit($url)) return false; // 'file_exists' doesn't work on distant file, and getimagesize makes the import slower. // Just hide the warning, the processing will be the same. if (Tools::copy($url, $tmpfile)) { ImageManager::resize($tmpfile, $path . '.jpg'); $images_types = ImageType::getImagesTypes($entity); if ($regenerate) foreach ($images_types as $image_type) { ImageManager::resize($tmpfile, $path . '-' . stripslashes($image_type['name']) . '.jpg', $image_type['width'], $image_type['height']); if (in_array($image_type['id_image_type'], $watermark_types)) Hook::exec('actionWatermark', array('id_image' => $id_image, 'id_product' => $id_entity)); } } else { unlink($tmpfile); return false; } unlink($tmpfile); return true; }
- 3 replies
-
- addproduct
- webservice
-
(and 1 more)
Tagged with:
-
Bonjour, J'essaye d'importer en masse les produit et les images. Je reçois les mêmes erreurs à chaque fois pour les images. Peut importe où je les placent sur les serveur avec CHMOD 777. "... Il y a 4 avertissements. Cacher l'avertissement Produit n°235 : L'image (http://www.monsite.c...ue/10012110.JPG) ne peut pas être sauvée! Produit n°236 : L'image (http://www.monsite.c...es/a1001211.jpg) ne peut pas être sauvée! ..." Avez-vous une idée comment m'en sortir? Merci,
- 12 replies
-
- images produit
- import images
-
(and 2 more)
Tagged with:
-
i have a question i have a file( .xlsx) with 9000 product in this file there are no images tables, therefore all the pictures I have in a folder every image have name as the product code example if the product code in .xlsx file have sku "9834623984" the image is called 9834623984.jpg now after import .xlsx file in prestashop how abbinate every image at product ?? note: for every product compare more image, for more image the image is called "9834623984+1.jpg" "9834623984+2.jpg" "9834623984+3.jpg" is used then the "+" for identificate more image There is software that does this ?? or code ?? or in alternative if you have competence for this contact in pm for quote thanks
-
Hi, I have 1.6.0.6 version of Prestashop. My problem is I can't upload more than one image to each combination. I would like to have 2 images for one color-size combination. So I separate image urls by ', ' but in doesnt work. It sees separate urls as one url and throws error 'there is a problem copying file... 'one url, second url'. There is no problem when it is only one url. My CSV line example: 1342331;Kolor:select:0, Rozmiar:select:1;szary:0,m:1;166727;kat.M.K145.szary.kat.170301;;;;;;10;1;0;0;1;media_110089.jpg, media_110090.JPG;1;1;0;0;0 Please help. I have tried many solutions and all don't work for me.
-
- import csv
- import combinations
-
(and 1 more)
Tagged with:
-
I use the Import function to add images to my product. The file has this field: header) id_product,img_url,delete_previous_img record) 10,http://www.myimgspace.com/10.jpg,0 After the process, retur the message with success but no images in my catalog. Any ideas? Thanks
-
- import product
- import products
-
(and 1 more)
Tagged with:
-
Hi, I need some help. Using product import based in a CSV file am I not able to upload the images also?? Very frustrating, cause I simply do not see what I am doing wrong here. The whole import works however I am getting an error on the images: “Error copying image:http://www.yacht-parts.com/upload/img.jpg” I did upload the product image to my \upload\ dir and it has 777 access rights. I also tried to do this from the \img\ and \img\p directory all with the same results! Anyone figured this out how this should work?? Using 1.4.7. See my import file attached. Thanks Bart importDH-ex.zip