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 |
Marketing |
Provides a product priorities column inside Admin Products Grid.
composer require run_as_root/ext-magento2-product-priorities
bin/magento setup:upgrade
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']
Defines all the getters and setters for the Product Priority entity.
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
Implements shared methods that are used inside Product Priority Form.
getEntityId()
: returns an id for the specific entitygetUrl($route = '', $params = [])
: implements urlBuilder wrapper
Implements back action for button if admin on the Product Priority Form page.
Implements delete action for button if admin on the Product Priority Form page.
Provides save action data for the Split Save button on the Product Priority Form page.
Implements DatePicker frontend_model for System Config.
Implements the functionality of fetching module configurations.
isModuleEnabled(int $storeId)
: returns if module is Enabled/DisabledgetFromDate(int $storeId)
: returns start date of the period
Returns the Product Priorities Grid page
Handles the mass delete Product Priority entities on the Product Priorities Grid
Implements shared methods that are used by Controllers (Product Priority Form).
Implements the CRUD actions
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
Implements data provider for Product Priority entity on the Create/Edit Form
Implement entity related models, resource model, collection, repository
Inserts the initial data to database (Priority Matrix
)
Implements Edit/Delete actions for Product Priorities Grid
Describes the 'Priority' column class
tab | group | section | field |
---|---|---|---|
run_as_root | general | Product Priorities | Enable |
run_as_root | general | Product Priorities | From Date |
- Navigate to Marketing -> run_as_root -> Product Priorities