this is from my new checkout version (jsut the paypal form part). Unfortunately I can't post the entire file as it contains a lot of changes that would make it not work with the version 1.3.6
//pay with paypal
if ($CONFIG['photo_shop_paypal_enable'] && $order_price > 0) {
$handling = $shipping_price-$discount;
$paypal_items = "";
$cd_price_set = false;
$counter = 0;
foreach ($shop_array as $key => $item_id) {
if ($SHOP_CONFIG[$item_id['id']]['price'] > 0 || $item_id['id']=="CD") { // if it's not a free item
$pid = $item_id['pid'];
$amount = $item_id['amount'];
$counter++;
if ($item_id['id']=="CD") {
$size = "CD";
//$price = $cd_price[1];
if ($cd_price_set === false) {
photoshop_add_field($form_fields, 'item_name_'.$counter, $cd_price[4]);
photoshop_add_field($form_fields, 'amount_'.$counter, $cd_price[1]);
photoshop_add_field($form_fields, 'quantity_'.$counter, $amount);
}
$cd_price_set = true;
} else {
$size = $SHOP_CONFIG[$item_id['id']]['name'];
$price = $SHOP_CONFIG[$item_id['id']]['price'];
//price override
$results = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_SHOP_PRICES']} WHERE aid={$item_id['aid']}");
while ($temp_data = mysql_fetch_array($results)) {
if($temp_data['gid']==$SHOP_CONFIG[$item_id['id']]['id'])
$price=$temp_data['price'];
} //end while
mysql_free_result($results);
//to grab the image title from the db
$query = cpg_db_query("SELECT title FROM {$CONFIG['TABLE_PICTURES']} WHERE pid={$item_id['pid']}");
$row = mysql_fetch_row($query);
($row[0]) ? $title= $row[0] : $title="No title";
mysql_free_result($row);
$picture_total = ($picture_total+$price*$amount);
photoshop_add_field($form_fields, 'item_name_'.$counter, "{$cd_price[4]} => Title: {$title} - ID: {$pid}");
photoshop_add_field($form_fields, 'amount_'.$counter, $price);
photoshop_add_field($form_fields, 'quantity_'.$counter, $amount);
}// end else
}//end if amount >0
else //it's a free item
{
//code here
}
} // end foreach
if ($CONFIG['photo_shop_paypal_use_ipn'] == '1') {
photoshop_add_field($form_fields, 'notify_url', $CONFIG['photo_shop_paypal_ssl_adress'].$CONFIG['photo_shop_paypal_ipn_notify_url']);
photoshop_add_field($form_fields, 'rm', '2');
if ($CONFIG['photo_shop_paypal_return_url'] != '') {
photoshop_add_field($form_fields, 'return', $CONFIG['photo_shop_paypal_ssl_adress'].$CONFIG['photo_shop_paypal_return_url']);
}
if ($CONFIG['photo_shop_paypal_cancel_return_url'] != '') {
photoshop_add_field($form_fields, 'cancel_return', $CONFIG['photo_shop_paypal_ssl_adress'].$CONFIG['photo_shop_paypal_cancel_return_url']);
} else $paypal_cancel_return_url = '';
}
if ($CONFIG['photo_shop_tax'] != '') {
photoshop_add_field($form_fields, 'tax_cart', $CONFIG['photo_shop_tax']*$picture_total);
}
photoshop_add_field($form_fields, 'cmd', '_cart');
photoshop_add_field($form_fields, 'upload', '1');
photoshop_add_field($form_fields, 'invoice', $order_id);
photoshop_add_field($form_fields, 'business', $CONFIG['photo_shop_paypal_email']);
photoshop_add_field($form_fields, 'currency_code', $CONFIG['photo_shop_paypal_currency']);
photoshop_add_field($form_fields, 'handling_cart', $handling);
foreach ($form_fields as $name => $value) {
$paypal_items .= "<input type=\"hidden\" name=\"$name\" value=\"$value\"/>\n";
}
$msg_box_txt .= <<<EOT
<br><br>{$lang_photoshop['paypal']}<br>
<form action="{$CONFIG['photo_shop_paypal_form_url']}" method="post" name="paypal_form">
{$paypal_items}
<input type="image" src="{$CONFIG['photo_shop_paypal_image']}" name="submit" alt="Pay with PayPal!">
</form>
EOT;
}