phpprestashop

Add carriers in a prestashop product in php


I am creating a product in php in prestashop, I have more elements to add and I arrive in the delivery part and I would like to know if we can add a carrier (see image) in php.

Thanks


Solution

  • this work's for me I'v created a atrigger with this insert

    --MYSQL example

    CREATE TRIGGER set_carrier_new_product AFTER INSERT ON pr2_product FOR EACH ROW INSERT INTO pr2_product_carrier (id_product, id_carrier_reference, id_shop) VALUES (NEW.id_product, '10', '1');

    My id_carrier is 10.

    *make sure you set the database prefix, pr2 in my case. you should put the trigger on table pr2_products after insert.

    I could understand this solution is not acceptable for many cases that you could need. In my case it was enough so I just have one carrier and I dont need handled with others.

    Best regards.