I wrote a custom shipping module for Magento 2.0 that adds an LTL/Fright option. It worked in Magento 2.0.7, and I was recently testing 2.1.7. It appears all of my other (self authored) modules work, but my Shipping module does not.
After adding an item to the cart, and going to http://localhost/checkout/cart
I get the following error:
Exception #0 (ReflectionException): Class Comstar\Tli\Model\Carrier does not exist
#0 D:\Web\html\vendor\magento\framework\Code\Reader\ClassReader.php(19): ReflectionClass->__construct('Comstar\\Tli\\Mod...')
#1 D:\Web\html\vendor\magento\framework\ObjectManager\Definition\Runtime.php(44): Magento\Framework\Code\Reader\ClassReader->getConstructor('Comstar\\Tli\\Mod...')
#2 D:\Web\html\vendor\magento\framework\ObjectManager\Factory\Dynamic\Developer.php(71): Magento\Framework\ObjectManager\Definition\Runtime->getParameters('Comstar\\Tli\\Mod...')
#3 D:\Web\html\vendor\magento\framework\ObjectManager\ObjectManager.php(57): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Comstar\\Tli\\Mod...', Array)
#4 D:\Web\html\vendor\magento\module-shipping\Model\CarrierFactory.php(74): Magento\Framework\ObjectManager\ObjectManager->create('Comstar\\Tli\\Mod...')
#5 D:\Web\html\vendor\magento\module-shipping\Model\Config.php(65): Magento\Shipping\Model\CarrierFactory->create('tli', NULL)
#6 D:\Web\html\vendor\magento\module-checkout\Model\DefaultConfigProvider.php(590): Magento\Shipping\Model\Config->getActiveCarriers()
#7 D:\Web\html\vendor\magento\module-checkout\Model\DefaultConfigProvider.php(292): Magento\Checkout\Model\DefaultConfigProvider->getActiveCarriers()
#8 D:\Web\html\vendor\magento\framework\Interception\Interceptor.php(146): Magento\Checkout\Model\DefaultConfigProvider->getConfig()
#9 D:\Web\html\var\generation\Magento\Checkout\Model\DefaultConfigProvider\Interceptor.php(26): Magento\Checkout\Model\DefaultConfigProvider\Interceptor->___callPlugins('getConfig', Array, Array)
#10 D:\Web\html\vendor\magento\module-checkout\Model\CompositeConfigProvider.php(32): Magento\Checkout\Model\DefaultConfigProvider\Interceptor->getConfig()
#11 D:\Web\html\vendor\magento\module-checkout\Block\Cart\Shipping.php(54): Magento\Checkout\Model\CompositeConfigProvider->getConfig()
#12 D:\Web\html\vendor\magento\module-checkout\view\frontend\templates\cart\shipping.phtml(28): Magento\Checkout\Block\Cart\Shipping->getCheckoutConfig()
.... (stack trace continues to 95 lines)
app/code/Comstar/Tli/Model/Carrier.php
namespace Comstar\Tli\Model;
[... class imports ...]
class Carrier extends AbstractCarrier implements CarrierInterface
{
[... var declarations ...]
public function __construct([... DI ...])
{
parent::__construct($scopeConfig, $errorFactory, $log, $data)
}
}
app/code/Comstar/Tli/etc/config.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<carriers>
<tli>
<active>1</active>
<sallowspecific>0</sallowspecific>
<allowed_methods>AACR,AACT</allowed_methods>
<model>Comstar\Tli\Model\Carrier</model>
<type>LTL</type>
<title>Freight</title>
<name>Comstar LTL</name>
<specificerrmsg>There are no LTL Quotes available for this shipment.</specificerrmsg>
<min_package_weight>125</min_package_weight>
<max_package_weight>10000</max_package_weight>
</tli>
</carriers>
</default>
</config>
The Class Comstar\Tli\Model\Carrier
clearly exists, and as I said, this module worked in 2.0.7. I did a quick review of Magento_Ups
to see if anything major changed in the way shipping modules are loaded, but it doesn't appear to be built any differently.
I am running on WAMP 3.0.9
, PHP 7.0.21
. I updated from 2.0.7 to 2.1.7 by deleting the /vendor/
folder and copying all 2.1.7 files into the Magento 2 root.
Why isn't Magento 2.1 able to find my Class?