Announcement

Collapse
No announcement yet.

MvCapture equivalent for Templates/storemorph

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

    MvCapture equivalent for Templates/storemorph

    Last I had checked mvt:capture wasn't yet available for template scripting. Is this still the case?

    If not, what or is there an equivalent?

    More info: I am needing to run some static JSON through mvt:call. An MvCapture capability would make this easy. So what's my alternative?

    Thanks.

    Scott
    Need to offer Shipping Insurance?
    Interactive Design Solutions https://www.myids.net
    MivaMerchant Business Partner | Certified MivaMerchant Web Developer
    Competitive Rates, Custom Modules and Integrations, Store Integration
    AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
    My T-shirt Collection is mostly MivaCon T-shirts!!

    #2
    I have a blog article with some code for converting Miva objects to JSON: http://themagicm.com/store/miva-json...revisited.html. I don't know if it's possible to convert the Miva Script to template code; but you could paste it into a small utility module and call it with mvt:do tags on your template. Also, I think Ray Yates has built this functionality into his Toolbelt module.

    HTH --
    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


      #3

      HTML Code:
      <mvt:call METHOD          = "RAW"
                ACTION          = "https://someurl"
                CONTENT-TYPE    = "application/json"
                HEADERS         = " 'Authorization: Basic xxxxxxx' $ asciichar( 13 ) $ asciichar( 10 ) "
                FIELDS          = "l.json">
         <MvEVAL EXPR = "{ s.callvalue }">
      </mvt:call>
      Can't recall where I derived this example, but attempting to use it. The var l.json is valid json. There is no complaint from compiling the template. Running the page says fields line is "Array index must be positive integer." OK, but when the contents of this var is a simple string instead I don't see a complaint. My conclusion: The JSON content needs to handled somehow. I'm assigning the json with mvt:assign. So, what do I do?

      Scott
      Need to offer Shipping Insurance?
      Interactive Design Solutions https://www.myids.net
      MivaMerchant Business Partner | Certified MivaMerchant Web Developer
      Competitive Rates, Custom Modules and Integrations, Store Integration
      AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
      My T-shirt Collection is mostly MivaCon T-shirts!!

      Comment


        #4
        I haven't used mvt:call, but I think maybe you need to put quotes around l.json in the FIELDS attribute. -- single quotes, that is, inside the double quotes. This may be needed for some of the other attributes too. I know Store Morph parses tag attributes differently from Miva Script, but I'm not sure of the exact rules; they may vary from one attribute to another. (Is there a document somewhere that explains that?)
        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


          #5
          Have you tried rendering the s.callvalue entity as mvtj:

          (May have to first use mvt:assign with a system variable)
          http://www.alphabetsigns.com/

          Comment


            #6
            I was trying to prototype with smt, but this isn't working. I switch to a component module. I am able to get back responses that confirm I talking to the server but the errors I get back are that the server isn't recognizing the formatting of the JSON. I am guessing that part of the issue is I may not know enough about JSON, but the DOCS for this server are presumably supplying valid JSON examples.

            Main error on the request that should be working is this:

            HTTP/1.1 415 Unsupported Media Type

            This seems to suggest that the JSON isn't correct, formatted incorrectly, or the string isn't being recognized. Another tidbit I found was that the Content-Type is being read after the fact. But I'm not sure that applies here.
            Need to offer Shipping Insurance?
            Interactive Design Solutions https://www.myids.net
            MivaMerchant Business Partner | Certified MivaMerchant Web Developer
            Competitive Rates, Custom Modules and Integrations, Store Integration
            AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
            My T-shirt Collection is mostly MivaCon T-shirts!!

            Comment


              #7
              http://www.miva.com/forums/forum/des...ray-via-mvcall

              I switched to a component module style solution based on Burch's code from that post. This issue I was having was that the JSON string in the MvCapture was being crunched to NULL for some reason. Maybe I missed something in the syntax but it always compile. When executed l.json was NULL. My solution was to construct the JSON using mvassign.

              Wasn't ideal to have to do this but it worked. So much for quickly prototyping something aye....
              Need to offer Shipping Insurance?
              Interactive Design Solutions https://www.myids.net
              MivaMerchant Business Partner | Certified MivaMerchant Web Developer
              Competitive Rates, Custom Modules and Integrations, Store Integration
              AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
              My T-shirt Collection is mostly MivaCon T-shirts!!

              Comment

              Working...
              X