Announcement

Collapse
No announcement yet.

Help getting started on creating a custom module

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

    Help getting started on creating a custom module

    I'm not familiar with the toolkit function either. I remember seeing it in the miva merchant tutorial video, but it looks simple. By the way, are there videos on miva scripting at all? A run down video tutorial on a LSK mv or a custom module for miva merchant would be nice.


    I found this site that list all the required functions for each feature.

    http://www.4thebest.com/miva-merchan...e-api-toc.html


    Originally posted by RayYates View Post
    You probably want to make sure your module is also a component module. Feature 'component'
    Then you can assign the items to you page.
    ComponentModule_Initialize() is called when the page loads. You can setup your variable in l.all_settings:myvariable
    and print it to the screen: &mvt:myvariable;

    Or

    ComponentModule_Render_Start() is called when you have assigned an item to the page script.
    mvt:item name="you_module_code" param="" />
    You can have it output something to the screen

    But I would really like to get a custom module working. Like the discount module I mention on the other thread.

    question: mvfunctionreturn = "0 or null" return false, mvfunctionreturn = "1" return true,.. but i also see mvfunctionreturn = "2". what is 2?
    Last edited by clee06; 06-13-12, 01:06 PM.

    #2
    Re: Help getting started on creating a custom module

    Start with the System module example in the lastest LSK (the 4thebest.com stuff is out of date). You will probably want to also make that system module a Component module. This step is simple: to <MvASSIGN NAME="l.module:features" VALUE="system"> add <MvASSIGN NAME="l.module:features" VALUE="system, component">

    then copy the Component specific module functions into the same module.

    Code:
    <MvFUNCTION NAME="ComponentModule_Render_Start" PARAMETERS="module var, item, all_settings var, settings var, param" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">
      <MvFUNCTIONRETURN VALUE="1">
    </MvFUNCTION>
    
    <MvFUNCTION NAME="ComponentModule_Tabs" PARAMETERS="module var,item,settings var" STANDARDOUTPUTLEVEL="">
       <MvFUNCTIONRETURN VALUE="">
    </MvFUNCTION>
    
    <MvFUNCTION NAME="ComponentModule_Update" PARAMETERS="module var,item,field_prefix,fields var,settings var" STANDARDOUTPUTLEVEL="">
       <MvFUNCTIONRETURN VALUE="1">
    </MvFUNCTION>
    
    <MvFUNCTION NAME="ComponentModule_Content" PARAMETERS="module var,item,tab,load_fields,field_prefix,fields var,settings var" STANDARDOUTPUTLEVEL="">
       <MvFUNCTIONRETURN VALUE="1">
    </MvFUNCTION>
    
    <MvFUNCTION NAME="ComponentModule_Validate" PARAMETERS="module var,item,field_prefix,fields var" STANDARDOUTPUTLEVEL="">
       <MvFUNCTIONRETURN VALUE="1">
    </MvFUNCTION>
    
    <MvFUNCTION NAME="ComponentModule_Defaults" PARAMETERS="module var,settings var" STANDARDOUTPUTLEVEL="">
       <MvFUNCTIONRETURN VALUE="1">
    </MvFUNCTION>
    
    <MvFUNCTION NAME="ComponentModule_Page_Assign" PARAMETERS="module var,page var,item,settings var" STANDARDOUTPUTLEVEL="">
       <MvFUNCTIONRETURN VALUE="1">
    </MvFUNCTION>
    
    <MvFUNCTION NAME="ComponentModule_Page_Unassign" PARAMETERS="module var,page var,item,settings var" STANDARDOUTPUTLEVEL="">
       <MvFUNCTIONRETURN VALUE="1">
    </MvFUNCTION>
    
    <MvFUNCTION NAME="ComponentModule_Initialize" PARAMETERS="module var,item,all_settings var,settings var" STANDARDOUTPUTLEVEL="">
    
       <MvFUNCTIONRETURN VALUE="1">
    </MvFUNCTION>
    
    <MvFUNCTION NAME="ComponentModule_Render_End" PARAMETERS="module var,item,all_settings var,settings var,param" STANDARDOUTPUTLEVEL="">
       <MvFUNCTIONRETURN VALUE="1">
    </MvFUNCTION>

    You will want to of course change the settings for:

    Code:
    <MvFUNCTION NAME="Module_Description" PARAMETERS="module var" STANDARDOUTPUTLEVEL="">
      <MvASSIGN NAME="l.module:code"      VALUE="pm_myCustom">  (a short code that will be used to identify the module internally.
      <MvASSIGN NAME="l.module:name"      VALUE="My Custom Module"> (the name of the module as it will appear in the store's admin
      <MvASSIGN NAME="l.module:provider"  VALUE="My Company">
      <MvASSIGN NAME="l.module:version"   VALUE="5.00">
      <MvASSIGN NAME="l.module:api_ver"   VALUE="5.60">
    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: Help getting started on creating a custom module

      What about the <MvASSIGN NAME = "l.module:features" VALUE = " ">? Is that needed also, or can I leave that out?

      Comment


        #4
        Re: Help getting started on creating a custom module

        RE: Start with the System module example in the lastest LSK (the 4thebest.com stuff is out of date). You will probably want to also make that system module a Component module. This step is simple: to <MvASSIGN NAME="l.module:features" VALUE="system"> add <MvASSIGN NAME="l.module:features" VALUE="system, component">
        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

        Working...
        X