VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: chong on October 16, 2015, 11:33:40 AM

Title: How to use/add JFactory::getSession() on ps_checkout.php
Post by: chong on October 16, 2015, 11:33:40 AM
How can we use/add JFactory::getSession() on ps_checkout.php file?
I have set a new session variable from the shopping cart and I want to use it on the ps_checkout.php file.

I have added these codes to the file and it doesn't work.
$sessionCart = JFactory::getSession();
$test = $sessionCart->get('taxExemptionNumber');

Thanks in advance.

Joomla version : 2.5.16
Virtuemart version : 2.0.24
Title: Re: How to use/add JFactory::getSession() on ps_checkout.php
Post by: GJC Web Design on October 16, 2015, 12:23:36 PM
ps_checkout.php is a VM1.1 file...  r u using the fork VM2 thing that isn't from VM?

try  $cart = $_SESSION['cart'];

then echo out $cart to see if your var is there  - its an array from memory
Title: Re: How to use/add JFactory::getSession() on ps_checkout.php
Post by: chong on October 17, 2015, 05:17:52 AM
Thanks for the reply,

No Sir, I'm not using fork VM2.
I have no problem getting the session data on the shopping cart, but on the ps_checkout.php file (/administrator/components/com_virtuemart/classes/ps_checkout.php). I want to get the session variable I declared from the shopping cart file (default.php).

My purpose is to change Tax rate to 0 if the shopper has entered Tax Exemption Number on the Billing Information. This Tax Exemption Number is the session variable I mentioned. Any idea how it can be done? Sorry its my first project in joomla.

Thanks in advance.
Title: Re: How to use/add JFactory::getSession() on ps_checkout.php
Post by: GJC Web Design on October 17, 2015, 10:29:03 AM
/administrator/components/com_virtuemart/classes/ps_checkout.php is VM1.1!!!!

1. your in the wrong section of the forum -> http://forum.virtuemart.net/index.php?board=66.0

if this is your first project why are you using 4 year old software? Current VM is 3.0.10

2. If you set your session var via the std. Joomla method then you retrieve it that way...

https://www.ostraining.com/blog/how-tos/development/how-to-use-sessions-in-joomla/