News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Canada Post Shipping Plugin using Carrier API

Started by mwf, January 20, 2012, 13:18:29 PM

Previous topic - Next topic

mwf

Hello,

I am developing a shipping plugin for the Canada Post Sell Online API, which would have the same functionality as my existing CPSOL module for VM 1.1.9. The Canada Post API provides a list of rates that the customer selects from, which should then be applied to the order.

In VM 2.0 it seems that the cart is only expecting one rate per shipping method (plugin). Is this correct?

If this this is correct, how should we handle multiple shipping options per per API response? I would expect the cart to handle this using data only passed back from the plugin (not create html in plugin).

Also, when an API like this is used the cart needs to show the shipping service options automatically, not default a rate with a link to the shipping view. Is that possible without hacking the cart code?

Any input is appreciated.

Micah
Professional Joomla Development and Support
http://www.exps.ca


lori_oreo

I don't know how to help you, but would love to know when it's available.  I just upgraded to 2.0 last night, only to find out this option wasn't available after it was installed.  Not impressed right now :(

mhaskell

Hello All,
Just wondering how the module for v2 is progressing?
mike

lysov

Quote from: mwf on January 20, 2012, 13:18:29 PM
In VM 2.0 it seems that the cart is only expecting one rate per shipping method (plugin). Is this correct?

If this this is correct, how should we handle multiple shipping options per per API response? I would expect the cart to handle this using data only passed back from the plugin (not create html in plugin).
Any input is appreciated.

Micah
Hello! You should rewrite some standart functions and create a helper.php with special class (g.e. russian_post_deliveryCost). Note, the $methodSalesPrice[] is an array containing the costs of delivery with multiple shipping options.

    public function plgVmDisplayListFEShipment(VirtueMartCart $cart, $selected = 0, &$htmlIn) {
JHTML::_('behavior.tooltip');

if ($this->getPluginMethods($cart->vendorId) === 0) {
if (empty($this->_name)) {
$app = JFactory::getApplication();
$app->enqueueMessage(JText::_('COM_VIRTUEMART_CART_NO_' . strtoupper($this->_psType)));
}
return false;
}
$html = array();
$method_name = $this->_psType . '_name';
if (!class_exists('russian_post_deliveryCost'))
    require (.... DS . 'helpers' . DS . 'russian_post_deliverycost.php');

foreach ($this->methods as $method) {
    $deliveryCost = new russian_post_deliveryCost($method, $product, $cart);
    $methodSalesPrice [] = $productPrice->calculateSalesPrice($cart, $method, $cart->pricesUnformatted);
    . . .
    and so

mwf

Professional Joomla Development and Support
http://www.exps.ca