Include the store details with each order
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!
- ahmed31916
- Advanced
- Posts: 148
- Joined: 14 Apr 2022, 12:15
Include the store details with each order
Hello Aimeos,
1. How can I get the store details for each order, in the history template? it shows just the Label of the store
2. How to get product url ('order.base.product.url') in the basket template or any checkout steps? it must be exist
1. How can I get the store details for each order, in the history template? it shows just the Label of the store
2. How to get product url ('order.base.product.url') in the basket template or any checkout steps? it must be exist
Re: Include the store details with each order
If you overwrite the account/history component class and change data() like this:ahmed31916 wrote: ↑14 Aug 2022, 19:09 1. How can I get the store details for each order, in the history template? it shows just the Label of the store
Code: Select all
public function data( \Aimeos\Base\View\Iface $view, array &$tags = [], string &$expire = null ) : \Aimeos\Base\View\Iface
{
$view->historyItems = \Aimeos\Controller\Frontend::create( $this->context(), 'order' )
->uses( ['product', 'locale/site', 'order/base', 'order/base/address', 'order/base/coupon', 'order/base/product', 'order/base/service'] )
->sort( '-order.id' )
->search();
return parent::data( $view, $tags, $expire );
}
Code: Select all
$orderProduct->getProductItem()->getSiteItem()
We will make that configurable so it's simply a config setting in the future.
You can create a decorator that fetches the original product for basket and checkout views. The original product is the only place where the URL segment is available.ahmed31916 wrote: ↑14 Aug 2022, 19:09 2. How to get product url ('order.base.product.url') in the basket template or any checkout steps? it must be exist
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: Include the store details with each order
You can create a decorator which loops over the products in the basket you can get from the view and fetch the site items for the site IDs of the products:
Code: Select all
$siteIds = $view->standardBasket->getProducts()->getSiteId();
$manager = \Aimeos\MShop::create( $this->context(), 'locale/site' );
$siteItems = $manager->search( $manager->filter()->add( ['locale.site.siteid' => $siteIds] ) );
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