Jump to content

CSV Upload does not set supplier


Recommended Posts

Hi all!

 

This is the problem. If you create a product manually you can set the supplier under the supplier tab. This is then saved in the ps_product_supplier table.

 

But if you upload a CSV instead this does not happen. The suppliers get the products assigned to them but if you look at the supplier tab in the detailed product page in BO, no supplier is marked and no info is saved in the ps_product_supplier table. How can this be solved. I know have a CSV with 1000 products to upload and having to go through them one by one in BO is just a nightmare

Hope someone understand

Edited by Vegaanders (see edit history)
Link to comment
Share on other sites

It should be added. I just checked the code and it's lines 1969-1984 (in PrestaShop v1.6.1.7) that imports the ps_product_supplier table:

            // Product supplier
            if (!$validateOnly && isset($product->id) && $product->id && isset($product->id_supplier) && property_exists($product, 'supplier_reference')) {
                $id_product_supplier = (int)ProductSupplier::getIdByProductAndSupplier((int)$product->id, 0, (int)$product->id_supplier);
                if ($id_product_supplier) {
                    $product_supplier = new ProductSupplier($id_product_supplier);
                } else {
                    $product_supplier = new ProductSupplier();
                }

                $product_supplier->id_product = (int)$product->id;
                $product_supplier->id_product_attribute = 0;
                $product_supplier->id_supplier = (int)$product->id_supplier;
                $product_supplier->product_supplier_price_te = $product->wholesale_price;
                $product_supplier->product_supplier_reference = $product->supplier_reference;
                $product_supplier->save();
            }

As long as the product, supplier and supplier reference exist, it should work. Did you specify a supplier reference?

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...