Ready-made "Featured Products" Plugin for Cotonti
Purpose:
The plugin allows displaying a block with selected (recommended) products anywhere on the website via the tag system (TPL).
Functionality:
Allows the administrator to manually mark products as "featured" or "recommended."
Works in conjunction with the store module (Market PRO v.5 module).
Supports output through widgets or separate blocks in the product page template.
Compatibility:
Designed for the current versions of Cotonti Siena.
This is the tool that eliminates the need to write code manually by providing an interface to manage the list of priority products on the data editing page.
Featured Products in Market
User and Administrator Guide for Cotonti Siena 0.9.26+
Introduction
The Featured Products in Market plugin is designed for manual assignment and display of recommended products and services in the Market module (MarketPRO). It allows you to link product cards together so that a predefined list of recommendations is shown on a product page.
Unlike automatic selections based on category or tags, this plugin focuses on full administrative and author control: you explicitly choose which products are displayed as recommendations and in what order.
The plugin is compatible with:
- Cotonti Siena 0.9.26
- PHP 8.4 and higher
- MySQL 8.0
- Market / MarketPRO module v5+
Optional integrations:
- i18n / i18n4marketpro
- Attacher
Plugin Purpose
The main purpose of the plugin is to add a “Featured Products and Services” block to a product page that:
- is manually configured when editing a product;
- is displayed on the public product page;
- supports sorting, images, and multilingual content;
- does not rely on categories, tags, or automated algorithms.
General Workflow
The plugin operates around a dedicated linking table that stores:
- which product is the source of recommendations;
- which products are linked to it;
- the display order of those links.
The workflow is as follows:
- A user edits a product card in Market.
- An additional block for selecting featured products appears in the edit form.
- The user selects products using live search.
- After saving, the relationships are stored in the database.
- The product page displays the featured products block in the defined order.
Data Storage Structure
All relationships are stored in a separate featuredproducts table, which:
- does not duplicate product data;
- stores only “from product → to product” relationships;
- enforces uniqueness for each product pair;
- supports ordered output.
When a product is deleted, all related links are automatically removed, preventing broken or orphaned recommendations.
Plugin Settings
The following configuration options are available in the admin panel:
Maximum Number of Featured Items
Defines how many products can be linked to a single product and how many are displayed on the page.
This limit is enforced:
- in the edit form selection;
- during data saving;
- during frontend rendering.
Short Description Length
Sets the maximum length of the text description displayed in the featured products block.
This ensures a clean and compact presentation.
Default Image
Specifies the path to a fallback image that is used if a product has no attached images.
Product Edit Interface
Featured Products Block
When editing a product, an additional block appears that:
- displays a fixed number of rows for selecting featured products;
- provides a search field in each row;
- performs real-time product search.
Search and Restrictions
The search functionality:
- works via AJAX without page reload;
- starts returning results after at least two characters are entered;
- excludes the currently edited product;
- shows only the user’s own products for regular users;
- shows all available products for administrators.
Access Control
- Administrators can link any published product.
- Regular users can select only their own products.
- Unpublished or hidden products are excluded.
Saving Relationships
When a product is saved:
- all previous relationships are removed;
- new relationships are written in the specified order;
- duplicate entries are automatically ignored;
- a product cannot be linked to itself;
- the maximum number of featured items is enforced.
This approach ensures data integrity and consistent ordering at all times.
Displaying Featured Products on the Product Page
Template Integration
The plugin integrates via a standard Market hook and provides a template tag that is inserted into the product page template.
If no featured products exist, the block is not rendered at all.
Display Logic
For each featured product:
- its publication status is verified;
- the predefined display order is respected;
- a proper product URL is generated;
- a main image or fallback image is loaded;
- the title, description, and category are displayed.
Image Handling
The plugin uses the following logic for images:
- if the Attacher plugin is active, the first attached image is used;
- if no images are found, the fallback image from the settings is used;
- all images are output with correct absolute URLs.
This guarantees a consistent and visually clean layout.
Text and Description Processing
To generate short descriptions:
- the main text or description of the product is used;
- all HTML tags are removed;
- special characters and extra spaces are normalized;
- the text is safely truncated to the configured length.
This ensures readable and secure output without breaking the layout.
Multilingual Support
The plugin fully supports multilingual websites when used with:
When translations are available:
- product titles, descriptions, and texts are displayed in the current language;
- category names are also translated;
- if a translation is missing, the original content is used.
Product Deletion Handling
When a product is deleted:
- all relationships involving that product are automatically removed;
- no orphaned records remain in the database;
- featured blocks on other products are updated correctly.
Plugin Advantages
- Full manual control over recommendations
- Tight integration with MarketPRO
- AJAX-powered live search
- Image and multilingual support
- Clean architecture without core modifications
- Proper access control handling
- Safe behavior during product deletion and updates
Conclusion
Featured Products in Market is a professional tool for increasing user engagement and cross-selling within Cotonti MarketPRO. It is ideal for online stores, service catalogs, and marketplaces where manual control over product recommendations and display logic is essential.
The plugin follows Cotonti standards, integrates cleanly into the existing system, and remains flexible for future enhancements.