I'm basically having this problem Getting started with Order Adjuster plugin
I have the file plugins/carbonbalance/carbonBalancePlugin.php containing;
<?php
namespace Craft;
Craft::import('plugins.carbonbalance.adjusters.carbonBalanceAdjuster');
class CarbonBalancePlugin extends BasePlugin {
... usual standard plugin methods ...
public function init()
{
}
public function commerce_registerOrderAdjusters()
{
return [
new CarbonBalanceAdjuster
];
}
}
and then in plugins/carbonbalance/adjusters/carbonBalanceAdjuster.php I have
<?php
namespace Commerce\Adjusters;
use Craft\Commerce_LineItemModel;
use Craft\Commerce_OrderAdjustmentModel;
use Craft\Commerce_OrderModel;
class CarbonBalanceAdjuster implements Commerce_AdjusterInterface {
public function adjust(Commerce_OrderModel &$order, array $lineItems = []){
$myAdjuster = new Commerce_OrderAdjustmentModel();
return [$myAdjuster];
}
}
But I get the following error message
Class 'Craft\CarbonBalanceAdjuster' not found
I understand this is most likely a naming issue, but I cannot see where I'm going wrong in that respect.
Update I think I have got past this problem by using;
public function init()
{
//Craft::import('plugins.carbonbalance.adjusters.carbonBalanceAdjuster');
require_once('adjusters/carbonBalanceAdjuster.php');
}
public function commerce_registerOrderAdjusters()
{
return [
new \Commerce\Adjusters\CarbonBalanceAdjuster
];
}
This appears to load the Adjuster, but shows other errors because I haven't yet completed the adjust method.