Upgrading from mm4 to mm5.5 API question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PJackson
    Mivite Lite

    • Nov 2012
    • 2

    #1

    Upgrading from mm4 to mm5.5 API question

    G'day All,
    We are upgrading from mm4 to mm5.5 and I could not find any info. on the FulfillmentModule_Invoice_Footer, will the old code that I have still work?
    The code looks like:
    <MvASSIGN NAME = "l.orders_id" VALUE = "{ orders.d.id }">
    <MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ OrderItem_FindFirst_Order( l.orders_id ) }">

    If found then in a loop:
    <MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found_opt" VALUE = "{ OrderOption_FindFirst_Line( l.line_id ) }">
    and:
    <MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ OrderItem_FindNext_Order( l.orders_id ) }">
    I access details from the orders like:
    <MvASSIGN NAME = "g.mm_orders_ship_fname" VALUE = "{ orders.d.ship_fname }">

    I also check for coupons:
    <MvOPEN NAME="ordrchrg" database="Merchant2/00000001/ordrchrg.dbf" indexes="">
    <MvGO NAME="ordrchrg" row="top">
    <MvASSIGN NAME="l.coupon" VALUE="">
    <MvWHILE EXPR="{NOT ordrchrg.d.eof}">
    <MvCOMMENT> Coupon - SPECWDC01 </MvCOMMENT>
    <MvIF EXPR="{ordrchrg.d.order_id EQ l.order_id AND 'SPECWDC01' CIN ordrchrg.d.desc}">
    <MvASSIGN NAME="l.coupon" VALUE="SPECWDC01">
    <MvWHILESTOP>
    </MvIF>
    <MvSKIP NAME="ordrchrg">
    </MvWHILE>
    <MvCLOSE NAME="ordrchrg">
    Is the above code still correct or is there a better way?

    Also, what is the return value in Module_API_Version and Module_Version please - thanks.

    TIA

    Regards, Peter

  • burch
    Administrator

    • Mar 2009
    • 630

    #2
    Re: Upgrading from mm4 to mm5.5 API question

    The 5.x API is significantly different than 4.x:

    FulfillmentModule_Invoice_Footer no longer exists
    The code you listed will not function, as the database API is completely different, and in most cases the dBase files you are referencing do not exist at all (MySQL stores, for example)
    Module_API_Version and Module_Version no longer exist and have been replaced (along with other functions) by Module_Description

    Documentation on updating from the 4.x API was last updated some time in 2004 or 2005, so it's very difficult for me to provide you with a simple answer of what you will need to change. However, I suggest you look in this thread, specifically this post for starters, as well as the current 5.x API guide at http://www.mivamerchant.com/apiguide. It would probably also be helpful to download the limited source kit from http://www.mivamerchant.com/products/MIVA-MMDL_5 and look at the fulfillment modules it contains for examples.

    Comment

    • PJackson
      Mivite Lite

      • Nov 2012
      • 2

      #3
      Re: Upgrading from mm4 to mm5.5 API question

      G'day Burch,
      Thank you very much for this. I have downloaded the LSK and it will take quite some time to review - thanks.
      I think that the problem is I'm asking for a direct translation from 4.22 to 5.5 which is too much to ask, which I do understand.
      Therefore, what I need is advise on how to do the following:
      I need to access the orders table record for the current order being processed and build a list of products for that order also for each order item I need to get the order options attri_code with a specific value and then get the order options opt_code.
      I then need to set some global variables using the orders file like ship_fname, ship_email, etc
      Finally I need to <MvDO> a compile Miva script that will do a lot of work and also provide HTM code that must be displayed on the final fulfilment page. This HTM code could be stored in a global variable for subsequent display.

      TIA

      Regards, Peter

      Comment

      • burch
        Administrator

        • Mar 2009
        • 630

        #4
        Re: Upgrading from mm4 to mm5.5 API question

        Either modules/fulfill/meremail.mv or modules/fulfill/custeml.mv in the LSK would be a good place for you to start looking. They are both fulfillment modules and demonstrate loading the contents of an order.

        If you store HTML to be displayed in a global variable, it could be output in the INVC template using a StoreMorph token reference. For example, &mvt:global:variablename;

        For anything more complicated you would need to look into implementing the component API and doing a deeper integration with the template system.

        Comment

        Working...
        X