2017 © Pedro Peláez
 

yii2-extension yii2-mcms-cart

Yii2 Cart extension

image

marciocamello/yii2-mcms-cart

Yii2 Cart extension

  • Saturday, April 19, 2014
  • by MarcioCamello
  • Repository
  • 4 Watchers
  • 6 Stars
  • 426 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 2 Open issues
  • 1 Versions
  • 6 % Grown

The README.md

Yii2-Cart

Cart extensions for Yii 2 Refactory library from Codeginiter Cart Class v3.0dev, (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

php composer.phar require --prefer-dist marciocamello/yii2-mcms-cart "*"

or add, (*4)

"marciocamello/yii2-mcms-cart": "*"

to the require section of your composer.json file., (*5)

Usage

Adding an Item to The Cart


use mcms\cart\Cart; $cart = new Cart(); $data = array( 'id' => 'sku_123ABC', 'qty' => 1, 'price' => 39.95, 'name' => 'T-Shirt', 'options' => array('Size' => 'L', 'Color' => 'Red') ); $cart->insert($data);

Adding Multiple Items to The Cart


use mcms\cart\Cart; $cart = new Cart(); $data = array( array( 'id' => 'sku_123ABC', 'qty' => 1, 'price' => 39.95, 'name' => 'T-Shirt', 'options' => array('Size' => 'L', 'Color' => 'Red') ), array( 'id' => 'sku_567ZYX', 'qty' => 1, 'price' => 9.95, 'name' => 'Coffee Mug' ), array( 'id' => 'sku_965QRS', 'qty' => 1, 'price' => 29.95, 'name' => 'Shot Glass' ) ); $cart->insert($data);

Displaying the Cart


use yii\helpers\Html; use yii\widgets\ActiveForm; use mcms\cart\Cart; $cart = new Cart(); if($_POST) { $cart->update($_POST); Yii::$app->controller->refresh(); }

'cart-form', 'options' => ['class' => 'form-horizontal'], ]) ?>
contents() as $items): ?>
QTY Item Description Item Price Sub-Total
'3', 'size' => '5']); ?> has_options($items['rowid']) == TRUE): ?>

product_options($items['rowid']) as $option_name => $option_value): ?> :
, (*6)

format_number($items['price']); ?> $format_number($items['subtotal']); ?>
Total $format_number($cart->total()); ?>
= Html::submitButton('Update your Cart', ['class' => 'btn btn-primary']) ?>

The Versions

19/04 2014

dev-master

9999999-dev

Yii2 Cart extension

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar MarcioCamello

extension yii2 cart mcms moltin