“A vs B” Product Comparison Pages for PrestaShop 8 & 9: documentation
Install the module, create and generate "A vs B" comparisons, configure URLs, markup and sitemap, and add the block to your theme.
Overview
The module creates public pages comparing two or three products, for example “iPhone 15 vs Galaxy S24”, to rank on comparison searches. Each page has a clean URL in every language, SEO tags, structured data, a comparison table, your verdict and an FAQ. A listing page gathers all published comparisons.
It does not replace a session comparator such as the Product Comparator, where visitors compare their own selection: both modules can be installed together.
Installation
- In Modules > Module Manager, click Upload a module and select the module ZIP file.
- Installation creates the Catalog > SEO comparisons tab, three tables (comparisons, translations, shop association) and the default URL prefix of each installed language.
- Check that friendly URLs are enabled in Shop Parameters > Traffic & SEO. Without them, the pages work but with addresses such as
index.php?fc=module&module=dfversus&controller=compare&rewrite=....
Settings
The module’s Configure button opens an information panel (link to comparison management, address of the listing page in each language, sitemap address) followed by three blocks of settings.
URLs and listing page
- URL prefix, per language: comparisons use
/prefix/page-slugand the listing page/prefix. Defaults: comparatif (fr), compare (en), comparativa (es), vergleich (de), confronto (it), porownanie (pl), vergelijking (nl), comparativo (pt). Prefixes used by PrestaShop (module, content, search, cart, order…) are rejected and replaced by the default value. - Listing page title (H1), meta title, meta description and introduction, per language.
- Comparisons per page: 24 by default, from 1 to 100.
Display
- Show links on product pages: lists, below the product page, the comparisons that include the product (displayFooterProduct hook). Links on product pages sets how many (6 by default).
- Related comparisons: number of comparisons sharing a product shown at the bottom of each page (6 by default, 0 hides the block).
- Compare product features: adds every feature from Catalog > Attributes & Features to the table.
- Show customer ratings: average rating and number of reviews from the Product Comments module (productcomments), when installed.
- Show only differences by default: visitors can still switch the option on the page.
- Accent color: used for the recommended product, badges, links and the best value. Fonts come from the theme.
Structured data
Add JSON-LD markup is on by default. Turn it off only if another module already outputs this markup on these pages. Open Graph tags are still added.
Creating a comparison
In Catalog > SEO comparisons, click Add a comparison.
Products and recommended product
Search for each product by name, reference, EAN or ID, then click a result (or use the arrow keys and Enter). Products 1 and 2 are required, product 3 is optional. An inactive product is flagged with a badge. The Recommended product field highlights one column with the “Our pick” badge and repeats it in the verdict. Products are reordered on save if a slot is left empty.
Title, slug and tags
- Title (H1): when empty, it is generated in each language from the product names, as “Product 1 vs Product 2”.
- URL slug: when empty, it is built from the title. It must be unique per language. A generated slug that already exists gets a -2, -3 suffix. A manually entered slug that is already used is rejected.
- Meta title: when empty, the title is used. About 60 characters are shown in Google.
- Meta description: about 155 characters. When empty, a description is generated from the product names.
The Search result preview shows the shop name, the real URL, the title and the description of the language being edited, live, with a green or red counter for each length.
Introduction and verdict
The introduction is shown above the table, the verdict below it. These two texts are what sets your page apart from a spec sheet: explain who each product is for and what really separates them.
Editorial criteria
One criterion per line, in the format Label | value for product 1 | value for product 2 | value for product 3. Add * at the end of a value to mark it as the best one. Example:
Real battery life | 18 h* | 12 h | 15 h
Night photos | Very good | Excellent* | Excellent*
Weight in hand | Light* | Medium | Heavy
These criteria form the “Our analysis” group of the table.
Questions and answers
One question per line, in the format Question | Answer. They are shown as an accordion at the bottom of the page and added to the JSON-LD as FAQPage.
Indexing and publishing
- Allow indexing: when off, the page stays reachable but carries the noindex tag and is left out of sitemaps.
- Published: when off, the page returns a 404 error to visitors. It can still be viewed through a signed preview link, shown in the form and in the View action of the list.
- Shop association: in multistore, choose the shops where the comparison exists.
Once saved, the form shows the public URLs of the comparison in each language. The Save and stay button keeps the form open.
Duplicate comparisons
A comparison covering exactly the same products as another one, in any order, is refused on save with the number of the existing comparison. Two pages on the same products would compete in Google: edit the existing page instead.
Generating from a category
The Generate from a category button creates one comparison for each pair among the top products of a category.
- Choose the category.
- Choose how products are picked: best sales, position in the category, newest first or highest price first.
- Enter the number of products, from 2 to 12: 6 products give 15 comparisons, 12 products give 66.
- Leave Publish immediately off, which is recommended, and choose whether the pages can be indexed.
Only products that are active and visible in the shop’s catalog are used. Titles and slugs are created in every language and pairs that are already compared are skipped. Generated pages only contain the table: add at least an introduction and a verdict before publishing them, a page without editorial content rarely ranks.
Comparison list
The list shows product thumbnails (greyed out for an inactive product), the title, the product names, the indexing and publishing status (toggled with one click), the number of views and the update date. Views exclude search engine bots and previews.
- View opens the public page, with the preview link when it is not published.
- Duplicate creates an unpublished copy with new slugs and opens its form. Change at least one product before saving the copy, otherwise it is refused as a duplicate.
- Bulk actions publish, unpublish or delete the selection.
The public page
The page uses your theme’s layout (breadcrumb, header, footer) and contains, in order: the update date, the introduction, the “Show only differences” switch, the table, the verdict, the FAQ, related comparisons and a link to the listing page.
The table
At the top of each column: image, name, price with struck-through price during a sale, add-to-cart button (simple, non-customizable, orderable products) and link to the product page. The table is then organized in groups, and rows that are empty everywhere are hidden:
- Key facts: price (best price marked), customer rating, availability, brand, condition.
- Our analysis: your editorial criteria.
- Technical specifications: product features, if the option is on.
- Details: weight, width, height, depth, reference, EAN-13.
On mobile
Below 768 px wide, each row shows its label above the values: two or three products fit the screen width with no horizontal scrolling.
Sticky bar
When the table header leaves the screen, a bar with the name and price of each product appears at the top. It places itself below a fixed or sticky theme header automatically. If it is misplaced with your theme, set its offset in the theme CSS:
:root { --dfv-sticky-top: 64px; }
Theme integration
The “Compare this product” block is shown below the product page through the displayFooterProduct hook. To place it elsewhere, turn the option off in the settings and add this to your theme template:
{hook h='displayDfVersusLinks' product=$product}
To add the listing page to your menu, use its address shown in the module’s information panel.
SEO
URLs, canonical and redirects
The canonical tag points to the comparison URL in the displayed language. A page reached through another language’s slug, an old prefix or the raw module address is redirected with a 301 to its canonical address. If you change a prefix or a slug, the old addresses are no longer recognized: plan redirects if the pages were already indexed.
hreflang
hreflang tags link the language versions of a comparison, with x-default on the shop’s default language. Only languages where the comparison has a slug are listed.
Structured data
Each comparison contains JSON-LD with WebPage (including the modification date), BreadcrumbList, ItemList and FAQPage when questions are filled in. The ItemList follows the “summary page” format: each item points to the product page, which already carries its own Product markup. The listing page contains CollectionPage and ItemList. Since 2023, Google only shows FAQ rich results for some government and health websites: the FAQPage markup remains valid but does not produce a rich snippet for a shop.
Sitemap
The dedicated sitemap is available at /dfversus-sitemap.xml (exact address in the module’s information panel). It contains the listing page and every published, indexable comparison with its hreflang alternates. Submit it in Google Search Console. If PrestaShop’s gsitemap module is installed, comparisons are also added to its sitemap.
Deleting a product
When a product is deleted from the catalog, it is removed from slot 3 of the comparisons that use it. A comparison that loses product 1 or 2 is unpublished. A disabled product is no longer shown in comparisons, and a comparison with fewer than two visible products no longer appears on the listing page or in sitemaps.
Troubleshooting
- Pages return a 404 error: check that the comparison is published, associated with the shop and contains at least two active products. If friendly URLs were enabled after installation, regenerate the .htaccess file from Traffic & SEO.
- A prefix conflicts with another page: choose a more specific prefix in the settings, for example “product-comparisons”.
- Customer ratings do not appear: the productcomments module must be installed and enabled, and reviews approved. Also check the “Show customer ratings” option.
- The Add to cart button does not appear: it is reserved for simple, non-customizable products that can be ordered, in stock or on backorder. Other products show the link to the product page.
- The sticky bar slides under the theme header: set the
--dfv-sticky-topvariable as shown above.