only load component if not already loaded
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user