Announcement

Collapse
No announcement yet.

What module feature is first?

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

    What module feature is first?

    That is, I want to dynamically set the product_code variable but I can't find a module feature that will let me set it before miva merchant starts doing it's thing. I always get "such and such product code not available at this time" (something along those lines)

    I was hoping I could do it with system screen, but that doesn't come early enough.

    I know it's easy enough to give the customer a bunch of links to product pages but I was hoping to make it automatic based on something they enter in a form.

    Thanks-

    Scot
    M.A.D.* since 1997

    http://www.scotsscripts.com

    *miva application developers

    #2
    Re: What module feature is first?

    Have you tried it using System_Action. I believe that runs before Merchant starts processing the 'Next Screen' as you can do:

    IF action = XXX
    Set Screen tp YYY
    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


      #3
      Re: What module feature is first?

      Thanks Bruce, that's not it, but when I took a look I realized I forgot to set g.screen and that's the product error you'll get when you go to a screen that doesn't have products features/item loaded. The function that does it is SystemModule_Screen. I'm guessing that SystemModule_Action is called during form submits.
      M.A.D.* since 1997

      http://www.scotsscripts.com

      *miva application developers

      Comment


        #4
        Re: What module feature is first?

        SystemModule_action is called for every page submit...same as SystemModule_screen, it just that Action comes first (AFAIK)
        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


          #5
          Re: What module feature is first?

          You mean every page submitted by a form button, right? If I just load a page up using a link, the systemmodule_Action function isn't called.
          M.A.D.* since 1997

          http://www.scotsscripts.com

          *miva application developers

          Comment


            #6
            Re: What module feature is first?

            Every page load AFAIK.
            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


              #7
              Re: What module feature is first?

              That's not what happens during my tests.

              Have you been able to verify that the SystemModule_Action is called every time a merchant.mvc page loads? I did a simple test by assigning g.screen and g.product_code to PROD and an existing product in the SystemModule_Action function and nothing happened, it stayed on the original screen. When I moved the same two lines of code to the SystemModule_Screen function, the PROD page loaded up with the expected product.

              I'm not trying to be obtuse, just trying to figure out why there is a difference in what we're seeing.

              What is AFAIK?
              M.A.D.* since 1997

              http://www.scotsscripts.com

              *miva application developers

              Comment


                #8
                Re: What module feature is first?

                I'm pretty sure SystemModule_Action is *only* called when there is an action, whereas SystemModule_Screen is called for every screen request.

                As far as which one is first, for some reason I thought it was Action, but I can't recall why. It would be easy enough to test. One nice thing about Actions is that they don't have to 'exist' - you can make up your own action (although it won't do anything unless you write code). If a screen doesn't exist you get an error.

                AFAIK = as far as I know.
                Gordon Currie
                Phosphor Media - "Your Success is our Business"

                Improve Your Customer Service | Get MORE Customers | Edit Any Document Easily | Free Modules | Follow Us on Facebook
                phosphormedia.com

                Comment


                  #9
                  Re: What module feature is first?

                  The source code for this is in the LSK, in the file merchant.mv.

                  Merchant processes "Action" codes before "Screen." If any Action codes are present, Merchant processes them first, using a loop so that the modules only see one code at a time when there's more than one.

                  When processing an Action, Merchant starts by calling SystemModule_Action in all the system-extension modules. If any of them returns a zero or negative value, it stops the processing for the Action (and if zero, causes a fatal error). If all the sys-ex modules return 1, Merchant goes on to do its own processing for the Action; then it calls the LogModule_Action function in all the log modules.

                  Action codes can be passed either as form fields or URL parameters. It's not necessary to submit a form to get an Action processed. For instance, the familiar "Buy One Now" links include the ADPR Action code to put a product in the basket.

                  Note: There was a significant change in the log-module API with version 5. Log modules are now called for every Action, regardless of whether or not it succeeded. For example, in MM4 and earlier, there was a function named LogModule_Action_AddProductToBasket, which would only be called if an item was actually put in the basket. If the Action failed because of an invalid quantity, product out of stock, etc., the log function would not be called.

                  In MM5, the log function is always called for ADPR, whether or not an item is placed in the basket. Likewise, the log function is called for LOGN even if the customer entered an invalid password, etc. This means that modules using log functions sometimes have to do some extra checking to find out what actually happened.

                  Hope that helps --
                  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

                  Working...
                  X