I've been over the code, but I can't figure out how I can get this to work. When a user clicks www.mysite.com/amember/signup.php?price_group=-1 they are taken to the signup page and only offered products from that price group. The initial visit to the site will be made via that link. How can I make it permanent so that they can not see products on our regular signup.php page if they navigate away from the page or come back later by entering www.mysite.com into the browser. I know how to set a cookie, I just don't know where to put the code to get amember to look for the cookie. Any ideas?
Just set all of your price groups to negative numbers then they won't show on the signup page unless invoked with ?price_group=
I need some to show up The problem is that I have three products that need to show up if the user gets to the site through normal navigation. However, there are some users whose companies pay for the memberships and we don't want them to be able to see the normal pricing. So, once they click the initial invitation I want a cookie set that will be picked up on subsequent visits and hide all of the regular products. I hope that makes sense. Besides, even if I did make all of the price goups negative, if a user navigates away from the sign up page (perhaps to view our 'about' page) when they go back to the signup page, it will not list any products because the 'price_group' variable doesn't even seem to persist for the session. Any ideas?
Hello, signup.php is what renders the template signup.html so I would assume in function show_payment_form you would do something. Jimmy
a solution Hi, I'm not sure if this is what you're looking for...but this may be a soltion (doesnt use cookies, rather writes it to the database). here's a really long post of me trying to figure it out with jimwrite (he helped a lot!!!). http://www.amember.com/forum/showthread.php?t=7919 But to cut a LOOOONG story short: * within Amember create a custom field called "price_group" (make sure it's of type SQL) then, change this block of code in member.html: Code: {if $config.member_select_multiple_products} {foreach from=$products_to_renew item=p} <input type="checkbox" id="product{$p.product_id}" name="product_id[]" value="{$p.product_id|escape}" {if in_array($p.product_id, (array)$smarty.request.product_id)}checked="checked"{/if} /> <label for="product{$p.product_id}"><b>{$p.title} ({if $p.price > 0 }{$config.currency|default:"$"}{$p.price}{else}free{/if})</b><br /> <span class="small">{$p.description}</span></label><br /><br /> {if $p.price <= 0.0 } {assign var="paysys_id_not_required" value="1"} {/if} {/foreach} {else} <select name="product_id" size="1"> <option value="0">#_TPL_MEMBER_SELECT#</option> {foreach from=$products_to_renew item=p} <option value="{$p.product_id}" {if $p.product_id == $smarty.request.product_id}selected="selected"{/if}>{$p.title} ({if $p.price > 0 }{$config.currency|default:"$"}{$p.price}{else}free{/if}) </option> {if $p.price <= 0.0 } {assign var="paysys_id_not_required" value="1"} {/if} {/foreach} </select> {/if} TO Code: {if $config.member_select_multiple_products} {foreach from=$products_to_renew item=p} {if $p.price_group == $smarty.session._amember_user.price_group} <input type="checkbox" id="product{$p.product_id}" name="product_id[]" value="{$p.product_id|escape}" {if in_array($p.product_id, (array)$smarty.request.product_id)}checked="checked"{/if} /> <label for="product{$p.product_id}"><b>{$p.title} ({if $p.price > 0 }{$config.currency|default:"$"}{$p.price}{else}free{/if})</b><br /> <span class="small">{$p.description}</span></label><br /><br /> {if $p.price <= 0.0 } {assign var="paysys_id_not_required" value="1"} {/if} {/if} {/foreach} {else} <select name="product_id" size="1"> <option value="0">#_TPL_MEMBER_SELECT#</option> {foreach from=$products_to_renew item=p} {if $p.price_group == $smarty.session._amember_user.price_group} <option value="{$p.product_id}" {if $p.product_id == $smarty.request.product_id}selected="selected"{/if}>{$p.title} ({if $p.price > 0 }{$config.currency|default:"$"}{$p.price}{else}free{/if}) </option> {if $p.price <= 0.0 } {assign var="paysys_id_not_required" value="1"} {/if} {/if} {/foreach} </select> {/if} And it should work...finally...try and use a different variable than price_group as suggested above. It does work, but if I was to do it again, I would chose a different one, as I have noticed it can get in the way of other modifications (because it has the same name). good luck! p.s. I'm not 100% sure if it will work if you change the price_group variable to something different...but I can't see why it shouldn't work. Just make sure you change the line: {if $p.price_group == $smarty.session._amember_user.price_group} to the new variable...you chose. let me know how you go...please!
here's what I did For the record here is what I did: I put this function at the top of signup.php function check_cookie(){ global $vars; if(isset($vars[price_group]))setcookie("price_group", $vars['price_group'], time()+60*60*24*30*12*2, "/", ".mysite.com", 0); elseif(isset($_COOKIE['price_group'])) { $vars['price_group']=$_COOKIE['price_group']; setcookie("price_group", $vars['price_group'], time()+60*60*24*30*12*2, "/", ".mysite.com", 0); } else unset($vars['price_group']); } Then I called it in signup.php in the "main" section i changed: $vars = & get_input_vars(); To: $vars = & get_input_vars(); check_cookie(); Now if a visitor comes to the site via a link passed to them such as www.mysite.com/amember/signup.php?price_group=-1 they will only see price group -1 even if they leave the page (or the site) and return via www.mysite.com. Thanks for the help. Your posts moved me in the right direction!
nice thanks for sharing the solution! I guess the only issue with your solution is if they go to the member.php they will still see all products...is that correct?
Hello, Just so people don't get confused ronniead and roibnsonryan had different issues/solutions even though they were very similiar. For ronniead he had people signing up but not completing payments. Because they signed up there was a member/user record created in aMember database that he could store price_group value in order to back reference the user. For roibnsonryan people were arriving at signup page but then navigating navigating away before completing signup. In this case no member/user record was created. Hence he used cookies to save the state information. Jimmy
member.php I assume that my solution won't affect member.php, but I haven't tested it out. The amember cp has enough options to control products once users have subscribed that I haven't needed to modify that part. However, you could use the same function in member.php. The only problem I can see is if your user clears cookies, they will see things within member.php that you may not have intended. jimjwright is correct. We each were trying to solve a different problem, but ronniead got me moving in the right direction. Thanks to all for the help!
Hello, If you want to limit what someone sees on members page you can always filter them via price_group by modifying either member.php or member.html. Thats basically what ronniead did.