run_as_root / ext-magento2-product-priorities
This module provides a product priorities column inside Admin Products Grid.
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:magento2-module
Requires
- magento/framework: *
- magento/module-backend: *
- magento/module-catalog: *
- magento/module-reports: *
- magento/module-sales: *
- magento/module-store: *
- magento/module-ui: *
- psr/log: *
Requires (Dev)
This package is auto-updated.
Last update: 2025-02-28 16:26:46 UTC
README
title | keywords | module_name | author | send_questions_to | category |
---|---|---|---|---|---|
RunAsRoot Product Priorities | run_as_root, priority, bestseller, grid, form | RunAsRoot_ProductPriorities | David Lambauer, Denys Sliepnov | david@run-as-root.sh | Marketing |
General
Provides a product priorities column inside Admin Products Grid.
Installations
composer require run_as_root/ext-magento2-product-priorities
bin/magento setup:upgrade
Features
'Priority' column inside 'Products' grid
Priority
column includes the proportion value of relevance for each product.
These values should match the Priority Matrix.
Priority Matrix
Priority name | Relevance proportion value % | Cell background color |
---|---|---|
A | 90 | green |
B | 80 | light-green |
... | ... | ... |
F | 0 | red |
Priority Matrix
is editable (data stores at the database inside run_as_root_product_priorities
table).
There are initial values. Priority Name
and relevance proportion value %
fields must be unique.
Admin can adjust priority for a specific period of time.
Priority value calculates by the next formula:
- report data loads for the specific period of time from the table
sales_bestsellers_aggregated_daily
- system finds the product with the greatest
ordered_qty
value and marks the target product as top bestseller (takes the highest priority value from the matrix, i.e.A
) - system walks through other products and calculates priority value by the formula:
4.
targetProduct['ordered_qty'] * 100 / topBestsellerProduct['ordered_qty'] = targetProduct['proportion_value']
5. system fetches the maxrelevance proportion value
from thePriority Matrix
that is less thantargetProduct['proportion_value']
Technical Specification
Api
RunAsRoot\ProductPriorities\Api\Data\ProductPriorityInterface
Defines all the getters and setters for the Product Priority entity.
RunAsRoot\ProductPriorities\Api\ProductPriorityRepositoryInterface
Gives access to persistent data entities. Have the following methods:
save(ProductPriorityInterface $productPriority)
: Creates a new record if no id present, otherwise updates an existing record with the specified id.get(int $entityId)
: Performs a database lookup by id and returns a data entity interfacedelete(ProductPriorityInterface $productPriority)
: Deletes the specified entitydeleteById(int $entityId)
: Deletes the specified entity by id
Block
RunAsRoot\ProductPriorities\Block\Adminhtml\ProductPriority\Buttons\GenericButton
Implements shared methods that are used inside Product Priority Form.
getEntityId()
: returns an id for the specific entitygetUrl($route = '', $params = [])
: implements urlBuilder wrapper
RunAsRoot\ProductPriorities\Block\Adminhtml\ProductPriority\Buttons\BackButton
Implements back action for button if admin on the Product Priority Form page.
RunAsRoot\ProductPriorities\Block\Adminhtml\ProductPriority\Buttons\DeleteButton
Implements delete action for button if admin on the Product Priority Form page.
RunAsRoot\ProductPriorities\Block\Adminhtml\ProductPriority\Buttons\SaveButton
Provides save action data for the Split Save button on the Product Priority Form page.
RunAsRoot\ProductPriorities\Block\Adminhtml\System\Config\Form\Field\Date
Implements DatePicker frontend_model for System Config.
ConfigProvider
RunAsRoot\ProductPriorities\ConfigProvider\General
Implements the functionality of fetching module configurations.
isModuleEnabled(int $storeId)
: returns if module is Enabled/DisabledgetFromDate(int $storeId)
: returns start date of the period
Controller
RunAsRoot\ProductPriorities\Controller\Adminhtml\Product\Priorities
Returns the Product Priorities Grid page
RunAsRoot\ProductPriorities\Controller\Adminhtml\Product\MassDelete
Handles the mass delete Product Priority entities on the Product Priorities Grid
RunAsRoot\ProductPriorities\Controller\Adminhtml\Product\AbstractPriority
Implements shared methods that are used by Controllers (Product Priority Form).
RunAsRoot\ProductPriorities\Controller\Adminhtml\Product\Priority\*
Implements the CRUD actions
DataProvider
RunAsRoot\ProductPriorities\DataProvider\Priority
Implements the calculation process and data provider for the 'Priority' column
getData()
: returns the processed dataprepareCollection()
: initiates and adjusts bestseller products collectiongetPriorityByProportion(int $proportionValue)
: returns the match value from the MatrixgetPriorities()
: returns the Matrix data
Model
RunAsRoot\ProductPriorities\Model\ProductPriority\DataProvider
Implements data provider for Product Priority entity on the Create/Edit Form
RunAsRoot\ProductPriorities\Model\*
Implement entity related models, resource model, collection, repository
Setup
RunAsRoot\ProductPriorities\Setup\Patch\Data\InsertSampleData
Inserts the initial data to database (Priority Matrix
)
Ui
RunAsRoot\ProductPriorities\Ui\Component\Listing\Columns\Actions
Implements Edit/Delete actions for Product Priorities Grid
RunAsRoot\ProductPriorities\Ui\Component\Listing\Columns\ProductPriority
Describes the 'Priority' column class
Configuration
tab | group | section | field |
---|---|---|---|
run_as_root | general | Product Priorities | Enable |
run_as_root | general | Product Priorities | From Date |
Product Priorities Grid
- Navigate to Marketing -> run_as_root -> Product Priorities