If we want to run a piece of php code in a file based on from where the function is called.
e.g. if a customer creates an order from frontend then we need to actually run some specific code
else if we create an order from backend then we want to run a generic code .
How can this be done?
If we want to run a piece of php code in a file based on from where the function is called.
e.g. if a customer creates an order from frontend then we need to actually run some specific code
else if we create an order from backend then we want to run a generic code .
How can this be done?
For backend we use AREA == 'A' & Fro frontent we use AREA == 'C'
Use :
if(AREA == 'A')
{
echo "admin area";
}
elseif((AREA == 'C')
{
echo "customer area";
}
And you can combine AREA with Registry::get('runtime.controller') == 'your_controller' where 'your_controller' might be 'orders', 'products', 'pages', 'index', ec.