PHP code example of acplo / acplocart

1. Go to this page and download the library: Download acplo/acplocart library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

acplo / acplocart example snippets



return array(
    'acplocart' => array(
        'vat'  => 21
    ),
);

$product = array(
    'id'      => 'cod_123abc',
    'qty'     => 1,
    'price'   => 39.95,
    'name'    => 'T-Shirt',
    'options' => array('Size' => 'M', 'Color' => 'Black')
);
$this->AcploCart()->insert($product);

$product = array(
    'token' => '4b848870240fd2e976ee59831b34314f7cfbb05b',
    'qty'   => 2
);
$this->AcploCart()->update($product);

$product = array(
    'token' => '4b848870240fd2e976ee59831b34314f7cfbb05b',
);
$this->AcploCart()->remove($product);

$this->AcploCart()->destroy();

$this->AcploCart()->cart();

$this->AcploCart()->total();

$this->AcploCart()->total_items();

$this->AcploCart()->item_options('4b848870240fd2e976ee59831b34314f7cfbb05b');

return new ViewModel(array(
    'items' => $this->AcploCart()->cart(),
    'total_items' => $this->AcploCart()->total_items(),
    'total' => $this->AcploCart()->total(),
));
html
 if($total_items > 0):