Miva Merchant Community Forums
-
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 at 03:41 PM.
-
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.
-
Re: Query string variables to custom field
-
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 at 09:57 AM.
-
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 at 01:05 PM.
-
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 at 02:14 PM.
-
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?
-
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?
-
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)
-
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.
Posting Rules
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules