josh48202 Posted December 17, 2009 Share Posted December 17, 2009 Hi everyone im trying to get links and other certain information to be displayed based on their group level. i added a row to the database called group_id every member is either a 1 or a 2. i also added these other bits of code as followed... in catelog/login.php i added group_id to $check_customer_query $check_customer_query = tep_db_query("select customers_id, group_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'"); i also added these as well to login.php $group_id = $check_customer['group_id']; tep_session_register('group_id'); everything from there works just fine. i added this code just for practice to get it working in the catelog/includes/column_right.php if (tep_session_is_registered('group_id')) require(DIR_WS_BOXES . 'loginbox.php'); Now this works and shows up if the member is registered and logged in. Now my question is.... How do i get this loginbox.php to only show up if the group_id is equal to 2? Link to comment Share on other sites More sharing options...
germ Posted December 17, 2009 Share Posted December 17, 2009 Hi everyone im trying to get links and other certain information to be displayed based on their group level. i added a row to the database called group_id every member is either a 1 or a 2. i also added these other bits of code as followed... in catelog/login.php i added group_id to $check_customer_query $check_customer_query = tep_db_query("select customers_id, group_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'"); i also added these as well to login.php $group_id = $check_customer['group_id']; tep_session_register('group_id'); everything from there works just fine. i added this code just for practice to get it working in the catelog/includes/column_right.php if (tep_session_is_registered('group_id')) Now this works and shows up if the member is registered and logged in. Now my question is.... How do i get this loginbox.php to only show up if the group_id is equal to 2? Something like this: <?php if ( ( tep_session_is_registered('group_id') ) && ( (int)$group_id == 2 ) ) require(DIR_WS_BOXES . 'loginbox.php'); ?> If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
josh48202 Posted December 17, 2009 Author Share Posted December 17, 2009 thanks for trying but that didnt work =[ Link to comment Share on other sites More sharing options...
josh48202 Posted December 17, 2009 Author Share Posted December 17, 2009 anyone else have an idea of why this isnt working? im running out of ideas and have been messing with it for the past couple hoursssss Link to comment Share on other sites More sharing options...
germ Posted December 18, 2009 Share Posted December 18, 2009 thanks for trying but that didnt work =[ I tried the code on site I manage and it works for me. :huh: If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
josh48202 Posted December 21, 2009 Author Share Posted December 21, 2009 hmmm strange il try it again Link to comment Share on other sites More sharing options...
josh48202 Posted December 21, 2009 Author Share Posted December 21, 2009 Nope same result.. nothing =[ Link to comment Share on other sites More sharing options...
burt Posted December 21, 2009 Share Posted December 21, 2009 echo the $group_id to determine the value, as it is possible it is not picking up the value you need. Link to comment Share on other sites More sharing options...
josh48202 Posted December 21, 2009 Author Share Posted December 21, 2009 when i echo $group_id it says "2" even if it is set to 1 Link to comment Share on other sites More sharing options...
josh48202 Posted December 22, 2009 Author Share Posted December 22, 2009 anyone else got any ideas? Link to comment Share on other sites More sharing options...
josh48202 Posted December 22, 2009 Author Share Posted December 22, 2009 alright i dont like that i cant edit my previous post so i dont have to double post but o well. i changed the code up in login.php $check_group_id_query = tep_db_query("select group_id from " . TABLE_CUSTOMERS . " where customers_id != '" . (int)$customer_id . "'"); $check_group_id = tep_db_fetch_array($check_group_id_query); $group_id = $check_group_id['group_id']; tep_session_register('group_id'); this works even when i echo $group_id but if i was to change the group_id value to anything else it wont change enless i empty cache and remove cookies. any ideas? Link to comment Share on other sites More sharing options...
germ Posted December 22, 2009 Share Posted December 22, 2009 alright i dont like that i cant edit my previous post so i dont have to double post but o well. i changed the code up in login.php $check_group_id_query = tep_db_query("select group_id from " . TABLE_CUSTOMERS . " where customers_id != '" . (int)$customer_id . "'"); $check_group_id = tep_db_fetch_array($check_group_id_query); $group_id = $check_group_id['group_id']; tep_session_register('group_id'); this works even when i echo $group_id but if i was to change the group_id value to anything else it wont change enless i empty cache and remove cookies. any ideas? Sounds like your session is getting lost. All I know is the code I posted works, provided the session isn't lost. In my test I set the value for $group_id on one page, and when I went to another and echo'ed it, it was exactly as I set it on the first page. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
josh48202 Posted December 22, 2009 Author Share Posted December 22, 2009 its pretty much the same exact code just separate from the rest of the code and i dont remember messing with any of the sessions but il take a look thanks for the tip Link to comment Share on other sites More sharing options...
josh48202 Posted December 22, 2009 Author Share Posted December 22, 2009 i just installed a fresh copy of oscommerce v2.2 with the same modifications as i said in the first post and the same modifications you said work and when i echo $group_id the same thing happens. i have to clear cookies for the number to change???????!!!!?!?!?!? Link to comment Share on other sites More sharing options...
josh48202 Posted December 23, 2009 Author Share Posted December 23, 2009 nevermind i started fresh and found Seperate Pricing Per Customer modification which works perfectly and used those variables to display certain information. sorry for the trouble and i really appreciate the help! =] Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.