How to make custom status "successful"?

I’m implementing payment method via bank.

I have a custom order statuses tied with that payment method.

One status is for the successful payment, and other is for the failed payment.

My problem is that when I set my custom status to the order, at the end of the ordering process customer get’s the notification that the order has failed.

Is there a way to tell the cscart that selected custom status is “successful”?

Yes but you will have to put that in the payment file

[quote name=‘E.Qi.Librium’]Yes but you will have to put that in the payment file[/QUOTE]



What do you mean by “put that in the payment file”?

I have made the payment processor, and it works.

It redirects customer to the bank page where he can enter his card number.

After the payment procedure, bank page redirects user back to my cart and notifies the cart on the transaction status.

I then use fn_finish_payment() to set the order status based on the transaction status.

It all works as I want it to work, except for that “filed” message customer gets at the end of the ordering process.

Here is the message i get: “Your order has been declined by the payment processor. Please review your information and contact store administration.”

In that specific payment method file, you will have to change certain part of the code that gives out that message, I don’t know how is the code for that payment, but I 'l give you an example of what I mean based in one of my payment methods:



```php $pp_response = array();

$pp_response[‘order_status’] = (($_REQUEST[‘Ds_Response’] == “0000” || $_REQUEST[‘Ds_Response’] == “0099”) && $_REQUEST[‘Ds_Signature’] == $signature) ? ‘P’ : ‘O’;

$pp_response[‘reason_text’] = $response_mess[$_REQUEST[‘Ds_Response’]];

if ($pp_response[‘order_status’] == ‘P’) {

$pp_response[‘transaction_id’] = $_REQUEST[‘Ds_AuthorisationCode’];

}



fn_finish_payment($_REQUEST[‘order_id’], $pp_response);

exit;



} elseif ($mode == ‘failed’) {

$order = fn_get_order_info($_REQUEST[‘order_id’]);

$pp_response = array(

‘order_status’ => ‘F’,

‘reason_text’ => fn_get_lang_var(‘text_transaction_declined’)

);

fn_finish_payment($_REQUEST[‘order_id’], $pp_response);

fn_order_placement_routines($_REQUEST[‘order_id’]);

}

} else {

```



It must be something similar, you just have to change the part of your code where it puts the “F” for failed and replace it with “O” for open

No, the ‘order_status’ and ‘reason_text’ are not the issue here.

My ‘order_status’ is ‘Z’ on success and ‘X’ on failure. I use ‘reason_text’ for some transaction info receive as a feed back from the banks system.



I found the solution for my problem inside the fn_order_placement_routines() function.

Success notification is regulated by the 4th argument. If it’s set to ‘save’ cart will display “success” notification not the “error” message.



Example:

```php fn_order_placement_routines($_POST[‘OrderID’], array(), true, ‘save’); ```



Thank you on your help.

I realy need your opinion-solution.



When a customer makes an order and pays with creditcard or paypal but he doesn’t finishes the payment successfuly(closes his browser or clicks the back button of the browser), something wrong is happening.

I get the order as open.

But it is not realy placed and the product is not more available and his gift certificate is used !!

So he cannot try again because the product isn’t there(case of 1 stock) and his gift certificate isn’t active.

So I would like to know how can this big issue can be handled.

Should be a solution to auto cancel the order if the paypal or creditcard processor doesn’t answer ?



I don’t know what to change to solve this, I am amazed !

To solve the stock problem, you have to change the Open order status regarding stock. This is how you can change it:



Open your database and find the “cscart_status_data” table, then you will see this line:



status type param value

O O inventory D



You just have to change the “D” to “I” in order to not decrease your inventory while the order is still in “open” status, this way you will not run out of stock due to false orders.

Ok, that was very helpful and it worked for the stock



So, now someone can make an order via paypal and creditcard and if clicks back or closes the browser he can make the order again without stock inavailability.

But if he has already used his gift certificate he now cannot !



Also if someone chooses an offline payment, the stock doesn’t change (not good).



So, solution no1:

I must change the success status of the offline payment method (uses money.tpl) to Processed which updates inventory.



anyone any idea?





P.S.I don’t know if there is a solution about gift cerificate issue

About the gift certificate can’t help you there because I never used that feature.

For the offline payments yes, you can change the default order status to “P” in that payment file or you can change it manually, I always do it manually, as it’s not every time the client ends up paying that order, sometimes he doesn’t.

I’ll try to use it not manualy at the begining.



You mean the money.tpl file ? Because it is empty !



I want to try to change the default order status to “P” .But where do you mean ?



I also searched in database but nothin

Good question dioskouros :rolleyes: , but the truth is that it seems that there’s no offline payment file in the payments folder. Let’s see if anyone knows where can it be changed.

yes, where can be the command that say the order to be statused as O or P ?