title: Apply Prestashop Cart to custom Hook
body: <p>First let me explain myself. I'm new to Prestashop Development, I've a background using Wordpress. The thing is, I'm trying to hook 'blockcart.php' to my custom hook 'HOOK_SHOPPINGBAG'. I have tried a lot and after a couple of hours I have decided to just ask the question here. </p>
  
  <p>First I have created the Hook inside ps_hook inside the Prestashop Database. This hook is functioning and Prestashop reads it. After that I have added my new hook to FrontController.php, the code is shown below: </p>
  
  <pre><code>public function initContent()
  {
      $this-&gt;process();
      if (!isset($this-&gt;context-&gt;cart))
          $this-&gt;context-&gt;cart = new Cart();
      if (!$this-&gt;useMobileTheme())
      {
          // These hooks aren't used for the mobile theme.
          // Needed hooks are called in the tpl files.
          $this-&gt;context-&gt;smarty-&gt;assign(array(
              'HOOK_HEADER' =&gt; Hook::exec('displayHeader'),
              'HOOK_TOP' =&gt; Hook::exec('displayTop'),
              'HOOK_SHOPPINGBAG' =&gt; Hook::exec('displayShoppingBag'),
              'HOOK_LEFT_COLUMN' =&gt; ($this-&gt;display_column_left ? Hook::exec('displayLeftColumn') : ''),
              'HOOK_RIGHT_COLUMN' =&gt; ($this-&gt;display_column_right ? Hook::exec('displayRightColumn', array('cart' =&gt; $this-&gt;context-&gt;cart)) : ''),
          ));
      }
      else
          $this-&gt;context-&gt;smarty-&gt;assign('HOOK_MOBILE_HEADER', Hook::exec('displayMobileHeader'));
  }
  </code></pre>
  
  <p>I also have added the Hook to the second bunch of lines inside FrontController.php:</p>
  
  <pre><code>// Call hook before assign of css_files and js_files in order to include correctly all css and javascript files
      $this-&gt;context-&gt;smarty-&gt;assign(array(
          'HOOK_HEADER' =&gt; $hook_header,
          'HOOK_TOP' =&gt; Hook::exec('displayTop'),
          'HOOK_SHOPPINGBAG' =&gt; Hook::exec('displayShoppingBag'),
          'HOOK_LEFT_COLUMN' =&gt; ($this-&gt;display_column_left ? Hook::exec('displayLeftColumn') : ''),
          'HOOK_RIGHT_COLUMN' =&gt; ($this-&gt;display_column_right ? Hook::exec('displayRightColumn', array('cart' =&gt; $this-&gt;context-&gt;cart)) : ''),
          'HOOK_FOOTER' =&gt; Hook::exec('displayFooter')
      ));
  </code></pre>
  
  <p>I want to show the Cart inside header.tpl so I have added the Hook to this file:</p>
  
  <pre><code>&lt;div class="shoppingbag"&gt;
      {$HOOK_SHOPPINGBAG}
  &lt;/div&gt;
  </code></pre>
  
  <p>To make sure Blockcart.php can be hooked to my new hook I have added the following line to blockcart.php:</p>
  
  <pre><code>public function hookShoppingBag($params) {
      return $this-&gt;hookheader($params, 'displayShoppingBag');
  }
  </code></pre>
  
  <p>I've already tried so many things, but when I try to Hook the module to the new Hook it keeps telling me "This modules can't transplant to this hook!"</p>
  
  <p>Maybe I have just made some stupid mistakes, but anyway I hope you guys can help me. Thanks!</p>