zerofront / module-zero-size-chart
Zero for Magento Open Source: size guides on product pages: tables made in the admin, shown by category or per product in a dialog.
Package info
github.com/zerofrontdev/module-zero-size-chart
Type:magento2-module
pkg:composer/zerofront/module-zero-size-chart
Requires
- php: ~8.2.0||~8.3.0||~8.4.0
- magento/framework: 103.0.*
- magento/module-backend: *
- magento/module-catalog: *
- magento/module-config: *
- magento/module-eav: *
- magento/module-store: *
- zerofront/module-zero-core: ^1.3
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
README
Size guides on product pages. A chart is a table made in the admin and shown to the products of chosen categories; the product page gets a "Size guide" button that opens it in a dialog.
Install
Requires Magento Open Source 2.4.7–2.4.9 and PHP 8.2–8.4 with the GD extension built with WebP (php -r 'var_dump(function_exists("imagewebp"));' says true; Magento's own PHP requirements cover the rest). Without WebP in GD, Zero skips its WebP image copies and serves the originals.
composer require zerofront/module-zero-size-chart bin/magento setup:upgrade bin/magento setup:di:compile # production mode bin/magento setup:static-content:deploy # production mode bin/magento cache:flush
Composer installs zerofront/module-zero-core with it.
Part of zerofront/zero, which installs the Zero theme and every Zero module at once.
Storefront
Between the product's options and Add to Cart: a "Size guide" button
(text in Stores > Configuration > Zero > Size Charts). It opens a native
<dialog> with the chart's heading, the table and the note; no JavaScript
beyond the theme's data-dialog-open. Nothing on products without a chart.
Which chart a product gets:
- Its Size Chart attribute, when set: a chart, or "No size guide".
- Otherwise the chart of the most specific category the product is in: a chart on "Men" covers everything under Men; a chart on "Men > Tops" wins over it for the tops. Between two charts of one category, the lower sort order wins.
Product pages are cached with the chart; saving or deleting a chart cleans the page and block caches.
Admin
Catalog > Size Charts (resource Zero_SizeChart::charts): the list and a
form: name, heading, the table as text (one row per line, cells separated
by |, the first line the headings; 2–12 columns, up to 60 rows), a note
under the table, categories, sort order, active. The form shows the saved
table as a preview.
Setup\Patch\Data\AddSizeChartAttribute adds the size_chart product
attribute (General / Product Details group of every attribute set).
Tests
Test/Unit/Model/TableTest.php (the text format);
dev/tests/zero-e2e/tests/size-chart-admin.spec.ts (a chart on the root
category shows on a product page, opens, and goes with the chart; writes,
so local or ZERO_E2E_PROD_WRITES=1).
Disabling or removing
Its data lives in zero_size_chart. With the module's code still in place,
bin/magento module:disable Zero_SizeChart followed by setup:upgrade
drops that table (Magento's declarative schema); enabling the module
again brings it back empty. To keep the charts, switch the size guide off in
Stores > Configuration instead, or back up first: bin/magento setup:upgrade --safe-mode=1 dumps the data before anything is dropped (--data-restore=1
puts it back). Deleting the module's code leaves the table in place. The
size_chart product attribute stays either way.
License
OSL-3.0 or AFL-3.0, your choice: see NOTICE.md.
Zero is made by Fixstacks in partnership with Vilmate, a software development company. Documentation: https://zerofront.dev/docs. Demo store: https://demo.zerofront.dev.