Move product to different category once paid?

  • Posts: 324
  • Thank you received: 4
  • Hikamarket Multivendor Hikashop Business
4 years 3 months ago #326935

Hi,

I am using Moonsoft's Calcbuilder to generate Hikashop products, but when it creates the product, it's automatically published to a particular category, even though it's not paid for yet. Is there any way to automatically move a product from one category to another when it is marked as paid?

I was just experimenting with mass actions, but I can't seem to figure out a way to change the category of the product when the order status is changed to confirmed. Is that possible?

Thanks!

Last edit: 4 years 3 months ago by DogPeople.

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

  • Posts: 83404
  • Thank you received: 13498
  • MODERATOR
4 years 3 months ago #326971

Hi,

I don't see a way to do that with a mass action.
Could you explain why you need to move the product to another category after the purchase ?
Couldn't you just make that category unpublished and leave the products where they are after the purchase ?
Maybe there is a simpler solution to your problem.

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

  • Posts: 324
  • Thank you received: 4
  • Hikamarket Multivendor Hikashop Business
4 years 3 months ago #327007

Hi,

I am using the site as a kind of a "job board".

So one type of customer (created as a Joomla group) fills in the form with Moonsoft's calcbuilder. That creates a product in a special category in Hikashop.

But if they choose to PAY for the order, it becomes a job that another kind of customer can "claim" from a job board.

Right now., I manually have to change the category. I am hoping to move it automatically if they choose to purchase it and pay for the order.

Regards,

Tamara

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

  • Posts: 83404
  • Thank you received: 13498
  • MODERATOR
4 years 3 months ago #327035

Hi,

Ah ok, I see what you mean.
I that case the best would be to develop a small plugin implementing the onAfterOrderUpdate trigger to move the products of the order automatically with a few MySQL queries and PHP code.

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

  • Posts: 324
  • Thank you received: 4
  • Hikamarket Multivendor Hikashop Business
4 years 3 months ago #327079

Hi there,

Thanks. That makes sense. How would I go about doing that? Is there any documentation I can refer to?

Thanks!

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

  • Posts: 83404
  • Thank you received: 13498
  • MODERATOR
4 years 3 months ago #327081

Hi,

Our developer documentation is here:
www.hikashop.com/support/documentation/6...r-documentation.html
You'll find a bit of information about this trigger there.
And also, if you don't know how to develop a Joomla plugin, there is a link there to the Joomla documentation about it.
Once you know how to make a Joomla plugin and can implement the trigger on your plugin, you can do a var_dump of the $order variable given to you and start testing by changing the status of a test order in the backend.
You'll probably want to use the loadFullOrder function of class.order to load all the data of the order being updated so that you can go through the products of the order to get their id and change their category if necessary.
To change their category, you can just update the entry with the matching product_id in the hikashop_product_category table with the new category_id.

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

  • Posts: 324
  • Thank you received: 4
  • Hikamarket Multivendor Hikashop Business
4 years 3 months ago #327096

Thanks! Bit of learning to do, but since I will process payments manually for a while, I have some time to get this figured out.

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

  • Posts: 324
  • Thank you received: 4
  • Hikamarket Multivendor Hikashop Business
4 years 3 months ago #327474

Hi again,

I was looking into this more, and I came across an article about mass action plugins.

Would I be able to do this to solve this problem? www.hikashop.com/support/documentation/1...s-action-plugin.html

It seems as though all I would need to do is add an action that works with the trigger of a product being paid for, based on the category I want to move it from?

Thanks.

Last edit: 4 years 3 months ago by DogPeople.

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

  • Posts: 324
  • Thank you received: 4
  • Hikamarket Multivendor Hikashop Business
4 years 3 months ago #327482

Could you advise, based on the previous information provided, if this would work?

Seems like I just need to add a new action?

Last edit: 4 years 3 months ago by DogPeople.

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

  • Posts: 83404
  • Thank you received: 13498
  • MODERATOR
4 years 3 months ago #327490

Hi,

This article was not removed.
It's still there. It seems you made a wrong copy / paste. Here is the link to it:
www.hikashop.com/support/documentation/1...s-action-plugin.html

It is certainly possible to develop plugins you add your own triggers, filters and actions to the mass action system following this documentation
Actually, all the triggers, filters and actions that you see there are added by the massaction plugins preinstalled with HikaShop.
I would recommend however not modifying directly the plugins already preinstalled as they are updated each time you update HikaShop and thus you'll loose your changes when you update.

Now, if you develop your own action, you could actually do the same without going through the mass action system, just implementing the onAfterOrderUpdate trigger and running your code when the order is being confirmed. It wouldn't be much more complex and you would have full control of the whole process in your plugin.

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

  • Posts: 324
  • Thank you received: 4
  • Hikamarket Multivendor Hikashop Business
4 years 2 months ago #327510

Thanks. I realized that when I went back to the bookmarked one!

I have hired a developer to build me a mass action plugin. I have asked them to build one that will:

- Be triggered when an order is paid.
- Only apply to one type of customer (so I need to be able to select the Joomla ACL user group)
- Only apply to a particular category.
- Automatically move paid products from that category to another category that I need to be able to select from the mass action interface.

Is there anything else I should be telling them, or is that enough information? I ran through the options on the existing mass actions, and it seemed like that was all that needed to happen.

I could have figured that out myself I suppose, but I am still learning PHP, and I wanted it done ASAP.

Thanks!

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

  • Posts: 83404
  • Thank you received: 13498
  • MODERATOR
4 years 2 months ago #327513

Hi,

Well, you should give him also the link to that documentation page :)
And tell him to base himself off of the mass action plugins already available in plugins/hikashop/massaction_order and the plugins/system/hikashop_massaction folders.
That will give him a good basis to not have to check all the code /files, especially if he isn't familiar with Joomla's structure.

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

  • Posts: 11
  • Thank you received: 0
4 years 2 months ago #327770

Hello Guys,

I have recently created a custom plugin for massaction.
SO after paid order your products will be moved to other category. I can send you with small amount,
Please contact me on my email id: This email address is being protected from spambots. You need JavaScript enabled to view it.
skype: sanjeev.raghuwanshi7
My website : joomtechsolutions.com/

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

Time to create page: 0.087 seconds
Powered by Kunena Forum