eXtropia: the open web technology company
Technology | Support | Tutorials | Development | About Us | Users | Contact Us
radical hacks
Currency convertor for webstore  

This is how I put an automatic currency convertor into webstore. The convertor is a java script located at http://cconv.textor.com, which is free as long as you accept the conditions. I have been using it now for about 2 months with no problems. I am using a html webstore V1.0, but I guess it will work with all versions. There are 2 changes to to be made to the webstore_html_lib.pl file, with all the new bits in red below...

 

Change 1 - (about the bottom of file) create a variable that contains the pre-shipping grand total. This variable will be sent to the currency convertor java script.

#######################################################################
# cart_table_footer Subroutine #
#######################################################################

        # cart_table_footer is used to display the footer for cart
        # table displays. It takes one argumnet, the pre shipping
        # grand total and is called with the following syntax:
        #
        # &cart_table_footer(PRICE);

sub cart_table_footer
{
local($price) = @_;
print qq!
</TABLE>
<P>
Pre-shipping Grand Total = $price
<P>

!;

$fred = $unformatted_grand_total; # fred is a variable to put the total into a textor currency convertor

}

#######################################################################
# make_hidden_fields Subroutine #
#######################################################################

 

Change 2 - (about the middle of the file) insert the java script code

#######################################################################
# cart_footer Subroutine #
#######################################################################

        # cart_footer is used to generate the HTML footer
        # code for the "view items in the cart" form
        # page. It takes no arguments and is called with the
        # following syntax:
        #
        # &cart_footer;
        #
        # As usual, we will admit the "Return to Frontpage" button
        # only if we are not using frames by defining it with the
        # $sc_no_frames_button in web_store.setup.

sub cart_footer
{
print qq!

<INPUT TYPE = "submit" NAME = "change_quantity_button"
VALUE = "Change Quantity">
<INPUT TYPE = "submit" NAME = "delete_item_button"
    VALUE = "Delete Items">
<INPUT TYPE = "submit" NAME = "order_form_button"
    VALUE = "Checkout Stand">
</FORM>


<FORM NAME="textor1">
<INPUT TYPE="hidden" NAME="texaccept" VALUE="site operator accepts conditions at http://cconv.textor.com">    # goto this site for further details
<INPUT TYPE="hidden" NAME="basevalue" VALUE="$fred">                                                         # $fred is a variable containing the unformated grand total
<INPUT TYPE="hidden" NAME="basecurrency" VALUE="1">                                                          # 1 is Australian dollars
<INPUT TYPE="hidden" NAME="initialcurrency" VALUE="0">                                                          # 0 is US dollars
<SCRIPT LANGUAGE="JavaScript1.1" SRC="http://cconv.textor.com/conv1.js"> </SCRIPT>
<SCRIPT LANGUAGE="JavaScript1.1" SRC="http://cconv.textor.com/fixnetscape3bug.js"></SCRIPT>
</FORM>

<P>

<p><a href="javascript:history.go(-2)"><font face="Arial" color="#FF0000"><small><strong>click
here to continue shopping</strong></small></font></a></p>                                         # ps  this is a bit I added, but it is not needed for the currency convertor



</CENTER>
</BODY>
</HTML>!;
}

#######################################################################
# bad_order_note Subroutine #
#######################################################################

That's it.
You can see how it works by adding something to your shopping cart at www.tallwomensclothing.com

cheers,
Peter Gillett