Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,559
    Plugin Contributions
    30

    Default Updating a customer-related SESSION variable on pageload with an observer

    When I update a custom field in the customer record, I want that to take effect on the next page load.

    Initially I am using the notifier-observer in function zen_is_logged_in to get the custom field, as it is only used when the customer is logged in, but I see that function gets called multiple times on a page load so it's wasteful.

    Suggestions for a better notifier/way to do this, that gets called once?
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto, Product Listing Sorter...

  2. #2
    Join Date
    Jul 2012
    Posts
    16,705
    Plugin Contributions
    17

    Default Re: Updating a customer-related SESSION variable on pageload with an observer

    On the store front there is the 'NOTIFY_FOOTER_END' notifier in the respective includes/templates/YOUR_TEMPLATE/common/tpl_main_page.php
    Code:
    $zco_notifier->notify('NOTIFY_FOOTER_END', $current_page);
    That is expected to be loaded once per page load, though also depends on the page actually loading to that point (e.g. a page error before that point will prevent execution).

    Alternatively some file that gets loaded on each page load... There are plenty of places to tuck that away.
    Last edited by mc12345678; 22 Jun 2021 at 11:44 PM.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,559
    Plugin Contributions
    30

    Default Re: Updating a customer-related SESSION variable on pageload with an observer

    That worked for me, thanks.
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto, Product Listing Sorter...

 

 

Similar Threads

  1. v154 Naming a global variable the same as a SESSION, GET or POST variable
    By torvista in forum General Questions
    Replies: 5
    Last Post: 6 Dec 2015, 11:11 AM
  2. v154 Accessing observer variable externally
    By mc12345678 in forum General Questions
    Replies: 1
    Last Post: 11 Oct 2015, 03:53 PM
  3. v150 how can i add session variable with it file path ?
    By tony_sar in forum General Questions
    Replies: 3
    Last Post: 14 Feb 2012, 01:50 PM
  4. Updating customer session info
    By KarZan in forum General Questions
    Replies: 2
    Last Post: 4 May 2010, 02:44 PM
  5. Customer session variable
    By 4ecomm in forum Managing Customers and Orders
    Replies: 4
    Last Post: 12 Oct 2007, 05:36 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR