Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Members Only Box


jspice

Recommended Posts

Posted

Hello All:

 

I have two groups set up for my shop, "Retail" and "Member". I am trying to set up a box that shows a "join" teaser to those not logged in, and to "Retail" shoppers. I want the content to be different for logged in "Members".

 

Following is the code I have written for the box, and I just can't get it to work. Any help on this syntax problem would be greatly appreciated.

<?php

  $boxHeading = 'Membership';

  $boxContent_attributes = ' align="center"';

  $boxLink = '';

 

 

$boink=(tep_db_query("select customers_group_name from " . TABLE_CUSTOMERS . " where customers_id = '$customers_id'"));

 

if (tep_session_is_registered('customer_id')) && ($boink='Member') {

 

$boxContent = 'The prices you see when logged in reflect a 25% savings over regular retail prices.';

 

} else {

 

$boxContent = '<a href="http://www.otherdomain.com"><img src="http://www.mydomain.com/images/join.gif" border="0" alt="Buy a Membership" title="membership" width="150" height=""><br>Learn More!</a>';

 

  require(DIR_WS_TEMPLATES . TEMPLATENAME_BOX);

 

  $boxLink = '';

  $boxContent_attributes = '';

 

?>

It's the "if...&&..." statement that is giving me problems. I can make it work with one condition (logged in), but not both.

 

I thought the $boink name would avoid conflictions with other reserved names.

 

Thanks in advance

 

Spice

Posted

$boink=(tep_db_query("select customers_group_name from " . TABLE_CUSTOMERS . " where customers_id = '$customers_id'"));

if (tep_session_is_registered('customer_id')) && ($boink='Member') {

should be

$boink_query=(tep_db_query("select customers_group_name from " . TABLE_CUSTOMERS . " where customers_id = '$customers_id'"));

if (tep_session_is_registered('customer_id')) && ($boink=tep_db_fetch_array($boink_query)) && ($boink['customers_group_name'] == 'Member') {

Hth,

Matt

Posted

Yeah that makes sense, but I still get the same parse error. Here is the amended code and the error.

<?php

  $boxHeading = 'Club Mo\'s Membership';

  $corner_left = 'square';

  $corner_right = 'square';

  $boxContent_attributes = ' align="center"';

  $boxLink = '';

 

 

$boink_query=(tep_db_query("select customers_group_name from " . TABLE_CUSTOMERS . " where customers_id = '$customers_id'"));

 

if (tep_session_is_registered('customer_id')) && ($boink=tep_db_fetch_array($boink_query)) && ($boink['customers_group_name'] == 'Member') {

 

$boxContent = 'The prices you see when logged in reflect a 25% savings over regular retail prices. <br><br><a href="http://www.mosgourmet.com/pagemaker">Create or edit your Club Mo\'s homepage</a>';

 

} else {

 

$boxContent = '<a href="http://www.mosgourmet.com/product_info.php?products_id=207"><img src="http://www.mosgourmet.com/images/join_club_mos.gif" border="0" alt="Buy a Mo\'s Gourmet Membership" title="membership" width="150" height=""><br>Learn More!</a>';

 

 

 

  require(DIR_WS_TEMPLATES . TEMPLATENAME_BOX);

 

  $boxLink = '';

  $boxContent_attributes = '';

 

?>

And the error...
Parse error: parse error in /home/excards/public_html/mosgourmet/includes/boxes/membership.php on line 11
where line 11 is the if...&& statement.

 

Any input?

 

Spice

Posted

if (tep_session_is_registered('customer_id') && ($boink=tep_db_fetch_array($boink_query)) && ($boink['customers_group_name'] == 'Member')) {

) was in the wrong place. Sorry, didn't check parentheses last time.

 

Hth,

Matt

Posted

I found my problem. I originally had:

where customers_id = $customers_id
whereas I needed:
where customers_id = $customer_id
I was beginning to question my sanity.

 

Thanks again.

 

Spice

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...