silvercommerce/checkout 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

silvercommerce/checkout

最新稳定版本:1.1.5

Composer 安装命令:

composer require silvercommerce/checkout

包简介

Adds a 'checkout' to a SilverStripe site which links to an Estimate and adds the ability to setup and pay

README 文档

README

Adds a checkout process, to allow users to pay for an Estimate using configured omnipay payment gateways.

Also allows you to overwrite the process so you can add more custom payment integration.

Install

Install this module using composer:

composer require silvercommerce/checkout

Usage

By default, this module works with silvercommerce/shoppingcart out of the box. But it is fairly simple to use it to create payment workflows for a custom estimate if required.

Paying for a custom estimate

If you want to create a payment flow for a custom estimate, you simply have to create the estimate, add some items, add it to the checkout and then redirect. This can be done with a simple bit of code.

The example below has a custom controller that creates an estimate from a pre-defined product and then redirects to the checkout:

use SilverStripe\Core\Injector\Injector;
use SilverCommerce\Checkout\Control\Checkout;
use SilverCommerce\OrdersAdmin\Factory\OrderFactory;

class ProductRedirectController extends PageController
{
    public function init()
    {
        parent::init();

        $product = $this->Product(); // Instance of SilverCommerce\CatalogueAdmin\CatalogueProduct
        $factory = OrderFactory::create();
        $factory->addItem($product);
        $factory->write();

        $checkout = Injector::inst()->get(Checkout::class);
        $checkout->setEstimate($factory->getOrder());

        $this->redirect($checkout->Link());
    }
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2018-02-20