Jump to content

Cart Rules multistore save problem


Recommended Posts

Hi,

 

More question on the multistore subject. 

 

I am having a prestashop 1.6.0.9 installation with 3 active shops.

I have for each store an employee only able to see one store.

When this employee saves a new cart rule or updates an existing rule he/she will not see the shop restriction option and when saving the cart rule is not given any shop restriction.

Is this really correct or is it a bug? Is it really ok for an employee only beeing able to access one of the three shops to add a cart rule for all three shops?

 

Hopefully someone is going to be able to answer me on this post.

 

Thank you in advance

Link to comment
Share on other sites

For you who is interested I fixed this with a module that hooks actionAdminCartRulesControllerSaveAfter.

 

In this hook, which is executed after saving the cart rule, I do like this:

 

if (Shop::getContext() == Shop::CONTEXT_SHOP && $_POST['shop_restriction'] == 0) {
                //PrestaShopLogger::addLog('Test id: '.$_POST['id_cart_rule'], 1, null, 'Cart', 1, true);                
                $where = "id_cart_rule = " . $_POST['id_cart_rule'];
                Db::getInstance()->update('cart_rule', array('shop_restriction' => 1), $where);
                Db::getInstance()->insert('cart_rule_shop', array(
                    'id_cart_rule' => $_POST['id_cart_rule'],
                    'id_shop' => Context::getContext()->shop->id
                ));
            }
 
Not the prettiest of solutions but it worked for me.
  • Like 1
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...