Add articles to cart by GET request

Questions around the TYPO3 integration and plugins
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
cnoelker
Advanced
Posts: 140
Joined: 20 Feb 2016, 18:21

Add articles to cart by GET request

Post by cnoelker » 30 Jun 2020, 11:30

Hello,
when an article is already in the cart, then I can e.g. update the quantity or deleting the article by starting a GET request.

When I check in the reference:
https://aimeos.org/docs/Developers/Html ... mes#Basket
it should be possible to provide b_attrvarid as a parameter, too.
But how do I provide the parameter containing the key for this?

I want to provide the params to the url function
https://aimeos.org/docs/Developers/Html ... helper#url

Like this:

Code: Select all

$params = array(
'b_action' => 'add', 
'b_prodid' => 1189,
'b_attrvarid[size]' => 1032
);
When I check the resulting URL, this contains a syntax error, though:
https://.../cart?ai[action]=index&ai[b_action]=add&ai[p_prodid]=1189&ai[b_attrvarid[size]=1032&ai[controller]=Basket

The closing ] is missing for the b_attrvarid .

How can I use the b_attrvarid properly?

Claudia

User avatar
aimeos
Administrator
Posts: 7873
Joined: 01 Jan 1970, 00:00

Re: Add articles to cart by GET request

Post by aimeos » 01 Jul 2020, 06:20

This parameter is only accepted when adding a product to the basket, not when modifying one of them. Then, only the quantity can be changed.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

cnoelker
Advanced
Posts: 140
Joined: 20 Feb 2016, 18:21

Re: Add articles to cart by GET request

Post by cnoelker » 01 Jul 2020, 06:58

Yes, that's exactly what I want to do: Add a product to the basket.

cnoelker
Advanced
Posts: 140
Joined: 20 Feb 2016, 18:21

Re: Add articles to cart by GET request

Post by cnoelker » 03 Jul 2020, 11:31

After giving this a bit more thought, I was able to solve my problem. You have to provide the parameters like e.g. this:

Code: Select all

$params = array(
'b_action' => 'add', 
'b_prodid' => 1189,
'b_attrvarid' => array('size' => 1032, 'color' => 134)
);

Post Reply