Product code auto generation

  • Posts: 112
  • Thank you received: 0
13 years 3 months ago #23983

Hi Nicolas,

Is it possible to configure the system so it auto generates product codes once a new product created?

Thank you.

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

  • Posts: 112
  • Thank you received: 0
13 years 3 months ago #23984

One more enquiry...

I am using PayPal plugin as a payment method. Could tell me where in the code an order status gets updated to confirmed? I need to do something at that point in time.

Thanks a lot.

P.S. Sorry I added this message to this post as I didn't want to open a new thread just for one question.

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
13 years 3 months ago #23987

The product codes are already generated automatically when the product is created.

If you want to do something when the order status changes, the best is to create a hikashop plugin and implement the onBeforeOrderUpdate or onAfterOrderUpdate events as explained in the developer documentation:
www.hikashop.com/en/support/documentatio...r-documentation.html

You can also edit the save function of the file administrator/components/com_hikashop/classes/order.php directly but your modification will be erased when you update HikaShop in the future.

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

  • Posts: 112
  • Thank you received: 0
13 years 3 months ago #24014

Hi,

Thank you for the suggestion.

Regarding the code auto generation - I can see that the code is being generated from product title. It's not very convenient to have rather long codes. Is there a way to use some sort of algorithm for this, like you do for order # where we can use various things, like date, strings, etc?

Thanks.

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

  • Posts: 112
  • Thank you received: 0
13 years 3 months ago #24016

Hi Nicolas,

I found this plugin plgHikashopAcymailing which implements the onAfterOrderUpdate function. Could you explain what it does on order status update? May be it's exactly what I need. I need to subscribe a user to a mailing list on order status update. Am I in the right file for this?

Thanks.

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
13 years 3 months ago #24027

If you want to have other types of product codes, you should create a hikashop plugin and implement the onBeforeProductCreate event:
www.hikashop.com/en/support/documentatio...r-documentation.html
There, you can just set yourself the product code in the product_code attribute of the object given and that will use your product_code.

The plgHikashopAcymailing plugin triggers the filter system of acymailing when the status of an order is changed. With the filters of AcyMailing (with the enterprise edition) you can save a filter to subscribe someone to a specific list and set that filter to run when an order is confirmed.
Then, thanks to that plugin, the filter will be triggered automatically when orders are confirmed and your customers will be subscribed to the list you want at that point. So it seems to do exactly what you want.

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

  • Posts: 112
  • Thank you received: 0
13 years 3 months ago #24068

Hi Nicolas,
Thank you for the advise. I have never created a plugin before. I suppose I can figure out how to write one by looking at other plugins, but how do I make it to be used by the product save function? Any advise would be highly appreciated. Also, could I reuse in the plugin the same function you use for order number generation?

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
13 years 3 months ago #24082

The product save function triggers an event before and after saving a product. If your plugin implement these events, they will be called automatically if you plugin is published in Joomla.
There is nothing special to do as long as you do your plugin like the other plugins already available.

You can't reuse the function we use for the order number generation. The code will have to be different as the order number generation code needs the order info, and wouldn't use the product info.

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

  • Posts: 112
  • Thank you received: 0
13 years 3 months ago #24087

Thank you. I'll give it a go...

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

Time to create page: 0.057 seconds
Powered by Kunena Forum