Announcement

Collapse
No announcement yet.

Pulling Custom Order Field data into the Template Based Batch Reports

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

    #16
    Re: Pulling Custom Order Field data into the Template Based Batch Reports

    Originally posted by Brennan View Post
    What code are you using on the emails to display the data?

    Are you displaying the custom basket data or the custom order data?
    Not sure I understand the question. I am reading the custom field the same exact way on the invc, batch rpt, conf emails. The custom field data is available and present in the manage orders. The same data isn't displayed when the order is placed and the conf email are generated, but show up when creating the conf email in manage orders.

    So, why is it different when the same same template is executed when the order is placed compared to a post process in admin?

    Code:
    <mvt:item name="customfields" param="Read_Order( g.order_id, 'addinfo' )" />
    -*-&mvt:customfields;<br/>
    <mvt:comment>Not the global here</mvt:comment>
    <mvt:item name="customfields" param="Read_Order( l.settings:order:id, 'addinfo' )" />
    *-* &mvt:customfields;<br/>
    NOTES you might need to know if I haven't already explained:

    The only differences might be that I've replaced &mvt: with &mvte:

    I am obviously repeating and flagging in this code to decide on the global or the local var.

    As I also mentioned, I am writing to the Basket in the OPAY screen and reading the order data in following screens.

    It makes sense to me that once the basket data (all the data including the custom field data) is transferred to Order, then reading the Order on the invoice makes perfect sense.

    It makes sense also that if I needed the custom order data prior to an order generated, I would read the basket data. Something I am not doing here.

    Thanks.
    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


      #17
      Re: Pulling Custom Order Field data into the Template Based Batch Reports

      What does your write code look like?

      I just tired it on my dev store, and I was able to get custom field to display in the emails when the order is placed.
      Brennan Heyde
      VP Product
      Miva, Inc.
      [email protected]
      https://www.miva.com

      Comment


        #18
        Re: Pulling Custom Order Field data into the Template Based Batch Reports

        Originally posted by Brennan View Post
        What does your write code look like?

        I just tired it on my dev store, and I was able to get custom field to display in the emails when the order is placed.
        I am pretty sure I followed your info you gave prev in this thread.

        OSEL screen:
        Here's the html to get the data.

        Code:
        <div>
               <textarea id="addinfo" name="AddInformation" cols="30" rows="5"></textarea>
        </div>
        OPAY screen:
        addinfo is the order custom field code.

        probably redundant, Next, I make sure the HTML variable is a mivascript global.

        Code:
        <div>
        	<mvt:assign name="g.AddInformation" value="AddInformation" />
        	<p>&mvt:global:AddInformation;</p>
        </div>
        Now I can write the data.

        Code:
        <mvt:item name="customfields" param="Write_Basket( 'addinfo', g.AddInformation )" />
        Has to be a basket because an order_id hasn't been created yet, unless the order id is assigned to a basket var that I'm not detecting. Then I should be able to use write_order if that is the case.

        Still, this data is part of the order when OPAY screen is submitted and IMO, the data should be available to all the fulfillment mods, including template based emails.

        Thanks
        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


          #19
          Re: Pulling Custom Order Field data into the Template Based Batch Reports

          I think I was able to figure out what it is going on. The Order Emails and the Custom Fields module are both fulfillment modules. Miva runs the fulfillment modules in the order they were installed in the store. Since the Order Emails module is installed by default and the Custom Fields module is not, the Custom Fields module will always run its functions second.

          Because of this when the order emails are being sent, the basket fields, have not been copied over to be Order Fields.

          There are a couple solutions:

          1. Add code for Read_Basket as well as Read_Order on the emails. The Read_Basket will work when the order is first being placed, and the Read_Order will work when you trigger the emails via the admin.

          2. Technically the order id is available after OCST gets submitted. Instead of using custom basket fields with Write_Basket, you could write the data directly to a Custom Order Field using this:

          Code:
          <mvt:item name="customfields" param="Write_Order(g.basket:order_id, g.AddInformation)" />
          This would save it directly to a custom order fields. The only downside to this would be if the customer never completes the order you will have some orphaned data in the table.
          Last edited by Brennan; 08-20-13, 09:08 AM.
          Brennan Heyde
          VP Product
          Miva, Inc.
          [email protected]
          https://www.miva.com

          Comment


            #20
            Re: Pulling Custom Order Field data into the Template Based Batch Reports

            Thanks Brennan. Read_Basket in the Template emails solved the issue.

            I have a suggestion. I am not sure if this classifies as a bug or enhancement request. It seems the custom Order field data needs to be available when the template conf emails are generated, or before other fulfillment modules. So, If the customfields module gets installed, it seems it should be executed before other mods that will be reading order data. There is probably other logic that this should be able to take care of this. But the result for the template emails is a bit clumsy by having to insert both forms of code (Read_Order and Read_Basket) in order to retrieve the same data.

            Thanks again,

            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


              #21
              Re: Pulling Custom Order Field data into the Template Based Batch Reports

              Hey Scott -

              I spoke with our development team about the issue today. They are going to think though a solution to make this work read_order in a future release.
              Brennan Heyde
              VP Product
              Miva, Inc.
              [email protected]
              https://www.miva.com

              Comment


                #22
                Re: Pulling Custom Order Field data into the Template Based Batch Reports

                Thanks Brennan.
                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


                  #23
                  Re: Pulling Custom Order Field data into the Template Based Batch Reports

                  Originally posted by Brennan View Post
                  1. Add code for Read_Basket as well as Read_Order on the emails. The Read_Basket will work when the order is first being placed, and the Read_Order will work when you trigger the emails via the admin.
                  I've done this. When I place a test order and view the order through Manage Orders, the custom field tab shows the data I collected curing checkout. However, no custom field data shows up in my merchant order confirmation email.

                  See my full description on this thread.

                  Comment


                    #24
                    Re: Pulling Custom Order Field data into the Template Based Batch Reports

                    Originally posted by wajake41 View Post
                    More on this. The code mentioned in my previous post worked on the INVC page, but did not work on the template merchant email. Still looking for answers. Larry
                    For it to show on merchant emails, you need both a Read_Basket and a Read_Orders line as per this post:

                    <mvt:item name="customfields" param="Read_Basket('coupon', g.coupon_code)" />
                    <mvt:item name="customfields" param="Read_Order(l.settings:order:id,'coupon')" />
                    &mvte:customfields:coupon;

                    Comment


                      #25
                      Re: Pulling Custom Order Field data into the Template Based Batch Reports

                      Has this been fixed?

                      Having issues getting the custom fields to show up on the original INVC screen and Emails though when re-posting the Customer Confirmation email, it works.

                      Code:
                                  <mvt:item name="customfields" param="Read_Order(l.settings:order:id, '' )" />
                                  <mvt:foreach iterator="field" array="customfields">
                                      <b>&mvte:field:name;:</b>&nbsp; &mvte:field:value;<br/>
                                  </mvt:foreach>
                      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


                        #26
                        Re: Pulling Custom Order Field data into the Template Based Batch Reports

                        Hi Bruce -

                        See this post here:

                        http://extranet.miva.com/forums/show...802#post412802
                        Brennan Heyde
                        VP Product
                        Miva, Inc.
                        [email protected]
                        https://www.miva.com

                        Comment


                          #27
                          Re: Pulling Custom Order Field data into the Template Based Batch Reports

                          Originally posted by Brennan View Post
                          I think I was able to figure out what it is going on. The Order Emails and the Custom Fields module are both fulfillment modules. Miva runs the fulfillment modules in the order they were installed in the store. Since the Order Emails module is installed by default and the Custom Fields module is not, the Custom Fields module will always run its functions second.

                          Because of this when the order emails are being sent, the basket fields, have not been copied over to be Order Fields.
                          Since upgrading to MM9, my custom field data isn't saving to the database when fields are completed during checkout. However, if I manually enter data into the custom fields on a particular order in Admin after it's been placed, then send the merchant confirmation email, the data shows up in the emails, as expected. What I can/t figure out is why the data isn't saving to the database when it is entered during checkout.

                          I use this code on my OCST page, where "custmrcmts" is the name of the custom field for collecting Customer Comments:

                          <textarea name="custmrcmts" wrap="soft" cols="80" rows="5"></textarea>

                          This is the only code I've ever used to collect the data. I've never used a Write_Basket on this page (which I've read about in this forum, which seems to be nevessary for some situations).

                          And then this code on the Printable Invoice page:

                          Code:
                          <mvt:item name="customfields" param="Read_Order(l.settings:order:id, 'custmrcmts')" /> <mvt:if expr="NOT ISNULL l.settings:customfields:custmrcmts"> <strong>CUSTOMER COMMENTS</strong>: &mvte:customfields:custmrcmts; <mvt:else> </mvt:if>
                          And this code on my Merchant Email:

                          Code:
                          <mvt:item name="customfields" param="Read_Basket('custmrcmts',g.custmrcmts)" /> <mvt:item name="customfields" param="Read_Order(l.settings:order:id,'custmrcmts')" /> 
                                          
                                          <mvt:if expr="NOT ISNULL l.settings:customfields:custmrcmts">
                                              <h2>Customer Comments</h2>
                                              &mvte:customfields:custmrcmts; 
                                          <mvt:else>
                                          </mvt:if>
                          This worked fine before the upgrade to MM9. I double-checked the the custom fields item is assigned to all three pages.

                          Any ideas what changed or what I am missing now?

                          Comment


                            #28
                            Re: Pulling Custom Order Field data into the Template Based Batch Reports

                            I just noticed that I accidentally overwrote this Write-Basket line on my OSEL page's "Basket Contents" template when I applied the MM9 template changes:

                            <mvt:item name="customfields" param="Write_Basket('custmrcmts', g.custmrcmts)" />

                            That should write Customer Comments to the database during checkout. However, putting that line back into the OSEL "Basket Contents" template, right at the end where it was before, still didn't solve the problem. When I place a test order, the value for the custom field (custmrcmts) still isn't being saved to the database.

                            I'm wondering if my custom fields, even though they appear in Utility Settings > Custom Fields, are also stored in a file that could have been over-written during the MM9 upgrade… For instance, this file was overwritten during the upgrade: modules/util/customfld.mvc

                            Were custom fields created pre-MM9-upgrade stored in there perhaps? Or, is it sufficient that I see them in Utility Settings > Custom Fields enough to mean they should be working?
                            Last edited by skepticwebguy; 02-09-15, 02:01 PM.

                            Comment


                              #29
                              Re: Pulling Custom Order Field data into the Template Based Batch Reports

                              I solved the problem.

                              Putting this line back into the OSEL Basket Contents page was crucial:

                              Code:
                              <mvt:item name="customfields" param="Write_Basket('custmrcmts', g.custmrcmts)" />
                              But that didn't solve the problem.

                              I had to delete and recreate the custom field using the same name as before. After that, comments left during checkout on a test order were written to the database, and appear on the merchant email and printable invoice, as expected.
                              Last edited by skepticwebguy; 02-09-15, 02:25 PM.

                              Comment

                              Working...
                              X