- Posts: 640
- Thank you received: 16
Mass action value update using PHP code
- PeterChain
-
Topic Author
- Offline
After an OnBeforeUpdate event I want product_description fieldcontent to be updated with the values of several custom_fields. Like:
Is it possible to do?
How should be the code be written inside the text box marked in red?
Please Log in or Create an account to join the conversation.
You have to use that syntax:
Please Log in or Create an account to join the conversation.
- PeterChain
-
Topic Author
- Offline
- Posts: 640
- Thank you received: 16
And, would be possible to include a Category Name or a Brand Name?
As far as I know the names of category are stored in another table so this would require some special syntax or some SQL query involved... unless you have a trick for this which would be great
Please Log in or Create an account to join the conversation.
At this time it is only possible to fill with values of the same table...
To have other entries it will require more requests.
Else you can create custom product field, and populate them with the desired data
Please Log in or Create an account to join the conversation.
- PeterChain
-
Topic Author
- Offline
- Posts: 640
- Thank you received: 16
Where and when are the results displayed?
Can they be piped to a field, variable or 'something' where it can be picked form?
Have you plans to create more extensive documentation in the topic of Mass Action? It would help a lot to have some more examples or and extra explanations.
Please Log in or Create an account to join the conversation.
The "Display the results" action allow to display the desired results when clicking on the "Process" button.
It can't work with a trigger, it must only be used when in backend.
The it will display a table with all the results, and the subtility is that this table is dynamic, you can clic on one row and change a value directly. So it can help to save time
Yes, we must improve the mass action documentation, do more tutorials etc. It is on our Todo list, and I have to do that as soon as possible
Please Log in or Create an account to join the conversation.
- PeterChain
-
Topic Author
- Offline
- Posts: 640
- Thank you received: 16
Please Log in or Create an account to join the conversation.
The correct syntax is finally:
category.cat_name_spanish
You have to select "Operation" instead of "String", and "cat_name_spanish" must be a valid category custom field column name.
Please Log in or Create an account to join the conversation.
- PeterChain
-
Topic Author
- Offline
- Posts: 640
- Thank you received: 16
I made this
the custom field exists
and I get this error message
I guess there is some wrong or "unflexible" code as the query tries to invoke hk_cat where my phpAdmin shows me this other table as the one holding the categories: tpjtx_hikashop_category
Of course I only have means to decide the general joomla prefix tpjtx_ but no the names of the hikashop tables.
Could you confirm that is a code thing and not a bad understanding of Mas Actions from my side?
Regards,
Please Log in or Create an account to join the conversation.
This is indeed a code issue, not a bad understanding.
But I was not able to reproduce the issue on my end, do you have the latest version of HikaShop ?
Any overrides on the plugin "hikashop / massaction_category" ?
Please Log in or Create an account to join the conversation.
- PeterChain
-
Topic Author
- Offline
- Posts: 640
- Thank you received: 16
no overrides
––––––––––––––––
And this is how is referenced in the code for /plugins/hikashop/massaction_category/massaction_category.php
read at line 63
file version
may I change 'hk_category' for hikashop_category' in all files containing it?
it sounds radical and dirty... but if we don't find why is going this way it maybe effective
Please Log in or Create an account to join the conversation.
- PeterChain
-
Topic Author
- Offline
- Posts: 640
- Thank you received: 16
Maybe is of use to you
Please Log in or Create an account to join the conversation.
Please install this plugin, this will solve the issue:
Please log in or register to see it.
This was caused by your custom field name. We were taking it and exploding it on '_' so we were using in this case the prefix "cat" and not "category". I changed that to force the "category" alias as we are only applying changes on the category columns.
Please Log in or Create an account to join the conversation.