balebond Posted November 12, 2008 Share Posted November 12, 2008 Does anyone know if there is a way to populate a custom product field via url like you can with variables like language and promocode? I know I can do this for example: cart.php?a=add&pid=1&promocode=TEST Is there anyway to accomplish it for custom fields... something like this?: cart.php?a=add&pid=1&customfield[20]=sometext 0 Quote Link to comment Share on other sites More sharing options...
balebond Posted November 30, 2008 Author Share Posted November 30, 2008 Anybody know on this? It would be extremely helpful to me. Matt? 0 Quote Link to comment Share on other sites More sharing options...
moronhater Posted October 11, 2009 Share Posted October 11, 2009 I want to know the same thing. I've search forums for last 3 hrs. Pissing me off. No-one can answer this. 0 Quote Link to comment Share on other sites More sharing options...
franklaval Posted February 5, 2010 Share Posted February 5, 2010 Ya same here 0 Quote Link to comment Share on other sites More sharing options...
Erik H. Posted February 5, 2010 Share Posted February 5, 2010 Anyone thought of mailing the SUPPORT team instead of placing a reply in this topic? (just my 2 cents) 0 Quote Link to comment Share on other sites More sharing options...
rmccny Posted February 5, 2010 Share Posted February 5, 2010 You can do it with a little jQuery magic... Put this in any template that you want to populate a custom field: {literal} <script type="text/javascript"> $(document).ready(function(){ $("input[name=customfield\[CUSTOMFIELD\]]").val("{literal}{$smarty.get.VAR}{/literal}"); }); </script> {/literal} Change CUSTOMFIELD to the numeric ID of the field, and change VAR to the name of the variable passed in the URL. Works like a charm, I use it in many areas of my site. It can also be accomplished using actionhooks, however it's a bit more complicated. 0 Quote Link to comment Share on other sites More sharing options...
franklaval Posted February 5, 2010 Share Posted February 5, 2010 When a put your code in the configureproducts.tpl i got a blank page ??? 0 Quote Link to comment Share on other sites More sharing options...
rmccny Posted February 6, 2010 Share Posted February 6, 2010 That's what I get for not actually testing code before posting it. There was a typo in the {literal}s. This one definately works because I just tested it. This code works: {literal} <script type="text/javascript"> $(document).ready(function(){ $("input[name=customfield\[CUSTOMFIELD\]]").val("{/literal}{$smarty.get.VAR}{literal}"); }); </script> {/literal} Change CUSTOMFIELD to the numeric ID of the field, and change VAR to the name of the variable passed in the URL. 0 Quote Link to comment Share on other sites More sharing options...
weblantis Posted February 6, 2010 Share Posted February 6, 2010 Here is another approach which I think is even more straight forward: http://forum.whmcs.com/showthread.php?p=138610#post138610 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.