Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

PHP-MySQL question & how to hide the temporary shopping cart for guests?


hello_world_

Recommended Posts

Posted

Hi people,

 

Just installed oscommerce for the first time 4 days ago...without too many problems.

Nevertheless I've been trying to find answers to a couple of questions by Googling, browsing the forums,

but so far no luck.

 

 

1) For logged-in users I'd like to make a simple credits balance, somesort of bonus points they can

collect and which are considered as one of the currencies.

I already added an extra 'customers_points' column in the customers table where the amount of bonus points will be stored

and I'd like to output the number bonus points in the shopping cart box after the 'Your cart contains ... items' line.

I've tried adding a Select query in the includes/header.php file to get the value out of the database and display it

in the shopping cart box for a specific user.

Could someone please show me an example or give me some advice on how do this in oscommerce?

 

 

2) Is it possible to disable/hide the shopping cart box for visitors who are Not logged in? And vice versa

enable/show when people are logged in?

 

 

Thanks in advance.

Greetings.

Posted

- ok answer on 2 was quite easy I had my searchbox in the header and just added the following code:

 

<?php if (tep_session_is_registered('customer_id')) { 

<table> <!--table contents with the searchbox, could be anything else as well--> </table>

} ?>

 

Basically a very simple piece of code that will check if the current viewer is logged on and display the box/data only if he's logged on.

 

 

- answer on 1 took me a little longer to find out, because it wasn't really clear to me what codes oscommerce uses to replace normal

sql queries and variables.

 

But what it looks like is this:

 

<!-- check if the customer exists in the database with a select query and grab the data -->
$check_customer = tep_db_query("select customers_id, customers_funds, customers_firstname, customers_password, customers_lastname, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_id = '" . tep_db_input($customer_id) . "'");
$data_customer = mysql_fetch_array($check_customer);

<!-- display the data on the site with a link to the my account page -->
  echo 
  'Funds: <strong><a href="' . tep_href_link('account.php') . '">' . $currencies->format($data_customer['customers_funds']) . '</a></strong><br>';

Posted

How do you give customers "points"?

How do those "points" get deducted at the point of sale?

If there is a balance outstanding, can they then pay by normal means?

How is htis showon on the Invoice?

How are you accounting for the points balance?

 

And so on, and so forth.

Posted

- ok answer on 2 was quite easy I had my searchbox in the header and just added the following code:

 

<?php if (tep_session_is_registered('customer_id')) { 

<table> <!--table contents with the searchbox, could be anything else as well--> </table>

} ?>

 

Basically a very simple piece of code that will check if the current viewer is logged on and display the box/data only if he's logged on.

 

I'm confused..how does hiding the searchbox hide the shopping cart? I thought you wanted to hide the shopping cart from guests? (as do I). Can you be a little more specific?

 

thanks,

Archived

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

×
×
  • Create New...