События (хуки) и др
https://www.hostcms.ru/documentation/modules/core/events/
1. Хуки для контроллеров корзины
// хук для доступа к Shop_Cart_Controller_Show
class My_MegaPost
{
static public function onBeforeCartShow($controller, $args)
{
$Shop_Cart_Controller_Show = $args[0];
$Shop_Cart_Controller_Show
->itemsProperties(FALSE)
->checkStock(TRUE);
}
}
Core_Event::attach('MegaPost_Command_Controller.onBeforeCartShow', array('My_MegaPost', 'onBeforeCartShow'));
// хук для доступа к MegaPost_Shop_Delivery_Controller_Show
class My_MegaPost
{
static public function onBeforeDeliveryShow($controller, $args)
{
$Shop_Delivery_Controller_Show = $args[0];
$Shop_Delivery_Controller_Show
->shopDeliveries()
->queryBuilder()
->where('shop_deliveries.id','NOT IN', array(123))
->setOr()
->where('shop_deliveries.id','IN', array(456));
}
}
Core_Event::attach('MegaPost_Command_Controller.onBeforeDeliveryShow', array('My_MegaPost', 'onBeforeDeliveryShow'));
// хук для доступа к Shop_Payment_System_Controller_Show
class My_MegaPost
{
static public function onBeforePaymentSystemShow($controller, $args)
{
$Shop_Payment_System_Controller_Show = $args[0];
$Shop_Payment_System_Controller_Show
->shopPaymentSystems()
->queryBuilder()
->where('shop_payment_systems.id','NOT IN', array(123))
->setOr()
->where('shop_payment_systems.id','IN', array(456));
}
}
Core_Event::attach('MegaPost_Command_Controller.onBeforePaymentSystemShow', array('My_MegaPost', 'onBeforePaymentSystemShow'));2. Остаток на складе
3. Изменение данных расчета доставок
Последнее обновление