Announcement

Collapse
No announcement yet.

In what order do modules initialize?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    In what order do modules initialize?

    I'm working on a module that will append some data to the product list array when the page loads. On the category page, I got it up and running as expected, appending to l.all_settings:category_list:products. However, on the search page, it seems like the product list isn't available when my module initializes, so nothing happens. I actually had my module just eval l.all_settings so I could look at it, and sure enough, the products list wasn't added to the search_results item.

    This leads me to a couple of questions:
    1 - Why would the product lists be loaded at different times relative to my module initializing from one page to the next?
    2 - Is there a way to force my module to initialize later?


    Thanks,
    Josh

    #2
    Re: In what order do modules initialize?

    The default initialization order is by alphabetic item code.

    The difference you are seeing on different pages is due to the particular item codes used on those pages.

    If you require another item to have been initialized in your ComponentModule_Initialize, call [ g.Module_Feature_TUI_MGR ].TemplateManager_Initialize_Item( l.all_settings, 'other_item_code' ). This will guarantee that its settings are available regardless of the item code.

    Comment


      #3
      Re: In what order do modules initialize?

      Awesome, that works perfectly. Thanks for the incredibly fast response!

      Comment

      Working...
      X