Bug report: "Link" custom field repeatedly adds quotes around label on each prod

  • Posts: 239
  • Thank you received: 8
  • Hikashop Business
6 days 13 hours ago #373301

-- HikaShop version -- : 6.5.2
-- Joomla version -- : ‎6.1.3
-- PHP version -- : 8.3.31

Hi HikaShop team,

I've encountered a bug regarding the "Link" type custom field on products. Each time the product is opened and saved, HikaShop adds an extra pair of quotation marks around the link's label/text value.

Steps to reproduce:

Go to Display > Custom fields and create a new field for the Product table.

Set its type to Link (e.g., column name: product_series_url).

Open any product in the backend and fill in this field:

URL: /abb/soft-starters/psr

Text / Label: Софтстартеры PSR

Click Save.

Save the product again without changing this field.

Repeat saving several times.

Observed result:
With every save, another layer of double quotes is prepended and appended to the label value. After several saves, it turns into:
"""""""""Софтстартеры PSR"""""""""

It looks like the text string gets re-escaped or improperly parsed each time the form data is processed on save.

Expected result:
The field should retain its original text string (Софтстартеры PSR) regardless of how many times the product is saved.

Could you please look into this and advise on a fix or patch?

Thank you!

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

  • Posts: 86114
  • Thank you received: 14210
  • MODERATOR
6 days 10 hours ago #373302

Hello,

Thank you for the precise report, it allowed me to reproduce the problem immediately.

The value of a "link" custom field is stored as "text":url and the edit form sends it back whole through a hidden input when you save. HikaShop was quoting the text part again on each save, which is where the extra pair of quotation marks came from every time.

Your example brought out two other problems of the same field: an address pointing to a page of your own website, like your /abb/soft-starters/psr, was not recognized, so the label ended up in the URL box and the address was lost on the next save, and an address entered without any text was displayed on the front end as a link labelled "https".

The three are fixed on our end. Download again the install package of HikaShop and install it on yours in order to get the patches.

The products which already carry extra quotation marks are cleaned automatically the next time you save them, there is nothing to correct by hand in your database.

The following user(s) said Thank You: Bender

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

  • Posts: 239
  • Thank you received: 8
  • Hikashop Business
6 days 37 minutes ago #373308

Thank you for the quick turnaround and for fixing all three issues so fast! I will download the updated package, install it, and test it out. Appreciate your great support!

The following user(s) said Thank You: nicolas

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

  • Posts: 239
  • Thank you received: 8
  • Hikashop Business
3 days 22 hours ago #373337

Hi Nicolas,

Thank you for the quick fix on the custom field issue!

We updated to the latest package, but now ran into a serious regression regarding the router/SEF URL resolution for category menu items.

1. The main issue: Unpublished category via Joomla menu item gives 404
In previous builds, our workflow allowed us to unpublish a category directly in HikaShop (so it doesn't appear in category listings/grids), while linking to it via a dedicated Joomla menu item (index.php?option=com_hikashop&view=category&layout=listing). In that case, navigating to the Joomla menu item URL still successfully loaded the page.

Now, with the category unpublished in HikaShop:

Accessing the newly created Joomla menu item URL directly returns a 404 error.

However, strangely enough, deeper child URLs (e.g., /owen/izmeriteli-regulyatory/2trm0, where the child sub-category itself is published) still load fine!

Some older categories configured the exact same way somehow still resolve, but newly created menu items with unpublished HikaShop categories fail immediately.

Did you introduce a strict category_published = 1 check in the router or controller when resolving the menu item's target category? Is there a setting or filter to allow direct access via a published Joomla menu item even if the category itself is unpublished in the catalog?

2. Router mismatch between Joomla menu item alias and HikaShop category alias
We also noticed a change in how URLs are rendered inside category listings on the front end:

Previously, if a Joomla menu item existed for a category, HikaShop automatically prioritized the Joomla menu item's alias/path when rendering links inside parent category listings, regardless of whether the internal HikaShop category alias differed.

Now, HikaShop seems to completely bypass the matching Joomla menu item and builds the listing links using its own internal category alias (e.g. rendering /owen/izm from the category alias instead of /owen/izmeriteli-regulyatory defined in the Joomla menu item).

Could you clarify what was changed in the routing logic (router.php or category.php class)? How can we ensure that:

A Joomla menu item pointing to a category remains accessible even if the HikaShop category is unpublished?

Listing links prioritize existing Joomla menu items rather than falling back to raw HikaShop category aliases?

Looking forward to your advice.

Thank you!

P.S.
If a merchant publishes a Joomla menu item explicitly targeting a specific category, the CMS menu item should take full precedence for routing and access. Hard-blocking it with a 404 simply because category_published = 0 completely strips away our flexibility to control public directory listings independently from direct landing URLs.


Previously, category URLs generated in listings strictly followed our Joomla menu structure, keeping the active menu item and the correct breadcrumb trail. Now, this is broken: listings generate raw category alias URLs instead of using the corresponding Joomla menu items, which breaks the breadcrumbs and menu context.

Our SEF Settings (see attached screenshot):

Insert canonical URLs in listings: No, generate URL

Category SEF name: (Empty — left blank intentionally for clean URLs)

Remove product and category IDs from URL: Yes

Simplified breadcrumbs: No

All categories and sub-menu items are published and have existed for a long time. Everything worked as expected on previous versions, but 6.6.0 no longer maps listing links to our Joomla menu items with these settings.

Could you please check what changed in the SEF router regarding Joomla menu item matching in listings?

Thank you!

Last edit: 3 days 21 hours ago by Bender.

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

  • Posts: 600
  • Thank you received: 12
  • Hikashop Business Vessel Template
3 days 22 hours ago #373340

Hi, I also have found a similar issue:
When selecting a product, it now opens in its own window instead of a new page, therefore I can no longer get the URL easy to send to customers when they are after a certain product, not easy when we have 1,000's of products online.

Rgds

Attachments:

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

  • Posts: 600
  • Thank you received: 12
  • Hikashop Business Vessel Template
3 days 20 hours ago #373341

found the issue, and fixed.

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

  • Posts: 239
  • Thank you received: 8
  • Hikashop Business
3 days 20 hours ago #373342

Hi HikaShop team,

I have tested and confirmed a breaking bug between previous versions and 6.6.0 regarding Joomla menu items and category URLs in listings.

The root cause:

In earlier versions, saving a HikaShop category listing menu item stored the category parameter in #__menu.params as a string/integer:

"category": "23"

In recent versions, the category selector saves it as an array (even for a single category):

"category": ["23"]

Because of this format change, the code casting in both router.php and view.html.php completely breaks:

In components/com_hikashop/views/category/view.html.php (getLink):

PHP
$params = $category_params->get('hk_category',false);
if($params && isset($params->category))
$parent = $params->category;
...
$submenuCategoryMap[$Itemid][(int)$parent] = (int)$submenu->itemid;
When $parent is ["23"], PHP evaluates (int)$parent to 1!

Because of this, $submenuCategoryMap stores key 1 instead of 23. The listing fails to recognize that a Joomla submenu item exists for category 23 and falls back to generating a raw alias/fallback URL (e.g. /category/p...) instead of the clean menu URL.

In components/com_hikashop/router.php (_HikashopBuildRoute):

PHP
if(isset($catParams->category)) $menuCat = (int)$catParams->category;
if($menuCat > 0 && $menuCat === (int)$query) { ... }
Here again, (int)$catParams->category evaluates to 1, so $menuCat === (int)$query is always false.

Verification:
When I manually edit #__menu.params in the database, change "category": ["23"] back to "category": "23", and clear the Joomla cache, the category URLs and breadcrumbs in listings immediately work correctly as expected. As soon as the menu item is re-saved in the Joomla administrator, it reverts to ["23"] and breaks again.

Could you please either save single category IDs as scalars or add an is_array() check when reading $params->category in view.html.php and router.php?

Thank you!

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

  • Posts: 239
  • Thank you received: 8
  • Hikashop Business
3 days 20 hours ago #373343

Regarding the "Main category" field UI change (see screenshot):
Notice how the "Main category" (category) field in the menu item options is now a multi-select tagged input (with the [x] badge) instead of the previous single-select field.

Because this field allows multiple tags, the form handler submits it as an array and stores "category": ["23"] in the database.

What was the rationale behind allowing multiple "Main categories" for a single Joomla menu item? A menu item naturally points to a single node in a site's breadcrumbs and URL structure. Allowing an array here directly breaks the router's ability to map parent categories and submenus because the core code still expects a scalar integer. If multiple main categories are truly supported, the router and view code must unpack the array; otherwise, this field should remain a single-select.

Last edit: 3 days 20 hours ago by Bender.

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

  • Posts: 86114
  • Thank you received: 14210
  • MODERATOR
3 days 18 hours ago #373339

Hello,

Thank you for the report, and for the analysis in your two messages of this afternoon: it is exactly right, and it is the one cause behind both points of your first message.

In 6.6.0 the "Main category" setting of the category and product menu items became a multi-select, so that a listing can be built on several categories. A menu item saved since that version stores its category as a list, even when you only picked one, and ten places in the code still read that setting as one value. A list read as one value gives the number 1, so a menu item pointing at exactly one category was no longer recognised as the page of that category.

That is what you are seeing. When HikaShop no longer recognises the menu item of a category, the category tiles of the parent listing stop pointing at the address of that menu item and fall back to the address HikaShop builds itself, /owen/izm instead of /owen/izmeriteli-regulyatory, or the category segments get added on top of the menu path. Both of those addresses carry the category in the URL, which is the case where HikaShop checks that the category is published, so an unpublished category answers "Category not found" through them. Your own menu items created before 6.6.0 still hold the old form of the setting, which is why the older categories kept working while the new ones did not.

No, we did not add a published check: the check on the category of the URL has been there since 2019, and it is deliberate, a category you unpublished should not be reachable by typing its address. Your workflow is not affected by it: the menu item you publish for that category remains a valid landing page and does not go through that check. The addresses which stopped honouring the menu item are what pushed you into it.

As for the reason for the multi-select: a listing menu item can now show the products of several branches of your catalog on one page, which was asked for regularly. The picker posts a list as a result, even with a single choice, and the places reading it had to follow, which we missed. A menu item naming one category is the page of that category, exactly as before; a menu item naming several is the page of none of them, so the router and the listings keep their previous behaviour there.

The fix reads the setting as the list it now is, everywhere. A menu item naming one category is the page of that category again, so the listings link to it, the router keeps the menu path alone rather than adding the category segments on top of it, and product links pick that menu item too.

Two more problems came out of the same reading and are fixed as well: a category listing menu item whose main category is emptied answered "Category not found" instead of showing the categories of the shop, and a product listing built on several categories printed an "Array to string conversion" notice.

Please download the install package of HikaShop again and install it on your site to get the patch. Your menu items need no change, they are read correctly as they are, and the ones you edited by hand in the database can simply be saved again from Joomla.

Last edit: 3 days 18 hours ago by nicolas.

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

Time to create page: 0.252 seconds
Powered by Kunena Forum