VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Coding Central => Topic started by: mar22 on March 13, 2015, 12:16:07 PM

Title: how to add new variable to cart (cookie)
Post by: mar22 on March 13, 2015, 12:16:07 PM
HI

Sorry for my English, but I do not know English well :(

How can I add a new variable to the cart?
When the administration panel will mark VM options: Configuration> Checkout> "Display modal popup upon the 'Add to cart' 'all guns, my new variable is added to the cookie when I check this option is not added variable does not communicate its contents to cookies. When you add a product to the basket, a new window jquery and I think it is a problem.

My variable is added to the file: components/com_virtemart/views/category/tmpl/default.php:

<input type="hidden" name="my-variable" value="" />

I save it in a file: components/com_virtuemart/helpers/cart.php in function (public function add($virtuemart_product_ids=null,&$errorMsg='')):

$product -> new_variable_in_cart = $_POST["my-variable"];


I have a VM version 2.0.26d and 2.5.18 joomla and php 5.3.29


I would be grateful for your help
Marcin
Title: Re: how to add new variable to cart (cookie)
Post by: jenkinhill on March 13, 2015, 12:22:32 PM
http://forum.virtuemart.net/index.php?topic=79799.0
Title: Re: how to add new variable to cart (cookie)
Post by: mar22 on March 14, 2015, 10:51:13 AM
I added my Joomla, virtuemart and php version
Title: Re: how to add new variable to cart (cookie)
Post by: jenkinhill on March 14, 2015, 14:32:52 PM
First I suggest you update your versions. http://forum.virtuemart.net/index.php?topic=118683.0

Current latest VM2 version is 2.6.17    http://dev.virtuemart.net/projects/virtuemart/files
Title: Re: how to add new variable to cart (cookie)
Post by: mar22 on March 14, 2015, 17:12:30 PM
I can not change to a higher version of the VM, it is too expensive :(
I have what I have to cope with this version.

Does not anyone know how to add a new variable to the basket (cookies)?
Title: Re: how to add new variable to cart (cookie)
Post by: mar22 on March 14, 2015, 17:55:58 PM
I would add that the variable in the cookie is created, but I do not know how to pass the value from the form it :(
Title: Re: how to add new variable to cart (cookie)
Post by: Milbo on March 15, 2015, 16:53:07 PM
We dont use cookies for that. Check the customplugin textinput to learn how that is done. Your approach is impossible in vm2. (actually open as a barn)
Title: Re: how to add new variable to cart (cookie)
Post by: mar22 on March 17, 2015, 07:18:09 AM
thank you very much, I worked it out otherwise, I made a new cookie in JS and everything works beautifully
Title: Re: how to add new variable to cart (cookie)
Post by: dazmilliom on April 26, 2016, 18:04:25 PM
Please can you paste your solution. It will be helpful for us begineers
Title: Re: how to add new variable to cart (cookie)
Post by: Milbo on May 09, 2016, 10:44:05 AM
It is quite likely "unsecure" solution. Just learn to use the userfields in vm3. More secure and less problems