agriya/webshopshipments

该软件包最新版本(dev-master)没有提供许可证信息。

dev-master 2014-05-21 07:57 UTC

This package is not auto-updated.

Last update: 2024-09-28 15:08:26 UTC


README

本软件包用于管理网站中不同国家和产品的运费。您可以通过调用一些简单的函数轻松管理运费。

安装

  1. 通过在根目录的 composer.json 中添加以下行来安装软件包

    "require": { ... ... "agriya/webshopshipment": "dev"

    },

    然后运行 "composer update"

2、在软件包加载后,将以下行添加到 app/conifg/app.php 中的 'providers' 数组中,如下所示

'providers' => array(
	...
	...
	'Agriya\Webshopshipments\WebshopshipmentsServiceProvider',
}
  1. 之后,通过运行以下命令发布配置

    如果是软件包,则运行以下命令 php artisan config:publish agriya/webshopshipments

    如果是工作台文件夹,则运行以下命令 php artisan config:publish --path="workbench/agriya/webshopshipments/src/config/" agriya/webshopshipments

    配置发布后,您可以提供自己的表详情,指定国家及其运费详情的存储位置。配置文件如下所示,

     <pre>
     /*
     *Table name for coutries list
     */
     'countries_table_details'	=>	array(
     	'table_name' => 'countries',
     	'id' => 'id',
     	'country_name' => 'country_name',
     ),
    
     /*
     *Table name for shipping fees
     */
     'shipping_fees_table_details'	=>	array(
     	'table_name' => 'shipping_fees',
     	'id' => 'id',
     	'country_id' => 'country_id',
     	'shipping_fee' => 'shipping_fee',
     	'foreign_id' => 'foreign_id'
     ),
     </pre>
    
  2. 如果您没有存储国家和运费详情的表,可以使用我们的数据库迁移。如果没有表,请运行以下命令。这将为您创建两个表

    对于已发布的软件包 php artisan migrate --package=Agriya/Webshopshipments

    对于工作台软件包 php artisan migrate --bench=Agriya/Webshopshipments

    注意:运行这些命令需要从根目录(composer.json 所在的位置)运行

安装完成。 :)

用法

国家列表

Webshopshipments::getCountriesList([String $return = 'list'])

参数

$return(可选) 这可以是 'list' 或 'all'。 (默认为 'list')

'list' 这将返回“国家 ID”和“国家名称”的组合 'all' 这将返回国家表中的所有字段

添加运费详情

Webshopshipments::addShipments(array('country_id' => $country, 'foreign_id' => $foreign_id, 'shipping_fee' => $shipping_fee ))

参数

数组(必填 - 所有 3 个字段都是必填的)

'country_id' 国家 ID。这是存储在国家表中的 ID 'foreign_id' 这是要指定运费的项或产品的 ID 'shipping_fee' 要存储的指定 country_id 和 foreign_id 的运费

更新运费详情

Webshopshipments::updateShippingFee(array('country_id' => $country, 'foreign_id' => $foreign_id, 'shipping_fee' => $shipping_Fee), $primary_id = null);

参数

数组(必填 - 'shipping_fee' 是必填的。'country_id' 和 'foreign_id' 是必填的,如果第二个参数未指定) 'country_id' 国家 ID(如果定义了 $primary_id,则不是必填的) 'foreign_id' 您已存储运费的产品的 ID 或项的 ID(如果定义了 $primary_id,则不是必填的) 'shipping_fee' 要更新指定国家和 foreign_id 的运费

$primary_id(如果指定了 'country_id' 和 'foreign_id',则此参数不是必需的。)存储在 shipping_fees 表中的主 ID(如果第一个参数数组中指定了 'country_id' 和 'foreign_id',则不是必需的)

删除运费详情

Webshopshipments::updateShippingFee(array('country_id' => $country, 'foreign_id' => $foreign_id, 'shipping_fee' => $shipping_Fee), $primary_id = null);

参数

数组(必填 - 'shipping_fee' 是必填项。'country_id' 和 'foreign_id' 如果未指定第二个参数则是必填项) 'country_id' 国家ID(如果定义了 $primary_id 则不是必填项) 'foreign_id' 您的产品或物品的ID,您已存储该物品的运费(如果定义了 $primary_id 则不是必填项)

$primary_id(如果指定了 'country_id' 和 'foreign_id',则此参数不是必需的。)存储在 shipping_fees 表中的主 ID(如果第一个参数数组中指定了 'country_id' 和 'foreign_id',则不是必需的)

物品运费列表

Webshopshipments::getItemShippingList($foreign_id);

参数

$foreign_id(必填)这是您已存储运费的产品的ID或物品ID。这将返回已添加的运费列表及其国家详情。

产品和国家的运费详情

Webshopshipments::updateShippingFee(array('country_id' => $country, 'foreign_id' => $foreign_id,), $primary_id = null);

参数

数组(必填 - 'shipping_fee' 是必填项。'country_id' 和 'foreign_id' 如果未指定第二个参数则是必填项) 'country_id' 国家ID(如果定义了 $primary_id 则不是必填项) 'foreign_id' 您的产品或物品的ID,您已存储该物品的运费(如果定义了 $primary_id 则不是必填项)

$primary_id(如果指定了 'country_id' 和 'foreign_id',则此参数不是必需的。)存储在 shipping_fees 表中的主 ID(如果第一个参数数组中指定了 'country_id' 和 'foreign_id',则不是必需的)