Alias Market PRO - Management and Tools
Automatically creates readable, transliterated aliases (URL paths) for Cotonti's market module products. Interface for managing aliases, titles, and meta-titles in the plugin's admin area.
Alias Market PRO — automatic aliases for Market module products
Plugin for Cotonti v1.+
Automatically creates readable, transliterated aliases (URL paths) for products of the market module if the user leaves the alias field empty.
Completely solves the problem of transliteration depending on the site's interface language: now an internal transliteration function is used, not tied to Cotonti core language files.
Table of Contents
- History of creation and the problem it solves
- Features
- Requirements
- Plugin structure
- Installation
- Plugin settings in admin panel
- Usage
- Administration panel (three tabs)
- Detailed description of each file
- Usage example
- Troubleshooting
- License
- Links
History of creation and the problem it solves
The original plugin (version 2.1.3) used the system language file cot_langfile('translit', 'core') for Cyrillic transliteration:
if($cfg['plugin']['aliasmarketpro']['translit'] && file_exists(cot_langfile('translit', 'core')))
{
include cot_langfile('translit', 'core');
if (is_array($cot_translit_custom))
{
$title = strtr($title, $cot_translit_custom);
}
elseif (is_array($cot_translit))
{
$title = strtr($title, $cot_translit);
}
}
The problem: on a site with a Russian interface language and Ukrainian product titles, the Russian transliteration table (GOST 7.79-2000, file lang/ru/translit.lang.php) was loaded. Ukrainian letters і, є, ї, ґ were missing from it, so they were either left unchanged or removed, making the alias incorrect.
Solution: completely abandon dependence on core language files and implement an internal transliteration function that contains a single character table covering both the Russian and Ukrainian alphabets. This guarantees correct alias generation regardless of the current interface language.
Features
- Automatic generation of an alias from the product title when adding or editing a product, if the alias field is left empty.
- Internal transliteration of Cyrillic (Russian + Ukrainian) into Latin using a single table — does not depend on Cotonti language files.
- Removal of all characters except letters, digits, hyphens, underscores, and spaces.
- Settings:
- enable/disable transliteration;
- prepend product ID to the beginning of the alias;
- behavior on alias duplicate (append ID or random number);
- word separator choice (hyphen, underscore, period);
- convert to lowercase.
- Administration panel with three tabs:
- Statistics — total number of products, how many with aliases, without aliases, without Meta Title.
- Lists & Aliases — view a list of products with ID, title, meta title, and alias.
- Management — bulk editing of title, Meta Title, and alias for multiple products on one page with saving changes.
- Actions on the "Statistics" tab:
- Create aliases — bulk generation of aliases for all products where the alias is empty.
- Clear all aliases — completely erase the
fieldmrkt_aliasfield for all products (with confirmation).
- Pagination in lists and management forms.
- All interface strings are localized (Russian, English).
Requirements
- Cotonti v1.+ (tested on the latest version)
marketmodule (must be installed and active)- PHP 8.5+
- MySQL 8.4+
- Administrator rights to access the plugin control panel.
Plugin structure
aliasmarketpro/
├── aliasmarketpro.setup.php # Plugin registration and settings description
├── aliasmarketpro.market.php # Hook for adding/editing a product
├── aliasmarketpro.admin.php # Administration panel
├── inc/
│ └── aliasmarketpro.functions.php # Transliteration, conversion, update functions
├── lang/
│ ├── aliasmarketpro.ru.lang.php # Russian language file
│ └── aliasmarketpro.en.lang.php # English language file
└── tpl/
└── aliasmarketpro.admin.tpl # Admin panel template
Installation
- Download the plugin ZIP archive from the official repository.
- Unpack the archive into the
plugins/folder of your site. - Go to the Cotonti admin panel → Extensions.
- Find "Alias Market PRO" and click "Install".
After installation, the plugin starts working immediately (when adding/editing products, the alias will be generated automatically if the field is empty).
Plugin settings in admin panel
Settings are available at Extensions → Alias Market PRO → Configuration.
| Parameter | Type | Default | Description |
|---|---|---|---|
translit | radio | 1 (on) | Enables transliteration of non-Latin characters (Cyrillic) into Latin. |
prepend_id | radio | 0 (off) | Prepend the product ID to the beginning of the alias. Example: 123-product-name. |
on_duplicate | select | ID | Action when a duplicate alias is found (if prepend_id is off): ID — append the product ID to the end; Random — append a random number from 2 to 99. |
sep | select | - | Word separator: hyphen (-), underscore (_), period (.). |
lowercase | radio | 1 (on) | Convert the alias to lowercase. |
Usage
Automatic alias creation
When you add or edit a product in the market module and leave the "Alias" field empty, the plugin triggers on the hooks market.add.add.done and market.edit.update.done. The alias generation process:
- The product title (
fieldmrkt_title) is taken. - If transliteration is enabled, the string is passed through the internal function
aliasmarketpro_transliterate(), which replaces all Cyrillic characters (Russian and Ukrainian) according to a single table. - All characters except letters, digits, hyphens, underscores, and spaces are removed (regular expression
[^\p{L}0-9\-_ ]). - Spaces are replaced with the chosen separator.
- If the "Lowercase" option is enabled, all letters become lowercase.
- If the "Prepend ID" option is enabled,
{id}{separator}is placed before the alias. - Uniqueness is checked: if the generated alias already exists for another product and
prepend_idis off, the product ID or a random number (depending on theon_duplicatesetting) is appended to the end. - The final alias is written to the
fieldmrkt_aliasfield.
Administration panel (three tabs)
The panel is accessible via Admin → Tools → Alias Market PRO.
"Statistics" tab
Shows four numbers:
- Total products — number of products with a non-empty title.
- With alias — products where the
fieldmrkt_aliasfield is filled. - Without alias — products with an empty alias.
- Without Meta Title — products where the meta title (
fieldmrkt_metatitle) is not filled.
Action buttons:
- Create aliases — starts generating aliases for all products where the alias is missing.
- Clear all aliases — erases the alias for all products (confirmation required).
- Configuration — go to plugin settings.
"Lists & Aliases" tab
Displays a table of all products (with pagination, 25 records per page) with columns:
- ID
- Title (links to the product page on the site)
- Meta Title
- Alias
Designed for a quick overview of alias statuses.
"Management" tab
Allows editing the title, Meta Title, and alias for several products at once on one page (10 records per page). The ID field is not editable.
To change data:
- Make changes in the desired fields.
- Click the "Update" button.
After saving, you will remain on the same pagination page you started from.
Detailed description of each file
Below is a detailed description of all plugin files.
aliasmarketpro.setup.php
Purpose: plugin registration in the Cotonti system and description of its settings.
Contains two mandatory sections:
[BEGIN_COT_EXT] … [END_COT_EXT]– metadata:Code– unique identifieraliasmarketpro.Name– display name.Category–seo(category in admin panel).Version– current version (2.5.0 in this file).Requires_modules–market.- Guest and user access rights.
[BEGIN_COT_EXT_CONFIG] … [END_COT_EXT_CONFIG]– list of configuration parameters:translit,prepend_id,on_duplicate,sep,lowercase.- Each line specifies sorting order, field type (radio/select), default value, and description.
Without this file, Cotonti cannot install the plugin and provide a settings form.
aliasmarketpro.market.php
Hooks: market.add.add.done, market.edit.update.done
Executed immediately after adding or updating a product. The code is minimal:
if (empty($ritem['fieldmrkt_alias']))
{
require_once cot_incfile('aliasmarketpro', 'plug');
$ritem['fieldmrkt_alias'] = aliasmarketpro_update($ritem['fieldmrkt_title'], $id);
}
If the alias field is empty, the plugin functions are included and aliasmarketpro_update() is called, which generates a new alias based on the title and product ID. The result is written directly into the $ritem array, and the market module saves it to the database.
aliasmarketpro.admin.php
Hook: tools
Builds the plugin administration page (under "Tools"). Work logic:
- Determines the current tab (
tab) and action (a) from the URL. - Assigns navigation variables for the template (active tabs, links).
- Special action handling (before tab output):
a=create– selects all products with an empty alias, callsaliasmarketpro_update()for each, outputs a message with the number of created aliases.a=clear_aliases– sets thefieldmrkt_aliasfield to empty for all products, outputs a clearance message.- After execution, redirects to the same tab (preserving parameters).
- Tab content generation:
- Statistics – executes four SQL queries to count metrics, passes them to the template, as well as the URL for the "Create aliases" button.
- Lists & Aliases – retrieves data with pagination (LIMIT/OFFSET) from the
cot_markettable. For each product, computes the URL viacot_market_url(), assignsLIST_ROW_*variables, and parses theLIST_ROWblock. If no products, outputsLIST_EMPTY. Adds pagination. - Management – similarly retrieves data with pagination. If a POST request with
a=updateis received, loops through and updates the title, meta title, and alias for all IDs submitted in the form. Uses$backUrlwith the current page number (durl) to return to the same page after saving. The issue with&in the URL is resolved by replacing&→&before redirection.
- Outputs system messages, parses the main
MAINblock, and returns HTML.
inc/aliasmarketpro.functions.php
Contains the three main plugin functions.
aliasmarketpro_transliterate($str)
Internal transliteration function. Takes a string and passes it through a single replacement array sorted from longest sequences to shortest:
- Unique Ukrainian letters:
Є,є,Ї,ї,Ґ,ґ,І,і. - Russian letters not present in Ukrainian:
ё,Ё,ы,Ы,э,Э,ъ,Ъ. - Common multi-character combinations:
Щ→Shch,Ж→Zh,Х→Kh,Ц→Ts,Ч→Ch,Ш→Sh,Ю→Yu,Я→Ya. - Single letters (common to Russian and Ukrainian):
А→A,б→b, etc. - Soft sign and apostrophes are replaced with an empty string (removed).
Returns the string with replaced characters. Does not depend on external files.
aliasmarketpro_convert($title, $id, $duplicate)
Main function for converting a title into an alias. Steps:
- If
translitis enabled, callsaliasmarketpro_transliterate(). - Removes forbidden characters via
preg_replace('#[^\p{L}0-9\-_ ]#u', '', $title). - Replaces spaces with the separator from configuration.
- If
lowercase=1, converts to lowercase. - If
prepend_id=1and$idis not empty, prepends$id . $sep. - If
$duplicate=true, appends the ID (if set andIDmode selected) or a random number (Randommode). Returns the finished alias.
aliasmarketpro_update($title, $id)
Called when adding/editing a product and during bulk creation. In a do...while loop:
- Generates an alias via
aliasmarketpro_convert(). - If
prepend_idis off, checks the database for an existing alias with another product (fieldmrkt_id != $id). - If a duplicate is found, sets
$duplicate=true, and on the next iterationaliasmarketpro_convertwill append the ID/random number. - Once a unique alias is obtained, updates the record in the
cot_markettable. - Returns the final alias.
Language files (lang/aliasmarketpro.ru.lang.php, en.lang.php)
Contain all text strings: plugin name, description, settings labels (including hints and dropdown values), tab names, messages.
Used by the cot_langfile() function when loading the plugin.
Template tpl/aliasmarketpro.admin.tpl
HTML template with XTemplate blocks for the admin panel. Uses Bootstrap 5 (included in Cotonti v1.+). Main blocks:
MAIN– page container with tabs.LIST_ROW,LIST_EMPTY– table rows in the "Lists & Aliases" tab.MANAGE_ROW,MANAGE_EMPTY– form rows in the "Management" tab.- Pagination is included via the system tag
{PAGINATION}.
Tabs are switched via conditional blocks <!-- IF {PHP.tab} == '...' -->.
Usage example
Situation: a site with a Russian interface, but a product is added with the Ukrainian name "Новий електроскутер". The alias is empty.
- User saves the product.
- The plugin calls
aliasmarketpro_transliterate('Новий електроскутер'). - Characters are replaced:
Н→N,о→o,в→v,и→y,й→y,е→e,л→l,к→k,т→t,р→r,о→o,с→s,к→k,у→u,т→t,е→e,р→r.- Space is replaced with hyphen (
sep=-).
- With
lowercaseenabled, we getnovyj-elektroskuter. - The alias is unique — written to the database.
If the old version of the plugin used the Russian table, и would have become i (resulting in novij), which does not conform to Ukrainian transliteration.
Troubleshooting
- Alias is not being created. Make sure the plugin is active and that you have not filled in the "Alias" field manually — the plugin only works when the field is empty.
- Table rows are not displayed in the admin panel. Check that the template file
aliasmarketpro.admin.tplmatches the latest version, and that theLIST_ROWandMANAGE_ROWblocks are directly insideMAIN(not wrapped in other blocks). - After saving in "Management", the URL contains
&. This issue was fixed in version 2.5.1 by forcibly replacing&→&in the redirect URL. If it still occurs, make sure you have the latestadmin.php. - Transliteration does not work as expected. The transliteration table is hardcoded in
aliasmarketpro_transliterate(). If a needed character is missing, add it to the$translitarray (filefunctions.php), maintaining the order from longest sequences to shortest. - The "Create aliases" button does nothing. Ensure there are records with an empty
fieldmrkt_aliasin thecot_markettable. Check database write permissions.
License
BSD. Free use and modification while retaining copyright.
Links
Product has no downloadable file
Page Discussion in Telegram
Content author
Offline
webitproff
Last logged: 2026-08-06 16:37
Чем могу помочь?
Оказываю весь спектр услуг по CMF Cotonti. Разработка открытых и закрытых корпоративных интернет порталов, небольших социальных сетей, торговые площадки, маркетплейсы, биржи фриланса, каталоги товаров оптовых поставщиков, интернет-магазин под заказ, чтобы делать совместные покупки и групповые совместные продажи от имени нескольких продавцов.
Разработки на GitHub бесплатно
Telegram
- 2026-08-06 13:55
- 2026-08-06 14:02
- Editing a translation
- Language:
Related and similar products
Market PRO Showcase
CMS, Script and Engine for an online storefront, infoproduct shop and digital goods store. Different prices in different currencies. Online cryptocurrency payments for goods and services.
Русский