承接 simpavl/zf3-shoppingcart 相关项目开发

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

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

simpavl/zf3-shoppingcart

Composer 安装命令:

composer require simpavl/zf3-shoppingcart

包简介

Simple ZF3 Shopping Cart

README 文档

README

This model is a simple ZF2 Shopping Cart solution. Provide basic functionality to create and modify Shopping Cart with any content in it. Easy to extend, just create your own Cart Entity and push it during Cart initialisation.

Inspired by

I was inspired to create the ShoppingCart by great job of Vincenzo Provenza and Concetto Vecchio (http://github.com/vikey89/ZendCart). Keeped the same idea behind but made it more flexible, easier to extend and simplier to change.

Zend Framework 3

This module was forked and repaired for zf3

Installation

For the installation uses composer composer. Add this project in your composer.json:

"require": {
    "simpavl/zf3-shoppingcart": "dev-master"
}

Post Installation

Configuration:

  • Add the module of config/application.config.php under the array modules, insert ShoppingCart.
  • Copy a file named shoppingcart.global.php.dist to config/autoload/ and change name to shoppingcart.global.php.
  • Modify config to fit your expectations.

Examples

Insert

You can insert as many items to the cart as you want. Each entry in cart will have unique token to work with. Example with one product:

$product = array(
    'id'      => 'XYZ',
    'qty'     => 1,
    'price'   => 15.15,
    'product' => 'Book: ZF2 for beginners',
);
$this->ShoppingCart()->insert($product);

Example with 2 products:

$products = array(
    array(
        'id'      => 'XYZ',
        'qty'     => 1,
        'price'   => 15.15,
        'product' => 'Book: ZF2 for beginners',
    ),
    array(
        'id'      => 'ZYX',
        'qty'     => 3,
        'price'   => 19.99,
        'product' => 'Book: ZF2 for advanced users',
    )
);
$this->ShoppingCart()->insert($products);

Remove

$token => '4b848870240fd2e976ee59831b34314f7cfbb05b';
$this->ShoppingCart()->remove($token);

Destroy

Erase Shopping Cart completely.

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

Cart

Get all content of Cart.

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

Total Sum

$this->ShoppingCart()->total_sum();

Total Items

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

Example in controller

return new ViewModel(array(
    'cart' => $this->ShoppingCart()->cart(),
    'total_items' => $this->ShoppingCart()->total_items(),
    'total_sum' => $this->ShoppingCart()->total_sum(),
));

How to change/extend Shopping Cart

Provided Shopping Cart Entity is really basic one. You can change the structure of it. For example, if you need to add options to each item in the cart or to provide discount field and so on. What you should do:

  • copy ShoppingCart/Entity/ShoppingCartEntity to your module
  • modify YourModule/Entity/ShoppingCartEntity: add any fields you need to have
  • during Shopping Cart initialisation provide your YourModule/Entity/ShoppingCartEntity
$this->ShoppingCart()->setEntityPrototype(new YourModule/Entity/ShoppingCartEntity());

FunctionsReference

Function Description
$this->ShoppingCart()->insert();Add item(s) to cart.
$this->ShoppingCart()->remove();Delete the item from the cart.
$this->ShoppingCart()->destroy();Delete all items from the cart.
$this->ShoppingCart()->cart();Extracts all items from the cart.
$this->ShoppingCart()->total_sum();Counts the total sum of all items in the cart.
$this->ShoppingCart()->total_items();Counts the total number of all items in the cart.

Contributors

Aleksander Cyrkulewski - cyrkulewski@gmail.com

simpavl/zf3-shoppingcart 适用场景与选型建议

simpavl/zf3-shoppingcart 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 203 次下载、GitHub Stars 达 2, 最近一次更新时间为 2017 年 05 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「zf2」 「shopping-cart」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 simpavl/zf3-shoppingcart 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 simpavl/zf3-shoppingcart 我们能提供哪些服务?
定制开发 / 二次开发

基于 simpavl/zf3-shoppingcart 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 18
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-05-02