1. What this module does

Show the right size chart next to the size selector, by category, brand or product. You write size charts in PrestaShop's editor, in every language of the shop, with an optional "how to measure" picture, and assign each chart to products, categories or brands. On the product page the customer gets a Size guide link with a small ruler under the Add to cart button; it opens the chart in a window over the page. The chart can also be shown in a product tab. Wide tables scroll sideways on a phone instead of widening the page.

The module does not recommend a size from the customer's measurements, has no grid editor for the tables (you write the table in the editor), imports nothing, does not copy charts from one shop to another, shows one chart per product (never several merged) and has no charts per combination: every size and colour of a product shows the same chart.

Works with PrestaShop 1.7.8, 8.x and 9.x (PHP 7.2.5 or newer), with the Classic and Hummingbird themes and with multistore.

2. Installation

  1. Download the module from My account → Order history at addonspresta.com.
  2. In your Back Office, open Modules → Module Manager and click Upload a module.
  3. Drop the ap_sizeguide_v1.0.0.zip file and wait for the confirmation.
  4. Click Configure on the module card.

If you have shell access, you can also unpack the zip into modules/ and run php bin/console prestashop:module install ap_sizeguide from the shop folder.

After the installation the module is switched on, but the shop has no size chart yet, so nothing changes in your shop and none of the module's files is loaded there. To show your first chart:

  1. Open Modules → Module Manager → Size Guide → Configure (in multistore, first select one shop in the Back Office header).
  2. Click Create an example chart, or Add a size chart to start from an empty form.
  3. Click Edit on the chart, adapt the title and the table, tick a category (for example your clothing category) under Categories, and click Save.
  4. Open a product of that category in your shop: the Size guide link is under the Add to cart button.

3. How it works

Size charts. A size chart has a name that only you see in the Back Office, a title and a content in every language, an optional picture, an on / off switch and a place in the list. The content is any HTML you write in PrestaShop's editor: usually a table of sizes and measurements with a sentence or two around it. A shop can have up to 100 charts.

Which products show a chart. You assign a chart to products (by their ID), to categories and to brands. A product shows one chart, chosen in this order:

  1. A chart assigned to the product itself.
  2. Otherwise a chart assigned to a category of the product. A category covers its subcategories, and a product counts in every category it is associated with, not only through its default category. When several assigned categories hold the product, the deepest one wins (the one furthest down the category tree); at the same depth, the one that holds the product's default category wins.
  3. Otherwise a chart assigned to the product's brand.

When several charts still match at the same level, the one higher in the list of charts wins. Only switched-on charts count. Charts are never merged: the product shows the winning chart and nothing of the others.

An example. Chart A "Clothing" is assigned to the category Clothes, chart B "Men's tops" to its subcategory Men, chart C "Studio Design" to the brand Studio Design, and chart D "Hummingbird t-shirt" to the product with ID 1.

  • The product with ID 1 (in the category Men, brand Studio Design) shows D: a product assignment comes first.
  • Another t-shirt in the category Men shows B: Men is deeper than Clothes.
  • A dress in the category Women, a subcategory of Clothes, shows A.
  • A mug of the brand Studio Design that is in no category of the charts shows C.
  • A product with none of these shows no link at all.

Test a product under the list of charts answers for any product ID which chart it shows and why (section 4).

What the customer sees.

  • A Size guide link with a small ruler icon. By default it is a line of its own under the Add to cart button, right below the sizes and the button and before the share buttons. The setting Place of the link can put it next to the Add to cart button instead, in the row of the button. The text of the link is yours (Link text) or "Size guide" in the visitor's language. The link takes the colour and font of your theme's links.
  • A click on the link, or Enter or Space on the keyboard, opens the chart in a window over the page, with the chart's title at the top and a close button. The keyboard stays inside the window while it is open, and the page behind does not scroll.
  • The window closes with the close button, with the Escape key or with a click on the dark area around it; the keyboard focus then goes back to the link.
  • The picture of the chart, when it has one, is shown above the content, scaled to the width of the window.
  • On a phone (below 576 px of screen width) the window takes the whole screen and scrolls inside. A table wider than the screen scrolls sideways inside the chart; the page itself never becomes wider.
  • After the customer changes a combination (another size or colour), PrestaShop redraws the area under the Add to cart button; the link comes back with it and keeps working.
  • A browser older than 2022 that cannot open such windows shows the link, but a click does nothing.

The product tab. With Show the chart in a product tab on, the product page also gets a tab with the chart (the chart's title, the picture and the content), among the description and the product details. The Classic theme shows it as one more tab; Hummingbird shows it as one more section of its accordion. The title of the tab is the Tab title setting, or "Size guide" in the visitor's language. The tab and the link can be used together or alone.

Quick view. With Show the link in quick view on, the link also appears in the quick view window of product lists, always next to the Add to cart button (it is the only place both Classic and Hummingbird print in quick view), whatever Place of the link says. The chart opens above the quick view window; Escape then closes only the chart, and the quick view stays open. Quick view never shows the tab.

Catalogue mode. When the shop is in catalogue mode (Shop Parameters → Products), the themes print no Add to cart button and leave out the place next to it. The link under the Add to cart button and the tab are still shown; the link next to the Add to cart button and the link in quick view are not.

Themes. The link is printed by the hooks displayProductAdditionalInfo (under the Add to cart button) and displayProductActions (next to it), the tab by displayProductExtraContent. Classic (1.7.8, 8 and 9) and Hummingbird call all three. At installation the module puts itself first in displayProductAdditionalInfo, so the link sits right under the buy row; you can move it in Design → Positions. A theme that does not call these hooks can show the link anywhere on the product page with this line in the product template, for example next to the size selector in templates/catalog/_partials/product-variants.tpl or after the add-to-cart block in templates/catalog/_partials/product-add-to-cart.tpl:

{widget name='ap_sizeguide'}

The widget shows the link and the window with the same rules as the hooks (module on, link on, a chart for the product), only on the product page and in quick view. If your theme also calls the hook, unhook the module from that hook in Design → Positions, otherwise the link appears twice.

How the tables look. The link, the window and the tab take the fonts and colours of your theme. Tables inside a chart get simple default styles from the module: full width, a thin border around every cell, a light background in the header cells and on every second row (zebra rows), centred values. These defaults apply only inside the chart (.ap-sizeguide__content) and are written so that any rule of your theme wins over them. To keep your theme's own table style, you or your developer can add a rule to the theme's CSS for .ap-sizeguide__content table, .ap-sizeguide__content th and .ap-sizeguide__content td, or simply remove the borders and the zebra colour with:

.ap-sizeguide { --ap-sizeguide-border: transparent; --ap-sizeguide-stripe: transparent; }

A table you style yourself in the editor (inline styles) keeps that style.

Trust: who may change the charts. The content of a chart is HTML that the module saves and shows exactly as typed, without any filter. This is also true when your shop has the option Use HTMLPurifier Library switched on in Shop Parameters → General: that option does not apply to the charts, and unlike product descriptions and CMS pages, scripts and event attributes are kept. Code in a chart runs on your product pages, in your customers' browsers on your shop's own address, and in the Back Office of every employee who later opens that chart with Edit. So an employee who may configure this module can, on purpose or by pasting a bad code, put a script into your shop's pages and into the Back Office session of another employee — a super administrator, or in multistore the manager of other shops. Treat the Configure permission of this module like super administrator access: in Advanced Parameters → Team → Permissions, on the Modules tab, tick Configure for this module only for profiles you trust with the whole shop, and with every shop in multistore. Paste only code from a source you know. Everything else you type in the module is plain text: names, titles, picture descriptions, the link text and the tab title refuse the characters < and > and are shown as text.

Where the pictures are. Pictures are stored in the folder img/ap_sizeguide/ of your shop, under random names (for example 3f9c…e1.jpg); the name of the file you uploaded is never used.

  • These are public files. Like your product pictures, anyone who knows the address of a picture can open it.
  • The module draws every picture again before it stores it: the stored file holds only the picture, without the data a camera or a phone adds (place where the photo was taken, date, camera, author). The longer side is reduced to 2000 pixels at most, and a photo taken sideways is turned upright. An animated GIF keeps only its first picture.
  • Backups and moves. The charts live in three database tables and their pictures in this folder. A backup or a move of the shop to another server must include both, otherwise the charts show no picture.
  • Apache and nginx. The module writes its own .htaccess file into the folder: Apache then serves only the module's pictures there and runs no PHP in it. nginx ignores .htaccess files; the folder is still safe, because the module only writes pictures it drew itself under names it chose.
  • A picture is deleted from the server when you replace or remove it, when you delete its chart, and when you uninstall the module.

What happens to charts and assignments.

  • Deleting a product, a category or a brand in your catalogue leaves its old assignment in the chart until you next save that chart. It does no harm: a deleted product has no page, a deleted category or brand holds no product, and the list of charts does not show it. The next Save of the chart drops it.
  • If a chart seems to have vanished from products after you deleted a category, that category was the one it was assigned to: assign the chart to another category.
  • Disabling the module, or switching off Enable the size guide, hides everything in the shop and keeps every chart (section 6).
  • Uninstalling or resetting the module deletes every chart of every shop, every setting and every picture (section 6).

Personal data, connections, e-mails. The module stores no personal data: charts and settings are your shop's content. It makes no outgoing connection — no licence check, no statistics, nothing to addonspresta.com or any other server. It has no cron job and sends no e-mails.

Failures. If the module cannot show a chart, the product page is shown without it and one line at most per hour is written to Advanced Parameters → Logs, starting with "Size Guide:".

4. Features and settings

Open Modules → Module Manager → Size Guide → Configure. The Help box at the top links this manual and the module page at addonspresta.com in the language of your Back Office, gives our support address and shows the installed version. Below it are two tabs: Size charts (open first) and Settings.

Size charts

Charts belong to one shop. In multistore, select one shop in the Back Office header; in the All shops or a group context the page only says "Size charts belong to one shop. Select one of your shops in the header to manage its charts."

Above the list: "A product shows one chart: one assigned to the product itself, otherwise one assigned to one of its categories or their parent categories (the deepest category wins), otherwise one assigned to its brand. When several charts match at the same level, the higher one in this list wins."

The list shows the charts in their order, with the columns # (the place in the list), Name, Title (in your Back Office language), Shown for, Picture and Enabled (Yes or No; a switched-off chart is greyed). Shown for sums up the assignments, for example "Products: #1 Hummingbird printed t-shirt", "Categories (with subcategories): Men, Women" and "Brands: Studio Design", with at most five names per line followed by "and … more"; a chart assigned to nothing says "Nothing yet: the chart is not shown." The buttons of each row:

  • Move up and Move down change the order ("Order of the charts changed."). The order decides between charts that match a product at the same level: the higher one wins.
  • Switch off and Switch on hide or show the chart in the shop without deleting it ("Size chart updated.").
  • Edit opens the form of the chart.
  • Delete, after the question "Delete this size chart and its picture?", deletes the chart with its picture ("Size chart deleted.").

Under the list, Add a size chart opens an empty form; it is hidden when the shop has 100 charts. While the list is empty it says "No size chart yet: nothing is shown in the shop. Add a chart, or create the example chart and adapt it."

Create an example chart

Shown only while the shop has no chart. It creates one switched-on chart named "Example: clothing sizes", with the title "Clothing sizes" and, in every language of the shop, a short sentence on how to read it, a table of sizes S, M, L and XL with chest, waist and hips in centimetres, and a tip on how to measure. "The example chart was created. Assign it to products, categories or brands to show it." The example is assigned to nothing, so it shows nothing until you assign it: click Edit, check the measurements against your own sizes, tick its categories or brands, and save.

The form of a chart

Add a size chart or Edit the size chart; Save stores the chart and goes back to the list ("Size chart saved."), Back to the list leaves without saving. New charts go to the end of the list.

Name

Required, up to 64 characters of plain text. Only for you, in the list: for example "Women's tops — EU sizes".

Enabled

On by default. A switched-off chart stays in the list but is never shown in the shop, and the next chart that matches the product is used instead.

Title

One field per language, up to 128 characters of plain text, required in the default language. It is the heading of the window and of the chart in the tab, for example "T-shirts and sweatshirts". A language left empty shows the title of the default language.

Content

The size table and any text around it, in PrestaShop's editor, one per language (up to 200,000 characters each). Required in the default language unless the chart has a picture; a language left empty shows the content of the default language. Use the editor's table button to build a table, or paste a table from a spreadsheet or from your supplier's size chart.

The content is printed on the product page exactly as typed, without any filter — also scripts and code pasted in the editor's source code view, and also when HTMLPurifier is switched on in your shop. The same content is opened unfiltered in the editor of every employee who later edits the chart. Only employees who may configure this module can change it: give that permission only to people you trust with the whole shop (section 3, "Trust: who may change the charts"). The note under the editor says the same.

Picture "how to measure"

Optional, one picture per chart (the same in every language), shown above the content: for example a drawing of where to measure chest, waist and hips. JPG, PNG, WebP or GIF — not SVG — up to 2 MB, up to 5000 pixels on each side and 16 megapixels in all. The module checks the file by its content, not by its name, and draws it again before storing it (section 3, "Where the pictures are").

When the chart has a picture, the form shows it with the checkbox Remove the picture: tick it and save to delete the picture. Choosing a new file replaces the current picture; the old file is deleted.

A refused file keeps the current picture and saves nothing else either; the form comes back with your values, but you have to choose the file again (browsers require it):

  • "The picture must be a JPG, PNG, WebP or GIF file of up to 2 MB and 5000 × 5000 pixels." — wrong format, too large a file or too many pixels, a damaged file, a format your server cannot process, or a file larger than PHP's upload_max_filesize.
  • "This WebP picture cannot be used: animated WebP pictures are not supported, and some servers cannot process WebP at all. Use a JPG or PNG picture." — an animated WebP, or any WebP on a server that cannot process this format. Save the picture as JPG or PNG.
  • "The server does not have enough memory to process this picture. Use a smaller picture."
  • "The form was not received because it is larger than the server accepts (…). Use a smaller picture and save again." — the whole form was larger than PHP's post_max_size, so the server dropped it: nothing is saved and the form shows what was stored before. Use a smaller picture, or ask your host to raise post_max_size and upload_max_filesize.

Picture description

One field per language, up to 255 characters of plain text: what the picture shows, for visitors who cannot see it, for example "Where to measure chest, waist and hips". A language left empty shows the description of the default language; with no description at all the picture is treated as decoration.

Shown for: Product IDs, Categories, Brands

The note above the three fields repeats the order of section 3: product first, then the deepest category, then the brand, then the order of the list.

  • Product IDs — the IDs from Catalog → Products separated by commas, for example 12, 7, 31, at most 500. The names of the products in the field are shown under it. An ID that is not a product of this shop refuses the save ("Some product IDs are not products of this shop. Check the numbers.").
  • Categories — the categories of the shop as a tree; tick the ones the chart is for. "A ticked category also covers its subcategories. A product counts in a category when it is associated with it, not only through its default category." The line Ticked: under the list repeats your choice.
  • Brands — the brands of the shop (Catalog → Brands & Suppliers); tick the ones the chart is for.

A chart assigned to nothing is kept but not shown anywhere.

When a value is wrong, nothing is saved and the form shows the message above your values, for example "Enter the name of the chart.", "Enter the title in the default language.", "Enter the content in the default language, or add a picture." or "The name, the titles and the picture descriptions are plain text: remove the characters < and >."

Test a product

Under the list of charts: type a Product ID and click Which chart?. The answer names the product and the chart it shows with the reason, using the same rules as the shop (switched-on charts only), for example:

  • "Chart "Clothing sizes": assigned to the product."
  • "Chart "Clothing sizes": assigned to the category "Men" (the product is in it or in one of its subcategories)."
  • "Chart "Clothing sizes": assigned to the brand "Studio Design"."
  • "No chart: no enabled chart is assigned to this product, its categories or its brand."

When another module changes the chart of products (developers can do it, see README.md), the test also runs it and adds "Another module changed the chart for this product."; the answer is green only when the product really shows a chart. With Enable the size guide off it adds "The module is switched off in Settings: nothing is shown in the shop." An ID that is not a product of this shop gives "No product with this ID in this shop." The test changes nothing.

Settings

Saved for the shop or shop group selected in the Back Office header with Save; "Settings saved." confirms it.

Enable the size guide

On after the installation. Off: nothing is shown in the shop and no file of the module is loaded there; the charts and their assignments stay, so you can prepare charts before you switch it on.

Show the link that opens the chart

On after the installation: the link with the ruler icon on the product page, which opens the chart in a window over the page. Off: no link anywhere (also not in quick view or through the widget); only the tab, if it is on.

Place of the link

  • Under the Add to cart button (default) — a line of its own below the sizes and the button, in every theme, also in catalogue mode.
  • Next to the Add to cart button — in the row of the quantity and the button. Not shown in catalogue mode. In the Classic theme of PrestaShop 1.7.8 and 8 that row does not wrap, so on narrow screens the link may break over several lines next to the button.

A theme can also place the link anywhere with {widget name='ap_sizeguide'} (section 3, "Themes").

Link text

One field per language, up to 64 characters of plain text. "Leave empty to show "Size guide", translated into the language of the visitor."

Show the link in quick view

On after the installation. "In quick view the link is always next to the Add to cart button: it is the only place both Classic and Hummingbird print there. Not shown in catalogue mode." Because quick view can open from any product tile, the module then loads its two small files (a stylesheet and a script) on every page of a shop that has at least one switched-on chart. Off: they load on product pages only.

Show the chart in a product tab

Off after the installation. On: "An extra tab (an extra section on Hummingbird) with the chart, among the description and the product details. Can be used together with the link."

Tab title

One field per language, up to 64 characters of plain text, empty by default: the tab is then called "Size guide" in the visitor's language.

5. Multistore

Size charts belong to one shop. Select the shop in the Back Office header to see, add, change or delete its charts; in the All shops or a group context the list is not shown. The products, categories and brands you can assign are those of that shop, and Test a product answers for that shop. Nothing is shared or copied between shops: to use the same chart in two shops, create it in each.

Settings are saved for the shop or shop group selected in the header. Values saved with All shops apply to every shop that has no value of its own. In the All shops or a group context only an employee who manages every shop of that context can save ("Select one of your shops in the header to change the settings: in the All shops or group context they also apply to shops you do not manage.").

Trust across shops. An employee who may configure the module in one shop can put code into that shop's charts, and that code runs in the Back Office of any employee who opens those charts, also one who manages other shops (section 3, "Trust: who may change the charts").

Each storefront shows the charts of its own shop, with that shop's settings. One licence covers every shop of the installation.

6. Uninstall

Module Manager → Size Guide → Uninstall deletes every size chart of every shop, every setting and every picture. PrestaShop asks first: "Uninstalling deletes all your size charts and their pictures. Continue?" The module drops its three tables, deletes its settings, and deletes its pictures in img/ap_sizeguide/, then the folder itself. Reset in the Module Manager does the same and then installs the module again, empty. There is no way back except a backup of the database and of the folder. What is kept: the declaration of the module's event for developers, so that other modules attached to it keep their place.

Disable keeps the charts, pictures and settings: while the module is disabled the shop shows no link, no window and no tab. Switching off Enable the size guide in the settings has the same effect for one shop.

7. FAQ and troubleshooting

The product page shows no Size guide link. Check in this order:

  1. The module is enabled in the Module Manager, and Enable the size guide and Show the link that opens the chart are on in the Settings of that shop.
  2. The chart is switched on (Enabled Yes in the list).
  3. The chart is assigned to the product, to one of its categories or to its brand (Shown for in the list).
  4. The chart was created in the shop you are looking at: in multistore every shop has its own charts.
  5. Another chart may win for this product. Type the product's ID in Test a product: it names the chart the product shows and why.
  6. With Next to the Add to cart button: the shop is not in catalogue mode (that place is not shown there).
  7. Your theme calls the hooks of section 3 ("Themes"); otherwise add the widget line to the product template.

If the link still does not appear, look in Advanced Parameters → Logs for an entry starting with "Size Guide:".

The link is in the wrong place. Choose the other Place of the link. To move it among other modules under the Add to cart button, change the order of the hook displayProductAdditionalInfo in Design → Positions. For any other place, your theme developer can use the widget {widget name='ap_sizeguide'} and unhook the module from its hook.

The window shows a broken layout or strange HTML. The content is printed exactly as it was typed or pasted. Open the chart with Edit, look at the content in the editor's source code view, and remove what does not belong there (for example styles or scripts copied from another website). A table wider than the window scrolls sideways; that is on purpose.

My picture is refused. It must be a JPG, PNG, WebP or GIF file (not SVG, not an animated WebP) of up to 2 MB, up to 5000 pixels on each side and 16 megapixels in all. Save it again from an image editor as JPG or PNG at a smaller size. When the message says the server does not have enough memory or that the form is larger than the server accepts, use a smaller picture (section 4, "Picture "how to measure""). If every picture is refused, also a small JPG, the server may be out of disk space or unable to write to the folder img/: ask your host to check.

The tables are too wide on phones. A wide table scrolls sideways inside the chart, and the page stays as wide as the screen. To need less scrolling, use fewer columns (for example one table for centimetres and one for inches) or shorter headings.

A chart vanished from products after I deleted a category. The chart was assigned to that category; its products no longer belong to it. Edit the chart, tick another category and save.

Can the module suggest a size from the customer's measurements? No. It shows your chart; the customer compares the measurements.

Can a combination or a colour have its own chart? No. A product shows one chart for all its combinations.

A text of the module is still in English in my shop or my Back Office. Open International → Translations → Installed module translations, select the module and your language, and check the translation.

8. Updates and support

Updates are free for life: download new versions from My account → Order history at addonspresta.com and upload them like a new module. Your charts, pictures and settings are kept.

Support is included for 12 months from your order: write to mail@addonspresta.com or use the contact form at addonspresta.com (Monday to Friday, 10:00–16:00; we usually answer within 2 business days). Please include your PrestaShop version, the module version and the steps that lead to the problem.

Back to User manuals

Loading...
Back to top