2017 © Pedro Peláez
 

library cart

image

jsnlib/cart

  • Tuesday, March 13, 2018
  • by fdjkgh580
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

jsnlib-cart

這是一個簡單的購物車,不依賴任何 framework。, (*1)

__construct($param = [])

建構子 - sess (選)使用的 session 名稱,預設是 'jsnlib_cart', (*2)

require_once 'vendor/autoload.php';
session_start();
$cart = new Jsnlib\Cart('jsnlibCart');

insert(array $param): bool

將產品放入購物車 - primaryid (string) 唯一編號 - name (string) 產品名稱 - quantity (int) 產品數量 - price (int) 產品金額 - option (array) 夾帶參數, (*3)

$ary = 
[
    'primaryid' => 'JSN5000000',
    'name'      => 'A款衣服',
    'price'     => 399,
    'quantity'  => 2,
    'option'    =>      
    [
        'productid' => 'A00001',
        'size'      => 'XL',
    ]
];
$cart->insert($ary);

update(array $param): bool

修改購物車的產品項目。如果指定參數數量 quantity 為 0 時,視同刪除。 - primaryid (string) 唯一編號, (*4)

$ary = 
[
    'primaryid' => 'JSN5000003',
    'quantity'  => 12
];
$cart->update($ary);

isnew($primaryid): bool

加入購物車的是新商品?, (*5)

$cart->isnew('JSN5000003'); 

delete($primaryid): bool

刪除購物車中的某個產品, (*6)

$cart->delete('JSN5000003');

get($primaryid)

取得已在購物車的產品資訊, (*7)

$cart->get('JSN5000000');

find($param = [])

尋找參數相符合的列表, (*8)

$cart->insert(
[
    'primaryid' => '0001',
    'name'      => 'A款衣服',
    'price'     => 100,
    'quantity'  => 10,
    'option'    =>      
    [
        'size'      => 's',
    ]
]);

$cart->insert(
[
    'primaryid' => '0002',
    'name'      => 'B款衣服',
    'price'     => 200,
    'quantity'  => 10,
    'option'    =>      
    [
        'size'      => 'xl',
    ]
]);

$cart->find(['quantity' => 10]); // A款衣服 + B款衣服
$cart->find(['option' => ['size' => 'xl']]); // B款衣服

truncate(): bool

清空購物車, (*9)

$cart->truncate();

order(array $exclude = NULL): array

取得帳單, (*10)

$cart->order();

取得排除某些列表,例如排除運費的帳單, (*11)

$cart->order(['Transport']);

total(array $exclude = NULL): int

合計, (*12)

$cart->total();

取得排除某些列表,例如排除運費的合計, (*13)

$cart->total(['Transport']);

The Versions

13/03 2018

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

shop ecommerce cart carts

13/03 2018

1.1.3

1.1.3.0

  Sources   Download

MIT

The Requires

 

shop ecommerce cart carts

13/03 2018

1.1.2

1.1.2.0

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

shop ecommerce cart carts

12/03 2018

1.1.0

1.1.0.0

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

shop ecommerce cart carts

08/03 2018

1.0.0

1.0.0.0

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

array object arrayobject convert

08/03 2018

1.1.1

1.1.1.0

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

array object arrayobject convert