[TYPO3-shop] tt_products handleScript for PayPal Express Checkout

Lukas Taferner lukas at taferner.net
Thu Mar 6 13:31:30 CET 2008


Hi Richard, Franz, List

i fixed the Problem.
Line 198:
$addr_type->setCountry($this->basket->recs['personinfo']['country']);

The problem: Country needs to be 2 Digit ISO Code (PAYPAL docu), if you 
use a <input type="text" /> for country the error will be produced. 
Unfortunately the Static Country Dropdown of tt_products uses the 3 
digit iso code (cn_iso_3) so I wrote a function to convert cn_iso_3 to 
cn_iso_2.

Here my question to Franz: can you easily change the Static Country 
Dropdown to use cn_iso_2?

greetings,

Lukas

function paypalexpress_iso3_to_iso2 ($iso3_code)
{
    // SQL Injection
    $iso3_code = substr($iso3_code,0,3);
    $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
                              'cn_iso_2',
                               'static_countries',
                               'cn_iso_3 = \''.$iso3_code.'\'',
                               '',
                               '',
                               '',
                               ''
                            );

    $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
   
    return $row['cn_iso_2'];
 }

Lukas Taferner schrieb:
> Hi Richard,
>
> thanks for this great piece of software!
>
> I have an issue here which seems like a bug:
> Paypal API reports:
>     "Shipping Address Country Error
>     There was an error in the Shipping Address Country field"
> I can do a echo $this->basket->recs['personinfo']['country']; and get 
> the right country information.
>
> I will try to fix this and keep you up 2 date!
>
> Best regards,
>
> Lukas
>
>
> Richard Hirner wrote:
>   
>> Hi,
>>
>> Just wanted to note that I have improved my handleScript for PayPal 
>> Express Checkout and it works now without ugly hacks like having to die() 
>> in case of a PayPal error. It also has got template support for 
>> customising the error messages and I spent a few hours for documentation.
>>
>> The handleScript allows you to add PayPal Express Checkout to your 
>> tt_products online shop.
>>
>> If your are interested, you can download it at this address:
>> http://www.bitfire.at/free-services
>>
>> I would be happy about comments and/or bug reports. (To my private email 
>> address if it isn't interesting for the other users.)
>>
>>   
>>     
> _______________________________________________
> TYPO3-project-tt-products mailing list
> TYPO3-project-tt-products at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-project-tt-products
>
>   


More information about the TYPO3-project-tt-products mailing list