only load component if not already loaded
This commit is contained in:
parent
80193e6242
commit
4b45725b33
|
|
@ -21,11 +21,14 @@ class CartItemsController extends AppController
|
|||
{
|
||||
parent::initialize(); // TODO: Change the autogenerated stub
|
||||
|
||||
$this->loadComponent('CakeCarts.ShoppingCart', [
|
||||
// This is default config. You can modify "actions" as needed to make
|
||||
// component work only for specified methods.
|
||||
'actions' => ['add'],
|
||||
]);
|
||||
if (!$this->components()->has('ShoppingCart')) {
|
||||
$this->loadComponent('CakeCarts.ShoppingCart', [
|
||||
// This is default config. You can modify "actions" as needed to make
|
||||
// component work only for specified methods.
|
||||
'actions' => ['add'],
|
||||
]);
|
||||
}
|
||||
|
||||
if ($this->components()->has('Authorization')) {
|
||||
$this->Authorization->skipAuthorization();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,11 +19,13 @@ class CartsController extends AppController
|
|||
{
|
||||
parent::initialize(); // TODO: Change the autogenerated stub
|
||||
|
||||
$this->loadComponent('CakeCarts.ShoppingCart', [
|
||||
// This is default config. You can modify "actions" as needed to make
|
||||
// component work only for specified methods.
|
||||
'actions' => true,
|
||||
]);
|
||||
if (!$this->components()->has('ShoppingCart')) {
|
||||
$this->loadComponent('CakeCarts.ShoppingCart', [
|
||||
// This is default config. You can modify "actions" as needed to make
|
||||
// component work only for specified methods.
|
||||
'actions' => true,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue