News:

Support the VirtueMart project and become a member

Main Menu

Preconfigured carts

Started by tisba, January 14, 2017, 10:41:49 AM

Previous topic - Next topic

tisba

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

jenkinhill

Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

tisba

Sorry  :)
I'm using VM 3.0.18 on Joomla 3.6.5 with PHP 5.5.38

Studio 42

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.

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

emedina

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

venneri

Hello mr. Milbo.
I just buy your extension  "vm-isx-cart-saver".
I have many problems.
Con you help me?
I wait yours.
Thanks.

jenkinhill

@verreri support for that plugin is by ticket - go to http://extensions.virtuemart.net/ticket
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum