JangoF Posted July 20, 2007 Share Posted July 20, 2007 Hi everyone, On my webserver I have the Live site in the root, and the Test-site in a sub-folder. Both sites works fine, but there are sometimes some strange mismatches between how the sites handle code, even though they have the exact same configuration. For instance, the currency script I am trying to use works perfect on the Test-site, but on the Live site it doesn't do anything at all. This is how my configuration looks from my Live site (database information is present as well, and sessions are handled by mysql): define('HTTP_SERVER', 'http://mydomain.com'); // eg, http://localhost - should not be empty for productive servers define('HTTPS_SERVER', 'https://mydomain.com'); // eg, https://localhost - should not be empty for productive servers define('ENABLE_SSL', true); // secure webserver for checkout procedure? define('HTTP_COOKIE_DOMAIN', 'mydomain.com'); define('HTTPS_COOKIE_DOMAIN', 'mydomain.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/content/s/c/p/username/html/'); define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/'); define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/'); And this is the configuration from the Test-site: define('HTTP_SERVER', 'http://mydomain.com'); // eg, http://localhost - should not be empty for productive servers define('HTTPS_SERVER', 'https://mydomain.com'); // eg, https://localhost - should not be empty for productive servers define('ENABLE_SSL', true); // secure webserver for checkout procedure? define('HTTP_COOKIE_DOMAIN', 'mydomain.com'); define('HTTPS_COOKIE_DOMAIN', 'mydomain.com'); define('HTTP_COOKIE_PATH', '/testsite'); define('HTTPS_COOKIE_PATH', '/testsite'); define('DIR_WS_HTTP_CATALOG', '/testsite/'); define('DIR_WS_HTTPS_CATALOG', '/testsite/'); 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/content/s/c/p/username/html/testsite/'); define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/'); define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/'); The currency script I am using looks like this: if (substr(basename($PHP_SELF), 0, 8) != 'checkout') { if ($currency == 'USD') { $local_currency = 'USD'; tep_draw_hidden_field('local_currency', $local_currency); $_POST[$local_currency] = $local_currency; } elseif ($currency == 'EUR') { $local_currency = 'EUR'; tep_draw_hidden_field('local_currency', $local_currency); $_POST[$local_currency] = $local_currency; } elseif ($currency == 'GBP') { $local_currency = 'GBP'; tep_draw_hidden_field('local_currency', $local_currency); $_POST[$local_currency] = $local_currency; } elseif ($currency == 'CAD') { $local_currency = 'CAD'; tep_draw_hidden_field('local_currency', $local_currency); $_POST[$local_currency] = $local_currency; } elseif ($currency == 'AUD') { $local_currency = 'AUD'; tep_draw_hidden_field('local_currency', $local_currency); $_POST[$local_currency] = $local_currency; } } <?php if ($local_currency == 'USD') { echo ' Subtotal in your selected currency'; echo '<div align="right">'; echo $currencies->format($order->info['subtotal'], $local_currency, $local_currency); echo ' (American Dollars)</div>'; } elseif ($local_currency == 'GBP') { echo ' Subtotal in your selected currency'; echo '<div align="right">'; echo $currencies->format($order->info['subtotal'], $local_currency, $local_currency); echo ' (British Pounds)</div>'; } elseif ($local_currency == 'CAD') { echo ' Subtotal in your selected currency'; echo '<div align="right">'; echo $currencies->format($order->info['subtotal'], $local_currency, $local_currency); echo ' (Canadian Dollars)</div>'; } elseif ($local_currency == 'AUD') { echo ' Subtotal in your selected currency'; echo '<div align="right">'; echo $currencies->format($order->info['subtotal'], $local_currency, $local_currency); echo ' (Australian Dollars)</div>'; } else { } ?> (yes, I use FEC, but this could be used anywhere) if (isset($HTTP_POST_VARS['local_currency'])) $local_currency = $HTTP_POST_VARS['local_currency']; That's about it. All it does is print the selected currency on the checkout pages, as I enforce a specific currency during checkout. However, as I said, on the Test-site it works, but on the Live site it does not. Does anyone have a clue what might be causing this? Link to comment Share on other sites More sharing options...
JangoF Posted July 20, 2007 Author Share Posted July 20, 2007 Anyone good any ideas? Link to comment Share on other sites More sharing options...
JangoF Posted July 21, 2007 Author Share Posted July 21, 2007 Anyone? Link to comment Share on other sites More sharing options...
♥Monika in Germany Posted July 21, 2007 Share Posted July 21, 2007 ok, without really seeing it, just guesswork .. BTW, fix your texst site cookie domains, should be define('HTTP_COOKIE_PATH', '/testsite/'); define('HTTPS_COOKIE_PATH', '/testsite/'); try for that echo line this if (isset($_POST['local_currency'])) $local_currency = $_POST['local_currency']; :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ... Link to comment Share on other sites More sharing options...
JangoF Posted July 21, 2007 Author Share Posted July 21, 2007 Fixed the cookie path, thanks for the tips. That's strange, when I echo $local_currency or $_POST['local_currency'], nothing appears, not even on the test site. I swear it all was working perfectly fine on the test site yesterday, even when logging in/out. Do you know what might be the cause of such strange behaviour? Link to comment Share on other sites More sharing options...
♥Monika in Germany Posted July 21, 2007 Share Posted July 21, 2007 Fixed the cookie path, thanks for the tips. That's strange, when I echo $local_currency or $_POST['local_currency'], nothing appears, not even on the test site. I swear it all was working perfectly fine on the test site yesterday, even when logging in/out. Do you know what might be the cause of such strange behaviour? nope ... this is one of the case where I would need to go in and check with my own debug code, but it takes way too long to do via the forum... sorry :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ... Link to comment Share on other sites More sharing options...
JangoF Posted July 21, 2007 Author Share Posted July 21, 2007 nope ... this is one of the case where I would need to go in and check with my own debug code, but it takes way too long to do via the forum... sorry Could you take a guess as to why the currency code isn't printed out, though? :) Link to comment Share on other sites More sharing options...
♥Monika in Germany Posted July 21, 2007 Share Posted July 21, 2007 pretty sure cause it's not filled with a value - but why I cannot know from far. Add the word 'test' next to the printout and I'm sure that will show. :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ... Link to comment Share on other sites More sharing options...
JangoF Posted July 21, 2007 Author Share Posted July 21, 2007 Yeah, I guess $local_currency is empty, or is not recognized by checkout_shipping.php somehow. But why it worked last night on the Test-site, and not today, that puzzles me. Link to comment Share on other sites More sharing options...
Guest Posted July 21, 2007 Share Posted July 21, 2007 Yeah, I guess $local_currency is empty, or is not recognized by checkout_shipping.php somehow. But why it worked last night on the Test-site, and not today, that puzzles me. I am at a loss, but you set your default currency in your language file (eg includes\languages\english.php) Link to comment Share on other sites More sharing options...
JangoF Posted July 21, 2007 Author Share Posted July 21, 2007 I am at a loss, but you set your default currency in your language file (eg includes\languages\english.php) No, this has nothing to do with the default currency. I use 5 different currencies on my site which the customers can choose from (USD being the default). However due to some restrictions on one of the payment methods I use, I am enforcing the checkout in Euros. To make things a little better for my customers, I am trying to print out their selected currency both the combined payment/shipping page and checkout_confirmation. Now I had it working last night on the Test site, but when I installed it on the Live site, it wouldn't work. Today it isn't working properly on the Test site either -- with nothing being changed over night. This is what puzzles me, I don't get why it does not work. Link to comment Share on other sites More sharing options...
JangoF Posted July 21, 2007 Author Share Posted July 21, 2007 Any experts that can see what I am doing wrong? Link to comment Share on other sites More sharing options...
Guest Posted July 21, 2007 Share Posted July 21, 2007 I am at a loss, but you set your default currency in your language file (eg includes\languages\english.php) Are the php and mysql versions exactly the same for both sites? Link to comment Share on other sites More sharing options...
JangoF Posted July 22, 2007 Author Share Posted July 22, 2007 Yes, as they are running on the same server. Link to comment Share on other sites More sharing options...
Guest Posted July 22, 2007 Share Posted July 22, 2007 Yes, as they are running on the same server. OK, I was wondering because of I thought that php 5 uses post and php 4 uses get if (isset($HTTP_POST_VARS['local_currency'])) $local_currency = $HTTP_POST_VARS['local_currency']; but then I am totally confused about it. Link to comment Share on other sites More sharing options...
JangoF Posted July 22, 2007 Author Share Posted July 22, 2007 The server is running PHP 4.3.11, should that make any difference as to how variables are passed on? Link to comment Share on other sites More sharing options...
Guest Posted July 22, 2007 Share Posted July 22, 2007 The server is running PHP 4.3.11, should that make any difference as to how variables are passed on? I don't know, I am getting more confused by php every day. Odd that it works on one site but not the other. I has that problem with one contrib I am working on, and it turned out to be a another contrib that has been working for yonks suddenly playing up (it was installed on one site but not the other). Link to comment Share on other sites More sharing options...
♥Monika in Germany Posted July 22, 2007 Share Posted July 22, 2007 In the first script you fill $local_currency check if that session parameter has been registered first then in your second part, you use it from a post_vars.... meaning from a form. Without seeing what you are doing there, whether ther IS a form at all, a post form, and then the value processed correctly, I will not be able to help ... and I do not think other experts will be able to help either. Giving only small bits of code does not help debugging. :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ... Link to comment Share on other sites More sharing options...
JangoF Posted July 22, 2007 Author Share Posted July 22, 2007 No, this is the whole code. The code from application_top.php is not within a form, so I guess that might be my error? Link to comment Share on other sites More sharing options...
♥Monika in Germany Posted July 22, 2007 Share Posted July 22, 2007 No, this is the whole code. The code from application_top.php is not within a form, so I guess that might be my error? did you try to use just echo $local_currency; ETA: reminding you that you HAVE to register the session for it first in appl top. Look how it's done for other stuff :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ... Link to comment Share on other sites More sharing options...
JangoF Posted July 22, 2007 Author Share Posted July 22, 2007 Yeah, echo turned up empty. But I will do what you suggest :) Link to comment Share on other sites More sharing options...
JangoF Posted July 22, 2007 Author Share Posted July 22, 2007 I tried adding a form - like this: tep_draw_form('local_currency', $local_currency, 'post'); if (substr(basename($PHP_SELF), 0, 8) != 'checkout') { if ($currency == 'USD') { $local_currency = 'USD'; tep_draw_hidden_field('local_currency', $local_currency); $_POST[$local_currency] = $local_currency; } But it still shows up empty. Am I doing it right? Link to comment Share on other sites More sharing options...
♥Monika in Germany Posted July 23, 2007 Share Posted July 23, 2007 I tried adding a form - like this:But it still shows up empty. Am I doing it right? uhm ... no. Unless I totally misunderstood what you are trying to achieve. Care to repeat it step by step? Then I will not look at what you have done till now but tell you how I would do it, ok? :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ... Link to comment Share on other sites More sharing options...
JangoF Posted July 23, 2007 Author Share Posted July 23, 2007 OK, basically this is what I am trying to achieve: I got 5 different currencies on my site (def. USD, EUR, GBP, CAD and AUD) that my customers can choose from when browsing the store. However I am enforcing the checkout as a whole in Euros (this is due to restrictions from my CC gateway) - but if customers select Paypal (my other payment alternative), the checkout confirmation page will be in USD (this is due to how my Paypal account works). Now ideally I would have everything in USD, but I have contacted my bank about switching the gateway to USD several times, they are just lazy unfortunately and it looks like it will never happen. So therefore I am going to enforce the aforementioned, and as such I thought it would be nice to also show Subtotal and Total in the users selected currency. So when they are browsing anywhere but the Checkout, I want the $local_currency variable stored in the session depending on whatever currency they have selected. Why not in the Checkout? Because I enforce it to Euros there, and the script would think that the customer selected Euros and mess it up. Well, that's about it :) Link to comment Share on other sites More sharing options...
♥Monika in Germany Posted July 23, 2007 Share Posted July 23, 2007 hmmm ... let me recapitulate: 1) customers browse in any of your 5 currencies 2) you have a column box where you show the products and the subtotal/total at all times, also in checkout 3) in checkout (first page is checkout_shipping) you want the currency for the checkout to be forced to EUR, but in this box, you want to "remember" what was the last currency the customer browsed in, and in this box, you want to display to extra line, subtotal and total in the remembered currency. questions: 1) can I see a quick screenshot of that box, with the spot marked for the extra lines? 2) can I see the full code of that box? 3) where does this paypal USD thing come in here (or neglectable for coding?) :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.