承接 noahenrik/cart2go 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

noahenrik/cart2go

Composer 安装命令:

composer require noahenrik/cart2go

包简介

A simple shopping cart.

README 文档

README

This is a simple cart system made for PHP that will allow you to save item IDs to add to your cart. Saving prices is risky and should always be checked in the back-end.

Installation

Use composer to install cart2go.

composer require noahenrik/cart2go

Make sure to update your autoloader. For composer:

composer dump-autoload

Usage

Import the namespace with class:

$cart = new \Cart\Cart();

Add items to cart:

The addItemToCart method takes 2 paramaters, itemId and $amount. Amount is an optional paramater.

If the user clicks on an item that's already in the cart, the amount will automatically be incremented by 1.

If you specify an amount, the existing amount will be updated to the amount given and not incremented by 1.

$cart->addItemToCart($itemId, $amount);

//OR

$cart->addItemToCart($itemId);

Grab all items currently in the cart:

This method will grab all the items currently in the cart.

$allCartItems = $cart->grabAllItems();

Example

$allCartItems = $cart->grabAllItems();

foreach ($allCartItems as $key => $cartItem) {
  
  echo "Amount: " . $allCartItems[$key]['amount'] . " ItemId: " . $allCartItems[$key]['itemId'];
}    

Reset a cart:

This will remove all items within the cart.

$cart->reset();

Grab single item:

This will grab only the selected item from the cart.

$cart->grabItem($itemId);

Remove item from cart:

This will remove a selected item from the cart.

$cart->removeItem($itemId);

License

GNU Affero General Public License v3.0

统计信息

  • 总下载量: 5
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2020-08-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固