Help with orders list
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Help with orders list
Hello!
I watn to use my orders data from "mshop_order" table in updateAsync() method.
I saw https://aimeos.org/docs/latest/models/m ... er-methods , but i can not apply it in my case.
I did so in my custom payment provider:
I did not get results.
Thanks!
I watn to use my orders data from "mshop_order" table in updateAsync() method.
I saw https://aimeos.org/docs/latest/models/m ... er-methods , but i can not apply it in my case.
I did so in my custom payment provider:
Code: Select all
$context = $this->getContext();
$manager = \Aimeos\MShop::create( $context, 'order' );
$filter = $manager->filter(true);
$filter->add( 'id', '==', 73 );
$items = $manager->search($filter, ['order']);
Thanks!
Re: Help with orders list
"id" is not a valid search key, but "order.id" would be.
There are also methods available in service providers which simplifies retrieving data:
https://aimeos.org/docs/latest/provider ... order-item
There are also methods available in service providers which simplifies retrieving data:
https://aimeos.org/docs/latest/provider ... order-item
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Help with orders list
I solved my problem with orders list, but I have new ). This code change my "order.statuspayment" in order object, but I have problem with $this->saveOrder($order); in method. It construction interupt scrip
I have new status in order after $order->setStatusPayment($status), but I have a new firld ".statuspayment" in order with old statuspayment value. Old status = 4. New status = 2.
https://disk.yandex.ru/i/LkqgkYrrEhgKHw
Code: Select all
public function updateAsync() : bool
{
$manager = \Aimeos\MShop::create($this->getContext(), 'order' );
$search = $manager->filter(true);
$expr = [
$search->compare( '==', 'order.statuspayment', [
\Aimeos\MShop\Order\Item\Base::PAY_UNFINISHED,
\Aimeos\MShop\Order\Item\Base::PAY_PENDING,
\Aimeos\MShop\Order\Item\Base::PAY_AUTHORIZED] ),
$search->compare( '!=', 'order.transaction_id', null),
];
$search->setConditions( $search->and( $expr ) );
$items = $manager->search( $search );
if ($items) {
foreach ($items as $item) {
$transactionId = $item->get('transaction_id');
dump($transactionId);
$response = ***get bank response ****;
$status = $this->statuses[$response->status];
$order = $this->getOrder($item->getId());
$order->setStatusPayment($status);
$this->saveOrder($order);
}
}
return true;
}
https://disk.yandex.ru/i/LkqgkYrrEhgKHw
Re: Help with orders list
I solved problem. Problem was in my Decorator
I deleted "order."
Code: Select all
private $attr = [
'order.transaction_id' => [
'code' => 'order.transaction_id',
'internalcode' => 'mord."transaction_id"',
'label' => 'Bank transaction Id',
'type' => 'string',
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
],
];
Code: Select all
private $attr = [
'transaction_id' => [
'code' => 'transaction_id',
'internalcode' => 'mord."transaction_id"',
'label' => 'Bank transaction Id',
'type' => 'string',
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
],
];