Jump to content

Problem when converting a cart with 2 products on order by code, just add 1


gusman126

Recommended Posts

I have developed a module that reads the data and adds the information to a cart

EDITO to clarify:

This cart is generated with a php file, it has been called from a CRON that reads the information by a call "curl", it is not generating the cart while visiting or using the web page.

Similar to if you read the data from a CSV -> cart -> Order

Add the new customer

 

 $customer = new CustomerCore();

Add the address

$address_shipping = new Address();

generate the cart

 $cart = new Cart();

Add products

foreach ($productos as $producto){
    $cart->updateQty($qty, $id_product, $attr);
}

It update and save, and until here everything ok, I check the cart and it is added with all products 1,2,3 or more

Valid the order associating it with a payment module and generate the order

$pago->validateOrder($id_cart, $order_status, $total_products, 'Pagado', NULL, array(), (int)$id_currency, false, $customer->secure_key);
$order = new Order($pago->currentOrder);
$order->setCurrentState($order_status);
$order->save();

And here the problem,

The order only stays with 1 product, does not add the products of the cart to the order, always 1, have the cart 1,2 or more

Solution?

Edited by gusman126 (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...