Skip to content

MelisCommerce ​

The e-commerce module: catalog (products, variants, attributes, categories), customers, baskets, orders, checkout, coupons and shipping. Package melisplatform/melis-commerce.

Purpose ​

MelisCommerce turns a Melis site into an online shop. In the backoffice it adds the full set of commerce tools (products, variants, attributes, categories, clients, orders, coupons, currencies, shipping…); on the front office it ships templating plugins for product pages, baskets, login and checkout. It is built on a layer of MelisCom* services backed by melis_ecom_* database tables. For an end-to-end walkthrough, see Commerce.

Enable it ​

MelisCommerce is a standard Laminas module listed in config/melis.module.load.php:

php
'MelisCommerce',

It requires melisplatform/melis-core (and the platform stack: melis-engine / melis-front to render the front-office plugins). The companion module MelisCommerceOrderInvoice adds order invoicing. Database tables are created via dbdeploy (extra.dbdeploy: true in composer.json, deltas under install/dbdeploy/).

Key services ​

Registered as service_manager aliases in config/module.config.php. Most expose getXxxList, getXxxById and saveXxx / deleteXxx methods returning Melis commerce entities.

Service aliasRole
MelisComProductServiceProducts: getProductList, getProductById, getProductVariants, getProductPricesById, saveProduct, deleteProductById, formatPrice.
MelisComVariantServiceProduct variants (stock-bearing sellable items) and their attribute values.
MelisComAttributeServiceAttributes, attribute types and translated values.
MelisComCategoryServiceCatalog categories (translated, per-country).
MelisComProductSearchServiceFront-office product search.
MelisComPriceServicePrice computation (per country / client group).
MelisComClientServiceCustomers/accounts: getClientList, getClientById, getClientMainPersonByClientId, addresses.
MelisComClientGroupsServiceClient groups (used for group-specific pricing).
MelisComContactServiceAccount contacts.
MelisComAuthenticationServiceFront client auth: login, getClientId, getPersonId, getClientKey, getClientGroup.
MelisComBasketServiceCart: getBasket, addVariantToBasket, removeVariantFromBasket, emptyBasket; anonymous (clientKey) and persistent baskets.
MelisComOrderServiceOrders: getOrderList, getOrderById, addresses/shipping/payment/messages, exportOrderList.
MelisComOrderCheckoutServiceCheckout flow (turns a basket into an order).
MelisComOrderProductReturnServiceProduct returns / RMA.
MelisComPostPaymentServicePost-payment handling.
MelisComCouponServiceDiscount coupons (per client / order / product).
MelisComShipmentCostServiceShipping cost computation.
MelisComCurrencyServiceCurrencies.
MelisComStockEmailAlertServiceBack-in-stock email alerts.
MelisComSeoServiceCommerce SEO (URLs / meta for products & categories).
MelisComLinksServiceBuilds front-office commerce links (also via the MelisCommerceLink view helper).
MelisComDocumentServiceProduct/order documents (media).
MelisComDuplicationServiceDuplicate products / variants.
MelisComCacheServiceCommerce cache layer.
MelisComHeadCommerce general/head data.

Backoffice ​

Tools are declared per area under config/tools/app.tools.*.php and config/interface/app.interface.*.php, all under the meliscommerce plugin key — e.g. meliscommerce_products, meliscommerce_variants, meliscommerce_attributes, meliscommerce_categories, meliscommerce_clients, meliscommerce_clients_group, meliscommerce_orders, meliscommerce_coupons, meliscommerce_currency, meliscommerce_country, meliscommerce_language, meliscommerce_documents, meliscommerce_checkout, meliscommerce_contact. Each maps to a controller such as MelisCommerce\Controller\MelisComProductList, …MelisComVariantList, …MelisComOrderList, …MelisComClientList. See Create a tool.

Dashboard widgets (in config/dashboard-plugins/): MelisCommerceDashboardPluginOrdersNumber, MelisCommerceDashboardPluginSalesRevenue, MelisCommerceDashboardPluginOrderMessages.

Front office ​

Templating plugins live under config/plugins/{products,categories,clients,orders}/ and are registered as controller_plugins in module.config.php. Drop them into a page's MelisDragDropZone (see Plugins). Notable ones:

AreaPlugins
ProductsMelisCommerceProductShowPlugin, MelisCommerceProductListPlugin, MelisCommerceProductSearchPlugin, MelisCommerceRelatedProductsPlugin, MelisCommerceProductPriceRangePlugin, MelisCommerceAttributesShowPlugin, MelisCommerceProductAttributePlugin
CategoriesMelisCommerceCategoryTreePlugin, MelisCommerceCategoryProductListPlugin
ClientsMelisCommerceLoginPlugin, MelisCommerceRegisterPlugin, MelisCommerceProfilePlugin, MelisCommerceAccountPlugin, MelisCommerceBillingAddressPlugin, MelisCommerceDeliveryAddressPlugin, MelisCommerceLostPasswordGetEmailPlugin, MelisCommerceLostPasswordResetPlugin
Orders / cart / checkoutMelisCommerceAddToCartPlugin, MelisCommerceCartPlugin, MelisCommerceCheckoutCartPlugin, MelisCommerceCheckoutAddressesPlugin, MelisCommerceCheckoutCouponPlugin, MelisCommerceCheckoutSummaryPlugin, MelisCommerceCheckoutConfirmPlugin, MelisCommerceOrderHistoryPlugin, MelisCommerceOrderReturnProductPlugin

View helpers: MelisCommerceLink (alias of MelisCommerceLinksHelper) and ToolTipTable.

Database tables ​

All tables use the melis_ecom_* prefix (created by install/dbdeploy/). Main ones:

  • Catalog: melis_ecom_product, melis_ecom_product_text, melis_ecom_product_attribute, melis_ecom_product_category, melis_ecom_product_links, melis_ecom_variant, melis_ecom_variant_attribute_value, melis_ecom_variant_stock, melis_ecom_attribute (+ _trans, _type, _value, _value_trans), melis_ecom_category (+ _trans), melis_ecom_price.
  • Customers: melis_ecom_client, melis_ecom_client_company, melis_ecom_client_person (+ _emails, _rel), melis_ecom_client_address, melis_ecom_client_groups, melis_ecom_client_account_rel, melis_ecom_civility.
  • Baskets & orders: melis_ecom_basket_anonymous, melis_ecom_basket_persistent, melis_ecom_order, melis_ecom_order_basket, melis_ecom_order_address, melis_ecom_order_shipping, melis_ecom_order_payment (+ _type), melis_ecom_order_status (+ _trans), melis_ecom_order_message, melis_ecom_order_product_return (+ _details).
  • Coupons & misc: melis_ecom_coupon (+ _client, _order, _product), melis_ecom_currency, melis_ecom_country, melis_ecom_lang, melis_ecom_seo, melis_ecom_document (+ _doc_type, _doc_relations), melis_ecom_stock_email_alert, melis_ecom_settings_account.

Example ​

Read a product and add one of its variants to the current customer's basket:

php
$products = $serviceManager->get('MelisComProductService');
$baskets  = $serviceManager->get('MelisComBasketService');

$product  = $products->getProductById($productId, $langId, $countryId);
$variants = $products->getProductVariants($productId, true); // only valid

// add the first variant, qty 1, for the logged-in client
$baskets->addVariantToBasket($variants[0]->getId(), 1, $clientId);
$basket = $baskets->getBasket($clientId);

Key files ​

ConcernPath
Module config (services, controllers, plugins)vendor/melisplatform/melis-commerce/config/module.config.php
Backoffice toolsvendor/melisplatform/melis-commerce/config/tools/app.tools.*.php
Backoffice interfacesvendor/melisplatform/melis-commerce/config/interface/app.interface.*.php
Front templating pluginsvendor/melisplatform/melis-commerce/config/plugins/{products,categories,clients,orders}/
Dashboard pluginsvendor/melisplatform/melis-commerce/config/dashboard-plugins/
Servicesvendor/melisplatform/melis-commerce/src/Service/
Controllersvendor/melisplatform/melis-commerce/src/Controller/
Table modelsvendor/melisplatform/melis-commerce/src/Model/Tables/
Listenersvendor/melisplatform/melis-commerce/src/Listener/
DB deltasvendor/melisplatform/melis-commerce/install/dbdeploy/

See also: Commerce guide · Module reference · Plugins.