Inhalte aufrufen

Profilbild

Add Products to cart using URL or similar procedure.

catalog cart url querystring

2 Antworten zu diesem Thema

#1 sebaherrera

sebaherrera

    Member

  • Members
  • 12 Beiträge

Geschrieben: 11 April 2014 - 08:55

Is it possible to prepopulate the shopping cart in the URL/QueryString? I would like to have the url send a person directly to the shopping cart with a specific product already added or to create a webpage and use the smartstore power to manage orders created from that form.

 

As an example in magento commerce (php) the following url will create an add to cart of a product including combinations = http://www.your_doma...tribute[525]=56

 

otherwise if its not possible, any workaround to create a webpage with a form where pressing send button also includes product + attributes combination into the cart?. 

 

thanks in advance!!



#2 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3034 Beiträge

Geschrieben: 11 April 2014 - 10:15

No, not out of the box.
 
It is possible to pre-select attributes in context of the product detail page. You can find these URLs in the product column
of the attribute combination grid (backend). So what you can offer is an URL/link to a product detail page where a specific attribute
combintaion is pre-selected.
 
You can automatically trigger the execution of the add-to-cart button with jQuery. For instance through a query string parameter 'addtocart'
with the value '1'. Append the following code to \SmartStore.Web\Views\Catalog\ProductTemplate.Simple.cshtml for it:
 
<script type="text/javascript">
jQuery(document).ready(function () {
	var params = new RegExp('[\\?&amp;]addtocart=([^&amp;#]*)').exec(window.location.href);

	if (params && params[1] && params[1] === '1')
	{
		setTimeout(function() {
			$('.add-to-cart-button').first().trigger('click');
		}, 1000);
	}
});
</script>

  • MediArt gefällt das

Schöne Grüße aus Düsseldorf,
Marcus Gesing


#3 sebaherrera

sebaherrera

    Member

  • Members
  • 12 Beiträge

Geschrieben: 11 April 2014 - 17:54

thank you so much marcus. brgds!





Auf dieses Thema antworten



  

Auch markiert mit einem oder mehrerer dieser Schlüsselwörter: catalog, cart, url, querystring