saurabhg / module-shop-by-company
Shop by Company: SEO-friendly company pages, all-companies listing, company slider/list/info widgets, company logos on product and listing pages.
Package info
github.com/saurabh20394/Saurabhg_ShopByBrand
Type:magento2-module
pkg:composer/saurabhg/module-shop-by-company
Requires
- php: ~8.1.0||~8.2.0||~8.3.0||~8.4.0||~8.5.0
- magento/framework: *
- magento/module-catalog: *
- magento/module-catalog-search: *
- magento/module-cms: *
- magento/module-eav: *
- magento/module-layered-navigation: *
- magento/module-sitemap: *
- magento/module-store: *
- magento/module-swatches: *
- magento/module-theme: *
- magento/module-ui: *
- magento/module-widget: *
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-18 08:42:52 UTC
README
Shop by Company for Magento 2.4 (Luma / Blank themes).
Customers can browse the catalog by company (manufacturer / brand). The module provides:
- SEO-friendly company pages with layered navigation
- an All Companies page with search and an A–Z filter
- a logo-grid popup in the top menu
- company logos on product and listing pages
- "More from this company" products
- Company List, Company Slider and Company Info widgets
- EU Product Safety (GPSR) manufacturer information
| Module | Saurabhg_ShopByCompany |
| Composer package | saurabhg/module-shop-by-company |
| Location | app/code/Saurabhg/ShopByCompany |
| Requires | Magento 2.4.x (tested on 2.4.9), PHP 8.1 – 8.5, OpenSearch / Elasticsearch |
| License | GPL-3.0-or-later |
Contents
- Installation
- Quick start
- Configuration
- Managing companies
- Storefront features
- Widgets
- Updating CSS / JS on Windows
- Uninstall
- Technical notes
- Troubleshooting
Installation
bin/magento module:enable Saurabhg_ShopByCompany bin/magento setup:upgrade bin/magento setup:di:compile # production mode only bin/magento setup:static-content:deploy -f # see the Windows notes below bin/magento indexer:reindex bin/magento cache:flush
setup:upgrade does the following:
- Creates the table
saurabhg_shopbycompany_option_setting, which holds company page settings per attribute option and store view. - Creates the Company (
company) dropdown product attribute in the General group of every attribute set. The attribute is filterable, used in product listing, and used for sorting. - Creates the All Companies CMS page (
/companies) containing the Company Slider and Company List widgets, and selects it in Choose CMS Page.
Quick start
- Add companies. Go to Stores → Attributes → Product → Company → Manage Options and add one option per company (e.g. Haldiram, Bikaner).
- Assign companies to products. Open each product and set the Company field. For configurable products, set it on the configurable (parent) product, which is the one shown in the catalog.
- Reindex with
bin/magento indexer:reindex. Product counts and company pages come from the search index. - Add logos and content. Go to Content → Shop By Company → Company Management → Edit (see Managing companies).
- Check the storefront.
- Menu COMPANY ▾ → logo popup
/companies→ All Companies page/company/<company>.html→ company page
Configuration
Stores → Configuration → Saurabh Extensions → Shop By Company
Every option can be set per website and per store view.
General Settings
| Option | Description |
|---|---|
| Enable | Turns the module on or off. |
| Company Attribute | The dropdown or swatch product attribute used as the company. It can differ per store view. On save, the attribute is made Filterable and Used in Product Listing (both required); reindex afterwards. |
| URL Key | Prefix of company page URLs (/company/acme.html). Leave empty for short URLs (/acme.html). Opening /{url_key} shows the All Companies page. |
| Choose CMS Page | The CMS page that is the All Companies page. |
| Search Engine Bucket Size | How many companies the search engine aggregates for product counts and layered navigation. The default is 500; higher values can affect performance. |
| Companies Item Label | Text of the top menu item, the account link and the breadcrumb (e.g. "Company"). |
| Display Tooltip | Where a tooltip with company info appears: All-Companies page, product pages, catalog listing. |
| Tooltip Content | HTML template for the tooltip. Variables: {title}, {small_image}, {image}, {description}, {short_description}. |
| Exclude Companies without Products from Sitemap | Leaves companies with no products out of the XML sitemap. |
| Add Companies to Account Top Links | Adds a link to the header account links. |
| Add Companies Link to Top Menu | No / Display First / Display Last. |
| Show Companies List Popup | Shows the logo-grid popup when hovering over the menu item. |
Companies List Popup Configuration
| Option | Description |
|---|---|
| Max Companies in Popup | Number of logo tiles shown before searching (default 16; 0 = all). Featured companies come first, then those with the most products, then alphabetical. |
| Show Company Logo | Logo, or coloured initials when the company has no logo. |
| Image Max Width / Height, px | Maximum logo size in a tile (default 140 × 110). |
| Enable Search | Search box above the tiles. It searches all companies, not only the visible ones. |
| Enable Filter by Character | A–Z buttons above the tiles. |
| Show Characters without Companies | Shows letters that have no companies, as disabled buttons. |
| Show Products Quantity | Shows "Name (count)". |
| Show Companies Without Products | When set to "No", only companies with products appear. |
To get a clean logo grid with no toolbar, set Enable Search and Enable Filter by Character to No.
More from this Company
| Option | Description |
|---|---|
| Enable | Adds a block of random products from the same company at the bottom of the product page. |
| Title | The block heading. {company_name} is replaced with the company name. |
| Max Product Count | Number of products in the block. |
Product Page Company Settings
| Option | Description |
|---|---|
| Display Company Logo on Product Page | Shows the logo under the price. It links to the company page. |
| Display Short Description on Product Page | Shows the company short description next to the logo. |
| Company Logo Width / Height, px | Maximum logo size. |
Product Listing Company Settings
| Option | Description |
|---|---|
| Display Company Logo on Product Listing | Shows the logo on category and search result items. |
| Company Logo Width / Height | Logo size in px (30) or % (10%). |
XML Sitemap
| Option | Description |
|---|---|
| Add Company Pages to XML Sitemap | Includes company pages in the sitemap. |
| Priority / Frequency | Sitemap <priority> and <changefreq> values for company pages. |
Managing companies
Content → Shop By Company → Company Management
The grid lists every option of the Company Attribute (default scope). A notice above the grid shows which attribute is used and lists store views that use a different one. Click Edit in the Action column, or click a row, to open a company.
Use the store switcher at the top of the edit page to enter store-view-specific values. In a store view, turn on Use Default Values and save to remove that store view's values so it falls back to the defaults.
| Section | Fields |
|---|---|
| Company Options | Show in Company List Widget, Show in Company Slider Widget, Position in Slider, Featured |
| SEO | URL Alias. Generated from the option label when empty; must be unique. |
| Meta Data | Meta Title, Meta Description, Meta Keywords |
| Page Content | Page Title, Description (WYSIWYG; widgets and variables allowed), Short Description, Image + Image Alt, Top CMS Block, Bottom CMS Block |
| Additional Company Information (EU GPSR) | Block Position (After Title, After Description, Above Page Footer, Product Page More Information Tab), Manufacturer/Importer Postal Address, Electronic Address, Responsible Person. Allowed tags: <u> <b> <a> <i> <br>. |
| Design | Layout: Default Category Layout, Empty, 1 column, 2 columns left/right, 3 columns |
| Other | Small Image (Logo) + Small Image Alt |
Updating a company logo
- Go to Company Management → Edit and open the Other section.
- Upload a Small Image (Logo) (jpg, jpeg, png, gif or webp, max 4 MB). Remove the old one first with the trash icon.
- Save. If full page cache is enabled, flush it.
The storefront logo falls back in this order: Small Image → Image (Page Content) → visual swatch image.
Files are stored in pub/media/saurabhg/shopbycompany/.
Rich page content with Page Builder
- Create a CMS block in Content → Elements → Blocks and design it with Page Builder.
- Select the block as Top CMS Block or Bottom CMS Block of the company.
Storefront features
Top menu (COMPANY ▾)
- The item is added as the first or last top menu item, in bold uppercase, with a ▾ caret.
- On hover or keyboard focus (desktop), a full-width logo-grid popup opens:
- 6 tiles per row (4 on narrower screens), each with a logo or initials and "Name (count)"
- a VIEW ALL COMPANIES button
- optional search and A–Z filter
Esccloses the popup. The caret flips while the popup is open. The popup is hidden on mobile.
All Companies page (/companies)
- Companies appear as cards: logo or coloured initials, name, and "12 products" / "No products yet".
- The toolbar stays visible while scrolling. It contains a rounded search box with a clear button (
Escalso clears) and A–Z buttons. - When nothing matches, a "No companies match your search" message appears with a Show all companies button.
- Responsive: two cards per row on phones, with the letters scrolling horizontally.
- The page is a normal CMS page, so you can edit its text or widgets in Content → Elements → Pages.
Company page (/company/<alias>.html)
- Shows all catalog-visible products of the company using Magento's native product list, toolbar and layered navigation. The company filter itself is hidden.
- Sorting options are name and price. Position sorting is not offered because it needs a category.
- The page has its own title, meta tags and canonical URL, plus breadcrumbs: Home › Company › Name.
- Page content and GPSR information appear at the configured positions.
Product page
- The company logo and short description appear under the price.
- "More from {company}" products appear at the bottom.
- Company information appears in the More Information tab when that position is selected for the company.
Product listing
- The company logo appears on category and search result items when enabled.
Accessibility
- Labelled controls and
aria-pressedon the letter buttons. - Live result counts for screen readers.
- Tooltips open on hover and on keyboard focus.
- The slider pauses on hover or focus and has a pause button when autoplay is on.
prefers-reduced-motionis respected.
Widgets
Insert widgets from the CMS WYSIWYG editor (Insert Widget) or from Content → Elements → Widgets.
Shop By Company: Company List
Options: Number of Columns, Show Company Logo, Image Max Width / Height, Enable Search, Enable Filter by Character, Show Characters without Companies, Show Products Quantity, Show Companies Without Products.
{{widget type="Saurabhg\\ShopByCompany\\Block\\Widget\\CompanyList" columns="4" show_logo="1" enable_search="1" filter_by_char="1" show_count="1" show_empty="1"}}
Shop By Company: Company Slider
Shows companies that have Show in Company Slider Widget enabled.
Options:
- Hide Companies
- Show Companies without Products
- Show Companies Related to Category (on category pages, only companies with products in that category)
- Visible Items Quantity
- Sort By (position / name)
- Slider Max Width
- Header Title
- Header Background / Text Color
- Image Max Width / Height
- Show Company Label
- Show Buttons
- Infinity Loop
- Simulate Touch (drag / swipe)
- Show Pagination
- Autoplay
- Autoplay Delay
Shop By Company: Company Info
Shows the short description and/or the additional (GPSR) information of the current company. The current company is the company page being viewed, or the company of the current product.
- Fields: empty shows all.
- Allowed containers: Main Content Area / Aside / Bottom / Container / Top, Product Extra Info, After Page Header (Top), Before Main Content, Before Page Footer (Container), Page Header Container.
Updating CSS / JS on Windows
On Windows, Magento cannot build missing static files on demand (a path-separator bug in static.php). Static content must therefore be deployed explicitly.
setup:static-content:deploy does not overwrite files that already exist. After changing the module's LESS or JS, delete the old files first:
# from the Magento root
rm -rf pub/static/frontend/Magento/luma/en_US/Saurabhg_ShopByCompany
rm -rf pub/static/frontend/Magento/blank/en_US/Saurabhg_ShopByCompany
rm -f pub/static/frontend/Magento/luma/en_US/css/styles-m.css pub/static/frontend/Magento/luma/en_US/css/styles-l.css
rm -f pub/static/frontend/Magento/blank/en_US/css/styles-m.css pub/static/frontend/Magento/blank/en_US/css/styles-l.css
rm -rf var/view_preprocessed/pub
bin/magento setup:static-content:deploy -f -a frontend -t Magento/luma -t Magento/blank -l en_US
bin/magento cache:flush
Then reload the browser with Ctrl+F5. Template (.phtml) and PHP changes only need a cache flush.
Uninstall
bin/magento module:disable Saurabhg_ShopByCompany bin/magento setup:upgrade
Disabling the module does not remove the company attribute, the /companies CMS page or the saurabhg_shopbycompany_option_setting table. Remove them manually if they are no longer needed.
Technical notes
| Area | Implementation |
|---|---|
| Routing | Controller\Router (sortOrder 25) matches {url_key}/{alias}{suffix} and forwards to shopbycompany/index/view/id/{option_id}. The suffix is the catalog category URL suffix. |
| Company page | A custom catalog layer type, saurabhg_company, whose search-engine collection is filtered by the company option instead of a category. It reuses the catalog_category_view and catalog_category_view_type_layered layouts, plus the shopbycompany_company_view handle. |
| Product counts | Search-engine facets (Model\ProductCount), the same source as layered navigation. Search Engine Bucket Size is applied by a plugin on the OpenSearch/Elasticsearch aggregation builder. |
| Data | saurabhg_shopbycompany_option_setting: one row per option and store (store 0 = default), with a foreign key to eav_attribute_option (rows are deleted together with the option). |
| Caching | Settings carry the cache tags sbc_company / sbc_company_{option_id}, so saving a company flushes the related full-page-cache entries. |
| Top menu | The page_block_html_topmenu_gethtml_before observer adds the menu node. The popup is rendered in before.body.end and moved under the <nav> by js/popup.js. |
| Sitemap | Model\Sitemap\ItemProvider is registered in Magento\Sitemap\Model\ItemProvider\Composite. |
| Frontend assets | view/frontend/web/css/source/_module.less; JS in js/list.js (search / A–Z), js/popup.js (menu popup) and js/slider.js (dependency-free slider). |
Troubleshooting
| Symptom | Fix |
|---|---|
| The page looks unstyled, or the popup does not open | Static files are stale. Follow Updating CSS / JS on Windows and press Ctrl+F5. |
| Popup says "No companies with products yet" | Assign companies to products and run bin/magento indexer:reindex, or set Show Companies Without Products = Yes. |
| Counts show 0 | Reindex. Counts only include enabled, catalog-visible products assigned to a company. |
| Company page returns 404 | Check that the module is enabled, that the company exists in the configured Company Attribute, and the URL key and suffix. |
| No company products on a company page | The attribute must be Filterable (set automatically when the Company Attribute is saved). Then reindex catalogsearch_fulltext. |
| Product page shows no company | The company is read from the product shown in the catalog. For configurable products, set it on the parent product. |