Add product to basket
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!
- marlonsamot
- Posts: 9
- Joined: 13 Apr 2021, 12:26
Add product to basket
Hi devs, please help me with this. Please help how to add product in basket in controller. Newbie here thanks!
Re: Add product to basket
The controllers are available here:
https://github.com/aimeos/ai-controller ... r/Frontend
For the basket controller, have a look at the interface for the available methods:
https://github.com/aimeos/ai-controller ... /Iface.php
To add a product to the basket, use:
How you get the context object depends on your host application. For Laravel, please read:
https://aimeos.org/docs/latest/laravel/ ... end-aimeos
https://github.com/aimeos/ai-controller ... r/Frontend
For the basket controller, have a look at the interface for the available methods:
https://github.com/aimeos/ai-controller ... /Iface.php
To add a product to the basket, use:
Code: Select all
$product = \Aimeos\Controller\Frontend::create( $context, 'product' )->find( 'myprodcode', ['text', 'price', 'media', 'attribute'] );
\Aimeos\Controller\Frontend::create( $context, 'basket' )->addProduct( $product, );
https://aimeos.org/docs/latest/laravel/ ... end-aimeos
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
- marlonsamot
- Posts: 9
- Joined: 13 Apr 2021, 12:26
Re: Add product to basket
What would be the value of context ? i'm just using function from controller. Other programmer just pass me a product id that would be a key to add a basket.
For example, $product_id = 15
What would be the right code to add to basket.
For example, $product_id = 15
What would be the right code to add to basket.
Re: Add product to basket
For IDs, use get() instead of find().
How to get the context depends on your host application. What do you use? Laravel?
How to get the context depends on your host application. What do you use? Laravel?
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
- marlonsamot
- Posts: 9
- Joined: 13 Apr 2021, 12:26
Re: Add product to basket
Yes laravel. I want to add to basket using parameter product id
Re: Add product to basket
Please read this article how to get the context object:
https://aimeos.org/docs/latest/laravel/ ... os-objects
https://aimeos.org/docs/latest/laravel/ ... os-objects
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