Ordernumers not correct

  • Posts: 79
  • Thank you received: 2
8 years 7 months ago #236946

-- HikaShop version -- : 2.6.2
-- HikaMarket version -- : 1.6.7
-- Joomla version -- : 3.5.1
-- PHP version -- : 5.3.48

Hi,

I have setup hikashop with hikamarket-multivendor. I created 2 vendors and using them for drop shipping.
When someone orders from the website they get a ordernumber lets say 000035.
I have turned on "same ordernumber for suborders" (set to yes). Now to the vendors its showing the same ordernumbers but when there is another order placed on the website it jumps up 2, so 000037.
This happened to when the vendors had their own ordernumbers, but since i turned that of and to use the same order numbers, i dont know whats going on. Maybe i missed a setting someplace.
Any help would be appreciated.
Thanks,

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 7 months ago #236984

Hi,

The "order_id" is an automatic number which is directly provided by your database.
There nothing that HikaMarket or HikaShop can do.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 79
  • Thank you received: 2
8 years 7 months ago #236996

Hi Jerome,

I understand that the ordernumber is a unique number provided by the database. However when i install hikashop everything goes fine.
When installing hikamarket multivendor is where it started happening.
I created 2 vendors. Now when i did a purchase on the front end and put in a product from each vendor in the shoppingcart and went through the check out. This is what happened.
Hikashop give an ordernumber to the customer order for instance 00035. Then a suborder was made for vendor 1 which had an ordernumber 00036 then another suborder was made for vendor 2 which was ordernumber 00037.
Then when a customer bought product in the front end it automatically gave it the ordernumber 00038.
So it jumped 2 numbers because of the suborder numbers. Probably if i have 3 vendors it would jump 3 numbers.
Now i turned on the option in hikamarket multi vendor to use the same ordernumber as the frontend (customer order) but then it still jumps up with 2 numbers.

It is like in the order table the customer ordernumber which is auto increment which works fine. But the suborders are i think seen as customer orders too in the same table.

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 7 months ago #237004

Hi,

Create an order without any vendor ; the system will continu to work as it was.
Create an order with 2 vendors, you will create 2 sub orders and your "counter" will be increase by 2.
Like I said :

The "order_id" is an automatic number which is directly provided by your database.
There nothing that HikaMarket or HikaShop can do.


Use the invoice ID instead.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 79
  • Thank you received: 2
8 years 7 months ago #237166

Hi,

I tried what you said, to use the invoice number. When the mainorder is placed 2 suborders are placed but also 2 "sub" invoice numbers. When i use code like $order->order_invoice_number then its not using the main orders invoice number, but the invoice number assigned to the vendors "order". I dont know if there is away to pull the invoice number from the main order.

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 7 months ago #237259

Hi,

That's not really what I meant.
You said that you see "holes" in your "Order numbers" and I explained that is logical because some orders are not clearly visible which could give that impression of "holes".
The "Invoice number" is made to generate sequential numbers ; each time an order is confirmed an invoice ID will be generated.
And each vendor have his own invoice sequence.

So now ; if you have another question please explain your context and your dilemma.
Because right now ; I can only tell you that there is no problem with the "order numbers" ; they are correct, they are like they should be.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 79
  • Thank you received: 2
8 years 7 months ago #237273

Hi,

ok i agree everything is working the way you developed the addon.
For me what i am trying to accomplish is the we dont work with "individual shops" or vendors they way the addon was developed.
We do dropshipping with several suppliers.
So for us the main order from the customer is important.
Then the emails send to the suppliers are based on the main order. I can see that individual "sub orders" are made.
In the hikashop_order table you have the main order and then the sub orders, which explains the order number jump up with 2 because i have 2 vendors. This i understand. Also each vendor gets their own invoice number, which is also in the order table.
For me whats important that i use the same number from the main order all the way down to the vendors.
So the order number changes, so i cant use that. The main invoice number i could use. Thats the number that goes on the invoice to the customer. This is what i thought you also meant with using the invoice number. I would like to use that main invoice number on the packingslip to the vendors.
Like in my previous post, if i use $order->order_invoice_number it will use the "sub invoice number".

So looking at the table i would be looking at something like this:

SELECT order_invoice_number
FROM hikashop_order
WHERE order_id = ( SELECT order_parent_id
FROM hikashop_order
WHERE order_id =<suborderID> )

This would pull the main invoice number out when sending a packinglist to the vendor. This way i would have one consistant number accross the platform.

Im just not sure how to implement that in the code.

btw this is done in the attachinvoice pdf plugin, that i duplicated to do the packinglist

Last edit: 8 years 7 months ago by rkuiper.

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 7 months ago #237323

Hi,

What I can propose you is to add a new invoice number format in HikaMarket.
In the HikaMarket order class, you can replace

$query = 'SELECT MAX(a.order_invoice_id)+1 FROM '.hikamarket::table('shop.order').' AS a WHERE a.order_type = '.$this->db->Quote('subsale').' AND a.order_vendor_id = '. (int)$vendor_id;
By
if($format == '{parent_code}') {
	$order_parent_id = !empty($order->order_parent_id) ? $order->order_parent_id : $order->old->order_parent_id;
	$query = 'SELECT o.order_invoice_id, o.order_invoice_number FROM '.hikamarket::table('shop.order').' AS o WHERE o.order_type = '.$this->db->Quote('sale').' AND o.order_id = '.(int)$order_parent_id;
	$this->db->setQuery($query);
	$order_number_data = $this->db->loadObject();
	$order->order_invoice_id = (int)$order_number_data->order_invoice_id;
	$order->order_invoice_number = $order_number_data->order_invoice_number;
} else {
	$query = 'SELECT MAX(a.order_invoice_id)+1 FROM '.hikamarket::table('shop.order').' AS a WHERE a.order_type = '.$this->db->Quote('subsale').' AND a.order_vendor_id = '. (int)$vendor_id;
Then
$order->order_invoice_number = hikamarket::encodeNumber($order, 'invoice', $format);
$order->order_invoice_created = time();
By
	$order->order_invoice_number = hikamarket::encodeNumber($order, 'invoice', $format);
}
$order->order_invoice_created = time();
And finally you will be able to set that new format in your HikaMarket configuration.
So instead of generating an invoice number for the subsales ; HikaMarket will extract the invoice number from the parent (main) order.

Let me know if you have feedback on it.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: rkuiper, allaspects

Please Log in or Create an account to join the conversation.

  • Posts: 79
  • Thank you received: 2
8 years 6 months ago #240399

Hi Jerome,
Sorry for the late response.
This worked for me thank you.

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 6 months ago #240426

Hi,

That's a good news because the patch is already in HikaMarket 1.7.0 :)

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

Moderators: Obsidev
Time to create page: 0.129 seconds
Powered by Kunena Forum