get product attribute in the order plugin
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
get product attribute in the order plugin
Hello,
For this plugin code, (when I use addProduct event), how can I get the attribute of the requested product?
For this plugin code, (when I use addProduct event), how can I get the attribute of the requested product?
Code: Select all
class Example
extends \Aimeos\MShop\Plugin\Provider\Decorator\Base
implements \Aimeos\MShop\Plugin\Provider\Decorator\Iface
{
public function update( \Aimeos\MW\Observer\Publisher\Iface $order, $action, $value = null )
{
dd($order->getProducts());
return true;
}
}
Re: get product attribute in the order plugin
Depending on the events your plugin is listening for, the data/object is passed in the $value parameter:
Check the interface for available methods:
https://github.com/aimeos/aimeos-core/b ... #L401-L425
Code: Select all
if( $value ) {
$attrItems = $value->getAttributeItems();
}
https://github.com/aimeos/aimeos-core/b ... #L401-L425
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