Announcement

Collapse
No announcement yet.

Query string variables to custom field

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

    Query string variables to custom field

    can someone tell me how to take variables passed with an url (going to ACNT page) and save them to hidden custom fields and/or some sort of session variable?

    ie http://www.mysite.com/do.php?t=12345&s=1

    custom_field_1 = value of t
    custom_field_2 = value of s

    I wanted to try a special email using a unique url generated and emailed to people who take a survey. If they then complete the account creation AND the specified global variable or custom_field exists indicating they also completed the survey, then I want to show them a coupon code.

    Something like
    <mvt:if expr="g.Action EQ 'ICST' AND [custom field or global] ">
    Thank you for taking the survey and creating an account. Here is your special code: 12345
    </mvt:if>

    Thanks for any help.
    Last edited by habreu; 01-22-13, 04:41 PM.

    #2
    Re: Query string variables to custom field

    Either save the value to a cookie (no module needed) or use the Emporium Plus Tool Kit to save the value to a custom customer field.
    Bill Weiland - Emporium Plus http://www.emporiumplus.com/store.mvc
    Online Documentation http://www.emporiumplus.com/tk3/v3/doc.htm
    Question http://www.emporiumplus.com/mivamodu...vc?Screen=SPTS
    Facebook http://www.facebook.com/EmporiumPlus
    Twitter http://twitter.com/emporiumplus

    Comment


      #3
      Re: Query string variables to custom field

      Thanks Bill.

      Comment


        #4
        Re: Query string variables to custom field

        Still banging my head on this and not quite right...

        I am testing a link like this
        https://www.allfrom1supply.com/merch...eyid=123456789

        on ACED I added
        <mvt:if expr="g.surveyid">
        <mvt:item name="toolkit" param="custinsert|SurveyID|g.surveyid" />
        </mvt:if>

        and on the STFNT I added

        <!-- begin new customer block-->
        <mvt:if expr="(g.ShowNewAccountMess) AND (g.Action EQ 'ICST')">
        <mvt:item name="toolkit" param="sassign|filepath|/merchant2/includes/new_cust_message_1.php" />
        <mvt:item name="toolkit" param="fileread|content|script|filepath" />
        &mvt:global:content;
        <!-- begin survey transaction-->
        <mvt:if expr="NOT ISNULL l.settings:customer:customfield_values:customfield s:SurveyID">
        Here is your coupon code: 12345
        </mvt:if>
        <!-- end survey transaction-->
        </mvt:if>
        <!--end new customer block-->

        When I use the link and create the account I check the customfield and it was empty. When I used it on an existing account, then logged out and back in it was there. Will pick at it again tomorrow.
        Last edited by habreu; 01-24-13, 10:57 AM.

        Comment


          #5
          Re: Query string variables to custom field

          Well skip it - I just don't know enough to sort this out as quick as I need it. One of the guys here knows php so I managed to work something out with toolkit's callurl which we are testing now. I'll probably keep playing with this on my own -and without the pressure. :) Thanks.
          Last edited by habreu; 01-24-13, 02:05 PM.

          Comment


            #6
            Re: Query string variables to custom field

            Guess I'm not done. I put the following code on the ACED page - not in a form - but the php script didn't get the variables. I want to be sure that this looks right.

            <!-- test survey variables-->
            <mvt:if expr="g.surveyid">
            <mvt:item name="toolkit" param="vassign|firstname|g.customer:Customer_ShipF irstName" />
            <mvt:item name="toolkit" param="vassign|lastname|g.customer:Customer_ShipLa stName" />
            <mvt:item name="toolkit" param="vassign|SurveyID|g.surveyid" />
            <mvt:item name="toolkit" param="callurl|survey|http://www.mysite.com/myfolder/dosomething.php|POST|SurveyID,firstname,lastname" />
            </mvt:if>
            <!-- test survey variables-->

            Thanks for your help.
            Last edited by habreu; 01-25-13, 03:14 PM.

            Comment


              #7
              Re: Query string variables to custom field

              A PHP script isn't going to be able read mivascript variables unless those variables are passed through the called script (via callurl) So, make sure that, for example, 'SurveyID' is actually how you pass the global "g.SurveyID". (BTW: if that last field in the callurl function is taking the actual globals, you don't need to assign them. Bascially, what you have is g.surveyID = g.surveyID.)

              Lastly, might it not be easier to just use:

              <input type="hidden" name="serveyID" value="&mvt:global:serveyID;">
              etc.

              and place those values inside the Form post?
              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


                #8
                Re: Query string variables to custom field

                Thanks for the response Bruce. I'm going to reveal just how little I know but the incoming page will have a ?surveyid=1234567890 appended, then when the person creates an account AND that surveyid exists we know they created an account at the end of the survey and want to write that to an sql database that is on another domain (we collect some stats on). If I put the value in the hidden input and the ACED page redirects to the SFNT page when the form is submitted ??? - not sure what the benefit of putting it in the hidden input is?

                Comment


                  #9
                  Re: Query string variables to custom field

                  You'd use the Toolkit on the SFNT page to CALL the php script.
                  <mvt:if expr="g.SurveyID">
                  <mvt:item name="toolkit" param="callurl|survey|http://www.mysite.com/myfolder/dosomething.php|POST|SurveyID" />

                  or

                  <mvt:item name="toolkit" param="callurl|survey|http://www.mysite.com/myfolder/dosomething.php|POST|g.SurveyID" />

                  </mvt:if>

                  (Not sure of the Tool kit syntax)
                  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


                    #10
                    Re: Query string variables to custom field

                    First - thanks for your help and patience. I can't seem to get it. I tried a manually created string and the php registers the value. But I put this in the form on the ACED page

                    <input type="hidden" name="surveyid" value="&mvt:global.surveyid;">


                    and in the SFNT page I put this

                    <mvt:item name="toolkit" param="callurl|survey|http://www.mysite.com/myfolder/dosomething.php|POST|surveyid" />

                    and tried it with

                    <mvt:item name="toolkit" param="callurl|survey|http://www.mysite.com/myfolder/dosomething.php|POST|g.surveyid" />


                    and I'm still not getting anything sent.

                    Comment


                      #11
                      Re: Query string variables to custom field

                      What is supposed to happen with this? Are you just sending data to a survey program? Or are you expecting to see a return value from that php file? If you want to see a return, you have to have &mvte:global:survey; to display the result at the end.
                      Bill Weiland - Emporium Plus http://www.emporiumplus.com/store.mvc
                      Online Documentation http://www.emporiumplus.com/tk3/v3/doc.htm
                      Question http://www.emporiumplus.com/mivamodu...vc?Screen=SPTS
                      Facebook http://www.facebook.com/EmporiumPlus
                      Twitter http://twitter.com/emporiumplus

                      Comment


                        #12
                        Re: Query string variables to custom field

                        No return value. The survey is on a 3rd party site. When they complete the survey they are sent to the Miva store ACNT page and passing the surveyid parameter which lets us know they have completed the survey. We wanted to then check and if they completed the survey AND create a new account we credit them $50. We looked at a few options but since we don't know enough Miva scripting, and this is just a one time application, we thought we'd use callurl to pass a php page the surveyid, customer number and maybe the name of the created account and write it to a database (we have someone who knows php) and then we can manually add the credit to those who create an account via this survey.
                        Last edited by habreu; 01-27-13, 11:12 PM.

                        Comment


                          #13
                          Re: Query string variables to custom field

                          Your logic is wrong. In your initial post you have g.Action EQ 'ICST'. That only happens at the point where a new customer saves their customer info by clicking the save button. The action in that form is ICST (insert customer). Once that has been done it cannot be done again later. Hence, you can't send them to complete a bunch of data at some php survey and return that data to create the same account again. You have to update a custom field for an existing customer. Hence the customer would need to be logged into miva, go off to the php survey, fill in the survey, then return from the php survey. The return could insert the code into the custom customer field of the currently logged in customer.

                          Alternatively, you could send them to the php first. The php would post back to your store where they could create an account. For example http://www.yourdomain.com/mm5/mercha...cialcode=12345 Then on the ACAD screen you would have a form input like <input type="hidden" name="specialcode" value="&mvte:global:specialcode;"> Then on the page where the customer lands after saving the account, e.g. ACLN or ACED or SFNT or whatever your store is set to, you would have the tool kit coding to save the specialcode value to the custom customer field or to trigger a discount coupon.
                          Bill Weiland - Emporium Plus http://www.emporiumplus.com/store.mvc
                          Online Documentation http://www.emporiumplus.com/tk3/v3/doc.htm
                          Question http://www.emporiumplus.com/mivamodu...vc?Screen=SPTS
                          Facebook http://www.facebook.com/EmporiumPlus
                          Twitter http://twitter.com/emporiumplus

                          Comment


                            #14
                            Re: Query string variables to custom field

                            Thanks for your responses Bill and Bruce. Took a few hours but I was able to sort it out on the ACAD screen and with the hidden input.

                            Comment


                              #15
                              Re: Query string variables to custom field

                              shouldn't it be <input type="hidden" name="surveyid" value="&mvt:global:surveyid;">

                              not
                              "&mvt:global:surveyid;">
                              Scott Bronstad
                              Marketing
                              Star Time Supply, Co. Inc.
                              http://store.startimesupply.com

                              Comment

                              Working...
                              X