Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Save Product Option In User Session On Product Page Rate Topic   - - - - -

 
  • Dexterflamez
  • Advanced Member
  • Trial users
  • Join Date: 08-Jan 18
  • 53 posts

Posted 16 April 2019 - 03:52 AM #1

How can i save the options user selected to the user's session?

Please if you don't have a solution, Give a suggestion.. I understand that I can ask or hire someone.. I'll be very happy to do so if i have the cash or if my project is up and running already.. Thanks

 

 

This is what i have tried. 

 

function fn_save_product_options($product_id) {
if (empty($save_options)) {
        if (fn_get_session_data('selected_options')) {
            $save_options = fn_get_session_data('selected_options');
        } else {
            fn_set_session_data('selected_options', $save_options, COOKIE_ALIVE_TIME);
        }
    }
}

 



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19158 posts

Posted 16 April 2019 - 05:56 AM #2

Use should pass $save_options array to the function parameters. E.g.

 

function fn_save_product_options($product_id, $save_options = array()) {
    if (empty($save_options)) {
        if (fn_get_session_data('selected_options')) {
            $save_options = fn_get_session_data('selected_options');
        } else {
            fn_set_session_data('selected_options', $save_options, COOKIE_ALIVE_TIME);
        }
    }
}

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • Dexterflamez
  • Advanced Member
  • Trial users
  • Join Date: 08-Jan 18
  • 53 posts

Posted 16 April 2019 - 12:51 PM #3

Tried it but it didn't work, I'm just wondering if selected_options is the right thing to use..



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19158 posts

Posted 16 April 2019 - 01:14 PM #4

How do you call this function?


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • Dexterflamez
  • Advanced Member
  • Trial users
  • Join Date: 08-Jan 18
  • 53 posts

Posted 16 April 2019 - 01:19 PM #5

How do you call this function?

I just place the snippet below inside "blocks/product_templates/default_template.tpl"
 
{$product.product_id|fn_save_product_options}


 
  • Dexterflamez
  • Advanced Member
  • Trial users
  • Join Date: 08-Jan 18
  • 53 posts

Posted 16 April 2019 - 01:22 PM #6

Then I place the snippet you shared inside "app/addons/my_changes/func.php"



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19158 posts

Posted 17 April 2019 - 05:53 AM #7

It will not work. Looks like you do not understand CS-Cart cor well. So I suggest you again to hire someone to perform modification according to your needs 


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.