Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Customer Dashboard


nockemout

Recommended Posts

Posted

Hello:

Where can I direct a user to a password protected dashboard area that I can format with my php/css ?

 

If a certain keyword or addon that I can use to find it please point me in the right direction.

 

Thanks

Posted

And what is this "dashboard area" supposed to be? a page or something?

 

If so, then

1) You create a new page (duplicate an existing ie shipping.php, call it ie dashboard.php, change the content, make the corresponding language file, define the new file in includes/filenames.php)

2) On top of the page check if the customer is logged in or not and let him in or redirect (like it is done ie in checkout_shipping.php)

 

So you will have a new page that only registered users can access, that you can format with php/css or in any way you want

 

EDIT: You can place a link to this page anywhere on your other pages, read about this here

Posted

Yes it's the user's "profile" page, for changing post-checkout user input, and will have links to other pages in the same fashion. Thanks for the information. Does the tep_href_link function need to be on any pages of the site outside the user backend? I have only one entry page to checkout..

Posted

I guess what I mean is: for example, do the entry pages that generate the user's inputneed to be linked with oSids? or only the user account pages?

Posted

Thanks so much for the information. This program makes so much more sense. I've been doing it this whole time without using tep_ functions. I'll have to go through every link, form input, and mysql query and replace them with these function calls

 

So , how do I know if I'm doing things right session-wise? I'm pretty much building my own checkout/signup process. Would it be to change all my tep_draw_form calls to GET method to see the sid?

Posted

Also, for storing user input i've been using regular php/sql code to store these functions. I've been passing the $_POST['customer_id'] from page to page from checkout to completion to make sure the data lands in the correct places.

 

So, if I understand correctly, i'll have to replace my php/sql code with tep_db_connect and tep_db_perform? And if I use sessions properly I won't have to use $_POST to pass the customer_id from page to page ?

Posted

No, you don't need to use GET in all forms, you can use POST as well. I you use the functions correctly, you don't need to pass the customer id from page to page via POST.

 

I'm sorry, but I can not give you a concrete opinin about what to do, since I don't know what you do. My impression is that you do more than necessary. osCommerce is already a working software, so the best is to stick with its conventions, to make sure any alternation or invention you do, will be working too. Also, you may want to integrate other solutions into yours, and this all is much more easier if everybody follows he same standards

 

Maybe you go and study the files that contain the tep_ functions, so you see what exactly they do, you will find them in folder includes/functions

Posted

absolutely, after reading the thread you pointed me to, my eyes were opened by the availability of tep_ functions. I'm doing a highly customized checkout process with 2 products. using 2.2 rc2a, with the one page checkout and STS addons installed only. I have the checkout process as follows:

 

product page > shopping cart > checkout.php > checkout_sucess.php > step1.php > step2.php > step3.php > account.php

 

I have inserted new fields in my db by hand, which are filled in by step1-3.php and finally landing in the user account area.

 

pages step1, 2, 3 and account .php contain this code @ top:

 

include 'includes/application_top.php';
 if (!tep_session_is_registered('customer_id')) {
   $navigation->set_snapshot();
   tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
 } else {  
 $customer_id = (int)$_SESSION['customer_id'];
}

 

SQL queries are handled like so:

 

$customers_petName = tep_db_prepare_input( $_POST['customers_petName'] );
$customers_petPhoto = tep_db_prepare_input( $_POST['customers_petPhoto'] );

$sql_data_array = array( 'customers_petName' => tep_db_input( $customers_petName ),
       'customers_petPhoto' => tep_db_input( $customers_petPhoto ));		
tep_db_perform( 'customers', $sql_data_array, 'update', 'customers_id = \'' . $customer_id . '\'' );

 

I'm using tep_ functions to draw out form fields:

 

echo tep_draw_form('form1', tep_href_link(FILENAME_STEP2), 'post');
echo tep_draw_input_field('customers_petName');

 

and hidden fields to pass the customer_id to make sure the data gets to the right place:

 

echo tep_draw_input_field(customer_id, $customer_id, null, 'hidden');
echo tep_image_submit('nextStep.png', 'Next Step');

 

I understand this method may not be the best way to go about it (passing customer_id post var). I'd rather do it the right way, by verifying the user session/ID and then moving forward with my sql query. I don't get how to do that. I'm hoping someone can break it down to me (inexperienced in php and osCommerce) so I can understand how to accomplish this.

 

in includes/functions/general.php, I see this:

 if (tep_session_is_registered('customers_petName') && tep_session_is_registered('customer_id')) {
   } 

 

It looks to be the start of a solution. Would I just stick my SQL queries within the brackets ?

Archived

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

×
×
  • Create New...