[Skip to main content](#vessel-content)

#   Inserting an order through a plugin

##

- **[sauvain](/forum/user/37052-sauvain "View sauvain's Profile")**
- [![sauvain's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/37052-sauvain "View sauvain's Profile") Topic Author
- [ Offline](/forum/user/37052-sauvain)

Less More

- Posts: 49
- Thank you received: 4
-
-

8 years 10 months ago -  8 years 10 months ago [\#285047](#285047) by [sauvain](/forum/user/37052-sauvain "View sauvain's Profile")  *[Inserting an order through a plugin](/forum/31-development/893282-inserting-an-order-through-a-plugin#285047 "-- HikaShop version -- : 3.2.1 -- Joomla version -- : 3.8.3 -- PHP version -- : 7.0.26 -- Browser(s) name and version -- : any -- Error-message(debug-mod must be tuned on) -- : no error  Hello,  I try to create a new order through a plugin, but it is not displayed in the the orders page. I tried using two different methods:  First using the order API:  In this case it is creating the element in the &quot;xx&#95;hikashop&#95;order&quot; database table, but not in the &quot;xx&#95;hikashop&#95;order&#95;product&quot; one. What is missing so that the order appears in the order admin list?  The other method I created is by inserting directly the elements in the tables &quot;xx&#95;hikashop&#95;order&quot;, &quot;xx&#95;hikashop&#95;history&quot; &amp; &quot;xx&#95;hikashop&#95;order&#95;product&quot; and updating the product quantity in the table &quot;xx&#95;hikashop&#95;product&quot;. Although everything seems to be fine, the new orders do not appear in the hikashop back-end.")* was created by *[sauvain](/forum/user/37052-sauvain "View sauvain's Profile")*

-- HikaShop version -- : 3.2.1
-- Joomla version -- : 3.8.3
-- PHP version -- : 7.0.26
-- Browser(s) name and version -- : any
-- Error-message(debug-mod must be tuned on) -- : no error

Hello,

I try to create a new order through a plugin, but it is not displayed in the the orders page. I tried using two different methods:

First using the order API: Code:

$order = new stdClass(); $order-&gt;order_billing_address_id = 3; $order-&gt;order_shipping_address_id = 3; $order-&gt;order_user_id = 1; $order-&gt;order_status = 'refunded'; $order-&gt;order_type = 'retour'; $order-&gt;order_number = 'RET'.substr($curr_time, -4); $order-&gt;order_created = $curr_time; $order-&gt;order_modified = $curr_time; $order-&gt;order_currency_id = '151'; $order-&gt;order_full_price = (($result[0]-&gt;price_value) * ($prod_tax + 1)); $order-&gt;order_tax_info = $prod_tax_info; $order-&gt;order_payment_id = '11'; $order-&gt;order_payment_method = 'check'; $order-&gt;order_shipping_id = '6'; $order-&gt;order_shipping_method = 'manual'; $order-&gt;order_shipping_params = 'O:8:\"stdClass\":1:{s:6:\"prices\";a:1:{s:3:\"6@0\";O:8:\"stdClass\":2:{s:14:\"price_with_tax\";s:7:\"0.00000\";s:3:\"tax\";d:0;}}}'; $order-&gt;order_ip = '188.155.141.69'; $order-&gt;order_currency_info = 'O:8:\"stdClass\":4:{s:13:\"currency_code\";s:3:\"CHF\";s:13:\"currency_rate\";s:7:\"1.00000\";s:20:\"currency_percent_fee\";s:4:\"0.00\";s:17:\"currency_modified\";s:10:\"1447973156\";}'; $order-&gt;order_token = 'xxxx'; $product = new stdClass(); $product-&gt;order_product_quantity = 1; $product-&gt;order_product_price = $result[0]-&gt;price_value; $product-&gt;order_product_tax = ($result[0]-&gt;price_value) * $prod_tax; $product-&gt;product_id = $retour_prod_id; $product-&gt;order_id = $retour_order_id; $product-&gt;order_product_name = $result[0]-&gt;product_name; $product-&gt;order_product_code = $result[0]-&gt;product_code; $product-&gt;order_product_price = $result[0]-&gt;price_value; $product-&gt;order_product_tax = ($result[0]-&gt;price_value) * $prod_tax; $product-&gt;order_product_tax_info = $prod_tax_info; $product-&gt;order_product_shipping_id = '6@0'; $product-&gt;order_product_shipping_method = 'manual'; $order-&gt;products = array($product); $orderClass = hikashop_get('class.order'); $orderClass-&gt;save($order);

In this case it is creating the element in the "xx_hikashop_order" database table, but not in the "xx_hikashop_order_product" one. What is missing so that the order appears in the order admin list?

The other method I created is by inserting directly the elements in the tables "xx_hikashop_order", "xx_hikashop_history" &amp; "xx_hikashop_order_product" and updating the product quantity in the table "xx_hikashop_product".
Although everything seems to be fine, the new orders do not appear in the hikashop back-end.

Last edit: 8 years 10 months ago by [Jerome](/forum/user/80-jerome "View Jerome's Profile"). Reason: [code] tag is REALLY marvelous for posting code

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg5MzI4Mi1pbnNlcnRpbmctYW4tb3JkZXItdGhyb3VnaC1hLXBsdWdpbj90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

8 years 10 months ago [\#285049](#285049) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Inserting an order through a plugin](/forum/31-development/893282-inserting-an-order-through-a-plugin#285049 "-- HikaShop version -- : 3.2.1 -- Joomla version -- : 3.8.3 -- PHP version -- : 7.0.26 -- Browser(s) name and version -- : any -- Error-message(debug-mod must be tuned on) -- : no error  Hello,  I try to create a new order through a plugin, but it is not displayed in the the orders page. I tried using two different methods:  First using the order API:  In this case it is creating the element in the &quot;xx&#95;hikashop&#95;order&quot; database table, but not in the &quot;xx&#95;hikashop&#95;order&#95;product&quot; one. What is missing so that the order appears in the order admin list?  The other method I created is by inserting directly the elements in the tables &quot;xx&#95;hikashop&#95;order&quot;, &quot;xx&#95;hikashop&#95;history&quot; &amp; &quot;xx&#95;hikashop&#95;order&#95;product&quot; and updating the product quantity in the table &quot;xx&#95;hikashop&#95;product&quot;. Although everything seems to be fine, the new orders do not appear in the hikashop back-end.")*

Hi,

Only orders of the type "sale" will be displayed in the orders listing of the backend of HikaShop.
Orders of the type "subsale" (for HikaMarket vendor sub-sales) or "partner" (for commission payments to partners of the affiliate system) are not displayed there either.
If you want your order to appear on the orders listing you need to change its type to "sale".

Regarding the products, you need to have them in $order-&gt;cart-&gt;products and not $order-&gt;products

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg5MzI4Mi1pbnNlcnRpbmctYW4tb3JkZXItdGhyb3VnaC1hLXBsdWdpbj90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[sauvain](/forum/user/37052-sauvain "View sauvain's Profile")**
- [![sauvain's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/37052-sauvain "View sauvain's Profile") Topic Author
- [ Offline](/forum/user/37052-sauvain)

Less More

- Posts: 49
- Thank you received: 4
-
-

8 years 10 months ago [\#285096](#285096) by [sauvain](/forum/user/37052-sauvain "View sauvain's Profile")  Replied by *[sauvain](/forum/user/37052-sauvain "View sauvain's Profile")* on topic *[Inserting an order through a plugin](/forum/31-development/893282-inserting-an-order-through-a-plugin#285096 "-- HikaShop version -- : 3.2.1 -- Joomla version -- : 3.8.3 -- PHP version -- : 7.0.26 -- Browser(s) name and version -- : any -- Error-message(debug-mod must be tuned on) -- : no error  Hello,  I try to create a new order through a plugin, but it is not displayed in the the orders page. I tried using two different methods:  First using the order API:  In this case it is creating the element in the &quot;xx&#95;hikashop&#95;order&quot; database table, but not in the &quot;xx&#95;hikashop&#95;order&#95;product&quot; one. What is missing so that the order appears in the order admin list?  The other method I created is by inserting directly the elements in the tables &quot;xx&#95;hikashop&#95;order&quot;, &quot;xx&#95;hikashop&#95;history&quot; &amp; &quot;xx&#95;hikashop&#95;order&#95;product&quot; and updating the product quantity in the table &quot;xx&#95;hikashop&#95;product&quot;. Although everything seems to be fine, the new orders do not appear in the hikashop back-end.")*

Great, thanks

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg5MzI4Mi1pbnNlcnRpbmctYW4tb3JkZXItdGhyb3VnaC1hLXBsdWdpbj90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.040 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
