Shopping Cart Problem

Discussion in 'PHP' started by chardb200, Jun 5, 2008.

  1. #1
    Hi,

    I have a shopping cart and it was configured for US dollars and worked fine. Problem is, when I change the currency to GBP and checkout using paypal, a paypal error comes up saying unsupported characters. Would anyone know how to fix this?? Thanks
     
    chardb200, Jun 5, 2008 IP
  2. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #2
    Which shopping cart you are using

    You will need to adjust that according to paypal.

    I guess its not well configured with paypal

    Regards

    alex
     
    kmap, Jun 5, 2008 IP
  3. chardb200

    chardb200 Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi there,

    I have copied below the checkout part of the script. It is configured to work with paypal and it it works fine when using US dollars. Only trouble is when I change the dollar symbol to the pound symbol the paypal doesn't work, it says unsuported characters? There are other files apart from the checkout so not sure if something there needs to be changed. I can't seem to get in touch with the person who wrote the script now. Any ideas would be appreciated.



    <?php
    /*url decode and as array
    Author:vishnu.
    */
    $string= urldecode($_SERVER["QUERY_STRING"]);
    $words = split("[&]+", $string);
    $totalnum=count($words)-1;
    $num=$totalnum-10;
    $nume=$words[$num];
    $maxnum = strstr($nume,'_');
    $maxnumnew = explode("=",$maxnum, -1) ;
    $final=$maxnumnew[0];
    $trimmed = trim($final, " _");
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Checkout</title>
    <link rel="stylesheet" type="text/css" href="checkout.css" media="screen" />
    <style type="text/css">ul,ol {position:relative; left:-20px}</style>
    <script type="text/javascript" src="language-en.js"></script>
    <script type="text/javascript" src="cart.js"></script>
    <script type="text/javascript">
    PaymentProcessor = 'pp';
    </script>
    <script type="text/javascript">
    function CheckForm( theform )
    {
    var bMissingFields = false;
    var strFields = "";

    if( theform.b_first.value == '' ){
    bMissingFields = true;
    strFields += " Billing: First Name\n";
    }
    if( theform.b_last.value == '' ){
    bMissingFields = true;
    strFields += " Billing: Last Name\n";
    }
    if( theform.b_addr.value == '' ){
    bMissingFields = true;
    strFields += " Billing: Address\n";
    }
    if( theform.b_city.value == '' ){
    bMissingFields = true;
    strFields += " Billing: City\n";
    }
    if( theform.b_state.value == '' ){
    bMissingFields = true;
    strFields += " Billing: State\n";
    }
    if( theform.b_zip.value == '' ){
    bMissingFields = true;
    strFields += " Billing: Zip Code\n";
    }
    if( theform.b_country.value == '' ){
    bMissingFields = true;
    strFields += " Billing: Country\n";
    }
    if( theform.b_email.value == '' ){
    bMissingFields = true;
    strFields += " Billing: E-Mail\n";
    }

    if( bMissingFields ) {
    alert( "We are sorry, but you must provide the following field(s) before continuing:\n" + strFields );
    return false;
    }
    return true;}
    </script>
    </head>
    <body background= "images/dgrey027.gif" bgcolor="#FFFFFF" text="#000000">
    <noscript>We detected that your browser does not have JavaScript, or it is disabled. Our product catalog requires that you have JavaScript enabled to order products. If you are using a JavaScript compliant browser and still have problems, make sure you have JavaScript enabled in your browser's preferences.</noscript><div align="center">
    <span class="arial"><font size="2" face="Tahoma"><br />
    Thank you for shopping with us. Please choose your payment method below:</font>
    </span> &nbsp;&nbsp;&nbsp;&nbsp;<br>
    <span class="arial"> </span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <div align="center">
    </div>
    <div class="container">
    <table width="100%" bgcolor="#B71808" align="center" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td>
    <script type="text/javascript">
    CheckoutCart();
    </script>
    </td>
    </tr>
    </table>
    <div align="right">
    <?php
    $value = $_GET[TOTAL];
    $valuefin= trim($value, "$");
    $shipping = $_GET[SHIPPING];
    echo"<FORM ACTION='https://www.paypal.com/cgi-bin/webscr' METHOD='POST'>";
    echo"<input type='hidden' name='cmd' value='_cart'>\n";
    echo"<input type='hidden' name='upload' value='1'>\n";
    echo"<INPUT TYPE='hidden' NAME='business' VALUE='james@b2b.supanet.com'>\n";
    echo"<INPUT TYPE='hidden' NAME='undefined_quantity' VALUE='1'>\n";
    echo"<INPUT TYPE='hidden' NAME='item_name' VALUE=Jame's Online Purchases'>\n";


    $max=$trimmed;
    for ($i=1; $i <= $max; $i++){
    $name = $_GET[NAME_.$i];
    $itemnum=$_GET[ID_.$i];
    $price=$_GET[PRICE_.$i];
    $addinfo=$_GET[ADDTLINFO_.$i];
    $shipping =$_GET[SHIPPING];
    $quantity = $_GET[QUANTITY_.$i];
    echo"<INPUT TYPE='hidden' NAME='item_name_$i' VALUE='$name'>\n";
    echo"<INPUT TYPE='hidden' NAME='item_number_$i' VALUE='$itemnum'>\n";
    echo"<INPUT TYPE='hidden' NAME='amount_$i' VALUE='$price'>\n";
    echo"<INPUT TYPE='hidden' NAME='quantity_$i' VALUE='$quantity'>\n";
    echo"<INPUT TYPE='hidden' NAME='on0_$i' VALUE='Type'>\n";
    echo"<INPUT TYPE='hidden' NAME='os0_$i' VALUE='$addinfo'>\n";
    }
    echo"<INPUT TYPE='hidden' NAME='shipping_1' VALUE='$shipping'>\n";
    echo"<INPUT TYPE='hidden' NAME='currency_code' VALUE='USD'>\n";
    echo"<br><br><INPUT TYPE='image' NAME='submit' BORDER='0' SRC='images/paypallogo4.jpg' ALT=''>\n";
    echo"<img alt='' border='' width='1' height='1' src='https://www.paypal.com/en_US/i/scr/pixel.gif'>";
    echo"</FORM>";
    ?>

    <?php

    echo"<FORM ACTION='check.php' METHOD='GET'>";
    $max2=$trimmed;
    $subtotal = $_GET[SUBTOTAL];
    $shipping2 =$_GET[SHIPPING];
    $totalamt =$_GET[TOTAL];
    for ($i=1; $i <= $max2; $i++){
    $name2 = $_GET[NAME_.$i];
    $itemnum2=$_GET[ID_.$i];
    $price2=$_GET[PRICE_.$i];
    $addinfo2=$_GET[ADDTLINFO_.$i];
    $quantity2 = $_GET[QUANTITY_.$i];
    echo"<INPUT TYPE='hidden' NAME='itemname_$i' VALUE='$name2'>\n";
    echo"<INPUT TYPE='hidden' NAME='quantity_$i' VALUE='$quantity2'>\n";
    echo"<INPUT TYPE='hidden' NAME='item_number_$i' VALUE='$itemnum2'>\n";
    echo"<INPUT TYPE='hidden' NAME='amount_$i' VALUE='$price2'>\n";
    echo"<INPUT TYPE='hidden' NAME='on0_$i' VALUE='Color'>\n";
    echo"<INPUT TYPE='hidden' NAME='os0_$i' VALUE='$addinfo2'>\n";
    }
    echo"<INPUT TYPE='hidden' NAME='subtotal' VALUE='$subtotal'>\n";
    echo"<INPUT TYPE='hidden' NAME='shipping' VALUE='$shipping2'>\n";
    echo"<INPUT TYPE='hidden' NAME='totalamt' VALUE='$totalamt'>\n";
    echo"<INPUT TYPE='image' NAME='submit' BORDER='0' src='images/checklogo2.jpg' height='48' width='250' border='0' alt='check payment' /></a>";
    ?>
    </div>
    </div>


    </body>
    </html>
     
    chardb200, Jun 5, 2008 IP
  4. GloBleeOne

    GloBleeOne Peon

    Messages:
    286
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    No about a wee bit more information?

    Which shopping cart?

    Is it OSCommerce?

    If it is, then in application_top.php - from memory there is USD hard coded in there, change that to your currency, and you will be fine - if it's OSC.
     
    GloBleeOne, Jun 5, 2008 IP
  5. chardb200

    chardb200 Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Hi there,

    It's not an OSCommerce. I had a programmer do it and now I can't track him down so I'm a bit stuck. I have changed all the currency symbols from "$" to "£" but paypal doesn't seem to like it and gives me the error about unsuported characters??
     
    chardb200, Jun 6, 2008 IP