robax:
The refunds do correspond to a refund made by the store operator through the ZC admin.
<phew>
This *is* what I was expecting to be the case though.
robax:
What I'm seeing with the repeated records in the debug logs are IPNs from PayPal telling the cart to record the refund. And it will likely send the IPN for a limited number of times, same as the IPN for payment fail/success is done.
The refund is not recorded in the order in Zen cart,
The refund not being recorded and the repeated attempts are probably both the result of the fatal PHP error.
robax:
I've searched the files for all instances of "TABLE_ORDERS_STATUS_HISTORY" and then looked for any instances associated with inserts into the table. This only exists in the orders.php which is the one I've already edited and then in the authorize.net and linkpoint gateways, which are not enabled and so I haven't edited them.
There are others.
/ipn_main_handler.phpline #344
zen_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
if (MODULE_PAYMENT_PAYPAL_ADDRESS_OVERRIDE == '1') {
$sql_data_array['comments'] = '**** ADDRESS OVERRIDE ALERT!!! **** CHECK PAYPAL ORDER DETAILS FOR ACTUAL ADDRESS SELECTED BY CUSTOMER!!';
$sql_data_array['customer_notified'] = -1;
zen_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
/includes/modules/payment/paypal/paypal_functions.php
line#643
$sql_data_array = array('orders_id' => (int)$ordersID,
'orders_status_id' => (int)$new_status,
'date_added' => 'now()',
'comments' => 'PayPal status: ' . $_POST['payment_status'] . ' ' . ' @ ' . $_POST['payment_date'] . (($_POST['parent_txn_id'] !='') ? "\n" . ' Parent Trans ID:' . $_POST['parent_txn_id'] : '') . "\n" . ' Trans ID:' . $_POST['txn_id'] . "\n" . ' Amount: ' . $_POST['mc_gross'] . ' ' . $_POST['mc_currency'],
[B] 'customer_notified' => 0[/B]
);
zen_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
/includes/modules/payment/paypaldp.php
line# 1344
```
$sql_data_array = array('orders_id' => (int)$oID,
'orders_status_id' => (int)$new_order_status,
'date_added' => 'now()',
'comments' => 'VOIDED. Trans ID: ' . urldecode($response['AUTHORIZATIONID']). $response['PNREF'] . (isset($response['PPREF']) ? "\nPPRef: " . $response['PPREF'] : '') . "\n" . $voidNote,
'customer_notified' => 0
);
zen_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
/includes/modules/payment/paypalwpp.php
line#813
```
$sql_data_array = array('orders_id' => $oID,
'orders_status_id' => (int)$new_order_status,
'date_added' => 'now()',
'comments' => 'REFUND INITIATED. Trans ID:' . $response['REFUNDTRANSACTIONID'] . $response['PNREF']. "\n" . /*' Net Refund Amt:' . urldecode($response['NETREFUNDAMT']) . "\n" . ' Fee Refund Amt: ' . urldecode($response['FEEREFUNDAMT']) . "\n" . */' Gross Refund Amt: ' . urldecode($response['GROSSREFUNDAMT']) . (isset($response['PPREF']) ? "\nPPRef: " . $response['PPREF'] : '') . "\n" . $refundNote,
[B] 'customer_notified' => 0 [/B]
);
zen_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
I've bolded Two lines in the codes above because I happened to spot that this was different in the code from two different sites. I don't know if this was a change made by the zencart team, or whether its the change I made to resolve the same issue that you are having. In any case, the change was making the '0' into a 'false' (in the 1st instance) and the '0' to a '-1' (in the second instance).
As far as PHP in concerned a 'false' and a -1 are the same value.
robax:
I don't really know PHP, but I'm going to see if putting '' around the -1 value in swguy's fix will make any difference. I noticed that the same line of code very nearby in orders.php has quotes around the value.
if ($customer_notified === '') {
$customer_notified = '-1';
}
>
> I'll see what happens.
> Regards
> ROb
Because the database defines the customer_notified field as being an integer then it is best/safer to NOT enclose this data with quotes. In *most* cases it won't make a difference either way.
I am a little bit concerned about the if ($customer_notified === '') check though, because the triple === is explicitly checking for an empty string '', which may or may not match if the $customer_notified variable is undefined or a NULL string.
Since you probably wish to match either/all of these, then a double == would probably be a better option.
Anyway, based on the error log that you provided earlier, the only place that I can see that would cause this exact error would be via the /includes/modules/payment/paypal/paypal_functions.php file.
line#647 'customer_notified' => 0
change to 'customer_notified' => false
I'm not convinced that this *will* fix your problem (because a 0 should be an acceptable value), but this change has apparently been made (either by myself, or the zencart team, for a reason) and it seems a little bit too coincidental that this is right around the area that you are having a problem.
Cheers
RodG
NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.
Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.