I implemented some custom options in the product pdp page. i.e, i have to engrave the product in frontend(eg.pendant FRONT SIDE) as well as the backend(eg.pendant BACK SIDE) without refreshing the page.. For making this i integrated the ajax call to engrave the front side of the product which is the custom module controller and once its completed i need to set the session variable for the back engraving option... that session value should be accessible in that product PDP page.

i set the some core session in custom module controller page

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
              $coreSession = $objectManager->get('Magento\Framework\Session\SessionManagerInterface'); 
              $sidepart = array();
              $sidepart[0] = 'back';
              $setting =  $coreSession->setData('sidepart', $sidepart);

and get it by product pdp page

 $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
  $coreSession = $objectManager->get('Magento\Framework\Session\SessionManagerInterface'); 
  $getting_val =  $coreSession->getData('sidepart', array());

its not working even after setting the session..



Your question is not very clear. I am trying to share the ideas based on my understand.

You mentioned without page refresh, you want to get the session value which is set by some custom controller in ajax call. Not sure how you will achieve this. You can access the session value either via page refresh / in some other page like cart / checkout. Otherwise you can store that value in your customer section data. which can be accessed at any point of time.

  • the session was set sucessfully but it will not reflect even the page is refresh too..but it will show the correct result while clearing the cache only sorry for my stupid communication – Thilagavathy Rathinavelu Mar 22 '19 at 10:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.