How to get distribution center address in the checkout delivery page?
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!
-
- Posts: 26
- Joined: 16 Oct 2023, 15:05
How to get distribution center address in the checkout delivery page?
I am trying to get the distribution center address in the checkout delivery page. Using the address postal, I want to call Fedex API to get rates. But I am not sure which is the right way to get supplier address?
Also, if have multiple products in card belonging to multiple sellers, how can I get the address for each of the seller?
Also, if have multiple products in card belonging to multiple sellers, how can I get the address for each of the seller?
Re: How to get distribution center address in the checkout delivery page?
You need to retrieve the products with the supplier and address information:
Code: Select all
$prodIds = $basket->getProducts()->getProductId();
$manager = \Aimeos\MShop::create( $this->context(), 'product' );
$filter = $manager->filter()->add( 'product.id', '==', $prodIds )->slice( 0, count( $prodIds ) );
$products = $manager->search( $filter, ['supplier', 'supplier/address'] );
foreach( $basket->getProducts() as $orderProduct )
{
if( $product = $products->get( $orderProduct->getProductId() ) )
{
if( $supplier = $product->getRefItems( 'supplier' )->first() ) {
$addrItem = $supplier->getAddressItems()->first();
}
}
}
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