Auto-generate alias on content translation

  • Posts: 13
  • Thank you received: 0
  • Hikashop Business
4 months 4 weeks ago #335340

-- HikaShop version -- : 4.4.3
-- Joomla version -- : 3.9.28
-- PHP version -- : 7.4.22

Hi,

my client translates hundreds of categories/products/etc. into 4 languages using the Falang extension. All works fine but I am trying to improve it a little. When saving translation from edit page I would like to autogenerate alias according to the name field (using stringURLSafe function). I don't like to hack core files so the ideal solution would be either if you implement this function (should be few lines in translation helper in function handleTranslations and one toggle switch in configuration) or more universally to trigger plugin event before and/or after translation saving.

Does it sound meaningful?

Thanks, Jan

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

  • Posts: 74655
  • Thank you received: 11522
  • MODERATOR
4 months 4 weeks ago #335342

Hi,

The handleTranslations is not really adapted to have before/after events.
And you can already use the onAfterProductUpdate and onAfterCategoryUpdate events to set the alias in the translations if empty.
And it's a bit more than a few lines to add code to handle that. It's more like 40 lines to do it properly.
But yes, it's a good idea to generate the alias automatically for the translation when the "alias auto fill" setting of the HikaShop configuration is activated. We'll look at adding that, thanks for your feedback.

Last edit: 4 months 4 weeks ago by nicolas.

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

  • Posts: 13
  • Thank you received: 0
  • Hikashop Business
4 months 4 weeks ago #335347

Thanks! :-)

I thought that translation editing uses controller function save_translation that does not update product/category and so does not trigger onAfterProductUpdate or onAfterCategoryUpdate. But maybe I am wrong, did not test it.

Jan

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

  • Posts: 74655
  • Thank you received: 11522
  • MODERATOR
4 months 4 weeks ago #335348

Hi,

That's my bad. You're correct. Still, we'll look at adding that. It will be better that way as events as not really appropriate there.

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

Time to create page: 0.060 seconds
Powered by Kunena Forum