Aldeag Posted January 21, 2021 Share Posted January 21, 2021 Hi, it has happened to me many times and I have googled and in this forum and still have not found the solution. It turns out that when importing the size and color combinations of a product through CSV and assigning an image (or several) to each combination, the images are multiplied. I don't know if I explain myself. If I have 2 colors red and black, and sizes S, M, L, I have 6 combinations, right? If I import an image link (the same link) into the CSV for the combinations of red and another for black, having two images, how do I end up having 6 imported images? Actually there should be two images, as they are two colors, in three sizes each. I can do that by hand if I create a new article, add the two images and then in combinations I edit each combination and assign one of the two images by color. We still have two images, right? Is there any way to do it when uploading in csv? That there are two images instead of 6? For each color I have to upload three images: front, and two sides. For four or five sizes and five or six colors: a lot of images. I don't want to upload hundreds of articles by hand being able to do it by csv. I dont want to edit the attributes -> colour and change to Texture, because a coat in red does not have the same image as a t-shirt in red. I would like to solve this because soon I will have to upload hundreds of products with several images per colour and that is a lot of images. Link to comment Share on other sites More sharing options...
elburgl69 Posted January 21, 2021 Share Posted January 21, 2021 Load all your images with the product and reference in the combination file the position of the image (in the Image Position entry) of this combination. FE. prd.csv 12324;"Test product";"image1Red.jpg, image2Red.jpg, imageBlue1.jpg, imageBlue2.jpg" combinations.csv "Product ID";"Atribute Name";"Attribute Value";"Image Position" 12324; "color, size";"Red, S", "1, 2" 12324; "color, size";"Red, M", "1, 2" 12324; "color, size";"Red, L", "1, 2" 12324; "color, size";"Blue, S", "3, 4" 12324; "color, size";"Blue, M", "3, 4" 12324; "color, size";"Blue, L", "3, 4" 1 2 Link to comment Share on other sites More sharing options...
Aldeag Posted January 21, 2021 Author Share Posted January 21, 2021 Thanks for your fast answer. How do I link those images with Image Position? I´m still not sure if I understand CSV´s Link to comment Share on other sites More sharing options...
elburgl69 Posted January 21, 2021 Share Posted January 21, 2021 (edited) In the product csv, you add all images. The will be loaded starting at position 1, 2, 3, etc. In the combinations csv you use the image position field, to link to the position of the image. In my example all the red combinations reference image position 1 and 2, which in this example are the images for the red product. If only one image, reference just 1 image. In the admin part with the product, the image top left is the first position, the next to it the second position, the one bottom right Count(position). And if you want to add a new combiation (1 color 3 sizes) to an existing product. Count how many images it has. Put in the csv field "image URL" with the first combination a link(s) to the image(s). Leave "image position" empty for the first row. Leave "image URL" empty for the other 2 sizes and fill "image position" with (count + 1), (count + 2) depending on the amount of images you added with the first combination. rg, Leo Edited January 21, 2021 by elburgl69 Addition. (see edit history) 1 Link to comment Share on other sites More sharing options...
Aldeag Posted January 21, 2021 Author Share Posted January 21, 2021 Thanks a lot for the time you take to explain it. It´s the first time someone takes care to explain a thing I´ve been looking for a long time I used to upload a link to the images in all the combinations, as well the product itself. May I ask you more details about CSV´s Sorry for my english. I´m from Spain. Link to comment Share on other sites More sharing options...
elburgl69 Posted January 22, 2021 Share Posted January 22, 2021 If you have any other questions, please feel free to ask. Glad to answer if I know the answer and have time available. 1 Link to comment Share on other sites More sharing options...
Aldeag Posted January 22, 2021 Author Share Posted January 22, 2021 What kind of ID do you use? Do you use the reference of your supplier? Then, what do you use as internal reference? Do you force ID? Link to comment Share on other sites More sharing options...
elburgl69 Posted January 22, 2021 Share Posted January 22, 2021 (edited) For Product.csv files the ID is the id_product the product will get in the database. If you do not set the switch force ID's, the value of the ID column in the CSV file is ignored and a new ID i generated by your MySQL server. So If you create your Product.csv and combinations.csv at the same time, use Force ID's. I don't see an use case where you do not want to use Force ID's if you have combinations. You have to load the product.csv, get the id from the system and enter that one in the id_product column of your combinations.csv? If you load product without combinations, it might be useful. Personally I always generate an ID with the following rules: Brand Identifier (2 digits) Year (1 digit last number of the year 2020 => 0, 2021 =>1) Collection identifier (1 digit, 0= Winter Collection, 1 = Summer Collection) A counter within a Brand increases with every product and every combination of that brand (6 digits, you can reset this yearly if necessary) I also store the product ID in the reference fields (of both the product and the combination). It allows you to easily find in the back-end all products of a brand, of a certain year, of the summer or winter collection. I use the supplier_reference to store the sku code of the point of sale system my customers use (the leading stock management system). This allows me to synchronize stock with and report sales to the pos-system. But you could also store the number that you use to order the product with your supplier. I have written some tooling that allows my customers to supply me with *.xlsx files, which contains a product and combination data combined. A row for each combination in which the product information repeats (or is left empty after the first row of that product). I process those files to generate the Product and Combination .csv files, generating the ID's and putting the correct image postions in the combination file, etc. I offer that as a service to my customers, they pay per file I process. In my humble opinion you can not create product and combination cvs files without some automated processing. To sensitive to errors. Edited January 22, 2021 by elburgl69 (see edit history) 1 Link to comment Share on other sites More sharing options...
Aldeag Posted January 22, 2021 Author Share Posted January 22, 2021 Thanks. Quite well explained. Link to comment Share on other sites More sharing options...
Aldeag Posted January 23, 2021 Author Share Posted January 23, 2021 (edited) Some times it happened to me if I upload an item with combinations size S, M, L, XL, XXL and color white, black, pink having pink only in S, M and black and white in M, L, XXL it can happen that S, L and XXL don´t show properly even if you select the right color. It means I have to fill all pinks in L, XL, XXL to 0 and white and black S to 0 so they show properly. If I don´t fill them I got that problem That is a mess because many items don´t come in all the sizes. And there are a lot of items. Edited January 23, 2021 by Aldeag (see edit history) Link to comment Share on other sites More sharing options...
Aldeag Posted January 24, 2021 Author Share Posted January 24, 2021 If I import combinations with new colours that don´t exist, they are created on the way, but how can I see the image combination instead colour swatches? Link to comment Share on other sites More sharing options...
elburgl69 Posted January 24, 2021 Share Posted January 24, 2021 (edited) Do you mean selecting the colors with the colored squared in stead of a drop down select? You must do it manual. Go to - Catalog -> Attributes and Features Edit on the Attribute tab the color attribute. Set attribute type to "color or texture", if it's not. Save. View the values of the attribute. Edit the ones without a color/texture assigned (or incorrect collor/texture) and assign one. (Color field or upload a texture in the field). From the combination upload you cannot assign the color/texture to a attribute value. You could override /classes/AdminImportController.php to allow for a third an a forth parameter: - Value (Value:Position:ColorCode:TextureFileURL)* or make a change request at Prestashop for it. For what it is worth. I do no use color types for attribute's. I use a drop down with the commercial color name like "Urban Kaki" or alike. I have my customers also fill a a comma seperated list of primary colors, uniformly named, that the product contains and create a color feature (add them in product.csv) with those colors as values, so customers can search and filter on color properties, but pick the color besed upon the commercial name. Rg, Leo Edited January 24, 2021 by elburgl69 (see edit history) Link to comment Share on other sites More sharing options...
Aldeag Posted January 24, 2021 Author Share Posted January 24, 2021 Thanks for your answer. That I knew it. The problem is that not all the combinations use the same image for it´s color, for example, a brown t-shirt does not use the same image as a brown jacket. I´ve been using this module in Prestashop 1.7.6.3 but as I updated to 1.7.7 it does not work till the developer updates it. I thought it can be done in Prestashop directly, but maybe I´ll wait till the update. https://www.sunnytoo.com/57773/show-combination-images-textures-free-prestashop-module Link to comment Share on other sites More sharing options...
elburgl69 Posted January 24, 2021 Share Posted January 24, 2021 Nice module. Something I can use too. Thanks. Link to comment Share on other sites More sharing options...
Aldeag Posted January 25, 2021 Author Share Posted January 25, 2021 Hi, I have a doubt. I am importing items with combinations (footwear) by CSV. Some sizes have a different price, so instead of putting a price on the item (product) and the impact on the combination, I am putting the price of the product "0" and in the impact I put the final price. With which I avoid having to calculate what is the price difference to add in the impact. I don't know if this is the right thing to do. The problem is that if I import the price from Product I can choose Tax excluded or Tax included But if I import the price from Combinations, Impact in price appears but it does not indicate whether or not it includes the tax. The fact is that I indicate in Combinations Impact on price and the final result is that VAT is added to a price that already includes VAT, that is, twice. How do I set the price so that the final price is what I want, including VAT, without having to calculate the price without VAT inversely? Link to comment Share on other sites More sharing options...
elburgl69 Posted January 25, 2021 Share Posted January 25, 2021 4 minutes ago, Aldeag said: But if I import the price from Combinations, Impact in price appears but it does not indicate whether or not it includes the tax. I would report this as an bug. One would expect such a including / excluding tax option with all product related prices. A work arround for now: I assume you make your csv files in a spreadsheet program? Then just add a column that caluculates the price ex taxes. On export to csv, export the values (not formulas). At importing the combinations in prestashop.map the price exluding taxed to the imact on price column and set the original price column to ignore. (save that setting as importCombinations for later reuse). 1 Link to comment Share on other sites More sharing options...
Aldeag Posted January 25, 2021 Author Share Posted January 25, 2021 I will try that. Maybe I have to add more than one column: One to discount the taxes, another to round up or down the decimals. I hope it works as I get fixed prices from the provider. Yes I´m using xlsx Excel. In Prestashop 1.7 I can import xlsx directly without exporting to CSV. It takes the result of the formula, not the formula itself. Link to comment Share on other sites More sharing options...
Aldeag Posted January 25, 2021 Author Share Posted January 25, 2021 (edited) Another question added to list: I´m almost finished configuring my Excel sheet. I have some item that came twice, so there are two lines of each item with different quantities For example: I have one pack with shoes size 39, 40, 41, 42, 43, 44 white and another pack the same item but in sizes 36, 37, 38, 39, 40 so they came in different lines. (I don´t mean a pack of products, but the boxes I receive, I sell them by unit) So I expected that if I get one per size in different lines they add up, so in size 39 and 40 I would end with 2 x 39 and 2 x 40, but no: I end up with: 1 x 39, 1 x 39, 1 x 40, 1 x 40 so this has no sense. There are too many lines in my list, up to 1200 lines. I cannot look for duplicates and add up by hand. Edited January 25, 2021 by Aldeag (see edit history) Link to comment Share on other sites More sharing options...
Aldeag Posted January 26, 2021 Author Share Posted January 26, 2021 I´m importing a csv (made a csv because xls gives me prices with decimals too long and the importer does not like it but it changes "´" and "ñ" ) I made two csv: one for men´s sizes (they come in boxes with men´s sizes but exactly same model, code as woman) in this case 39-40, 41-42, 43-44, 45-46 I made another csv for womans sizes 35-36, 37-38, 39-40, 41-42 Same problem. They don´t add up, but makes separate lines for sizes 39-40 and 41-42 Any solution? Link to comment Share on other sites More sharing options...
Aldeag Posted January 27, 2021 Author Share Posted January 27, 2021 (edited) I made a test Product with one color and 4 sizes (39-40; 41-42; 43-44; 45-46) I import via csv with this quantities (1 x 39-40; 5 x 41-42; 5 x 43-44; 1 x 45-46) once. I does it right. I import the same again. In this case I suppose I´ll get (2 x 39-40; 10 x 41-42; 10 x 43-44; 2 x 45-46) But no. I get (1 x 39-40; 5 x 41-42; 5 x 43-44; 1 x 45-46) and (1 x 39-40; 5 x 41-42; 5 x 43-44; 1 x 45-46) This is a mess!! How can update new arrivals (dozens or hundreds) if with just a single one this happens? In the front office I get the Select size with just those 4 sizes, and the quantities applies only for that first import. In backoffice I get eight combination lines instead 4 Is it a bug or I´m doing it wrong way? Edited January 27, 2021 by Aldeag (see edit history) Link to comment Share on other sites More sharing options...
elburgl69 Posted January 27, 2021 Share Posted January 27, 2021 Sorry was busy. Do you have the refence field (in combinations.csv) correctly filled? If they macth it should update the existing product. For syncing stocks, this is not really the most appropiate way to go. Do master PHP a bit? I can mail some code that downloads a file from a well known location and processes it the file to update stocks and prices (the latter on product level though). I have it running under cron each 30 minutes. But you can also start it manually by pointing in a browser to it. You could the upload your file manually to your server an start manually, using that file. It uses the barcode (ean-code) to synch. It is of course completely written to my situation, but I guess it could be a starting point. When interested, please drop me a mail. Rg, Leo Link to comment Share on other sites More sharing options...
elburgl69 Posted January 27, 2021 Share Posted January 27, 2021 On 1/25/2021 at 4:25 PM, Aldeag said: So I expected that if I get one per size in different lines they add up, so in size 39 and 40 I would end with 2 x 39 and 2 x 40, but no: Here also, use the same reference field value. Link to comment Share on other sites More sharing options...
Aldeag Posted January 27, 2021 Author Share Posted January 27, 2021 (edited) Yes, I use the same ID for Product (and force ID) and for importing Combinations. I use the same name for colors. Or should I use their ID? (Then that would be very complex to find and add to csv) I use the EAN, which there is one for each combination alone. I use Cost price impact and Price without taxes impact in the Combinations csv (In Products I set them to 0, because some sizes change price) I do not know anything about php. I only know copy and paste. And Update combinations or Products, do they add the new values to the old or change the old values for the new? ""Do you have the refence field (in combinations.csv) correctly filled?"" Which Reference you mean? I use spanish so I got this fields Edited January 27, 2021 by Aldeag (see edit history) Link to comment Share on other sites More sharing options...
elburgl69 Posted January 27, 2021 Share Posted January 27, 2021 (edited) It is the "Referencia" field. In my memory it matches on that field. Probably uploading through combinations will not add but over write the stock posistion. I have made a customisation to the upload controller not sure anymore what excactly. I perhaps it concerned the reference field. I attached it. Put it in you <docRoot>/override/controllers/admin/ directory and test. I have no time to have a look in depth, perhaps this weekend. If stocks are overwritten it should be easy to adapt this in controller. Note this is not the earlier mentioned stock syncing code. Rg, Leo AdminImportController.php Edited January 27, 2021 by elburgl69 Correction type + addtion info (see edit history) Link to comment Share on other sites More sharing options...
Aldeag Posted January 27, 2021 Author Share Posted January 27, 2021 Thanks a lot. Once uploaded, how does it work? What should I do? Link to comment Share on other sites More sharing options...
elburgl69 Posted January 27, 2021 Share Posted January 27, 2021 Ptestashop picks up overrided controllers automatically. Clear cache to be sure. Rg, Leo Link to comment Share on other sites More sharing options...
Aldeag Posted January 27, 2021 Author Share Posted January 27, 2021 Now AdminImportController.php is installed and I made the import twice but with different quantities per size. Now I don´t get the extra lines per sizes, so now is right this way. But the quantities in combinations do not add but over write the stock. I only get the last import. Link to comment Share on other sites More sharing options...
elburgl69 Posted January 28, 2021 Share Posted January 28, 2021 Have not tested it, no time. But if you do not use advanced stock management feature, this version should add stocks. Succes AdminImportController.php Link to comment Share on other sites More sharing options...
Aldeag Posted January 28, 2021 Author Share Posted January 28, 2021 I tried to import again with stock management disabled. Now I don´t see any stock in combinations, neither in front office. So this is a bad side effect of disabling stock management. Translate from the help in Prestashop: Activate automatic stock management. This option allows you to adjust the main function of the stock manager: you can set the current quantity that a product has (stock), and allow PrestaShop to reduce this quantity each time an order is produced, and increase this quantity for each canceled order. By default, you should leave this feature enabled, as disabling it would affect all inventory in your store. You should only disable this option if you don't have any physical inventory - for example, if you only sell virtual products. Link to comment Share on other sites More sharing options...
elburgl69 Posted January 28, 2021 Share Posted January 28, 2021 It about Advanged Stock Management. Something with seperate stock locations. Leave the option stock management on an then test. Link to comment Share on other sites More sharing options...
Aldeag Posted January 28, 2021 Author Share Posted January 28, 2021 I get this in Shop Parameters -> Products Configuration Now It keeps changing the stock, not add up. Link to comment Share on other sites More sharing options...
Aldeag Posted January 29, 2021 Author Share Posted January 29, 2021 En 28/1/2021 a las 9:20 AM, elburgl69 dijo: Have not tested it, no time. But if you do not use advanced stock management feature, this version should add stocks. Succes AdminImportController.php 72.78 kB · 1 download You'll forgive me. I haven´t noticed that you uploaded a second version of AdminImportController so I haven´t tried with this second one. Now I made the test with this one. But unfortunately I don´t see any difference. It keeps Updating to the new quantities without adding to the existing ones. Link to comment Share on other sites More sharing options...
Aldeag Posted February 2, 2021 Author Share Posted February 2, 2021 Any way that I can import csv adding the new quantities to the old ones, instead changing the old ones for the new ones? Link to comment Share on other sites More sharing options...
elburgl69 Posted February 2, 2021 Share Posted February 2, 2021 Try this one. Unless your are using Advanced Stock Management, this must do the trick. In case you do use Advanced Stock Management I can help. Did not work with it and I cant oversee the impact of StockAvailable on those cases. Rg, Leo AdminImportController.php 1 Link to comment Share on other sites More sharing options...
Aldeag Posted February 4, 2021 Author Share Posted February 4, 2021 SUCCESS!! Finally this last one updates quantities in combinations, adding up new quantities to existing ones, not simply deleting old ones and changing to new ones. Thanks a lot!! I will test it a bit harder as I only tried with one product, one color, 4 sizes Thanks again!! Link to comment Share on other sites More sharing options...
TheCHE Posted June 23, 2022 Share Posted June 23, 2022 (edited) Hello, I have read this page and I dare to ask if you can help me. I have been spending quite a bit of time exporting and importing products from one store to another via .CSV. Everything works correctly except the assignment of the images in the combinations because the order of the images in the source store is not the same as the destination store. The order that I get to export is the order of insertion of the images (example: if I insert an image it is assigned id_image=1, if I assign another image id_image=2), not the modified order of the source store. Is there a way to export the images so that they have the same order? I get this result. But the "position" value is only correct if the order of the images is the same. I want to get the same sequence here in order to assign the combination position correctly. Edited June 23, 2022 by TheCHE (see edit history) Link to comment Share on other sites More sharing options...
TheCHE Posted June 23, 2022 Share Posted June 23, 2022 5 hours ago, TheCHE said: Hello, I have read this page and I dare to ask if you can help me. I have been spending quite a bit of time exporting and importing products from one store to another via .CSV. Everything works correctly except the assignment of the images in the combinations because the order of the images in the source store is not the same as the destination store. The order that I get to export is the order of insertion of the images (example: if I insert an image it is assigned id_image=1, if I assign another image id_image=2), not the modified order of the source store. Is there a way to export the images so that they have the same order? I get this result. But the "position" value is only correct if the order of the images is the same. I want to get the same sequence here in order to assign the combination position correctly. Then I get different position sequence in destination combinations page. Ok guys, I just found a solution. To get the same sequence you have to add "Order BY" in the product export SQL script. GROUP_CONCAT(DISTINCT(CONCAT('https://', . . . . . . . -- put the image extension '.jpg')) Order by pi.position SEPARATOR ', ') AS 'Images (x,y,z...)', Link to comment Share on other sites More sharing options...
Aldeag Posted February 4 Author Share Posted February 4 En 3/2/2021 a las 12:57 AM, elburgl69 dijo: Try this one. Unless your are using Advanced Stock Management, this must do the trick. In case you do use Advanced Stock Management I can help. Did not work with it and I cant oversee the impact of StockAvailable on those cases. Rg, Leo AdminImportController.php 73.39 kB · 13 downloads Hi Elburgl69 Will those changes work in Prestashop 8 ? Thanks in advance. 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