Price Group ID and Redirection After Payment

Discussion in 'Customization & add-ons' started by basichip, Jul 21, 2010.

  1. basichip

    basichip New Member

    Joined:
    Mar 25, 2007
    Messages:
    22
    Hello -

    I have searched and cannot find a solution amongst all the great advice within this forum specific to my situation. Please keep in mind I am a novice at customizing files but can perform simple edits with clear instruction.

    I have several sets of products with different Price Group ID's assigned. Each set contains several products I link to these groups with signup / login URL's from various web pages For example:

    Product Group A = http://www.myurl/amember/member.php?price_group=1
    Product Group B = http://www.myurl/amember/member.php?price_group=2
    Product Group C = http://www.myurl/amember/member.php?price_group=3
    Product Group D = http://www.myurl/amember/member.php?price_group=4

    This works just as it should, only the products I want displayed appear in the selection menu on the signup and member pages.

    The problem comes when a subscriber selects product, pays for it and is redirected from my "thank you" page back to the member page to access it. Now ALL PRODUCTS FROM ALL GROUPS are displayed and this could be confusing, not to mention cluttered and unorganized looking.

    I hope I do not have to create duplicate products with neg and pos ID values as my product list is long. Very long. If I can just get past this stumbling block, I am home free! Thank you in advance for any tips or changes to code.

    Ford
  2. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    you have a few options:

    1) you could take your existing positive price groups and make them negative. This way you have no duplicate products and the products show only where you specifically want them.

    2) you can customize the member and signup pages to exclude listing certain price groups by modifying the core to do so.
  3. basichip

    basichip New Member

    Joined:
    Mar 25, 2007
    Messages:
    22
    Thank you for your response.

    I tried option 1 using negative values. It's fine in signup or member login when linked as follows:

    http://www.myurl/amember/signup.php?price_group=-1
    or
    http://www.myurl/amember/member.php?price_group=-1

    The problem there is when redirected, now NOTHING appears in the selection box. So I went from all to nothing. I just want products from Price Group ID -1 (or the variable price group) shown after redirecting.

    For what it's worth - and this my be an important clue - my "thank you" page contains a "click here" link to access product.

    The path of the link is:
    http://www.myurl/amember/login.php

    Next page says user is being redirected to protected area and lands back on the member page, where the product just purchased is displayed. but the selection box is empty.

    URL in address bar is:
    http://www.myurl/amember/member.php

    I understand that with this address and all neg values, it would be empty.

    So the question is, how do I redirect back to:
    http://www.myurl/amember/member.php?price_group=-1

    With a variable for each price group?

    I am fine with simple editing of code provided I have clear instruction, I'm a clueless novice.

    Thanking you kindly -

    Ford

    PS - Wouldn't this be a typical scenario for anyone using multiple price groups? I would think this would be a common question with an easy solution. This leads me to wonder if there is something unique within my setup that is causing this to happen.
  4. basichip

    basichip New Member

    Joined:
    Mar 25, 2007
    Messages:
    22
    After sifting through threads, I'm pretty sure the problem lies within my thanks.html page.

    The path of the link on this page to access product is currently:
    http://www.myurl/amember/login.php

    I need to edit to:
    http://www.myurl/amember/member.php?price_group=-1

    Or -2 or -3 or -4, or the corresponding price group ID.

    I experimented with this line of thanks.html:

    <strong>#_TPL_THX_ENJOY|<a href="{$config.root_url}/login.php">|</a>#</strong>

    I think all I have to do is edit it to:

    <strong>#_TPL_THX_ENJOY|<a href="{$config.root_url}/member.php?price_group=HELP ME">|</a>#</strong>

    Can someone please confirm if I am on the right track and provide a value for HELP ME which will be a wild card value for all price groups I have?

    Thanks.

    Still not getting why anyone that has ever used price groups had not had the same problem redirecting back and displaying ALL PRODUCTS.
  5. basichip

    basichip New Member

    Joined:
    Mar 25, 2007
    Messages:
    22
  6. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,274
    thanks.html modifications will not help, because this will not work when user will navigate to /amember/member.php he will be redirected to default renewal page.
    Here is how this can be done:
    1. Add custom filed to store price_group in user's profile. (field should have price_group name)
    2. Then at thge top of member.php after check.inc.php include add this code:
    if(!$_REQUEST[price_group] && $_SESSION[_amember_user][price_group]){
    header("Location: /amember/member.php?price_group=$_SESSION[_amember_user][price_group]");exit;
    }

    Price group will be stored when user signup and then when user will try to access member.php without price group, he will be redirected to correct page.
  7. basichip

    basichip New Member

    Joined:
    Mar 25, 2007
    Messages:
    22
    Alex, thank you, but remember, you are an expert talking to a novice.

    1. Add custom filed to store price_group in user's profile. (field should have price_group name)

    Sorry, I have no idea what this means. How do you do this? What custom filed (sic?) Where is user's profile? What user?

    Tried step 2 on it's own, but had no success.

    I need more help and specific information please.

    Why is what I am trying to accomplish not more clearly defined or built into the program? It would seem to me that anybody using price groups would want the user to see only the products shown on signup/login from a unique page to see only them when redirected. I don't get it.
  8. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,274
    1. You can add that field from aMember CP -> Add fields.
    Set field type to SQL. Name should be "price_group" exactly.
  9. basichip

    basichip New Member

    Joined:
    Mar 25, 2007
    Messages:
    22
    Anton from support added this field. See attached image. Is this correct? I checked SQL, per your instructions, he had Common field (default) checked. Do I need a field for each price group?

    He also added this to member.php.

    require($config['plugins_dir']['protect'] . '/php_include/check.inc.php');


    if($_REQUEST['price_group'] && !$_SESSION['_amember_user']['data']['price_group']){
    $u = $_SESSION['_amember_user'];
    $user_=$db->get_user($u['member_id']);
    $_SESSION['_amember_user']['price_group']=$user_['data']['price_group']=$_REQUEST['price_group'];
    $db->update_user($user_['member_id'],$user_);
    }
    if(!$_REQUEST['price_group'] && $_SESSION['_amember_user']['data']['price_group']){
    header("Location: /amember/member.php?price_group=".$_SESSION['_amember_user']['data']['price_group']);exit;
    }

    It differs from the instruction you gave, but is placed as specified (afer check.inc.php).

    Unfortunately, I am still not getting the results I want, all products still appear after redirection.

    One last try and then I will give up on price groups. Thanks.
  10. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,274
    I will take ticket you have in helpdesk and will implement correct solution.

Share This Page