You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.
dh783 wrote:
Code:
foreach ($orders as $num => $order) { $link = $this->link_namespace($app,'ordersummary',array('ref' => $order['id'])); print '<tr class="khxc_sorttable">' . $eol; print '<td class="khxc_sorttable">'; print '<a href="' . $link . '" title="Review Order ' . $this->xhtml_encode($order['id']); print '">View Order</a></td>'; print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['id']) . '</td>' . $eol; print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['date']) . '</td>' . $eol; print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['status']) . '</td>' . $eol; if ($recur) {print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['recurtotal']) . '</td>' . $eol;} print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['ordertotal']) . '</td>' . $eol; print '</tr>' . $eol; } // End of foreach statement.to
Code:
foreach ($orders as $num => $order) { if ($order['status'] != 'Not Completed') { $link = $this->link_namespace($app,'ordersummary',array('ref' => $order['id'])); print '<tr class="khxc_sorttable">' . $eol; print '<td class="khxc_sorttable">'; print '<a href="' . $link . '" title="Review Order ' . $this->xhtml_encode($order['id']); print '">View Order</a></td>'; print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['id']) . '</td>' . $eol; print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['date']) . '</td>' . $eol; print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['status']) . '</td>' . $eol; if ($recur) {print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['recurtotal']) . '</td>' . $eol;} print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['ordertotal']) . '</td>' . $eol; print '</tr>' . $eol; } // End of if statement. } // End of foreach statement.John
Hi John,
I just implemented this mod and it works great. I had an issue with the last } // End of if statement - gave me an error, so I removed it to look like below:
foreach ($orders as $num => $order) { if ($order['status'] != 'Not Completed') { $link = $this->link_namespace($app,'ordersummary',array('ref' => $order['id'])); print '<tr class="khxc_sorttable">' . $eol; print '<td class="khxc_sorttable">'; print '<a href="' . $link . '" title="Review Order ' . $this->xhtml_encode($order['id']); print '">View Order</a></td>'; print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['id']) . '</td>' . $eol; print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['date']) . '</td>' . $eol; print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['status']) . '</td>' . $eol; if ($recur) {print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['recurtotal']) . '</td>' . $eol;} print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['ordertotal']) . '</td>' . $eol; print '</tr>' . $eol; } // End of foreach statement.
and it works fine now.
For people that have not tried this mod yet - this puts all unfinished orders (orders that have not gone through the payment process) as not completed under Home > ClickCartPro > Commerce: Orders and Checkout > Manage Online Orders (Completed and Processing)
From there, you can view it and delete it. As far as I can see, the customer does not even see it under his/her account.
Awesome mod - thank *you* for . Now I do not have to wait yet another 6 months to get my cart up and running!
Kay
Offline
Kay
I am happy that you got the mod to work but just looking at what you posted to get it to work doesn't look right since you show to open brackets ({) and only one closeing one in that foreach statement. You have to have another closing bracket after what you posted.
John
Offline
dh783 wrote:
Kay
I am happy that you got the mod to work but just looking at what you posted to get it to work doesn't look right since you show to open brackets ({) and only one closeing one in that foreach statement. You have to have another closing bracket after what you posted.
John
Hi John,
Here is the whole thing:
if ($order['status'] != 'Not Completed') {
$link = $this->link_namespace($app,'ordersummary',array('ref' => $order['id']));
print '<tr class="khxc_sorttable">' . $eol;
print '<td class="khxc_sorttable">';
print '<a href="' . $link . '" title="Review Order ' . $this->xhtml_encode($order['id']);
print '">View Order</a></td>';
print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['id']) . '</td>' . $eol;
print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['date']) . '</td>' . $eol;
print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['status']) . '</td>' . $eol;
if ($recur) {print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['recurtotal']) . '</td>' . $eol;}
print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['ordertotal']) . '</td>' . $eol;
print '</tr>' . $eol;
} // End of foreach statement.
print '</table>' . $eol . $eol;
} // End of if statement.
?>
All works fine for me and that makes me a happy camper - thank you again
K
Offline
dh783 wrote:
Kay
Could you post your entire script, I still think there is something out of place.
John
Hi JOhn,
If it is working, what could be out of place? LOL, I am just happy that something worked :-) Ok here is the whole code:
<?php
$app = $this->globals('khxc_display.app');
$eol = $this->globals('khxc.eol');
$orders = $this->globals('ecom.order_listing');
$ovlink = $this->link_namespace($app,'accountover',array());
// +--
// | Handle empty order arrays (the user has no orders).
// +--
if (empty($orders)) {
print '<p>There are no online orders available for review associated with your ';
print 'account. When you place an order using our online store, all orders are ';
print 'stored here for your review. Please visit this page again after you have ';
print 'placed an order.</p>' . $eol . $eol;
print '<p><a href="' . $ovlink . '" title="Account Overview">';
print 'Click here for your account overview.</a></p>' . $eol;
// +--
// | We've got orders. List them.
// +--
} else {
// +--
// | Get a count of all of the orders and figure out whether there
// | are recurring charges in any of them.
// +--
$count = 0;
$recur = 0;
foreach ($orders as $num => $order) {
if (!(empty($order['hasrecur']))) {$recur++;}
if ($order['status'] != 'Not Completed') {
$count++;
} // End of if statement.
} // End of foreach statement.
// +--
// | Print a header.
// +--
print '<p>There are ' . $count . ' online orders available for review associated ';
print 'with your account. Please review the listing below. Orders are presented with ';
print 'the most recent orders at the top of the listing. To view all of the information ';
print 'for an order, track packages (if tracking information has been made available) and ';
print 'to view a printable version of the order, click the \'View Order\' link next to the ';
print 'order for which you would like more information.</p>' . $eol . $eol;
print '<div class="khxc_storehead">Online Orders</div>' . $eol . $eol;
print '<table id="ORDERLIST" class="khxc_sorttable">' . $eol;
print '<tr class="khxc_sorttable">' . $eol;
print '<th class="khxc_sorttable">View Order</th>' . $eol;
print '<th class="khxc_sorttable">Order Number</th>' . $eol;
print '<th class="khxc_sorttable">Order Date and Time</th>' . $eol;
print '<th class="khxc_sorttable">Order Status</th>' . $eol;
if ($recur) {print '<th class="khxc_sorttable">Recurring Charge Total</th>' . $eol;}
print '<th class="khxc_sorttable">Total</th>' . $eol;
print '</tr>' . $eol;
if ($order['status'] != 'Not Completed') {
$link = $this->link_namespace($app,'ordersummary',array('ref' => $order['id']));
print '<tr class="khxc_sorttable">' . $eol;
print '<td class="khxc_sorttable">';
print '<a href="' . $link . '" title="Review Order ' . $this->xhtml_encode($order['id']);
print '">View Order</a></td>';
print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['id']) . '</td>' . $eol;
print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['date']) . '</td>' . $eol;
print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['status']) . '</td>' . $eol;
if ($recur) {print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['recurtotal']) . '</td>' . $eol;}
print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['ordertotal']) . '</td>' . $eol;
print '</tr>' . $eol;
} // End of foreach statement.
print '</table>' . $eol . $eol;
} // End of if statement.
?>
Offline
I know you say it's working but I am not sure how since your script is missing the second foreach statement which would loop through to order array and print all of the customers orders. It must be just printing the first order in the array but you need the foreach statement to get all of the orders for a customers account, so your code should look like (note the second foreach statement at the bottom)
<?php $app = $this->globals('khxc_display.app'); $eol = $this->globals('khxc.eol'); $orders = $this->globals('ecom.order_listing'); $ovlink = $this->link_namespace($app,'accountover',array()); // +-- // | Handle empty order arrays (the user has no orders). // +-- if (empty($orders)) { print '<p>There are no online orders available for review associated with your '; print 'account. When you place an order using our online store, all orders are '; print 'stored here for your review. Please visit this page again after you have '; print 'placed an order.</p>' . $eol . $eol; print '<p><a href="' . $ovlink . '" title="Account Overview">'; print 'Click here for your account overview.</a></p>' . $eol; // +-- // | We've got orders. List them. // +-- } else { // +-- // | Get a count of all of the orders and figure out whether there // | are recurring charges in any of them. // +-- $count = 0; $recur = 0; foreach ($orders as $num => $order) { if (!(empty($order['hasrecur']))) {$recur++;} if ($order['status'] != 'Not Completed') { $count++; } // End of if statement. } // End of foreach statement. // +-- // | Print a header. // +-- print '<p>There are ' . $count . ' online orders available for review associated '; print 'with your account. Please review the listing below. Orders are presented with '; print 'the most recent orders at the top of the listing. To view all of the information '; print 'for an order, track packages (if tracking information has been made available) and '; print 'to view a printable version of the order, click the \'View Order\' link next to the '; print 'order for which you would like more information.</p>' . $eol . $eol; print '<div class="khxc_storehead">Online Orders</div>' . $eol . $eol; print '<table id="ORDERLIST" class="khxc_sorttable">' . $eol; print '<tr class="khxc_sorttable">' . $eol; print '<th class="khxc_sorttable">View Order</th>' . $eol; print '<th class="khxc_sorttable">Order Number</th>' . $eol; print '<th class="khxc_sorttable">Order Date and Time</th>' . $eol; print '<th class="khxc_sorttable">Order Status</th>' . $eol; if ($recur) {print '<th class="khxc_sorttable">Recurring Charge Total</th>' . $eol;} print '<th class="khxc_sorttable">Total</th>' . $eol; print '</tr>' . $eol; foreach ($orders as $num => $order) { if ($order['status'] != 'Not Completed') { $link = $this->link_namespace($app,'ordersummary',array('ref' => $order['id'])); print '<tr class="khxc_sorttable">' . $eol; print '<td class="khxc_sorttable">'; print '<a href="' . $link . '" title="Review Order ' . $this->xhtml_encode($order['id']); print '">View Order</a></td>'; print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['id']) . '</td>' . $eol; print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['date']) . '</td>' . $eol; print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['status']) . '</td>' . $eol; if ($recur) {print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['recurtotal']) . '</td>' . $eol;} print '<td class="khxc_sorttable">' . $this->xhtml_encode($order['ordertotal']) . '</td>' . $eol; print '</tr>' . $eol; } // End of if statement. } // End of foreach statement. print '</table>' . $eol . $eol; } // End of if statement. ?>
John
Offline
What exactly are the advantages of this mod? Does this mod send the email as well, when an order has tried to take place, but the card has failed? That's my biggest problem. My client has lost a few orders because they didn't know someone was trying to order, so couldn't contact to help them.
Offline
So this would make it easy for us to distinguish actual cancelled orders from ones where the customer chooses "pay by phone" or when their credit card fails?
Thanks!
Offline
This will set the default status as Not Completed so that any order that doesn't get to the final process want be labled as Pending Payment. If the customer hits the final process button then all gateway that are set to update the order status will and all gateways set to not update the order status to Complete will set the status to Pending Payment.
This will not affect orders or send out email where the credit card fails as these order do not have a valid response from the payment processor that the order has been funded and would not get to this part of the code.
John
Offline
Just to double check, was this implemented in the last update? (dec07 or jan08)
James...
Offline
ok, then I'm safe to implement it myself thanks John
Last edited by wyattea (03-30-2008 19:55:20)
Offline
Ok, I've implemented, but I got this error:
Thank you. Your order has been approved and completed. You can review and print a copy of your order below. You will receive an email message containing your order confirmation within a few minutes. Fatal error: Class 'CCP_Order_status-ORIGINAL-BACKUP' not found in /khxc-private/core/KHXC/KHXC.php on line 1752
I don't understand why it's seeing that...i usually save a copy of the original file I'm editing with 'ORIGINAL-BACKUP' in the name...where is it seeing that?
UPDATE:
I deleted some files that were 'ORIGINAL-BACKUP' (saved to hd) and I didnt' get the error the next try...but i'm still curious why it would show this...did the khxc.php file reference ANY class files in a particular directory?
Regards,
James...
Last edited by wyattea (03-30-2008 21:46:49)
Offline
wyattea wrote:
I deleted some files that were 'ORIGINAL-BACKUP' (saved to hd) and I didnt' get the error the next try...but i'm still curious why it would show this...did the khxc.php file reference ANY class files in a particular directory?
If that file was in the ext directory below CCP_Order the answer is yes. Any file in that directory with an extension of PHP will be run when an order is processed. When making backups in that directory you need to change the extension to something other than PHP to avoid what you saw.
Offline
ah, that's good to know for future consideration...i always just change file name to 'ORIGINAL-BACKUP' + copy to HD.
James...
Offline