CartController
extends Controller
in package
Class CartController
- Manages the shopping cart stored in the user's session
- Handles adding, removing, and clearing items before checkout
Table of Contents
Properties
- $trans : array<string|int, mixed>
- $translations : array<string|int, mixed>
Methods
- __construct() : mixed
- Constructor.
- add() : void
- Adds a specific mosaic configuration to the cart
- clear() : void
- Removes all items from the shopping cart
- index() : void
- Displays the cart contents and calculates totals
- remove() : void
- Removes a single item from the cart based on its unique id
- render() : void
- Renders a view file within a layout template.
Properties
$trans
protected
array<string|int, mixed>
$trans
= []
Holds translation strings for the current language.
$translations
private
array<string|int, mixed>
$translations
Key/Value pair of translations.
Methods
__construct()
Constructor.
public
__construct() : mixed
initializes the controller and ensures the cart session structure exists
add()
Adds a specific mosaic configuration to the cart
public
add() : void
clear()
Removes all items from the shopping cart
public
clear() : void
index()
Displays the cart contents and calculates totals
public
index() : void
remove()
Removes a single item from the cart based on its unique id
public
remove() : void
render()
Renders a view file within a layout template.
public
render(string $file[, array<string|int, mixed> $data = [] ][, string $template = 'default' ]) : void
Parameters
- $file : string
-
The name of the view file (without .php extension).
- $data : array<string|int, mixed> = []
-
Associative array of data to pass to the view.
- $template : string = 'default'
-
The layout template to use (default: 'default').