0

I'm having problems with the credit card payment transaction and I'm kind of sure that the quote_id is the cause of it. The problem is I don't know how to increment manually the quote_id in order to find out if I'm right or I'm wrong.

4
  • What "problems" exactly? Commented Jun 23, 2015 at 4:04
  • Well, there were some problems, but right now (apparently) I have just one: the credit card transaction company rejects the cc transactions with the answer "ABORTED", according with configuration manual, that they give to their clients, the meaning is "the transaction was canceled by the user", which definitely is not true. After a lot of debugging with custom log files I spotted the possible error: the quote_id never is incremented, so the cc transaction company got always the same ID (no matter what) which is forbidden on its side (according its conf manual).
    – abiyi
    Commented Jun 23, 2015 at 13:20
  • as @Adarsh said, quote_id is auto_increment in the database, thus it will increment for each new record. You should check first if a quote record is created, then if the id of that quote is sent to the cc transaction company. Commented Jun 23, 2015 at 13:27
  • That's something I've asking to my self since yesterday: when the quote_id is incremented?. I've been working with this with two transactions (almost everything is logged) and both have the same quote_id: 2 and 23. What do I have to do in order to get the next number?
    – abiyi
    Commented Jun 23, 2015 at 13:39

2 Answers 2

0

First

You cannot do increment manually the quote_id since it is set to auto increment in the database since it is primary key of the table.

So when any quote is created, quote_id is created automatically as it is auto increment and which has to be unique all the time as per sql rule.

To your problem

If you have problem with credit card payment then should you be debugging in payment section. If you are using any external extension for your payment system then please contact them. Or else magento should by default handle all payment without any error.

2
  • Eventually I guess I will have to put in contact with the credic card transaction company support office, but before of that I want to. I already logged everything about the cc payment transaction and the only thing out of place is the costant value of quote_id (which is not allowed it), but how I tell to Magento to jump to the follow ID?
    – abiyi
    Commented Jun 23, 2015 at 13:45
  • I noticed something interesting: into the data array sent to the cc transaction company is included the order ID, but the value doesn't come from order_id but from quote_id (probably because the order_id is created at the very end of the process, after the cc data is sent), now I found out that I can change the quote lifetime days in the Admin Panel, but the cuote_id for my user keeps using the same ID. That could explain why the cc transaction was rejected "ramdomly".
    – abiyi
    Commented Jun 23, 2015 at 20:18
0

First at all, the problem I was having was getting the "ABORTED" answer, the reason was that one field always was sent with the same value, that value was orderid (which is actually the quote_id because the order id is hasn't been created at that point), which is forbidden cause is a unique field in their database. Magento never create a new quote for one user until its current transaction is complete (or when another session is created, I'm not sure yet), the quote_id is sent (as a orderid) with the same value for one user, over and over again so every transaction is aborted.

The solution: just deactive the current quote when the credit card gateway doesn't answer with the string "APPROVED", in sales_flat_quote just set is_active to 0, so Magento would give to the user a brand new quote. The problem is that everything in the cart would lost for the user (the record still exists, but the user wouldn't have access to it anymore), so the Magento would have to clone the quote, then deactive the current and save both, the cloned quote will be now the current quote but with a different quote_id.

// get the current quote
$current_quote = Mage::getModel('sales/quote')->load(23);

// create a new one
$cloned_quote = Mage::getModel('sales/quote');

// copy the content of the current one into the new one
$cloned_quote->merge($current_quote);

// deactive the current quote
$current_quote->setIsActive(false);

// save the cloned quote
$cloned_quote->collectTotals()->save();

// and save the changes of the current quote
$current_quote->save();

// now the current save is inactive 
// and the cloned one is the "new" current quote

the solution was taken from here How to copy one quote (only cart items) to other quote (only items )

Now the final step (or maybe the first one) is increment the quote_id manually, why? the credit card gateway already has a lot of order ids registered with this e-shop, 149 to be precise (using Magento 1.7, by the way). I migrated almost everything to Magento 1.9, but with a brand new database, the quotes were setted to zero, so the first quote generated will be rejected from the cc gateway. This is the solution:

ALTER TABLE sales_flat_quote AUTO_INCREMENT = 149;

So, basically this sum up the solution to my problem. Hope this will be useful to someone else.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.