Jump to content

[Solved] Insert manufacturers for existing product in database


Recommended Posts

First, sorry for my english. One part of my module that I create is importing manufacturers for existing products. I use:

Db::getInstance()->insert('manufacturer', array(
            'name' => $producent,
            'date_add' => date("Y-m-d H:i:s"),
            'active' => 1
 $id_manufacturer = $this->get_id_manu_by_name($producent);
        Db::getInstance()->insert('manufacturer_lang', array(
            'id_manufacturer' => $id_manufacturer,
            'id_lang' => 1,
        Db::getInstance()->insert('manufacturer_shop', array(
            'id_manufacturer' => $id_manufacturer,
            'id_shop' => 1,

and after that I update the product table:

Db::getInstance()->update('product', array(
            'id_manufacturer' => intval($id_manufacturer),
                ), 'id_product = "' . (int) $id_product . '"');

I have right id_manufacturer in product table. When i edit product in back office, manufacturer is set, but in front office I can't see this product on my manufacturer page. This works properly only after save again product in back office.

How can I fix it?

Edited by sweszler (see edit history)
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...