Developer forum

Forum » Ecommerce - Standard features » Cart Context
Dinis Figueira
Reply

Hi guys,

 

I'm having quite a problem.

I've created 3 context carts all in the same shop and properly configured them but somehow, when I'm trying to add a product to the cart, It won't add anything. It just refreshes to the same page.

 

Am I doing anything wrong in the following code?

 

- When using anchor;

<a href="@(Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(@currentPageId))?CartCmd=add&ProductID=PROD160&OrderContext=ORDERCONTEXT1">ts</a>

 

- When I'm using a form, I'm using the following hidden inputs;

<input type="hidden" name="cartcmd" value="add"/>
<input type="hidden" name="productID" value="PROD1"/>
<input type="hidden" name="variantID" id="variantID" value="VO1" />
<input type="hidden" name="OrderContext" value="ORDERCONTEXT1"/>

 

Best Regards,

Dinis


Replies

 
Nicolai Pedersen
Reply

Hi Dinis

The code looks right. Except you do not have to call serchfriendly URL, it is better that you don't and just use Default.aspx?ID=123.

 

That said, adding products to the cart usually just redirect back to the page you were at. If you create a new page and add a paragraph with a cart that displays the content of the above context, you can browse that and see whats in the cart...

BR Nicolai

 
Dinis Figueira
Reply

Hi Nicolai,

 

By switching the searchfriend to direct ID, the cart is updated but only the cart itself. Elsewhere on the website, If I call TemplateTags, It shows that the cart is empty and there are no associated tags to it.

Do I have to be always "choosing" what context am I using? By passing down the parameter on the url?

Or am I missing something here that's blocking out the base tags?

 

Best Regards,

Dinis

 
Nicolai Pedersen
Reply

But what cart are you refering to?

The one that you can access in the layout template is the default cart. If you need to see what is in the context cart, you have to create a page rendering the cart context or loop the contexts.

Read this http://manual.dynamicweb-cms.com/Dynamicweb-eCommerce/Modules/Shopping-Cart-v2/Paragraph-settings/Order-context-carts.aspx

And this: http://templates.dynamicweb.com/TemplateTags/Dynamicweb-template-tags/Page-tags/Page/Loops/OrderContexts.aspx

 

You must be logged in to post in the forum