Methods summary
public
mixed
|
#
calculate( )
Main shipping rate calculation method. Returns array of estimated shipping
rates and transit times. or error message to be displayed to customer, or false,
if this shipping option must not be available under certain conditions.
Main shipping rate calculation method. Returns array of estimated shipping
rates and transit times. or error message to be displayed to customer, or false,
if this shipping option must not be available under certain conditions.
Returns
mixed
Example
<pre> //return array of shipping options return array(
'option_id1' => array( 'name' => $this->_w('...'),
'description' => $this->_w('...'), 'est_delivery' => '...', 'currency'
=> $this->currency, 'rate' => $this->cost, ), ... ); //return error
message return 'Для расчета стоимости доставки
укажите регион доставки'; //shipping option is unavailable
return false;</pre> Useful parent class (waShipping) methods to be used in
calculate() method: <pre> // total package price $price =
$this->getTotalPrice(); // total package weight $weight =
$this->getTotalWeight(); // order items array $items = $this->getItems();
// obtain either full address info array or specified address field value
$address = $this->getAddress($field = null);</pre>
|
public
array|string
|
#
allowedCurrency( )
Returns ISO3 code of the currency (or array of ISO3 codes) this plugin
supports.
Returns ISO3 code of the currency (or array of ISO3 codes) this plugin
supports.
Returns
array|string
See
|
public
array|string
|
#
allowedWeightUnit( )
Returns the weight unit (or array of weight units) this plugin supports.
Returns the weight unit (or array of weight units) this plugin supports.
Returns
array|string
See
|
public
string
|
#
tracking( string $tracking_id = null )
Returns general tracking information (HTML).
Returns general tracking information (HTML).
Parameters
- $tracking_id
string $tracking_id Optional tracking id specified by user.
Returns
string
See
Example
return _wp('Online shipment tracking: link.');
Overrides
|
public
array
|
#
getPrintForms( waOrder $order = null )
Returns array of printable forms this plugin offers
Returns array of printable forms this plugin offers
Parameters
- $order
waOrder
$order Object containing order data
Returns
array
Example
return <pre>array( 'form_id' => array( 'name' => _wp('Printform
name'), 'description' => _wp('Printform description'), ), );</pre>
Overrides
|
public
string
|
#
displayPrintForm( string $id, waOrder $order, array $params = array() )
Returns HTML code of specified printable form.
Returns HTML code of specified printable form.
Parameters
- $id
string $id Printform id as defined in method getPrintForms()
- $order
waOrder
$order Order data object
- $params
array $params Optional parameters to be passed to printform generation template
Returns
string Printform HTML
Throws
Overrides
|
public
array
|
#
allowedAddress( )
Limits the range of customer addresses to allow shipping to.
Limits the range of customer addresses to allow shipping to.
Returns
array Return array() to allow shipping anywhere
Example
<pre>return array( 'country' => 'usa', # or array('usa', 'can')
'region' => 'NY', # or array('NY', 'PA', 'CT'); # or omit 'region' item if
you do not want to limit shipping to certain regions );</pre>
Overrides
|
public
array|boolean
|
#
requestedAddressFields( )
Returns array of shipping address fields which must be requested during
checkout.
Returns array of shipping address fields which must be requested during
checkout.
Returns
array|boolean Return false if plugin does not request any fields during checkout; return
array() if all address fields must be requested
See
Example
<pre>return array( #requested field 'zip' => array(), #hidden field
with pre-defined value; 'country' => array('hidden' => true, 'value' =>
'rus', 'cost' => true), #'cost' parameter means that field is used for
calculation of approximate shipping cost during checkout 'region' =>
array('cost' => true), 'city' => array(), #field is not requested 'street'
=> false, );</pre>
Overrides
|