PrestaShop 9.2: Mastering Full-Width Banner Placement Between Header and Wrapper (Warehouse Theme)

PrestaShop 9.2: Mastering Full-Width Banner Placement Between Header and Wrapper (Warehouse Theme)

Customizing the layout of a PrestaShop store, especially after a major upgrade, can often present unique challenges. This community thread delves into a common customization request: adding a full-width image or banner between the main header and the content wrapper (#wrapper section), specifically on the homepage of a PrestaShop 9.2 store running the Warehouse theme.

The Challenge: Homepage-Specific Banner Placement

The user, Yxarata, recently upgraded their PrestaShop instance to version 9.2 and the Warehouse theme to 4.8. Their primary goal was to display a full-width banner exclusively on the homepage, positioned directly below the header but above the main content area. Initial attempts using standard Slider and Banner modules resulted in the banner appearing at the bottom of the page content, not in the desired prominent location.

Solution 1: Direct Template Modification (Developer Approach)

Alexandre Carette suggested a direct approach involving theme file modification. For developers comfortable with code, this involves:

  • Locating the theme's main template file for the homepage, typically home.tpl or index.tpl, within the /themes/warehouse/templates/ directory.
  • Inserting an tag or a custom HTML block immediately after the closing header tag and before the opening of the #wrapper section.
  • Ensuring associated CSS does not restrict the block's full width.

Solution 2: Module Hooking (Merchant/Low-Code Approach)

Knowband Plugins offered a more robust, update-safe solution leveraging PrestaShop's module hooking system:

  • Utilize a standard Banner module (or similar widget module).
  • Navigate to Apparence > Positions in the PrestaShop back office.
  • Use the « Greffer un module » (Hook a module) functionality.
  • Select the displayNavFullWidth hook. This hook is specifically designed to appear in a full-width section at the end of the header, just before the #wrapper, in themes based on the Classic theme (which Warehouse often extends or mimics).
  • Crucially, to ensure the banner appears only on the homepage, configure exceptions to display it on all pages except « index » (the homepage). This seems counter-intuitive, but the goal is to *exclude* it from other pages, making it *only* appear on the homepage.

Yxarata initially found success with this method for placement, but encountered a duplication issue where the banner still appeared at the bottom of the page content.

Troubleshooting Duplication and Homepage-Only Display

The duplication issue highlighted the need for more precise control. Alexandre Carette provided a key insight: using Smarty conditional logic directly within the template files.

  • Smarty Condition: To ensure content appears only on the homepage, wrap the HTML code for the banner within a Smarty {if} statement checking the page name:
{if $page.page_name == 'index'}
    
{/if}
  • This condition can be applied whether you're directly editing home.tpl/index.tpl or if a module's template is being included dynamically.

Theme-Specific Modules and Further Refinements

Yxarata later switched to the Warehouse theme's proprietary module, IQITHTMLANDBANNERS. While this module might offer more theme-integrated styling, it lacked a direct option for homepage-only display.

Alexandre Carette reiterated the Smarty condition solution and further advised:

  • Verifying that the IQITHTMLANDBANNERS module is correctly hooked to displayHome or another appropriate full-width hook via Modules > Positions.
  • Inspecting the theme's theme.yml file for any automatic inclusions that might be causing unexpected banner placements.

Key Takeaways for PrestaShop Merchants and Developers

This thread offers valuable lessons for anyone looking to customize their PrestaShop layout:

  • Prioritize Hooks: Whenever possible, use PrestaShop's hook system for module placement. It's more robust against theme updates than direct template edits. The displayNavFullWidth hook is excellent for full-width content between the header and main wrapper.
  • Smarty for Precision: For page-specific content, especially the homepage, Smarty conditional statements ({if $page.page_name == 'index'}) are indispensable.
  • Theme-Specific Modules: While convenient, theme-bundled modules might not always offer the granular control of core PrestaShop features or direct template editing. Be prepared to combine them with Smarty conditions or custom CSS/JS.
  • Inspect and Debug: When issues like duplication occur, inspect the generated HTML and review module positions and template inclusions carefully.

By combining strategic module placement with precise Smarty conditions, PrestaShop users can achieve complex layout customizations like a homepage-only full-width banner with confidence.

Start with the tools

Explore migration tools

See options, compare methods, and pick the path that fits your store.

Explore migration tools