Announcement

Collapse
No announcement yet.

Admin Bug: g.module_path variable different in admin.mvc and merchant.mvc

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

    Admin Bug: g.module_path variable different in admin.mvc and merchant.mvc

    Good Morning guys, I think this is a bug. g.module_path variables are different in admin.mvc and merchant.mvc

    Admin:
    g.module_root = /mm5/5.00/
    g.Module_Store_Module_Currency =
    g.Store_Module_Currency = modules/currency/usmoney.mvc

    Merchant:
    g.module_root = /mm5/5.00/
    g.Module_Store_Module_Currency = /mm5/5.00/modules/currency/usmoney.mvc
    g.Store_Module_Currency = 1,5.00,usmoney,87,modules/currency/usmoney.mvc,US Currency Formatting,Miva Merchant,1,9.0000

    I'm calling a function that contains [g.path].CurrencyModule_AddFormatting() in both the admin.mvc and merchant.mvc However, I am getting the following path error

    Runtime error in .... MvDO: The specified path references a directory that does not exist.

    For years I've been using [g.Module_Store_Module_Currency].CurrencyModule_AddFormatting( g.Store_Module_Currency, l.Shipping_Charge )

    However, that variable is now empty in the admin. So I switched to [g.module_root $ g.Store_Module_Currency]. That fixed the admin but crashed in merchant where g.Store_Module_Currency now contains a structure.

    Is this a bug? If so, what's the recommended workaround? I'd rather not fix this again after the next update.
    Last edited by RayYates; 03-02-15, 06:08 AM.
    Ray Yates
    "If I have seen further, it is by standing on the shoulders of giants."
    --- Sir Isaac Newton

    #2
    Re: Admin Bug: g.module_path variable different in admin.mvc and merchant.mvc

    After scanning the LSK I found this which works in the admin and merchant.

    [ g.Module_Root $ g.Store:currncy_mod:module ].CurrencyModule_AddFormatting( g.Store:currncy_mod, l.total )

    However I also found this. I'm not sure how it could work at all.

    orders.mv <MvEVAL EXPR = "{ JSON_Encode( [ g.Store_Module_Currency ].CurrencyModule_AddFormatting( g.Store_Module_Currency, l.order:total ) ) }">",
    Ray Yates
    "If I have seen further, it is by standing on the shoulders of giants."
    --- Sir Isaac Newton

    Comment


      #3
      Re: Admin Bug: g.module_path variable different in admin.mvc and merchant.mvc

      Yeah, I'd call it a bug ... but it's been that way for a few years now.

      Here's a little helper function I wrote to simplify my work. Besides handling this problem, it also contains a line to prevent that weird bug where the VM will destroy a variable's value when you read it.
      Code:
      <MvFUNCTION NAME="Curr" PARAMETERS="amount" STANDARDOUTPUTLEVEL="">
      	<MvASSIGN NAME="l.bugfix" VALUE="{ g.Store_Module_Currency }">		-- don't let VM bug clobber value
      	<MvIF EXPR="{ len(l.bugfix:module) }">
      		<MvDO FILE="{ g.Module_Root $ g.Store_Module_Currency:module }" NAME="l.out"
      		 VALUE="{ CurrencyModule_AddFormatting(l.dummy, l.amount) }">
      	<MvELSE>
      		<MvDO FILE="{ g.Module_Root $ g.Store_Module_Currency }" NAME="l.xx" VALUE="{ Module_Description(l.module) }">
      		<MvDO FILE="{ g.Module_Root $ g.Store_Module_Currency }" NAME="l.out"
      		 VALUE="{ CurrencyModule_AddFormatting(l.module, l.amount) }">
      	</MvIF>
      	<MvFUNCRETURN VALUE="{ l.out }">
      </MvFUNCTION>
      HTH --
      Last edited by Kent Multer; 03-03-15, 09:54 AM.
      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


        #4
        Re: Admin Bug: g.module_path variable different in admin.mvc and merchant.mvc

        The g.Store:currency_mod (module reference, added in PR7) was created to address this specific issue and is the correct value to use in all modern versions of Miva Merchant.

        Example usage:

        Code:
        <MvASSIGN NAME = "l.formatted_amount" VALUE = "{ [ g.Module_Root $ g.Store:currncy_mod:module ].CurrencyModule_AddFormatting( g.Store:currncy_mod, l.amount ) }">
        Ryan Guisewite
        Lead UI Developer / Miva, Inc.
        www.miva.com

        Comment

        Working...
        X