Productcode in URL gives a 404

  • Posts: 206
  • Thank you received: 10
  • Hikashop Multisite
7 years 1 week ago #284701

-- HikaShop version -- : 3.2.1
-- Joomla version -- : 3.8.3

Hi,

I'm trying to get the productcode (not the product-id) in my URL but everything i do results in a 404.

/lego/fireman-60051
/lego/60051/fireman
/lego/fireman-set60051

I also turned on and off the "simple breadcrumbs" and "remove id" in the SEF options but nothing works.
Can you point me in the right direction?

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

  • Posts: 26166
  • Thank you received: 4029
  • MODERATOR
7 years 1 week ago #284703

Hello,

CF : www.hikashop.com/support/documentation/5...ig.html#features_sef

By default HikaShop use the ID in order to find the product.
When you remove the ID from the SEF URL, it will base its search on the "product alias" (and "product name" if it can't find an alias).
Thanks to the "alias auto fill" setting, the system would automatically generate the alias when finding the product (to speed up the process afterwards).

So if you want to base your URLs on the product code ; the best would be to copy the value in the product alias too.

But please note that an alias cannot start with a number since the Joomla router system will consider it as an ID. That's why HikaShop will add a "p" prefix in case of the product name start with a number.

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: 206
  • Thank you received: 10
  • Hikashop Multisite
7 years 6 days ago #284769

Thank you Jerome,
It seems to work when i change the alias.

Now we have 4000 products, so is there a way to add the product-code after the product-alias with a massaction or another fast way?

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

  • Posts: 83024
  • Thank you received: 13403
  • MODERATOR
7 years 6 days ago #284778

Hi,

Yes, you can use mass actions for that.
You can have a "update the values" action on the product_alias column equal to product.product_code if you want to directly set the product code in the alias.
Or you could also append it with an operation like that: concat( product.product_alias, product.product_code )
I've never tried a concat with a mass action but it should work and if it doesn't, you could actually run the same query directly in your phpmyadmin:
update #__hikashop_product SET product_alias = concat( product_alias, product_code )

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

  • Posts: 206
  • Thank you received: 10
  • Hikashop Multisite
7 years 5 days ago #284842

Thanks Nicolas,

Because we imported all products the alias is empty.
Now i have enabled the autofill alias, but i have to open and save each product to get a alias.
Is this also possible with a massaction? So i can first create an alias and later concat it

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

  • Posts: 83024
  • Thank you received: 13403
  • MODERATOR
7 years 5 days ago #284845

Hi,

The alias auto fill will basically copy the product_name in the product_alias field.
You can do that with the mass action system. Just replace the product_code by "product_name".

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

  • Posts: 206
  • Thank you received: 10
  • Hikashop Multisite
7 years 5 days ago #284898

Thanks for helping me in the right direction.

I used
concat(product.product_name, "-", product_code)

to get what i need: url/productname-code

The following user(s) said Thank You: Jerome

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

Time to create page: 0.066 seconds
Powered by Kunena Forum