Different Prices for Different Membership Levels

Discussion in 'PHP' started by lastMinutes, Aug 21, 2008.

  1. #1
    Can anyone give me a function/script that detects if a member is a free/paid one, and if it's for example, free, then how can I set the person to a different price for the same product that's publicly accessible (not just free members)?
     
    lastMinutes, Aug 21, 2008 IP
  2. Pos1tron

    Pos1tron Peon

    Messages:
    95
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    We're not magic workers you know - or at least free magic workers. We can't, believe it or not, create with no information about where that info is on your site a function that will tell us. Or at least, nothing better than the thing below, which just decides at random :)

    <?php
    function IsPaidUser() {
    	$random_answer = mt_rand(0, 1);
    	return $random_answer;
    }
    ?>
    PHP:
     
    Pos1tron, Aug 21, 2008 IP
  3. lastMinutes

    lastMinutes Peon

    Messages:
    91
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    :)

    I think the script is called a dynamic pricer or price descriminator.

    If anyone knows, please reply.

    Thanks.
     
    lastMinutes, Aug 21, 2008 IP
  4. lovelycesar

    lovelycesar Peon

    Messages:
    145
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    step 1)- You need to make a registration system with a mark field of free/paid members in database.
    step 2)-
    
    if(logged_in()){
    mysql_query = "SELECT * FROM your_database WHERE user_name ='$user_name_form'"; //or similar
    // next is you get a row fetch for data
    $free_or_paid = $above_row[x_number]; // 1 if free, 2 if paid
    if($free_or_paid == "1"){ $price1 = $fixed_price * 3;} // three folds of predefined normal price
    if($free_or_paid == "2"){ $price1 = $fixed_price;} // with this you can make many levels as you want
    }
    
    Code (php):
     
    lovelycesar, Aug 21, 2008 IP
  5. lastMinutes

    lastMinutes Peon

    Messages:
    91
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Hey thank you so much lovelycesar!

    step 1) already done.

    But the whole case is this:
    1. My membership area is already set up with the step 1) above.
    2. I want to integrate the site with FreeWebshop shopping cart because I just love its simplicity.
    3. Public and free users of the cart will get regular/normal price for any products, but paid members from the membership site would pay less (get discount).

    So how to secure everything?
     
    lastMinutes, Aug 21, 2008 IP
  6. lovelycesar

    lovelycesar Peon

    Messages:
    145
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I don't understand clearly. For security, if you use cookies for login system, the thing is encryption user's cookies or so on. And you should use SSL too (https://yousite). I didn't get FreeWebshop, but it seems having a user management system already. You need to hack some modules to integrate your modification.
     
    lovelycesar, Aug 22, 2008 IP