2017 © Pedro Peláez
 

zf2-module acplocart

Cart in ZF2

image

acplo/acplocart

Cart in ZF2

  • Monday, May 4, 2015
  • by abelclopes
  • Repository
  • 2 Watchers
  • 0 Stars
  • 25 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

AcploCart

Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

Version 1.0, (*2)

This model allows you to manage a shopping cart for e-commerce in an easy, simple and fast., (*3)

Installation

For the installation uses composer composer., (*4)

php composer.phar require  acplocart/acplocart:dev-master

Add this project in your composer.json:, (*5)

"require": {
"acplo/acplocart": "0.0.1"
}

Post Installation

Configuration: - Add the module of config/application.config.php under the array modules, insert AcploCart - Create a file named acplocart.global.php under config/autoload/. - Add the following lines to the file you just created:, (*6)

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

Example

Insert

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

Update

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

Remove

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

Destroy

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

Cart

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

Total

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

Total Items

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

Items Options

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

Example in view

Controller, (*7)

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

View, (*8)

 0): ?>


Products in cart ():

< table style="width: 900px;" border="1"> <tr> <th>Qty</th> <th>Name</th> <th>Item Price</th> <th>Sub-Total</th> </tr> <tr> <td style="text-align: center;"><?php echo $key['qty']; ?></td> <td style="text-align: center;"> <?php echo $key['name']; ?> <?php if($key['options'] != 0):?> Options: <?php foreach($key['options'] as $options => $value):?> <?php echo $options.' '.$value;?> <?php endforeach;?> <?php endif;?> </td> <td style="text-align: center;"><?php echo $key['price']; ?></td> <td style="text-align: center;"><?php echo $key['sub_total']; ?></td> </tr> <tr> <td colspan="2"></td> <td style="text-align: center;"><strong>Sub Total</strong></td> <td style="text-align: center;"> </td> </tr> <tr> <td colspan="2"></td> <td style="text-align: center;"><strong>Vat</strong></td> <td style="text-align: center;"> </td> </tr> <tr> <td colspan="2"></td> <td style="text-align: center;"><strong>Total</strong></td> <td style="text-align: center;"> </td> </tr>

The Shopping Cart Empty

Function Reference

Function Description
$this->AcploCart()->insert(); Add a product to cart.
$this->AcploCart()->update(); Update the quantity of a product.
$this->AcploCart()->remove(); Delete the item from the cart.
$this->AcploCart()->destroy(); Delete all items from the cart.
$this->AcploCart()->cart(); Extracts all items from the cart.
$this->AcploCart()->total(); Counts the total number of items in cart
$this->AcploCart()->total_items(); Counts the total number of items in cart
$this->AcploCart()->item_options(); Returns the an array of options, for a particular product token.
Config Vat Set your vat in acplocart.global.php

Contributors

  • Concetto Vecchio - info@cvsolutions.it

The Versions

04/05 2015

dev-master

9999999-dev https://github.com/acplo/AcploCart

Cart in ZF2

  Sources   Download

BSD-3-Clause

The Requires

 

e-commerce cart zf2 module zend cart carrello zf2

29/04 2015

0.0.1

0.0.1.0 https://github.com/acplo/AcploCart

Cart in ZF2

  Sources   Download

BSD-3-Clause

The Requires

 

e-commerce cart zf2 module zend cart carrello zf2