Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Customer Modify an existing order


juniorprg

Recommended Posts

Posted

Hello

 

I have a new challenge on hand, i have to create a mod which should let customer modify an existing order, ordered within the last 12 hrs.

 

basically after the order is made, its available in account_history, after viewing the order he/she should be able to edit the contents of the order, similar to what happens at checkout_confirmation.php page..but with the difference that they should be able to modify the ones made within 12hrs

 

I do not have too much clue about this, has anyone worked on it or any idea will be helpful. thank you

l8ter

Posted

Would it not be much easier to delete/cancel the order and place a new one?:) . That way, not only 12hrs, but 12wks, or even 12mths, if the transaction hasn't gone through to the bank and ordered item hasn't been delivered? :P

 

Ken

 

Hello

 

I have a new challenge on hand, i have to create a mod which should let customer modify an existing order, ordered within the last 12 hrs.

 

basically after the order is made, its available in account_history, after viewing the order he/she should be able to edit the contents of the order, similar to what happens at checkout_confirmation.php page..but with the difference that they should be able to modify the ones made within 12hrs

 

I do not have too much clue about this, has anyone worked on it or any idea will be helpful. thank you

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Posted
Would it not be much easier to delete/cancel the order and place a new one?:) . That way, not only 12hrs, but 12wks, or even 12mths, if the transaction hasn't gone through to the bank and ordered item hasn't been delivered? :P

 

Ken

 

thats correct..actually i was thinking about that...but now i dont know how to create a customer cancel order mod. i found a post in this forumn about cancelling order but it seems to have some error, have a look and see if you can help me out here..thanks in advance

 

in account_history_info.php :

 

just after this (the back button stuff) :

 

<td><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY, tep_get_all_get_params(array('order_id')), 'SSL') . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td>

 

 

You add this (add a cancel order button only if the status is right):

 

<?php

$statquery = tep_db_query("select orders_status from " . TABLE_ORDERS . "

where orders_id = '" . (int)$_GET['order_id'] . "'");

 

$status_array = tep_db_fetch_array($statquery);

 

$order_cancel_ok = array(1); // stati which allow cancelling

 

if (in_array($status_array['orders_status'], $order_cancel_ok)) {

echo '<td width="140px" valign="middle" align="center">' . tep_image_submit('button_cancel_order.gif', 'Cancel Order','','update_button') . tep_draw_hidden_field('oID', $HTTP_GET_VARS['order_id']) . '</td>';

}

?>

 

 

in application_top.php :

 

just after (basically any of the case statements):

 

case 'buy_now' : if (isset($_GET['products_id'])) {

if (tep_has_product_attributes($_GET['products_id'])) {

tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $_GET['products_id']));

} else {

$cart->add_cart($_GET['products_id'], $cart->get_quantity($_GET['products_id'])+1);

}

}

tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

break;

 

 

You add :

 

//**********************

 

case 'cancel_order':

$oID = tep_db_prepare_input($_POST['oID']);

$check_status_query = tep_db_query("select customers_name,

customers_id,

customers_email_address,

orders_status,

date_purchased

from " . TABLE_ORDERS . "

where orders_id = '" . (int)$oID . "'");

 

$check_status = tep_db_fetch_array($check_status_query);

$order_cancel_ok = array(1); // stati which allow cancelling

 

if (

($check_status['customers_id'] == $_SESSION['customer_id']) // just to be sure

and (in_array($check_status['orders_status'], $order_cancel_ok))

) {

tep_db_query("update " . TABLE_ORDERS . "

set orders_status = '" . tep_db_input(4) . "',

last_modified = now()

where orders_id = '" . (int)$oID . "'");

 

// update stock and status if order is cancelled

$products_query = tep_db_query("select products_id,

products_quantity

from " . TABLE_ORDERS_PRODUCTS . "

where orders_id = '" . (int)$oID . "'");

while ($ordered_products = tep_db_fetch_array($products_query)) {

$product = $ordered_products['products_id'];

$qty = $ordered_products['products_quantity'];

tep_db_query("update " . TABLE_PRODUCTS . "

set products_quantity = products_quantity+'" . $qty . "',

products_status = '" . 1 . "'

where products_id = '" . $product . "'");

}

tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . (int)$oID . "', '" . '4' . "', now(), '" . ($customer_notified) . "', '" . 'Cancelled by Customer' . "')");

 

}

break;

 

//**********************

 

 

you could add a confirmation cycle but for now I have not done so.

 

 

THIS IS FROM THIS POST: http://www.oscommerce.com/forums/index.php?sho...mp;#entry592068

l8ter

Posted

The issue here is, in IMHO, why you'd want your customers to cancel their orders online, and if so, up to what order stage you'd allow them to do so? Or would you really want to put on hold processing all orders until after 12hr? If so, some, or rather many, of your customers would be disappointed by the delay of their orders. The seemingly un-tested code you quoted here was based on the understanding that only orders at the pending stage could be cancelled, not within 12hrs. You may be better off to state in your ts & cs that orders could only be cancelled if they call in and th e order hasn't passed a certain stage, eg, payment accepted/delivery, which could have been a refund/return issue and not cancellation. You'd add a 'cancel' order stage via admin, and if the customer does call in, you then simply 'downgrade' the order status to 'cancel'. Isn't that more practical/easier?

 

Ken

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Posted

the customers chooses the date to be ordered so they know that the order will be only delivered by that date so they have an understanding, i want them to have the ability to cancel the order within that stipulated time period. (my future plan is to let them modify too) . the code i pasted above i believe is perfect for my scenario, i think in the code the missing is the cancel_order function thats been used in the application_top

 

i believe it should be called somwhere in this code..but where

 

if (in_array($status_array['orders_status'], $order_cancel_ok)) {

echo '<td width="140px" valign="middle" align="center">' . tep_image_submit('button_cancel_order.gif', 'Cancel Order','','update_button') . tep_draw_hidden_field('oID', $HTTP_GET_VARS['order_id']) . '</td>';

}

?>

l8ter

Posted

Sorry, just realised was a bit carried away :) . your question was about modifying orders not cancellation. But then thnk it may still be better to cancel th eoriginal and re-order.

 

Ken

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Posted

:) its ok , the code i pasted above was for cancel the order ...can you see where to put that cancel_order function in that coding pasted above...

 

im thinking to find out a way to cancel the order...then make them re-order with the changes...

l8ter

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...