View Single Post
  #19  
Old 08-21-2006, 10:01 AM
 
koaloa koaloa is offline
 

Member
  
Join Date: Jul 2006
Posts: 17
 

Default Re: Multiple Currencies Mod Complete (v4.1.2)

Hey guys,
This really boggles me why it's not working for you. Well let's try and debug this... my GUESS is that the script is not able to pull the values out of the database for some reason. To start, make a backup of the file /<your store dir>/skin1/customer/main/show_currency_options.tpl and REPLACE it with the following code. What I'm trying to do is just print what currency values are found in the database. Please let me know if the page prints out all of the currency rates in the database (this debug script is just for testing purposes, it will just print the values and then cause the script to terminate). Please show me your results. Thanks!

Code:
{* $Id: alter_currency_value.tpl,v 1.11.2.1 2006/04/29 06:36:56 max Exp $ *} {literal} <script language="javascript"> <!--- function SelectLink(form, url) { /*alert(document.currency_select_form.currency_options.options[document.currency_select_form.currency_options.selectedIndex].value);*/ window.location.href=url + "currency_code=" + document.currency_select_form.currency_options.options[document.currency_select_form.currency_options.selectedIndex].value; } //--> </script> {/literal} {php} // Debug Info: /* echo "<pre>"; print_r($_COOKIE); echo "</pre>"; */ $CURRENCY_RATES = func_koa_get_currency_rates(); echo "<pre>"; print_r($CURRENCY_RATES); echo "</pre>"; {/php} <form name="currency_select_form" action="nothing.php" method="post"> <select name="currency_options" onChange="SelectLink(document.currency_select_form, '{php} $url = $_SERVER['REQUEST_URI']; // remove any existing 'currency_code' variables. if(strstr($url, "currency_code")) { // we DID find the variable, so remove it! $url = preg_replace("/currency_code=[a-zA-Z]+(&)?/", "", $url); } $parsed_url = parse_url($url); if(!strstr($url, "?")) { $url .= "?"; } //echo "query is: " . $parsed_url[query] . "<br>"; if(trim($parsed_url['query']) != "") { $url = trim($url, "&"); $url .= "&"; } echo $url; {/php}')"> {php} global $smarty, $currency_code; $CURRENCY_RATES = func_koa_get_currency_rates(); if($_COOKIE[currency_code] != "") $currency_code = $_COOKIE[currency_code]; for($i = 0; $i < count($CURRENCY_RATES); $i++) { $cur_rate = $CURRENCY_RATES[$i]; $abbrev = $cur_rate->code; if($currency_code == "" && $abbrev == "USD") $selected_str = "selected=\"selected\""; if($currency_code != "" && $currency_code == $abbrev) { $selected_str = "selected=\"selected\""; $default_selected = true; } echo "<option value=\"$abbrev\" $selected_str>$abbrev</option>\n"; $selected_str = ""; } {/php} </select> </form> {php} /* echo "<pre>"; print_r($_COOKIE); echo "</pre>"; */ {/php}
__________________
X-Cart Gold v4.1.2
(running on a unix server)
Reply With Quote