Not execute saveBase from my custom Order Manager
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Not execute saveBase from my custom Order Manager
I have a code:
Order is saved to database by not by my custom Order Manager class
Code of my custom Order Manager class
Method saveBase is not executed
Code: Select all
$orderCntl = \Aimeos\Controller\Frontend::create($this->context, 'order');
$basketCntl = \Aimeos\Controller\Frontend::create($this->context, 'basket');
$this->setAddress($req);
$basketCntl->get()->setChannel('web');
$order = $basketCntl->store();
$orderCntl->save($order);
Code of my custom Order Manager class
Code: Select all
<?php
namespace Aimeos\MShop\Order\Manager;
use App\Models\Order;
class CustomOrderManager extends Standard
{
use Session;
use Update;
private $searchConfig = [
'order.order_no' => [
'code' => 'order.order_no',
'internalcode' => 'mord."order_no"',
'label' => 'Order number',
'type' => 'string', // integer, float, etc.
],
];
public function __construct(\Aimeos\MShop\ContextIface $context)
{
parent::__construct( $context );
}
public function saveBase(\Aimeos\MShop\Common\Item\Iface $item, bool $fetch = true): \Aimeos\MShop\Common\Item\Iface
{
dd('ggg');
if (empty($item->getOrderNo())) {
$context = $this->context();
$siteCode = $context->locale()->getSiteCode();
$item->setOrderNo('fddf'/*Order::createOrderNumber($item->getId(), $siteCode)*/);
}
return parent::saveBase($item, $fetch);
}
public function getSearchAttributes(bool $withsub = true) : array
{
return parent::getSearchAttributes($withsub)
+ $this->createAttributes($this->searchConfig);
}
public function create(array $values = []) : \Aimeos\MShop\Common\Item\Iface
{
$context = $this->context();
$locale = $context->locale();
$values['.locale'] = $values['.locale'] ?? $locale;
$values['.price'] = $values['.price'] ?? \Aimeos\MShop::create($context, 'price')->create();
$values['order.siteid'] = $values['order.siteid'] ?? $locale->getSiteId();
$item = new \Aimeos\MShop\Order\Item\CustomOrderItem('order.', $values);
\Aimeos\MShop::create($context, 'plugin')->register($item, 'order');
return $item;
}
}
Re: Not execute saveBase from my custom Order Manager
I resolved my problem.
Sorry for bothering you @Aimeos
Sorry for bothering you @Aimeos