Announcement

Collapse
No announcement yet.

Guide for module development

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

    Guide for module development

    I am interested in developing modules for Miva merchant.
    Is there any module development guide available?

    Thank you.
    Daniel Kim, Compu-Mate
    Developer

    #2
    Re: Guide for module development

    This may be just a rough overview of what you're looking for...

    http://www.miva.com/videos/category/...veloper-series
    Ron Frigon
    Jedi Webmaster Obi-Ron Kenobi

    Comment


      #3
      Re: Guide for module development

      That is good information.
      it is rough as you mentioned.

      I was able to create some log module & system module successfully.

      But I have some problem with a component module.

      Whenever I assigned the item to the page , I am just getting a blank page with following source.

      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
      <HTML><HEAD>
      <META http-equiv="Content-Type"
      content="text/html; charset=ks_c_5601-1987"></HEAD>
      <BODY></BODY></HTML>
      I do not think page script is even processed.

      What am I missing here and where does this page source come from?

      Thanks in advance.
      Daniel Kim, Compu-Mate
      Developer

      Comment


        #4
        Re: Guide for module development

        Are you using Component Module Render or Initialize?
        What does your SMT Item code look like?
        What does the distribution code in the Component module look like?

        For example, to use the Component Module Render, you typically have an SMT Item tag like <mvt:item name="my_module_code" param="SayHi" />

        Then, in ComponentModule_Render_Start, you control distribution doing something like

        <mvif expr="{ tolower(l.param) EQ 'sayhi' }">
        <p>Hi There!</p>
        </mvif>

        (usually, you call a function in place of the Hi There text.
        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: Guide for module development

          SMT statement is:

          Code:
          <mvt:item name="item2" param="" />
          In ComponentModule_Render_Start function,

          Code:
          <MvIF EXPR = "{ l.item EQ 'item2' }">
              <!-- code for item2 -->
              <MvDO FILE = "{ g.Store_Template_Path $ l.settings:template_filename }" NAME = "l.null" VALUE = "{ Template_Render( l.null, l.all_settings ) }">
              <!-- end code for item2 -->
          </MvIF>
          template file was created in ComponentModule_Page_Assign function.

          Code:
           <MvIF EXPR = "{ l.item EQ 'item2' }">
               <MvEVAL EXPR = "{ Generate_Code( l.template_source ) }">
               <MvASSIGN NAME = "l.settings:template_filename" VALUE = "{ tolower( l.page:code ) $ '-' $ tolower( l.item ) $ '.mvc' }">
               <MvASSIGN NAME = "l.settings:template_id"  VALUE = "{ [ g.Module_Feature_TUI_MGR ].TemplateManager_Create_ManagedTemplate_NoDuplicates( l.template_source, l.settings, l.settings:template_filename ) }">
               <MvIF EXPR = "{ NOT [ g.Module_Feature_TUI_MGR ].TemplateManager_Page_Assign_Item( l.page, 'item1' ) }">
                   <MvFUNCTIONRETURN VALUE = 0>
               </MvIF>
          <MvIF>
          In ComponentModule_Tabs,

          Code:
              <MvIF EXPR = "{ l.item EQ 'item2' }">
                  <MvASSIGN NAME = "l.tab" VALUE = "{ l.item $ ':List Layout' }">
              <MvELSE>
                  <MvASSIGN NAME = "l.tab" VALUE = "">
              </MvIF>
              <MvFUNCTIONRETURN VALUE = "{ l.tab }">
          In page configuration, tab [List layout] is shown and code defined in Generate_Code is displayed in it.

          Thanks
          Daniel Kim, Compu-Mate
          Developer

          Comment


            #6
            Re: Guide for module development

            Originally posted by compumate99 View Post
            SMT statement is:

            Code:
            <mvt:item name="item2" param="" />
            You don't use an empty param, if you are not using it, leave it off

            In ComponentModule_Render_Start function,

            Code:
            <MvIF EXPR = "{ l.item EQ 'item2' }">
                <!-- code for item2 -->
                <MvDO FILE = "{ g.Store_Template_Path $ l.settings:template_filename }" NAME = "l.null" VALUE = "{ Template_Render( l.null, l.all_settings ) }">
                <!-- end code for item2 -->
            </MvIF>
            The SMT Item Name should be your modules code, (but that can be aliased by the Item assignment). Either way, that's the handle Merchant uses to call the module. Its of no use once the module is called. If you module only does ONE thing, then you can just use the ComponentModule_render_start function to run the code you need.
            [/quote]
            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: Guide for module development

              Thanks for quick reply.

              I have 3 component items, item1, item2, and item3 associated with module and these items are already defined in Module_Install_Store function.

              Code:
              ...
              <MvIF EXPR = "{ NOT [ g.Module_Feature_TUI_DB ].Item_Load_Code( 'item2', l.null ) }">
                    <MvIF EXPR = "{ NOT [ g.Module_Feature_TUI_MGR ].TemplateManager_Create_Item( 'item2', l.module:code ) }">
                         <MvFUNCTIONRETURN VALUE = "{ [ g.Module_Library_Utilities ].Error( 'STAR-ADDR-DTB-00005', g.MvQUERY_Error ) }">
                    </MvIF>
               </MvIF>
              ...
              One thing I do not understand is why it does not even process the script page and renders plain blank page.

              By the way I forgot to mention that pages in trouble are ACED & OCST.
              Last edited by compumate99; 11-11-15, 01:57 PM.
              Daniel Kim, Compu-Mate
              Developer

              Comment


                #8
                Re: Guide for module development

                Well for starters:

                "{ l.item EQ 'item2' }">

                will never be true because the module will never have a value for l.item.

                As I wrote previously, if you need to pass in a value from the SMT item, you need to pass it in via the parameter:

                <mvt:item name="my_module" param="SayHi" />

                then test for that in render start using l.param

                <mvif expr="{ tolower(l.param EQ 'sayhi') }">
                do this
                </mvif>
                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


                  #9
                  Re: Guide for module development

                  I think you are wrong on this.

                  If you look parameters passed to ComponentModule_Render_Start, variable item is one of the parameter listed.

                  Code:
                  <MvFUNCTION NAME = "ComponentModule_Render_Start" PARAMETERS = "module var, item, all_settings var, settings var, param" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">
                      <MvIF EXPR = "{ l.item NE 'shipestimate_rates' }">
                          <MvDO FILE = "{ g.Store_Template_Path $ l.settings:template_filename }" NAME = "l.null" VALUE = "{ Template_Render( l.null, l.all_settings ) }">
                      </MvIF>
                  </MvFUNCTION>
                  I got this code from component module included in LSK and it is actually used in cmp-mv-shipestimates module.

                  Let's say you are right and it never evaluates true.
                  ACED page script should still display some except ones expected to be generated in ComponentModule_Render.

                  It does not display anything on ACED page.

                  I need to get ACED page display something, even garbage, before I correct information error.

                  Thanks
                  Daniel Kim, Compu-Mate
                  Developer

                  Comment


                    #10
                    Re: Guide for module development

                    ah, that would be true....been a long time since i created a module that could only have a single call handle...which is what the param is for. In that case, the value of l.item is going to be the 'Item Code" as defined in the item assignment. (BTW: using l.item eq 'itemx' is probably not a good idea from a taxonomy standpoint.)
                    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


                      #11
                      Re: Guide for module development

                      In your ComponentModule_Render_Start function, try putting in some test html content so you can see if it ever outputs anything to the page. The TemplateRender function call is just complicating things, since you don't know if that is the problem or something else.

                      I always make the item = module code so it is easy to remember and then I can write code like
                      Code:
                      <MvIF EXPR = "{ l.item NE l.module:code }">
                      	<MvFUNCTIONRETURN>
                      </MvIF>
                      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

                      Working...
                      X