Page 1 of 1

How should look got GET if product have attributes ?

Posted: Sat Nov 16, 2013 8:52 am
by newone123.1991
Hi I want make normal (not ajax) GET request to add product to cart but when I try something like this:

localhost:8080/cart/add?quantity=1&productId=300&color=Black

I have:

[artifact:mvn] org.broadleafcommerce.core.order.service.exception.RequiredAttributeNotProvidedException: Unable to add to product (300) cart. Required attribute was not provided: COLOR
[artifact:mvn] at org.broadleafcommerce.core.order.service.workflow.add.ValidateAddRequestActivity.findMatchingSku(ValidateAddRequestActivity.java:148)
[artifact:mvn] at org.broadleafcommerce.core.order.service.workflow.add.ValidateAddRequestActivity.determineSku(ValidateAddRequestActivity.java:124)
[artifact:mvn] at org.broadleafcommerce.core.order.service.workflow.add.ValidateAddRequestActivity.execute(ValidateAddRequestActivity.java:82)
[artifact:mvn] at org.broadleafcommerce.core.order.service.workflow.add.ValidateAddRequestActivity.execute(ValidateAddRequestActivity.java:40)
[artifact:mvn] at org.broadleafcommerce.core.workflow.SequenceProcessor.doActivities(SequenceProcessor.java:79)

Re: How should look got GET if product have attributes ?

Posted: Wed Nov 27, 2013 12:48 pm
by Theo Schumacher
When you do the same with the demo site, with firebug I do see the following differences:

POST is used instead of GET (not sure if this is required)

The POST command shows the following parameters:

hasProductOptions true
itemAttributes[COLOR] Silver
itemAttributes[SIZE] XL
productId 200
quantity 1

the param string should be something like:

productId=200&quantity=1&hasProductOptions=true&itemAttributes%5BCOLOR%5D=Silver&itemAttributes%5BSIZE%5D=XL

Re: How should look got GET if product have attributes ?

Posted: Sun Dec 01, 2013 12:56 am
by bpolster
Thanks for answering your own question - that's helpful.