tylerkidd/silverstripe-shop-shippingframework

物流模块

安装: 14

依赖者: 0

建议者: 0

安全性: 0

星级: 1

关注者: 2

分支: 25

类型:silverstripe-module

dev-master 2013-11-25 19:37 UTC

This package is not auto-updated.

Last update: 2024-09-24 06:21:30 UTC


README

这实际上不是一个子模块,而是一系列对商店系统的潜在更改。

要求

  • Shop模块 v0.9

安装

  • 将shop_shippingframework文件夹放入您的SilverStripe根目录中
  • 将ShippingFrameWorkModifier添加到您的修饰器配置中,例如
    Order::set_modifiers(array(
        'ShippingFrameworkModifier',
        'FlatTaxModifier'
    ));
  • 您需要使用新的SteppedCheckout系统,以便客户在选择运输方式之前设置他们的地址。要设置步骤,包括运输方式步骤,请将以下内容添加到您的mysite/_config.php文件中
    SteppedCheckout::setupSteps(array(
		  'membership' => 'CheckoutStep_Membership',
        'contactdetails' => 'CheckoutStep_ContactDetails',
        'shippingaddress' => 'CheckoutStep_Address',
        'billingaddress' => 'CheckoutStep_Address',
        'shippingmethod' => 'CheckoutStep_ShippingMethod', //extra line for shipping method
        'paymentmethod' => 'CheckoutStep_PaymentMethod',
        'summary' => 'CheckoutStep_Summary'
    ));
  • 要将运输估算表单添加到您的CartPage模板中,请将以下内容添加到您的CartPage.ss模板的某个位置
    <% include ShippingEstimator %>

如果您需要一些示例tableshipping数据来填充您的网站进行测试/开发,您可以运行以下任务:yoursite.tld/dev/tasks/PopulateTableShippingTask

架构

ShippingPackage是一个用于封装运输数据的类,包括:重量、尺寸、价值、数量。

ShippingMethod是不同类型运输计算的基类。这些可以是统一费用、基于表格的费用,或是一个TableShippingMethod

TableShippingMethod有许多TableShippingRate,其中TableShppingRate extends RegionRestriction。表格运输费用还包含可选的重量、体积、价值、数量约束字段。

地区限制

RegionRestriction类作为提供地区化限制的基类。限制通过国家、州和邮政编码指定。每个限制可以指定一个值/费率。为了工作适当的费率,查询所有匹配的限制,并按最便宜排序。

通配符'*'表示限制将匹配任何地区。