"codeigniter 4" cart
public static function cart($getShared = true)
{
if ($getShared) {
return static::getSharedInstance('cart');
}
return new \App\Libraries\Cart();
}
// Call the cart service using the helper function
$cart = cart();
// Insert an array of values
$cart->insert(array(
'id' => 'sku_1234ABCD',
'qty' => 1,
'price' => '19.56',
'name' => 'T-Shirt',
'options' => array('Size' => 'L', 'Color' => 'Red')
));
// Update an array of values
$cart->update(array(
'rowid' => '4166b0e7fc8446e81e16883e9a812db8',
'id' => 'sku_1234ABCD',
'qty' => 3,
'price' => '24.89',
'name' => 'T-Shirt',
'options' => array('Size' => 'L', 'Color' => 'Red')
));
// Get the total items
$cart->totalItems();
// Remove an item using its `rowid`
$cart->remove('4166b0e7fc8446e81e16883e9a812db8');
// Clear the shopping cart
$cart->destroy();
// Get the cart contents as an array
$cart->contents();
function cart(bool $getShared = true)
{
return \Config\Services::cart($getShared);
}
Also in PHP:
- echo date('Y-m-d'); python
- add one day in date in php
- echo current time user php
- How do you clear cache in Laravel?
- base64_encode decode php
- date("l",$date) php
- 'cross-env' is not recognized as an internal or external command, laravel
- datetime w3schools php
- code php ajout heure
- como destruir uma variavel de sessão
- create new project in laravel
- Laravel DB Cache
- .length php
- clear route cache laravel 5.1
- How to get the current time in PHP if
- check key exists in associative array in php
- 1,458.00 to save as float php
- find out type of in php
- check if string is in string php
- datetime-local laravel migration data type
- buttons in php
- It is possible to perform an HTTPS redirect using PHP code as well as writing PHP code to prevent the browser from caching your we
- WooCommerce Add Long Description to Products on Shop Page with Character limit
- addslashes php