Jump to content

Set carrier for product using Import CSV


Recommended Posts

Hi
I have set only one special carrier for products from one category. I know that it is possible for each product to determine the carrier opening each product and add appropriate. But how to do a few at a time? I have a lot of products.
Earlier I import products and combinations of the csv file but I can not see where the carrier settings option.

You have any ideas?

Link to comment
Share on other sites

  • 4 months later...

I need this as well.  Hopefully someone finds this.  I have several categories and a different local courier for each category.  This will be very tedious to do it manually in the back office.  I see an Advanced Stock Management column in the CSV upload file, but no carrier.  Might have to write an SQL query to accomplish this????

Link to comment
Share on other sites

I wouldn't say this is solved, but I found a way to do this that isn't too painful via MSExcel and MySQL INSERT query.

 

In your CSV file, force ID column, aa in this example.  Also create a column for the id_carrier, zz in this example. Lastly. create a column that is ignored by the CSV upload but used for an SQL query.  

 

In this ignored column, enter the formula:

=CONCATENATE("INSERT INTO `ps_product_carrier` (id_product, id_carrier_reference, id_shop) VALUES ('";aa1;"','";zz1;"','1');")

 

The resulting text should look something like:

INSERT INTO `ps_product_carrier` (id_product, id_carrier_reference, id_shop) VALUES ('100','5','1');
INSERT INTO `ps_product_carrier` (id_product, id_carrier_reference, id_shop) VALUES ('101','6','1');
INSERT INTO `ps_product_carrier` (id_product, id_carrier_reference, id_shop) VALUES ('102','7','1');
INSERT INTO `ps_product_carrier` (id_product, id_carrier_reference, id_shop) VALUES ('103','8','1');

 

After uploading the products, copy and paste this entire column into mysql> to execute the queries.  Worked for me!

 

Hope it helps someone out!

Teo

  • Like 2
Link to comment
Share on other sites

I wouldn't say this is solved, but I found a way to do this that isn't too painful via MSExcel and MySQL INSERT query.

 

In your CSV file, force ID column, aa in this example.  Also create a column for the id_carrier, zz in this example. Lastly. create a column that is ignored by the CSV upload but used for an SQL query.  

 

In this ignored column, enter the formula:

=CONCATENATE("INSERT INTO `ps_product_carrier` (id_product, id_carrier_reference, id_shop) VALUES ('";aa1;"','";zz1;"','1');")

 

The resulting text should look something like:

INSERT INTO `ps_product_carrier` (id_product, id_carrier_reference, id_shop) VALUES ('100','5','1');
INSERT INTO `ps_product_carrier` (id_product, id_carrier_reference, id_shop) VALUES ('101','6','1');
INSERT INTO `ps_product_carrier` (id_product, id_carrier_reference, id_shop) VALUES ('102','7','1');
INSERT INTO `ps_product_carrier` (id_product, id_carrier_reference, id_shop) VALUES ('103','8','1');

 

After uploading the products, copy and paste this entire column into mysql> to execute the queries.  Worked for me!

 

Hope it helps someone out!

Teo

Thanks for the tip smallbizwiz!  Is it possible to select multiple carries (but not all available) for a product using this method?

Link to comment
Share on other sites

  • 2 weeks later...

Thanks for the tip smallbizwiz!  Is it possible to select multiple carries (but not all available) for a product using this method?

Sorry for such a late reply, haven't been coding lately...yes, you could accomplish 0, 1 or more than 1 carrier for a given product.  The INSERT statement would be exactly the same, just replace the id_carrier_reference with the carriers that wish to have.  To be clear, you can have more than one row in ps_product_carrier with hte same id_product.  If product #1 has four carriers, the insert statements might look like this:

NSERT INTO `ps_product_carrier` (id_product, id_carrier_reference, id_shop) VALUES ('1','5','1');
INSERT INTO `ps_product_carrier` (id_product, id_carrier_reference, id_shop) VALUES ('1','6','1');
INSERT INTO `ps_product_carrier` (id_product, id_carrier_reference, id_shop) VALUES ('1','7','1');
INSERT INTO `ps_product_carrier` (id_product, id_carrier_reference, id_shop) VALUES ('1','8','1');
Link to comment
Share on other sites

  • 1 month later...

I wouldn't say this is solved, but I found a way to do this that isn't too painful via MSExcel and MySQL INSERT query.

 

In your CSV file, force ID column, aa in this example.  Also create a column for the id_carrier, zz in this example. Lastly. create a column that is ignored by the CSV upload but used for an SQL query.  

 

In this ignored column, enter the formula:

=CONCATENATE("INSERT INTO `ps_product_carrier` (id_product, id_carrier_reference, id_shop) VALUES ('";aa1;"','";zz1;"','1');")

 

The resulting text should look something like:

INSERT INTO `ps_product_carrier` (id_product, id_carrier_reference, id_shop) VALUES ('100','5','1');
INSERT INTO `ps_product_carrier` (id_product, id_carrier_reference, id_shop) VALUES ('101','6','1');
INSERT INTO `ps_product_carrier` (id_product, id_carrier_reference, id_shop) VALUES ('102','7','1');
INSERT INTO `ps_product_carrier` (id_product, id_carrier_reference, id_shop) VALUES ('103','8','1');

 

After uploading the products, copy and paste this entire column into mysql> to execute the queries.  Worked for me!

 

Hope it helps someone out!

Teo

 

Brilliant piece of work! Thanks for your code.

 

Ash.

Link to comment
Share on other sites

×
×
  • Create New...