Jump to content

Désactiver Un Module En Fonction D'un Groupe Client


Recommended Posts

J'en ai fais un override ;)

 

Fichier FrontController.php à placer dans "override\classes\controller\"

<?php

class FrontController extends FrontControllerCore
{
    /**
     * Initializes page header variables
     */
    public function initHeader()
    {
        /** @see P3P Policies (http://www.w3.org/TR/2002/REC-P3P-20020416/#compact_policies) */
        header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"');
        header('Powered-By: PrestaShop');

        // Hooks are voluntary out the initialize array (need those variables already assigned)
        $this->context->smarty->assign(array(
            'time'                  => time(),
            'img_update_time'       => Configuration::get('PS_IMG_UPDATE_TIME'),
            'static_token'          => Tools::getToken(false),
            'token'                 => Tools::getToken(),
            'priceDisplayPrecision' => _PS_PRICE_DISPLAY_PRECISION_,
            'content_only'          => (int)Tools::getValue('content_only'),
	    'customer_groups'	    => $this->getCurrentCustomerGroups(),
        ));
		
        $this->context->smarty->assign($this->initLogoAndFavicon());
    }

}

Et dans votre tpl:


{$view_module = 0}
{foreach from=$customer_groups item=customer_group}
	{if $customer_group == 4}
 		{$view_module = 1}
    {/if}
{/foreach}
{if $view_module != 1}
    J'affiche ou pas mon code. $customer_group = x, x étant l'identifiant du groupe
{/if}

Bon dev

Edited by Ridea Bikes (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...