what my client want is below:
but Zen Cart does not pass product's attribute values eg size/color to a separate column Options in paypal transaction details page.
instead, Zen Cart only simply append the attribute's values to product's name.
see the current paypal transaction details,it's blank in the column Options
I follow the manual below,realized that there are on0, on1 parameters for attribute #1 and #2, os0 and os1 are for their according values to attribute #1 or 2. I added the corresponding code under paypaldp.php (\includes\modules\payment\paypaldp.php) around line after #1530 but didn't seem to be working.https://developer.paypal.com/docs/cl...#id08A6HF080O3
on0 Optional First option field name and label. The os0 variable contains the corresponding value for this option field. For example, if on0 is size, os0 could be large.
Optional for Buy Now, Add to Cart, Subscribe, Automatic Billing, and Installment Plan buttons
Not used with Donate or Buy Gift Certificate buttons
64
on1 Optional Second option field name and label. The os1 variable contains the corresponding value for this option field. For example, if on1 is color then os1 could be blue.
You can specify a maximum of 7 option field names (6 with Subscribe buttons) by incrementing the option name index (on0 through on6).
Optional for Buy Now, Add to Cart, Subscribe, Automatic Billing, and Installment Plan buttons
Not used with Donate or Buy Gift Certificate buttons
64
PHP Code:
// loop thru all products to prepare details of quantity and price.
for ($i=0, $n=sizeof($order->products), $k=-1; $i<$n; $i++) {
// PayPal is inconsistent in how it handles zero-value line-items, so skip this entry if price is zero
if ($order->products[$i]['final_price'] == 0) {
continue;
} else {
$k++;
}
$optionsLI["L_NUMBER$k"] = $order->products[$i]['model'];
$optionsLI["L_NAME$k"] = $order->products[$i]['name'] . ' [' . (int)$order->products[$i]['id'] . ']';
// Append *** if out-of-stock.
$optionsLI["L_NAME$k"] .= ((zen_get_products_stock($order->products[$i]['id']) - $order->products[$i]['qty']) < 0 ? STOCK_MARK_PRODUCT_OUT_OF_STOCK : '');
/**
* johnny1114 06/26/2015 bug fix for paypal order details (Options value missing for size/color)https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/
* https://www.paypal.com/cgi-bin/webscr?cmd=p/pdn/howto_checkout-outside
* on0_x First option field name for item #x. 64 character limit
* os0_x First set of option value(s) for item #x. 200 character limit. "on0_x" must be defined in order for "os0_x" to be recognized.
* on1_x Second option field name for item #x. 64 character limit
* os1_x Second set of option value(s) for item #x. 200 character limit. "on1_x" must be defined in order for "os1_x" to be recognized.
*/
// if there are attributes, loop thru them and add to description
// 06/27/2015 johnny1114 add item attribute Options
$optionsLI["ON0$k"] = "";
$optionsLI["OS0$k"] = "";
$optionsLI["ON1$k"] = "";
$optionsLI["OS1$k"] = "";
if (isset($order->products[$i]['attributes']) && sizeof($order->products[$i]['attributes']) > 0 ) {
for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
// 06/27/2015 johnny1114 add item attribute Options
$optionsLI["ON0$k"] = $order->products[$i]['attributes'][0]['option'];
$optionsLI["OS0$k"] = $order->products[$i]['attributes'][0]['value'];
$optionsLI["ON1$k"] = $order->products[$i]['attributes'][1]['option'];
$optionsLI["OS1$k"] = $order->products[$i]['attributes'][1]['value'];
$optionsLI["L_NAME$k"] .= "\n " . $optionsLI["ON0$k"] . '- ' . $optionsLI["OS0$k"]; // for zen cart forum, you may ignore this because I put these two lines here just want to see if my ON and OS are being passed to the paypay transaction API or not.
$optionsLI["L_NAME$k"] .= "\n " . $optionsLI["ON1$k"] . ': ' . $optionsLI["OS1$k"];
//$optionsLI["L_NAME$k"] .= "\n " . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'];
} // end loop
} // endif attribute-info
Bookmarks