Jump to content

Multistore - different attributes for shops issue


Recommended Posts

Hello 

First my post here. I have a problem managing attributes for products in multistore. My Prestashop version is 1.7.6.4

This is my shop configuration in multistore. 

Shop1 (group) ---> shop1 ---> shop1.cooki.it 

Shop2 (group) ---> shop2 --> shop2.cooki.it 

I created a couple of attributes for shop 2 (and only for shop 2)  but when I create a product with combination in the right panel of "Combination" tab i can' t see my new attributes. The system continue to visualize / assign only the attributes from shop1. 

I don't understand why. 

Probably it's a simple stuff but it's one day I tried to understand where is the configuration issue and I can't find. 

Thanks for your help

 

Link to comment
Share on other sites

Yes the problem become from controller!

because the store id it's not setup properly!

please add the store id like this:

in : src\PrestaShopBundle\Controller\Admin\ProductController.php

around line #608

 

// MODIFIED BY OSI

// $language['id_shop'] returned always 1, with this new value we get the original shop on current

$oc_id_shop = $this->getContext()->shop->id; $doctrine = $this->getDoctrine()->getManager();

$language = empty($languages[0]) ? ['id_lang' => 1, 'id_shop' => $oc_id_shop] : $languages[0];

$attributeGroups = $doctrine->getRepository('PrestaShopBundle:Attribute')->findByLangAndShop((int) $language['id_lang'], $oc_id_shop);

 

it's all!

Link to comment
Share on other sites

  • 6 months later...
On 4/29/2020 at 4:33 AM, carlosr said:

Yes the problem become from controller!

because the store id it's not setup properly!

please add the store id like this:

in : src\PrestaShopBundle\Controller\Admin\ProductController.php

around line #608

 

// MODIFIED BY OSI

// $language['id_shop'] returned always 1, with this new value we get the original shop on current

$oc_id_shop = $this->getContext()->shop->id; $doctrine = $this->getDoctrine()->getManager();

$language = empty($languages[0]) ? ['id_lang' => 1, 'id_shop' => $oc_id_shop] : $languages[0];

$attributeGroups = $doctrine->getRepository('PrestaShopBundle:Attribute')->findByLangAndShop((int) $language['id_lang'], $oc_id_shop);

 

it's all!

Hello carlosr, 

I don't know how to apply your solution.

I've the same problem of foresiteg, and I found a temporary "solution" by editing this at line 656.

i changed from findByLangAndShop (1,1) to (2,3)

But this cannot be a permanent solution. Yours looks much better to me. But how should I implement it? Where should I go to edit in the file?
Or just copy and paste the code you wrote, somewhere?

(Prestashop 1.7.4.3)

        $attributeGroups = $this
            ->getDoctrine()
            ->getManager()
            ->getRepository('PrestaShopBundle:Attribute')
            ->findByLangAndShop(2, 3);

 

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