retrieve attributes-orders
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!
retrieve attributes-orders
hello aimeos,
i have integrated aimeos with laravel.
versions:
"aimeos/aimeos-laravel": "~2020.10",
"laravel/framework": "^8.12",
I have implemented Delivery service provider perfectly my problem is that i stored the tracking id of order which is returned from delivery api in order.i am posting the code below.
it sends order successfully and also attribute is saved as order service attribute .I can see in my data base.Now i want to retrieve that reference number in the order list but i don't know how to do it .i am posting the code of orderlist below
Please note that this is the code from orders list(file name: list-standard).it contains more code but i have only picked the necessary code.that dd gives me
now from here i dont know how can i access the service attribute
i have integrated aimeos with laravel.
versions:
"aimeos/aimeos-laravel": "~2020.10",
"laravel/framework": "^8.12",
I have implemented Delivery service provider perfectly my problem is that i stored the tracking id of order which is returned from delivery api in order.i am posting the code below.
Code: Select all
<?php
namespace Aimeos\MShop\Service\Provider\Delivery;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
class Myprovider
extends \Aimeos\MShop\Service\Provider\Delivery\Base
implements \Aimeos\MShop\Service\Provider\Delivery\Iface
{
/**
* Sends the order details to the ERP system for further processing.
*
* @param \Aimeos\MShop\Order\Item\Iface $order Order invoice object to process
*/
public function process(\Aimeos\MShop\Order\Item\Iface $order): \Aimeos\MShop\Order\Item\Iface
{
$parts = \Aimeos\MShop\Order\Item\Base\Base::PARTS_ALL;
$basket = $this->getOrderBase($order->getBaseId(), $parts);
// here is the code which i have skipped which contains $data array which i have sent to the api
$apiurl = 'http://demodashboardapi.shipsy.in/api/customer/integration/consignment/softdata';
$response = Http::withHeaders([
"api-key" => "xxxxxxxxxxxxxxxxxxxx",
"Content-Type" => "application/json"
])->post($apiurl,$data);
$t = json_decode($response);
if($t->data[0]->success){
// $status = \Aimeos\MShop\Order\Item\Base::STAT_PROGRESS;
// $order->setDeliveryStatus( $status );
// $this->saveOrder( $order );
$attributes = ['reference_number' => $t->data[0]->reference_number];
$serviceType = \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY;
$orderServiceItem = $basket->getService( $serviceType );
if(($serviceItem = reset($orderServiceItem)) !== false){
$this->setAttributes( $serviceItem, $attributes, 'myprovider' );
$this->saveOrderBase( $basket );
}
}
return $order;
}
}
Code: Select all
$baseItems = $this->get( 'baseItems', [] );
<?php foreach( $this->get( 'items', [] ) as $id => $item ) : ?>
<?php $baseItem = ( isset( $baseItems[$item->getBaseId()] ) ? $baseItems[$item->getBaseId()] : null ); ?>
dd($baseItem->getServices())
<?php endforeach: ?>
Code: Select all
Aimeos\Map {#1836 ▼
#list: array:2 [▼
"delivery" => array:1 [▼
0 => Aimeos\MShop\Order\Item\Base\Service\Standard {#1591 ▼
-serviceItem: null
-attributes: []
-attributesMap: null
-price: Aimeos\MShop\Price\Item\Standard {#1550 ▶}
-prefix: "order.base.service."
-available: true
-modified: false
#bdata: array:19 [▼
"order.base.service.id" => "15"
"order.base.service.baseid" => "12"
"order.base.service.siteid" => "17."
"order.base.service.serviceid" => "7"
"order.base.service.type" => "delivery"
"order.base.service.code" => "shipsy"
"order.base.service.name" => "shipsy"
"order.base.service.mediaurl" => ""
"order.base.service.currencyid" => "SAR"
"order.base.service.price" => "0.00"
"order.base.service.costs" => "37.50"
"order.base.service.rebate" => "0.00"
"order.base.service.taxvalue" => "0.3713"
"order.base.service.taxrates" => array:1 [▶]
"order.base.service.taxflag" => "1"
"order.base.service.position" => "0"
"order.base.service.mtime" => "2021-04-08 08:08:25"
"order.base.service.editor" => "127.0.0.1"
"order.base.service.ctime" => "2021-04-08 08:08:25"
]
}
]
"payment" => array:1 [▼
1 => Aimeos\MShop\Order\Item\Base\Service\Standard {#1594 ▼
-serviceItem: null
-attributes: []
-attributesMap: null
-price: Aimeos\MShop\Price\Item\Standard {#1556 ▶}
-prefix: "order.base.service."
-available: true
-modified: false
#bdata: array:19 [▼
"order.base.service.id" => "16"
"order.base.service.baseid" => "12"
"order.base.service.siteid" => "17."
"order.base.service.serviceid" => "8"
"order.base.service.type" => "payment"
"order.base.service.code" => "cash"
"order.base.service.name" => "cashondelivery"
"order.base.service.mediaurl" => ""
"order.base.service.currencyid" => "SAR"
"order.base.service.price" => "0.00"
"order.base.service.costs" => "15.00"
"order.base.service.rebate" => "0.00"
"order.base.service.taxvalue" => "0.1485"
"order.base.service.taxrates" => array:1 [▶]
"order.base.service.taxflag" => "1"
"order.base.service.position" => "1"
"order.base.service.mtime" => "2021-04-08 08:08:25"
"order.base.service.editor" => "127.0.0.1"
"order.base.service.ctime" => "2021-04-08 08:08:25"
]
}
]
]
}
Re: retrieve attributes-orders
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