The Artbambou SmileCustomEntityWidget module extends Magento 2 by adding widget capabilities to Smile Custom Entities, empowering merchants to display filtered custom entity collections with advanced presentation options. This module bridges the gap between content management and presentation, allowing for dynamic display of custom entities on any content page.

- Custom Entity Widget: Create widgets that display custom entities from specified attribute sets
- Advanced Filtering: Filter entities using sophisticated condition combinations
- Custom Attribute to Filter : "Entity Has Image", "Entity ID" (without chooser grid for now)
- Customizable Sorting: Sort entities by any attribute with configurable direction
- Pagination Controls: Optional paging functionality with customizable items per page
Execute the following commands in your Magento root directory:
composer require artbambou/module-smile-custom-entity-widget
bin/magento module:enable Artbambou_SmileCustomEntityWidget
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy
- Create directory
app/code/Artbambou/SmileCustomEntityWidget
in your Magento installation - Clone or download this repository into that directory
- Enable the module and update the database:
bin/magento module:enable Artbambou_SmileCustomEntityWidget
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy
After installation, a new widget type "Smile Custom Entity Widget" will be available in the Magento Admin Panel:
- Navigate to Content > Elements > Widgets
- Click Add Widget
- Select Smile Custom Entity Widget as the widget type
- Configure the widget with the following options:
- Heading Title: Optional title for the widget section
- Attribute Set: Select the custom entity attribute set to display
- Conditions: Define filtering rules to determine which entities to display
- Display Page Control: Enable/disable pagination
- Number of Items: Configure how many items to display
- Sorting Options: Choose which attribute to sort by and the direction
- Image Dimensions: Set the width and height for entity images
- (Not implemented in template) Footer Button: Optionally display a call-to-action button
- (Not implemented in template) Template: Select the display template
The widget can be placed on any CMS page, block, or within layout XML, providing flexible integration options.
To customize or extend the SmileCustomEntityWidget's options, you can override the widget configuration within your theme by creating a widget.xml file in your theme's configuration directory.
-
Create the following directory structure in your theme folder if it doesn't already exist:
app/design/frontend/YourVendor/YourTheme/Artbambou_SmileCustomEntityWidget/etc/
-
Create a
widget.xml
file within this directory with the following structure:<?xml version="1.0" encoding="UTF-8"?> <widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Widget:etc/widget.xsd"> <widget id="artbambou_smile_custom_entity_set_widget" class="Artbambou\SmileCustomEntityWidget\Block\Set\Widget\CustomEntityWidget"> <parameters> <!-- Add or modify parameters here --> <parameter name="template" xsi:type="select" required="true" visible="true"> <label translate="true">Template</label> <options> <option name="grid" value="Artbambou_SmileCustomEntityWidget::widget/grid.phtml"> <label translate="true">Grid Template</label> </option> <option name="custom_list" value="YourVendor_YourTheme::smile_entity/custom_list.phtml"> <label translate="true">Custom List Template</label> </option> <!-- Add more template options as needed --> </options> </parameter> </parameters> </widget> </widgets>
-
After adding this file, clear the Magento cache:
bin/magento cache:clean
This approach allows you to extend the widget configuration without modifying the core module code. You can add new template options, modify existing parameters, or introduce entirely new parameters to customize the widget's behavior to meet your specific design requirements.
Note that any custom templates referenced in your widget.xml must exist within your theme structure for them to work properly.
- Smile CustomEntity module (https://github.com/Smile-SA/magento2-module-custom-entity)
- Smile ScopedEav module (https://github.com/Smile-SA/magento2-module-scoped-eav)
- Magento 2.4.x
- PHP 8.3
Contributions are welcome! Please feel free to submit a Pull Request.
For issues or feature requests, please create an issue on our GitHub repository.
This module is licensed under the Open Software License ("OSL") v3.0. See the LICENSE.txt file for details.
Developed by Ilan Parmentier for Amadeco.