agriya/webshopshipments

There is no license information available for the latest version (dev-master) of this package.

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

This package is not auto-updated.

Last update: 2024-11-09 15:39:40 UTC


README

This package is to manage the shipping fee for the countries and product in the site. You can manage shipping fees easily by calling some easy function

Instatllation

  1. Install the package by add the following line in composer.json of your root directory

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

    },

    And then run "composer update"

2, After the package loaded add this line to app/conifg/app.php in the 'providers' array as like follows

'providers' => array(
	...
	...
	'Agriya\Webshopshipments\WebshopshipmentsServiceProvider',
}
  1. After that publish the configuration by run the following command

    If this is a package, then run the following php artisan config:publish agriya/webshopshipments

    if this is a workbench folders the run the following command php artisan config:publish --path="workbench/agriya/webshopshipments/src/config/" agriya/webshopshipments

    After published the configuration, you can provide your own table details to where the countries and shipping fee details should be stored. The configuration file will look likes follows,

     <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. You can also use our database migration if you dont have the table to store countries and shipping fee details. If you dont have the tables, then run the following commands. This will create you two tables

    For published package php artisan migrate --package=Agriya/Webshopshipments

    For workbench package php artisan migrate --bench=Agriya/Webshopshipments

    Note: run these commands needs to be run from your root directory (where the composer.json has placed)

Thats it of installation. :)

Usage

Countries list

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

Parameters

$return(optional) This can be either 'list' or 'all'. (default is 'list')

'list' This will return the result as "country id" and "country name" combination 'all' This will return all the fields from the countries table

Add shipping details

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

Parameters

Array (mandatory - all 3 fields are mandatory)

'country_id' Id of the country. This is the id that have stored in the countries table 'foreign_id' This is the id of the item or product for which you need to specify the shipping fee 'shipping_fee' Shipping fee that you want to store for the specified country_id and foreign_id

Update shipping details

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

Parameters

Array(mandatory - 'shipping_fee' is mandatory. 'country_id' and 'foreign_id' is mandatory if the second parameter is not specified) 'country_id' Country id (not manadatory if $primary_id is defined) 'foreign_id' Id of your product or item for which you have stored the shipping fee (not manadatory if $primary_id is defined) 'shipping_fee' Shipping fee that you want to update for the specified country and foreign id.

$primary_id(if 'country_id' and 'foreign_id' is specified, then this parameter is not required.) Primary id that is stored in the shipping_fees table (not mandatory if both 'country_id' and 'foreign_id' is specified in the first parameter array)

Delte shipping details

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

Parameters

Array(mandatory - 'shipping_fee' is mandatory. 'country_id' and 'foreign_id' is mandatory if the second parameter is not specified) 'country_id' Country id (not manadatory if $primary_id is defined) 'foreign_id' Id of your product or item for which you have stored the shipping fee (not manadatory if $primary_id is defined)

$primary_id(if 'country_id' and 'foreign_id' is specified, then this parameter is not required.) Primary id that is stored in the shipping_fees table (not mandatory if both 'country_id' and 'foreign_id' is specified in the first parameter array)

Item shipping list

Webshopshipments::getItemShippingList($foreign_id);

Parameters

$foreign_id(mandatory) This is the product id or item id that you have stored the shipping is for. This will return the list of shipping_fees that are added and country details for it.

Shipping details for Product and country

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

Parameters

Array(mandatory - 'shipping_fee' is mandatory. 'country_id' and 'foreign_id' is mandatory if the second parameter is not specified) 'country_id' Country id (not manadatory if $primary_id is defined) 'foreign_id' Id of your product or item for which you have stored the shipping fee (not manadatory if $primary_id is defined)

$primary_id(if 'country_id' and 'foreign_id' is specified, then this parameter is not required.) Primary id that is stored in the shipping_fees table (not mandatory if both 'country_id' and 'foreign_id' is specified in the first parameter array)