Incorrect URLs for products in multiple categories

  • Posts: 272
  • Thank you received: 3
  • Hikashop Business
3 months 1 week ago #328873

-- HikaShop version -- : 4.4.0
-- Joomla version -- : 3.9.23
-- PHP version -- : 7.3

Hi there,

we have many products in multiple categories. Force canonical urls is set to No, generate the URLs, because otherwise when viewing a product in a different category it would have always the canonical url.

However the current situation is even more random. When viewing category A as a product listing, some links to the products go through category A and other through category B. When viewing category B, the products that had the correct link in category A, still have the link to category A, which is now incorrect, and those products which had the incorrect link (to category B) when viewing category A, now have the right links.

On further investigation hikashop is searching thought the category to product table and uses the first result found as the "principle category". However as explained before it means the right URLs are not display.

We found a configuration value of "auto_search_menu_item_based_on_main_category", which when set to zero resolves the issue described but we couldn't find the corresponding value in the hikashop configuration. We therefore filed this as a bug as this appears to be missing.

Kind regards, James

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

  • Posts: 72763
  • Thank you received: 11096
  • MODERATOR
3 months 1 week ago #328879

Hi,

This is a hidden setting.
So it's normal you don't find any option for it.
There are dozens of such hidden settings in HikaShop.
We don't reference them and don't provide an interface to change them as usually, you won't want to change them, unless you're in a specific case.
So if you want to change them, you can add an entry in the table hikashop_config and it will be taken into account.
We're actually working on an hidden settings interface similar to what's available in FireFox with the aboug:config interface so that people can more easily find these settings.

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

  • Posts: 272
  • Thank you received: 3
  • Hikashop Business
3 months 1 week ago #328910

I didn't realise there were hidden config settings. We fixed the issued by adding to the config key and value to the config table.

A hidden settings interface will be useful to know what other configurations are available that are outside the standard config settings which are already numerous.

Thanks

The following user(s) said Thank You: Philip

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

  • Posts: 272
  • Thank you received: 3
  • Hikashop Business
3 months 4 days ago #329185

When looking at the issue I think I found a bug:
in cpanel_order.php line 142
the code is

$link = hikashop_contentLink('product&task=show&cid='.$product->product_id.'&name='.@$this->products[$product->product_id]->alias . $url_itemid, $this->products[$product->product_id]);

Should this not be:
$link = hikashop_contentLink('product&task=show&cid='.$product->product_id.'&name='.@$this->products[$product->product_id]->product_alias . $url_itemid, $this->products[$product->product_id]);

with $this->products[$product->product_id]->product_alias instead of $this->products[$product->product_id]->alias?

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

  • Posts: 72763
  • Thank you received: 11096
  • MODERATOR
3 months 3 days ago #329211

Hi,

No.
In the cpanel_orders function of the components/com_hikashop/views/order/view.html.php, you have this code:

$productClass = hikashop_get('class.product');
			foreach($this->products as $k => $product) {
				if(!empty($product->product_parent_id))
					$parent_ids[$product->product_id] = (int)$product->product_parent_id;
				else {
					$productClass->addAlias($this->products[$k]);
				}
			}
Its role is precisely to add the "alias" attribute in each product object of the $this->products array. The addAlias function does several things :
- check if product_alias has been filled or not. If not, use the product_name
- translate the alias if necessary
- transliterate the alias if necessary
So ->alias is there and it's normal to use it rather than product_alias. However, In 90% of the cases, you'll see the same value in ->alias and in ->product_alias

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

Time to create page: 0.061 seconds
Powered by Kunena Forum