Announcement

Collapse
No announcement yet.

Direct Call to custom module missing global variables

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

  • Direct Call to custom module missing global variables

    When I call my custom module directly it seems like g.Store_Table_Prefix and some other global level variables are not being set. How do i get these values populated?

  • Re: Direct Call to custom module missing global variables

    You may need to patch together some code yourself, by copying and pasting from the LSK. A lot of variables are intialized by config.mv. Many other important ones are initialized at the beginning of merchant.mv.
    Kent Multer
    Magic Metal Productions
    http://TheMagicM.com
    * Web developer/designer
    * E-commerce and Miva
    * Author, The Official Miva Web Scripting Book -- available on-line:
    http://www.amazon.com/exec/obidos/IS...icmetalproducA

    Comment


    • Re: Direct Call to custom module missing global variables

      Are you using LATU or another variable source program to find out what the global variables are?
      Scott Bronstad
      Marketing
      Star Time Supply, Co. Inc.
      http://store.startimesupply.com

      Comment


      • Re: Direct Call to custom module missing global variables

        In PR8 Update 5 there's a Variable and Entity module built in to the core software.
        Thanks,

        Rick Wilson
        CEO
        Miva, Inc.
        [email protected]
        http://www.miva.com

        Comment


        • Re: Direct Call to custom module missing global variables

          ...but does that work on the ADMIN side? i'm assuming that the OP was looking for variables to use when his module runs as a script in the background.
          Bruce Golub
          Phosphor Media - "Your Success is our Business"

          Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
          phosphormedia.com

          Comment


          • Re: Direct Call to custom module missing global variables

            Originally posted by Rick Wilson View Post
            In PR8 Update 5 there's a Variable and Entity module built in to the core software.
            Where would I find this module? What's it called?
            Ray Yates
            "If I have seen further, it is by standing on the shoulders of giants."
            --- Sir Isaac Newton

            Comment


            • Re: Direct Call to custom module missing global variables

              It's built into the Pages section, look up a page and then click the VAR List button in the upper right. Also it's documented in the reference docs on our main site.
              Thanks,

              Rick Wilson
              CEO
              Miva, Inc.
              [email protected]
              http://www.miva.com

              Comment


              • Re: Direct Call to custom module missing global variables

                Originally posted by Rick Wilson View Post
                It's built into the Pages section, look up a page and then click the VAR List button in the upper right. Also it's documented in the reference docs on our main site.
                Rick

                I found it in the PDF but it's not showing up on any of the sites we manage.

                Miva Merchant 5.5
                Production Release 8Update 5
                Miva Merchant Engine v5.13
                Database API: mysql

                Ray Yates
                "If I have seen further, it is by standing on the shoulders of giants."
                --- Sir Isaac Newton

                Comment


                • Re: Direct Call to custom module missing global variables

                  You should contact Wayne tomorrow and have him look, something's amiss.
                  Thanks,

                  Rick Wilson
                  CEO
                  Miva, Inc.
                  [email protected]
                  http://www.miva.com

                  Comment


                  • Re: Direct Call to custom module missing global variables

                    Originally posted by dorgan View Post
                    When I call my custom module directly it seems like g.Store_Table_Prefix and some other global level variables are not being set. How do i get these values populated?
                    Usually when I'm calling one of my modules directly I try to figure out which global variable I actually need (you likely don't need all of them) and pass those directly in the call.
                    Ray Yates
                    "If I have seen further, it is by standing on the shoulders of giants."
                    --- Sir Isaac Newton

                    Comment


                    • Re: Direct Call to custom module missing global variables

                      Originally posted by RayYates View Post
                      Rick

                      I found it in the PDF but it's not showing up on any of the sites we manage.

                      Miva Merchant 5.5
                      Production Release 8Update 5
                      Miva Merchant Engine v5.13
                      Database API: mysql

                      Go to Utilities from the store admin. You should see an item labelled Token List under the Modules tab. Check the box next to it and click update. After that, navigating to a page in admin will show the VAR LIST button at the top right of the page (next to the extras and help buttons).

                      Remember, this is only available on PR8 Update 5+ stores.
                      Ryan Guisewite
                      Lead UI Developer / Miva, Inc.
                      www.miva.com

                      Comment


                      • Re: Direct Call to custom module missing global variables

                        Very Very Nice!!! Much better than any of the third party tools (including mine). Great Job.
                        Ray Yates
                        "If I have seen further, it is by standing on the shoulders of giants."
                        --- Sir Isaac Newton

                        Comment


                        • Re: Direct Call to custom module missing global variables

                          Originally posted by dorgan View Post
                          When I call my custom module directly it seems like g.Store_Table_Prefix and some other global level variables are not being set. How do i get these values populated?
                          When called directly your module should do something like the following:

                          Code:
                          <MvDO FILE = "../../lib/config.mvc">
                          
                          <MvIF EXPR = "{ NOT [ '../../lib/db.mvc' ].OpenDataFiles( g.Merchant_Version, g.Domain ) }">
                              <MvEXIT>
                          </MvIF>
                          
                          <MvEVAL EXPR = "{ [ '../../lib/util.mvc' ].SetRuntimePaths() }">
                          
                          <MvIF EXPR = "{ NOT [ g.Module_Library_DB ].Store_Open( g.Store_Code, g.Store ) }">
                              <MvEXIT>
                          </MvIF>
                          The initial MvDO of lib/config.mv will set all of the global variables that indicate the version and the various feature and lib paths relative to the mm5 directory. We have to use a relative path to get to config.mvc because we haven't yet determined the root directory for modules so that we can use the g.Module_XXX variables.

                          The OpenDataFiles call will connect to the database and populate g.Domain. Note that we have to use a relative path here as well.

                          The SetRuntimePaths function will look at the settings in g.Domain and set the g.Module_XXX path variables.

                          The Store_Open call will open the store specified by the input parameter Store_Code and set the g.Store variable. This function will also set g.Store_Table_Prefix. Note that since we've called SetRuntimePaths() we can use g.Module_Library_DB in the call.

                          It is critically important that, at the bare minimum, any custom entry points into Miva Merchant MvDO lib/config.mvc. This MvDO explicitly sets any global variables that we use in database queries or subsequent MvDO operations. Passing any of those variables in as parameters will introduce one or more major security holes into your module.

                          Comment

                          Working...
                          X