Wendy James Posted March 20, 2006 Posted March 20, 2006 (edited) Hello : ) I am trying to install this contribution http://www.oscommerce.com/community/contributions,355 (the newest download) and everything works as it is suposed to except one function and I can't seem to work it out. If a customer does not create an account and makes a purchase everything works right. If a customer either already has an account or creates an account their address does not show up anywhere until the confirmation page (and it gets added to their address book). I have widdled it down to this bit of code that goes on includes/functions/general.php function tep_address_label($customers_id, $address_id = 1, $html = false, $boln = '', $eoln = "\n") { // Ingo PWA Beginn if ($customer_id == 0) { global $order; if ($address_id == 1) { $address = $order->pwa_label_shipping; } else { $address = $order->pwa_label_customer; } } else { $address_query = tep_db_query("select entry_firstname as firstname, entry_lastname as lastname, entry_company as company, entry_street_address as street_address, entry_suburb as suburb, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customers_id . "' and address_book_id = '" . (int)$address_id . "'"); $address = tep_db_fetch_array($address_query); } // Ingo PWA Ende $format_id = tep_get_address_format_id($address['country_id']); return tep_address_format($format_id, $address, $html, $boln, $eoln); } If I change it back to the original code function tep_address_label($customers_id, $address_id = 1, $html = false, $boln = '', $eoln = "\n") { $address_query = tep_db_query("select entry_firstname as firstname, entry_lastname as lastname, entry_company as company, entry_street_address as street_address, entry_suburb as suburb, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customers_id . "' and address_book_id = '" . (int)$address_id . "'"); $address = tep_db_fetch_array($address_query); $format_id = tep_get_address_format_id($address['country_id']); return tep_address_format($format_id, $address, $html, $boln, $eoln); } the addresses show up for customers with accounts or who create an account but not those checking out without an account so that is why I am guessing it has to do with this code. Does anyone have any ideas on how to fix this or if I am missing something somewhere that could be causing this problem? I don't think I am, I have installed/uninstalled twice to be sure I do everything I am suposed to. Thanks in advance. Edited March 20, 2006 by wendyjames Quote Wendy James Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Wendy James Posted March 21, 2006 Author Posted March 21, 2006 Is there a way to maybe seperate this part of the code into two different codes and have the customer be directed to which ever is the right page depending on if they are logged in or a customer? I still haven't been able to figure this out and looking for any ideas before I uninstall the contribution again. Quote Wendy James Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
webshop Posted March 21, 2006 Posted March 21, 2006 I think I've found a security risk in this contribution. My shop is currently in development and has already around 15 contributions in it. I really want to purchase without account to work correctly before I'm going to use it in my store. Here my problem: I have a login box where registered users can login and check their account and order history. Now I found out that if somebody buys a product using purchase without account he actually is 'logged in' because in my login box I can't see the login fields but see welcome:(empty), my account and Logoff. (if I clink on any I go to shopping cart or checkout depending what?s in my cart) Off course this is not correct because if the somebody clicks checkout now after he made an order he doesn't see the login, create account or purchase without account. This means I have to figure out something that will 'logoff' only the purchase without account user at the purchase successfully page. Could somebody please help me getting this done. I think it should be something in the checkout_succes.php like if (tep_session_is_registered('pwa_array_customer')) { HERE THE CODE TO LOGOFF } any help would be awesome... G Quote
webshop Posted March 21, 2006 Posted March 21, 2006 Hell YEAH i think i've just got it working the way I want it I've inseted the following code into the checkout_succes.php page: if ($customer_id == 0) { tep_session_unregister('pwa_array_customer'); tep_session_unregister('pwa_array_address'); tep_session_unregister('pwa_array_shipping'); tep_session_unregister('customer_id'); tep_session_unregister('customer_default_address_id'); tep_session_unregister('customer_first_name'); tep_session_unregister('customer_country_id'); tep_session_unregister('customer_zone_id'); tep_session_unregister('comments'); tep_session_unregister('recently_viewed'); $cart->reset(); } and now the PWA user is logged off after the purchase. Now I edited my column_left.php with: if (tep_session_is_registered('pwa_array_customer')) { } else { include(DIR_WS_BOXES . 'memberlogin.php'); } this will disable the loginbox while PWA user is in his checkout if (tep_session_is_registered('pwa_array_customer')) { } else { include(DIR_WS_BOXES . 'memberlogin.php'); } Quite clean I think so Can anybody tell me whats the differecnce between ($customer_id == 0) and (tep_session_is_registered('pwa_array_customer')) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.