bestit/ct-order-export-bundle

Symfony 3 Bundle,用于基于模板和虚拟文件系统导出commercetools订单。

0.3.2 2017-03-07 13:38 UTC

This package is not auto-updated.

Last update: 2024-09-14 20:09:45 UTC


README

Symfony 3 Bundle,用于基于模板和虚拟文件系统导出commercetools订单。

安装

示例实现可以在以下链接找到:bestit/commercetools-order-export

步骤 1:下载包

打开命令行,进入您的项目目录,然后执行以下命令以下载此包的最新稳定版本

$ composer require bestit/ct-order-export-bundle

此命令要求您全局安装了Composer,如Composer文档中的安装章节所述。

步骤 2:启用包

然后,通过将其添加到项目app/AppKernel.php文件中注册的包列表来启用此包

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new \Oneup\FlysystemBundle\OneupFlysystemBundle(),
            new \BestIt\CtOrderExportBundle\BestItCtOrderExportBundle()
        );

        // ...
    }

    // ...
}

步骤 3:包的配置

best_it_ct_order_export:
    commercetools_client:  # Required
        id:                   ~ # Required
        secret:               ~ # Required
        project:              ~ # Required
        scope:                ~ # Required

    # Please provide the service id for your flysystem file system.
    filesystem:           ~ # Required
    
    # Please provide the service id for your logging service.
    logger:               logger
    orders:

        # Should we use a paginated list of orders (or is the result list changing by "itself")?
        with_pagination:      true

        # Add where clauses for orders: https://dev.commercetools.com/http-api-projects-orders.html#query-orders
        default_where:        []
        
        # Which template is used for the export of a single order?
        file_template:        detail.xml.twig

        # Provide an order field name or a format string for the date function enclosed with {{ and }}.
        name_scheme:          'order_{{id}}_{{YmdHis}}.xml'

使用包

Shell-命令

此包提供了一个shell命令

$ php bin/console order-export:export-orders [-v|-vv|-vv] [-q]

事件

截至目前,此包提供了两个事件

  1. order_export.preOrderExport:此事件与一个BestIt\CtOrderExportBundle\Event\PrepareOrderExportEvent实例一起触发。使用exportData API获取更多可导出数据。
  2. order_export.postOrderExport:类型为BestIt\CtOrderExportBundle\Event\FinishOrderExportEvent的事件实例允许您在导出后操作订单。

其他待办事项

  • 单元测试
  • 添加了列表模板
  • 更充分地使用事件