Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Creating a shipping module in 5.2.13

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 04-05-2016, 10:15 PM
 
castcontrol castcontrol is offline
    
Join Date: Jun 2013
Posts: 1
 

Default Creating a shipping module in 5.2.13

Hi,

I'm having difficulties creating a shippin gmodule for X-Cart 5.2.13.

It seems the documentation for shipping modifications is outdated and no longer compatible with the latest version:
http://kb.x-cart.com/display/XDD/Shipping+modifications

1. Uploaded module from https://dl.dropboxusercontent.com/u/23858825/Tony-ShippingDemo-v5_1_0.tar
2. Redeploy Store
3. Modules displays "The module is not compatible with your X-Cart version". Simple fix, updated Main.php getMajorVersion() to return '5.2' and redeploy.
3. Enable Module and receive the following error:
Quote:
Cleaning up the cache... [0.00sec, 3.5MB (60kB)]
Building classes tree... [3.36sec, 13.6MB (10.1MB)]
Run the "Doctrine_Plugin_Cache" plugin... [0.00sec, 13.7MB (139kB)]
Run the "Doctrine_Plugin_DocBlock_FakeEntities" plugin...
Fatal error: Class XLite\Module\Tony\ShippingDemo\Model\Shipping\Proc essor\MyProcessor contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (XLite\Model\Shipping\Processor\AProcessor::getPro cessorId) in /home3/arindus2/public_html/classes/XLite/Module/Tony/ShippingDemo/Model/Shipping/Processor/MyProcessor.php on line 31

4. Resolved this problem by replacing line 7 of MyProcessor.php with the following and rebuilding:
PHP Code:
public function getProcessorId() 
    {
        return 
'myprocessor';
    } 

The enable/redeploy now runs smoothly however the module appears to not do anything, the "Store Setup -> Shipping" methods do not include the ShippingDemo or "My Processor" and there are no relative errors in the logs files.

Comparing to the other Shipping Modules, it seems that performRequest() replaces getRates() and i have attempted renaming the getRates() with performRequest() but still appears to do nothing.

Any advise on how to proceed?
__________________
--
Reply With Quote
  #2  
Old 04-13-2016, 09:10 AM
 
xgarb xgarb is offline
 

eXpert
  
Join Date: Jul 2004
Location: UK
Posts: 263
 

Default Re: Creating a shipping module in 5.2.13

I've been having the same problem. I discovered this method

Code:
/** * Return params list to use for search * * @return \XLite\Core\CommonCell */ protected function getSearchCondition() { $result = parent::getSearchCondition(); $result->{\XLite\Model\Repo\Shipping\Method::P_CARRIER} = ''; $result->{\XLite\Model\Repo\Shipping\Method::P_ADDED} = true; $result->{\XLite\Model\Repo\Shipping\Method::P_ORDER_BY} = array('m.position', 'ASC'); return $result; }

in \XLite\View\LitemsList\Model\Shipping\Carriers.php

Which shows the fields in the _shipping_methods table need to have certain values.

The yaml file for the UPS module has the following
Code:
XLite\Model\Shipping\Method: - processor: ups carrier: '' code: '' enabled: false added: false position: 0 moduleName: XC_UPS translations: - code: en name: UPS - processor: ups carrier: ups code: 'NDA' enabled: 1 position: 10 translations: - code: en name: "UPS Next Day Air®"

Fiddling around with this has got my carrier to show in the admin area.. but that's as far as I've got so far.
__________________
Core version: 5.5.xx
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 07:43 AM.

   

 
X-Cart forums © 2001-2020