VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: tisba on January 14, 2017, 10:41:49 AM

Title: Preconfigured carts
Post by: tisba on January 14, 2017, 10:41:49 AM
Dear all,
is it possible to create some preconfigured carts containing different products and quantities?
E.g, I would like to create "cart 1" containing 2 products A and 3 products B. Than, I would like to create a "cart 2" containing 1 products B and 4 products C.
This way a user can select "cart 1" or "cart 2", modify it (if needed) or create hits own cart
Title: Re: Preconfigured carts
Post by: jenkinhill on January 14, 2017, 12:10:21 PM
http://forum.virtuemart.net/index.php?topic=79799.0
Title: Re: Preconfigured carts
Post by: tisba on January 14, 2017, 21:13:49 PM
Sorry  :)
I'm using VM 3.0.18 on Joomla 3.6.5 with PHP 5.5.38
Title: Re: Preconfigured carts
Post by: Studio 42 on January 14, 2017, 23:13:21 PM
You can use a link, having all data on it.
In my case for 1 product it's MYSITE/fr/cart?task=add&quantity%5B%5D=15&virtuemart_product_id%5B%5D=22
For multiple products
MYSITE/fr/cart?task=add&quantity%5B%5D=15&virtuemart_product_id%5B%5D=22&quantity%5B%5D=2&virtuemart_product_id%5B%5D=45 ...
SEF is active and i use fr language tag for french.
Title: Re: Preconfigured carts
Post by: Milbo on January 16, 2017, 18:11:45 PM
I could adjust my extension for this case
http://extensions.virtuemart.net/product/products/vm-isx-cart-saver-detail
Title: Re: Preconfigured carts
Post by: emedina on January 24, 2017, 13:58:41 PM
I think you can do this with Javascript in your template:

for example:

<?php if ($myvar == 'myresult'){   //check condition A or B
?>  //close php
<script>
jQuery(document).ready(function($){  //or other trigger we want to use
jQuery.ajax({
  method: 'POST',
  url: Virtuemart.vmSiteurl + "index.php?option=com_virtuemart&nosef=1&view=cart&task=addJS&format=json"+Virtuemart.vmLang+window.Itemid,  //be sure this script is under virtuemart javascript is defined
  cache: 'false',
  data:{
     ids: [1991]   //an array with our ids
  },
  success: function(msg){
    //TODO handle success function, maybe alert or sweetalert
  },
  error: function(){
    //TODO handle error
}

});
</script>
<?php
}
else
{
//another javascript for other products
?>
<script>
jQuery(document).ready(function($){  //or other trigger we want to use
jQuery.ajax({
  method: 'POST',
  url: Virtuemart.vmSiteurl + "index.php?option=com_virtuemart&nosef=1&view=cart&task=addJS&format=json"+Virtuemart.vmLang+window.Itemid,  //be sure this script is under virtuemart javascript is defined
  cache: 'false',
  data:{
     ids: [1995,1987]   //an array with our ids
  },
  success: function(msg){
    //TODO handle success function, maybe alert or sweetalert
  },
  error: function(){
    //TODO handle error
}

});
</script>
<?php
};
?>

Good luck
Title: Re: Preconfigured carts
Post by: venneri on January 12, 2018, 17:43:25 PM
Hello mr. Milbo.
I just buy your extension  "vm-isx-cart-saver".
I have many problems.
Con you help me?
I wait yours.
Thanks.
Title: Re: Preconfigured carts
Post by: jenkinhill on January 12, 2018, 23:31:23 PM
@verreri support for that plugin is by ticket - go to http://extensions.virtuemart.net/ticket