title: Create Order in prestashop programmatically
body: <p>I am trying to create an order in prestashop programmatically, </p>
  
  <p>Here are the steps I am following:</p>
  
  <pre><code>$billingAddress = $order-&gt;getBillingAddress();
          $shippingAddress = $order-&gt;getShippingAddress();
          if (empty($billingAddress)) {
              continue;
          }
          $id_customer = $this-&gt;createPrestashopCustomer($billingAddress, $order-&gt;getEmail());
          $lines = $order-&gt;getLines();
  
          $AddressObject = new AddressCore();
          $AddressObject-&gt;id_customer = $id_customer;
          $AddressObject-&gt;firstname = $billingAddress-&gt;getfirstName();
          $AddressObject-&gt;lastname = $billingAddress-&gt;getlastName();
          $AddressObject-&gt;address1 = " " . $billingAddress-&gt;getHouseNr();
          $AddressObject-&gt;address1.= " " . $billingAddress-&gt;getHouseNrAddition();
          $AddressObject-&gt;address1.= " " . $billingAddress-&gt;getStreetName();
          $AddressObject-&gt;address1.= " " . $billingAddress-&gt;getZipCode();
          $AddressObject-&gt;address1.= " " . $billingAddress-&gt;getCity();
          $AddressObject-&gt;city = $billingAddress-&gt;getCity();
          $AddressObject-&gt;id_customer = $id_customer;
          $AddressObject-&gt;id_country = CountryCore::getByIso($billingAddress-&gt;getCountryIso());
          $AddressObject-&gt;alias = ($billingAddress-&gt;getcompanyName() != "") ? "Company" : "Home";
          $AddressObject-&gt;add();
          $currency_object = new CurrencyCore();
          $default_currency_object = $currency_object-&gt;getDefaultCurrency();
          $id_currency = $default_currency_object-&gt;id;
          $id_address = $AddressObject-&gt;id;
  
          $cart = new Cart();
          $cart-&gt;id_customer = (int) $id_customer;
          $cart-&gt;id_address_delivery = $id_address;
          $cart-&gt;id_address_invoice = $id_address;
          $cart-&gt;id_lang = 1;
          $cart-&gt;id_currency = (int) $id_address;
          $cart-&gt;id_carrier = 1;
          $cart-&gt;recyclable = 0;
          $cart-&gt;gift = 0;
          $cart-&gt;add();
          if (!empty($lines)) {
              foreach ($lines as $item) {
                  $cart-&gt;updateQty(1, 5, 19);
              }
          } 
          $cart-&gt;update();
          $order_object = new OrderCore();
          $order_object-&gt;id_address_delivery = $id_address;
          $order_object-&gt;id_address_invoice = $id_address;
          $order_object-&gt;id_cart = $cart-&gt;id;
  
          $order_object-&gt;id_currency = $id_currency;
          $order_object-&gt;id_customer = $id_customer;
          $CarrierObject = new CarrierCore();
          $CarrierObject-&gt;delay[1] = "2-4";
          $CarrierObject-&gt;active = 1;
          $CarrierObject-&gt;name = "ChannelEngine Order2";
          $CarrierObject-&gt;add();
          $id_carrier = $CarrierObject-&gt;id;
          $order_object-&gt;id_carrier = $id_carrier;
          $order_object-&gt;payment = "Channel Engine Order";
          $order_object-&gt;module = "1";
          echo $order-&gt;getTotalInclVat();
          $order_object-&gt;valid = 1;
          $order_object-&gt;total_paid_tax_excl = $order-&gt;getTotalInclVat();
          $order_object-&gt;total_discounts_tax_incl = $order-&gt;getTotalInclVat();
          $order_object-&gt;total_paid = $order-&gt;getTotalInclVat();
          $order_object-&gt;total_paid_real = $order-&gt;getTotalInclVat();
          $order_object-&gt;total_products = $order-&gt;getSubTotalInclVat() - $order-&gt;getSubTotalVat();
          $order_object-&gt;total_products_wt = $order-&gt;getSubTotalInclVat();
          $order_object-&gt;conversion_rate = 1;
          $order_object-&gt;id_shop = 1;
          $order_object-&gt;id_lang = 1;
          $order_object-&gt;secure_key = md5(uniqid(rand(), true));
          $order_id = $order_object-&gt;add();
  </code></pre>
  
  <p>The Order is getting added to admin But somehow I can not see products in the order, Can anyone check and let me know what I am doing wrong here.
  Also order total is also 0.</p>