Jump to content

How to get "id_image" of CoverImage for each Shops


Recommended Posts

By saving Product in context "All Shops" I want to get id_image of "CoverImage" of "this"-product for each shop.

For instance we have Multistore of 3 Shops, each of shops has Product_id "8" but with diferent Cover Image. (id_image: 23,35,36)

Edit product "8" in context "All Shops" and Save:

public function hookActionProductUpdate()
{
...
    if (Shop::getContext() == Shop::CONTEXT_SHOP) {
        $shops[] = $this->context->shop->id;
    } else {
        foreach (Shop::getCompleteListOfShopsID() as $key => $shop) {
            $shops[] = (int)$shop;
        }
    }
    ...
    foreach ($shops as $key => $id_shop) {
        ...
        $image = Product::getCover((int)($id_product));
        $params = array(
            'id_image' => (int)$image['id_image'],
        ...
    ...
    }
...
}

But this code returns the same id_image of CoverImage. (for first(default) Shop)

Can someone help?
Thanks in advance.

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