News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

how to add new variable to cart (cookie)

Started by mar22, March 13, 2015, 12:16:07 PM

Previous topic - Next topic

mar22

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

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

mar22

I added my Joomla, virtuemart and php version

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

mar22

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)?

mar22

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 :(

Milbo

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)
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

mar22

thank you very much, I worked it out otherwise, I made a new cookie in JS and everything works beautifully

dazmilliom

Please can you paste your solution. It will be helpful for us begineers

Milbo

It is quite likely "unsecure" solution. Just learn to use the userfields in vm3. More secure and less problems
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/