Post by yashu262 » Sat Feb 25, 2023 6:59 pm

Hi,
I am trying to create a form where the customer need to give their details such as name, email and phone to get coupon code.
The email and phone collected needs to be then stored in the session variable so that when the same customer checks out, the email and phone no. are prefilled.

The issue that i am facing is that i am using a custom php file to store the values to the session variables and hence i am not able to get the current session id.

Code: Select all

<?php
session_start();
$_SESSION['$this->session_id']]['payment_address']['firstname'] = 'JOHNDOE';
echo "Thankyou!";
?>
Can anyone tell me what am i missing here?

I am using OC 2302
With Journal 3 Theme
Onepage Checkout

Newbie

Posts

Joined
Wed Feb 08, 2017 1:09 am

Post by ADD Creative » Sun Feb 26, 2023 6:08 am

Look in system/library/session.php to see how to get the ID. So something like.

Code: Select all

$_SESSION[$_COOKIE['default']]]['payment_address']['firstname'] = htmlspecialchars('JOHNDOE', ENT_COMPAT, 'UTF-8');
You will probably want to encode with htmlspecialchars to prevent XSS.

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom
Who is online

Users browsing this forum: No registered users and 3 guests