Jump to content

CSV Uploads - Primary Key


Recommended Posts

Let's say I have a csv with the following fields.:-

ID
Active (0/1)
Name *
Categories (x,y,z...)
Price tax excl.
Tax rate
On sale (0/1)
Reference #
Supplier reference #
Supplier
Weight
Quantity
Short description
Description
Tags (x,y,z...)
Meta-title
Meta-keywords
Meta-description

I want to re-upload because the "Name" and "Price tax excl." have changed. I will need to tie these changes with the products already in the database so that the details can be over written (I do not want to create duplicate products). I will need to include another field (primary key) are you saying that EAN13, Reference and Supplier Reference are all primary keys?

If so:

My Supplier has changed the box quantities of some products and issued a new Supplier Reference even though the product has not changed. Which two fields would I need to upload in order to change the supplier reference?

I really need to know the hierarchy before I start uploading products otherwise I wil not be able to modify my database if I don't get the structure correct.

Link to comment
Share on other sites

To be honest, the csv import is something for when you upload alot of products in the first time to fill in your shop and not to be used for little adjustments.

Otherwise, you would need to change somtehing on the csv and import all again (click delete existing products during the import) and that will replace all the product with your new csv.

but is it worth replacing all for a couple of changes?
I suggest you dont use the csv for changes that you do.
Ok another way to replace 2 of 3 products, is:
Look for the IDs of the products that you want to replace. make sure the ID in the csv matches the ID of the products in your catalogue that you want to replace (how to find the product ID? in catalogues click on the category where the products are listed and you will see the ID field)
So if you want to replace product ID# 35 in the catalogue for example, make sure that they product ID field in the csv is 35
And during the import DO NOT delete the existing products.

Again, i would say that product import through csv should be for mass import and not for little modifications.
there is a module called masspdate, search for it and maybe you can tweak it to suit your need to update the products in an easy way.
I hope this helped.

Link to comment
Share on other sites

Thanks for the explanation. I have a web site http://www.lampspecs.co.uk where we have over 4500 products and we drive it from csv files. When a supplier changes the prices we simply open the csv in excel and re-upload. It is a very simple process to update prices, I was hoping that I could update PrestaShop the same way.

I find that the way Presta handles the positioning of products to be bizarre. Because you don't put in the path to the product otherwise it adds the products to several categories at once. The means I cannot have to categories with the same name and use csv. For example

home/bulbs/Clear BC
home/candles/Clear BC

There are two categories called "Clear BC" that are not related but in the csv the category can only be "Clear BC"

Unless you know different.

Link to comment
Share on other sites

You are wrong on this one.

Again the category field in the csv is not the category name, it is the category id
So
home/bulbs/Clear BC (cat ID 8 for example)
home/candles/Clear BC (cat ID 23 for example)
In the csv under category, you put 8,23
this way it will appear in both categories.

and when you create the categories, althought the might have the same names, they iwll have different IDs. so not a problem

Prestashop is a clever system :)

Link to comment
Share on other sites

Oh that is great. So if I use Catogory ID's I can be certain the product will go in the right place - good.

If I use product ID's won't that overwrite each time I upload the file; so for example, I have a new set of prices if I upload a csv with just three fields :-

"Product ID" "Product Name" and "Pice excl. tax"

Wouldn't that just update the sales prices but leave descriptions and images etc in place?

Link to comment
Share on other sites

  • 4 weeks later...

Does anyone have a example csv-file?

I'm tryin to get it to import, but no luck yet. Category and manufacturors no problem. But product...no luck. Is there a manual somewhere which states what value you must fill the csv with? Like was said above that categorie is not the name, but the id. So if anyone has an example csv-file or a manual with the correct definitions...that would be great.

Link to comment
Share on other sites

That would be great!

I don't understand why there is no better solution to this yet. There are so many smart developers here. Why isn't there a script directly on the database istead of through the presta backend. I don't know how to make those scripts, but my brother in law said this weekend that if you have the model of the database with all the relations between the tables, then it's easy he said. I'll try to get him to make something like that.

Maybe any of you guys at Presta have the model? You need just a part of it that concerns the relations around the products.

Anyway...till then I hope whatever you (Paul) will send me will work for me as well as it does for you. The massupdate sounds perfect as well. That will save a lot of work!

Link to comment
Share on other sites

  • 1 year later...

EarlMax, I did it with excel. Just search a bit more for how to. Just do not type any data in the ID fild cos PS does it by it self. If you want to add a sub cat , type the sub cat name to NAME and type the main category that sub cat belongs to to "Parent category".

Ex: ID, Name , Parent category
: , AUDI ,
: , A4 , AUDI


Thats all.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...