Lone_fox Posted May 19, 2004 Posted May 19, 2004 I have recently gone online with my DVD store. It can be found at this link: AsiatiskDVD.com I just been aware of a really bad bug by a customer that I must get rid of asap. The problem only occurs to guests, when you have logged in it works ok! If you are logged in as a guest and purchase any products, the products is showned in the shopping cart in the top right menu as it should be. But if you click on any of the infoboxlinks in the left menu (shopping cart, products new, specials, reviews...) the products in the shopping cart are lost!! Anyone have any tips on where to look to find this nasty bug?
Databuilder Posted May 20, 2004 Posted May 20, 2004 Not a bug. Do you have SSL enabled? If so, do you have an SSL certificate? If the answer to both is "yes", then check you configure.php to make sure SSL and sessions are set up correctly.
Lone_fox Posted May 20, 2004 Author Posted May 20, 2004 Thanks for your reply! No, I haven't enabled SSL. This is what my configure.php file looks like, could you find anything faulty? : // Define the webserver and path parameters // * DIR_FS_* = Filesystem directories (local/physical) // * DIR_WS_* = Webserver directories (virtual/URL) define('HTTP_SERVER', 'http://www.asiatiskdvd.com'); // eg, http://localhost - should not be empty for productive servers define('HTTPS_SERVER', ''); // eg, https://localhost - should not be empty for productive servers define('ENABLE_SSL', false); // secure webserver for checkout procedure? define('HTTP_COOKIE_DOMAIN', 'http://www.asiatiskdvd.com'); define('HTTPS_COOKIE_DOMAIN', 'http://www.asiatiskdvd.com'); define('HTTP_COOKIE_PATH', '/'); define('HTTPS_COOKIE_PATH', '/'); define('DIR_WS_HTTP_CATALOG', '/'); define('DIR_WS_HTTPS_CATALOG', '/'); define('DIR_WS_IMAGES', 'images/'); define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/'); define('DIR_WS_INCLUDES', 'includes/'); define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/'); define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/'); define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/'); define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/'); define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/'); define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/'); define('DIR_FS_CATALOG', '/home/spyweb1/spy1u40/html/'); define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/'); define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/'); // define our database connection define('DB_SERVER', 'db.spyweb1.spymac.com'); // eg, localhost - should not be empty for productive servers define('DB_SERVER_USERNAME', 'XXX'); define('DB_SERVER_PASSWORD', 'XXX'); define('DB_DATABASE', 'XXX'); define('USE_PCONNECT', 'true'); // use persistent connections? define('STORE_SESSIONS', 'mysql'); // leave empty '' for default handler or set to 'mysql'
Lone_fox Posted May 20, 2004 Author Posted May 20, 2004 It seems like I have found what's causing this. I have changed the code for the infobox-heading. Before I had some design/layout glitches with the original code so I changed the infobox-headings into normal html and simply put a normal html link f <?php /* $Id: whats_new.php,v 1.31 2003/02/10 22:31:09 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ if ($random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status = '1' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) { ?> <!-- whats_new //--> <tr> <td> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td valign="top"> <table width="100%" border="0" cellpadding="2" cellspacing="0"> </td> </tr> <td class="headerNavigation2"><center>Nyheter <a href=products_new.php><img src="images/infobox/arrow_right.gif" border="0"></a></center></td> </tr> </table> </td> </tr> <tr> <td class="main" bgcolor="white"> <?php $random_product['products_name'] = tep_get_products_name($random_product['products_id']); $random_product['specials_new_products_price'] = tep_get_products_special_price($random_product['products_id']); $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_WHATS_NEW); new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_PRODUCTS_NEW)); if (tep_not_null($random_product['specials_new_products_price'])) { $whats_new_price = '<s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br>'; $whats_new_price .= '<span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>'; } else { $whats_new_price = $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])); } $info_box_contents = array(); $info_box_contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br>' . $whats_new_price); new infoBox($info_box_contents); ?> </td> </tr> </table> </td> </tr> <!-- whats_new_eof //--> <?php } ?> the link in the code below is what must be changed... <table width="100%" border="0" cellpadding="2" cellspacing="0"> </td> </tr> <td class="headerNavigation2"><center>Nyheter <a href=products_new.php><img src="images/infobox/arrow_right.gif" border="0"></a></center></td> </tr> </table> <a href=products_new.php> to something with tep_href_link(FILENAME_PRODUCTS_NEW) will make it work i think, but how do I implement that? It seems easy but don't get it.... :blink: Right now the link is simply "products_new.php" missing the 'oscid-code' in the end of the link which makes the shopping cart content lost when clicked on. Hope someone can help me out, thanks!
Chris Dunning Posted May 20, 2004 Posted May 20, 2004 Use the tep_href_link() function to create a link - it will keep the session intact. Chris Dunning osCommerce, Contributions Moderator Team Please do not send me PM! I do not read or answer these often. Use the email button instead! I do NOT support contributions other than my own. Emails asking for support on other people's contributions will be ignored. Ask in the forum or contact the contribution author directly.
Lone_fox Posted May 20, 2004 Author Posted May 20, 2004 Mm, that's what i figured, but how do I do that? I have changed the code somewhat. Can anyone help me out with the the code that's needed to do tep_href_link() function anywhere on a page, from scratch I guess. The place where I need the link to be is outside the original php code... ?
♥Vger Posted May 20, 2004 Posted May 20, 2004 You need to sort out your config file first - it's a bit of a mess. This define('HTTP_COOKIE_DOMAIN', 'http://www.asiatiskdvd.com'); should be set to this define('HTTP_COOKIE_DOMAIN', 'www.asiatiskdvd.com'); And this define('HTTPS_COOKIE_DOMAIN', 'http://www.asiatiskdvd.com'); should read as this define('HTTPS_COOKIE_DOMAIN', ''); This define('DB_SERVER', 'db.spyweb1.spymac.com'); should either bet set to 'localhost' or to '127.0.0.1' Use persistent connection should be set to 'false' and not to true. Hope this helps - Vger
Lone_fox Posted May 20, 2004 Author Posted May 20, 2004 define('DB_SERVER', 'db.spyweb1.spymac.com'); should either bet set to 'localhost' or to '127.0.0.1' Thanks I have changed everything but this, it didn't work at all when changed to localhost or to 127.0.0.1 -I haven't haven't noticed any difference, faster load times? Although I have temporarily removed all of the links which didn't have a session-id I would like to have them back. So if anyone can help me with the code for that it would be great... :rolleyes:
Lone_fox Posted May 20, 2004 Author Posted May 20, 2004 It seems to works now. I guess since the define('HTTPS_COOKIE_DOMAIN', 'http://www.asiatiskdvd.com'); was "removed" the session-problem is gone as long as I don't install SSL... so thanks! :)
♥Vger Posted May 20, 2004 Posted May 20, 2004 The problem you mentioned in your original post is not a problem. osCommerce is set up so that a buyer has to register and login to be able to purchase something. The long session id appended to each link can be gotten rid of by simply switching on 'force cookie use' in your admin panel, under Sessions. However, your config files do have to be spot on for it to work - else you'll always end up on the cookie_usage.php page, telling you that your browser doesn't have cookies enabled. My personal view is that you have made so many alterations to the original code that you should either reinstall and start fresh, or, if your changes are limited to a small number of pages, download osCommerce 2.2 zip, unzip it to a folder and then upload the files you want to restore. Vger
Recommended Posts
Archived
This topic is now archived and is closed to further replies.