Prestashop – CMS Pages by Group

Prestashop is missing some core functionality when it comes to Groups and CMS pages. Use this class override and SMARTY tags to limit which groups can see what pages or information.

  1. Create a new Override file and save it locally into override/classes/
  2. Name the new override file FrontController.php (just like the original)
  3. In your override file, add this code to the file and save
    <?php
    class FrontController extends FrontControllerCore
    {
    paste the init function here
    }
    ?>
  4. In the new override file, you will need to copy/paste the entire init function from the original classes/FrontController.php.
  5. Look to around line 71 for public function init() and copy down to around line 317 just under $this->setMedia();. Be sure to grab the last }
  6. With the old init function pasted in the new override file, look for
    $cookie = new Cookie('ps');
  7. Paste this code under $cookie = new Cookie(‘ps’);
    /* New code entered here - - - - - - - - - - - - - - - - - - - - - - */
    $customer = new Customer(intval($cookie->id_customer));
    $wholesaleGroup = $customer->isMemberOfGroup(2);
    $smarty->assign('wholesale', $wholesaleGroup);
    /* New code entered here - - - - - - - - - - - - - - - - - - - - - - */
  8. FTP your new override file to override/classes/
  9. On the tpl file where you want the information to show only for your group, use something like this
    {if $wholesale}
    getPageLink('prices-drop.php')}" title="{l s='Specials' mod='blockcms'}">{l s='Specials' mod='blockcms'}
    {/if}
  10. The important parts being the {if $wholesale) and {/if}

    It would be really nice if this functionality was built into the next version of Prestashop.