0

I'm creating orders programatically in magento but when I have to assign the payment method it will takes 10 to 50 minutes. I use:

$quote->getPayment()->importData(array('method' => 'banktransfer'));

Is posible to avoid the import data stament and use preformated array like in billing address, see example:

$addressData = array(
        'firstname' => $customer->getFirstname(),
        'lastname' => $customer->getLastname(),
        'street' => $pedido->ID,
        'city' => 'Ciudad',
        'postcode' => '123456',
        'telephone' => '123456',
        'country_id' => 'ES',
        'region_id' => 12, // id de la tabla directory_country_region
);
$shippingAddress = $quote->getShippingAddress()->addData($addressData);

Any idea about the payment array fields?

Thanks

1

You can use addData instead of importData.

  • addData take the same time as importData. Probably the problem is that I have more than 170 cart rules and I supose that when I apply the payment method, probably the cart apply the rules. But If I make the order using the admin area the cart dont take too many time to apply cart rules. Programatically about 40 minutes for a order of 20 items and in admin area 5 minutes for the same order. THANKS! – jfrubio Apr 20 '16 at 11:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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