Product alias issue

  • Posts: 584
  • Thank you received: 22
  • Hikaserial Subscription Hikashop Multisite
6 years 2 days ago #291294

-- HikaShop version -- : 3.4.0
-- Joomla version -- : 3.8.6
-- PHP version -- : 7

Hi Hikashopteam,

I have an issue for a long time now with all my websites and I don't know how to fix this.

When I copy a product and open it and then immediately save again I get this error:
"An element with the same alias already exists
Error Saving"

I know when I fill in a unique alias the issue is solved.

But the strange thing is that after you made a copy of a product the alias of that product is empty.
I can imagine that's the intention. But when you edit the product and save it, the empty alias is not filled in automatically like it does when you create a new product. Why?

So now every-time customers have to fill in the alias by them selves for the copied products. But sometimes they forget to do that and and then they get the error and have lost all their entered data. That is really frustrating for everybody.

So why is it not possible to fill in the empty alias for copied products after a user has changed the values like it does with new products?

I have also looked into the database and there is no product with the same (empty alias) so why do we get the error that this alias is already exist?



See also this movie for more details: https://lumiga.nl/1/2018-04-13_10-38-50.mp4

Hope you can help me to fix this issue for once and for all. :-)

Kind regards,
Lumiga


Kind regards,
Lumiga
Attachments:
Last edit: 6 years 2 days ago by Lumiga.

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

  • Posts: 81428
  • Thank you received: 13058
  • MODERATOR
6 years 2 days ago #291295

Hi,

When the alias is empty and you save a product, with the "Alias automatic filling" setting activated, HikaShop will automatically try to use the name of the product as the alias.
But if your product was copied from another product, then the product name is the same as the original product name. And thus, that's why you get the error.

The following user(s) said Thank You: Lumiga

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

  • Posts: 84
  • Thank you received: 2
5 years 6 months ago #298463

Hi Jerome,

I bumped to this issue today with the alias.

I made multivendor hika market. Vendors add their products in front end. Do not allow dublicate product codes. Do not allow for vendors enter product alias.
The project is still offline and I do testings.

The issue ---> if vendor enters product with title "Palaidine" (Blouse) and then enter second product "Palaidine rozine" (Blouse pink), the system saves and all looks kind of good. But when I go to shop category and try to open product with title "Palaidine" I get error 1064 (attached file). If I change the product title form "Palaidine" to " Palaidine violetine" (blouse violet), then all is well in shop as well. BTW: the products codes are unique.

The issue-2 ---> If vendor enter product "Palaidine rozine" ...saves .... then adds second product and the title the same "Palaidine rozine" , the system allows to save (the products codes generates unique) and system do not show any error for vendor. But when I come to shop/ category... in category list I see both products, but when I try to open the system opens in both cases the same one product, which was added in first place.

How to make in multivendor market that even if product title entered the same the system generates the unique alias as it is done with product codes. Because all vendors cant know what other vendor enters. Even if I will allow vendors to enter alias in front end , the problem will be the same, the system do not give any error about the same alias. And to allow vendors to edit alias field I think is not very reasanable (as the vendor is not IT human). In back-end, if I edit such product and try to same with same alias the system gives me error alis message.

I tried Force canonical URLs on listings / no, generate Url's / use canonical urls and generates if missing --- but it do not solve this issue

Thank you for the support

Attachments:

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

  • Posts: 25997
  • Thank you received: 4004
  • MODERATOR
5 years 6 months ago #298464

Hello,

The issue is coming the "alias auto fill" setting. In the HikaMarket product class, you have to change a line in order to avoid the re-generation (because vendors might not have an access on that field).
It is something I fixed not long ago and which would be include in HikaMarket 3.0

if($shopConfig->get('alias_auto_fill', 1) && (empty($product->product_alias) && empty($product->old->product_alias)) && !empty($product->product_name)) {

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 84
  • Thank you received: 2
5 years 6 months ago #298482

Hello, Jerome,

Oh it is really good news, that its already solved.
Could you please guide me where exactly I should change this line ... I'm not so advaced

Thank you

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

  • Posts: 25997
  • Thank you received: 4004
  • MODERATOR
5 years 6 months ago #298499

Hello,

administrator/components/com_hikamarket/classes/product.php

You will find the line to replace, it's the only one with the content: $shopConfig->get('alias_auto_fill', 1)

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 84
  • Thank you received: 2
5 years 6 months ago #298506

Hello, Jerome,

I did as you said. Changed this line, cleared browser , but the the result the same in front end and in back end, if I enter the same title which already exist, the alias generated the same and in front end when open these two different products , opens the first entered one.

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

  • Posts: 81428
  • Thank you received: 13058
  • MODERATOR
5 years 6 months ago #298511

Hi,

In the backend, you should get a warning message if you save a product with an alias that already exists as a check is done on that.
So maybe we're talking about something else ?
You said before that you didn't had the problem in the backend, but now it seems that you're saying you do, so I'm not following.
The change you made in the code of HikaMarket has no impact on the check done by HikaShop in the backend.

Also, note that this issue occurs because you have activated the "remove categories and products ids from URLs" setting of the HikaShop configuration. If you turn back off that setting, the vendors and admins can put similar aliases to different products and it won't be a problem as the id in the URL will allow the system to know which product to display.
With a multivendor setup, I believe it can be nice to keep the ids so that they can put whatever they want for the alias or name of their product and the link will work whichever way.

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

  • Posts: 84
  • Thank you received: 2
5 years 6 months ago #298556

Hello Nicolas,

Earlier I wrote that the system do not give any warning message in front -end for vendors. In back -end I get warning that the product already exist with same alias, only if I open this product and try to save.

You are right, I turn OFF the option "remove categories and products ids from URLs" and "Force canonical URLs on listings" to "No, generate Urls" (if to leave "USE canonical"... it gives errors, when open any product). This allow to open all products , even if they do have the same title and same alias.

I really like your thought:
"With a multivendor setup, I believe it can be nice to keep the ids so that they can put whatever they want for the alias or name of their product and the link will work whichever way" . Is it nessesary to have categories in URLs? , it would be nice to have only Product IDs in URLs, the link would be nicer and lightweighter.

Last edit: 5 years 6 months ago by SEKME.

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

Time to create page: 0.086 seconds
Powered by Kunena Forum