Get vendor id in order number format

  • Posts: 69
  • Thank you received: 5
  • Hikamarket Multivendor Hikashop Business
1 week 4 days ago #322464

-- HikaShop version -- : 4.3.0
-- Joomla version -- : 3.9.20
-- PHP version -- : 7.2.26

Hello,

is it possible to add the vendor id in the order number format?

I tried to proceed in this way:

{order_vendor_id}-{date format="dmY"}-{id size="3"}

It works everything but not the order vendor id.

Just to let you know I enabled the option to let just one vendor in the cart and in this way there is ust one vendor every time in the cart


How can I proceed?


Thank you for your support

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

  • Posts: 70194
  • Thank you received: 10508
  • MODERATOR
1 week 4 days ago #322476

Hi,

The order_vendor_id is only used for sub orders where the vendor is always unique.
For the main orders, as they can potentially be configured with products from different vendors, that value stays at 0.
Even in "one vendor" mode, you are still able to add products from different vendors in the backend, so it doesn't change the way it works and that's why what you want doesn't work.
The only solution I see is to develop a small plugin in the group "hikashop" and implement the onBeforeOrderNumberGenerate(&$order, &$result) trigger
In $order you'll have the data of the order, and in $result you can set the order number you want to be used.
That way, you can use the vendor_id set in the products (I suppose in $order->cart->products).

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

  • Posts: 69
  • Thank you received: 5
  • Hikamarket Multivendor Hikashop Business
1 week 4 days ago #322486

I see the documentation about triggers but I didn`t understand where I can create a new trigger. I developed a lot of code but never a trigger.

Thank you for you precious support

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

  • Posts: 70194
  • Thank you received: 10508
  • MODERATOR
1 week 4 days ago #322492

Hi,

Well, you need to create a plugin of the group "hikashop".
I would recommend to check the two first parts of our developer documentation:
www.hikashop.com/support/documentation/6...mentation.html#intro
It has a link to the Joomla documentation on how to create plugins.
And then a small example of a plugin's code with 2 triggers implemented.
With that, if you're a developer, you should be able moving forward.

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

Time to create page: 0.059 seconds
Powered by Kunena Forum