Unknown format specifier "i"

  • Posts: 51
  • Thank you received: 7
  • Hikashop Business
2 months 1 week ago #363747

-- HikaShop version -- : 5.1.1
-- Joomla version -- : 5.4.1
-- PHP version -- : 8.2.20
-- Browser(s) name and version -- : Firefox
-- Error-message(debug-mod must be tuned on) -- : 0
Unknown format specifier "i"

Hi,

I have the following problem on a Joomla site with Hikashop and Yootheme template:

If a customer is not logged in, he sees the shop perfectly.
As soon as he has logged in and clicks on the same menu item, the message [Unknown format specifier ‘i’] appears.

If I switch to Cassiopeia, the shop loads without errors. However, all other pages work perfectly with Yootheme. I therefore suspect a coflict between Joomla and Yootheme.

Since the call stack (see below) is dominated by Hikashop, I'll post the problem in your forum first.

The website has been running stable for several months, the error is probably caused by an update.

The stack:
# Function Location
1 () JROOT/libraries/src/Language/Text.php:281
2 sprintf() JROOT/libraries/src/Language/Text.php:281
3 Joomla\CMS\Language\Text::sprintf() JROOT/administrator/components/com_hikashop/classes/cart.php:3731
4 hikashopCartClass->checkCartQuantities() JROOT/administrator/components/com_hikashop/classes/cart.php:916
5 hikashopCartClass->getFullCart() JROOT/components/com_hikashop/views/product/view.html.php:2500
6 ProductViewProduct->cart() JROOT/components/com_hikashop/views/product/view.html.php:28
7 ProductViewProduct->display() JROOT/administrator/components/com_hikashop/helpers/helper.php:936
8 hikashop_getLayout() JROOT/modules/mod_hikashop_wishlist/mod_hikashop_wishlist.php:65
9 include() JROOT/libraries/src/Dispatcher/ModuleDispatcher.php:52
10 Joomla\CMS\Dispatcher\ModuleDispatcher::Joomla\CMS\Dispatcher\{closure}() JROOT/libraries/src/Dispatcher/ModuleDispatcher.php:55
11 Joomla\CMS\Dispatcher\ModuleDispatcher->dispatch() JROOT/libraries/src/Helper/ModuleHelper.php:291
12 Joomla\CMS\Helper\ModuleHelper::renderRawModule() JROOT/libraries/src/Helper/ModuleHelper.php:162
13 Joomla\CMS\Helper\ModuleHelper::renderModule() JROOT/libraries/src/Document/Renderer/Html/ModuleRenderer.php:99
14 Joomla\CMS\Document\Renderer\Html\ModuleRenderer->render() JROOT/libraries/src/Document/HtmlDocument.php:681
15 Joomla\CMS\Document\HtmlDocument->countModules() JROOT/templates/yootheme/index.php:158
16 require() JROOT/libraries/src/Document/HtmlDocument.php:731
17 Joomla\CMS\Document\HtmlDocument->_loadTemplate() JROOT/libraries/src/Document/HtmlDocument.php:785
18 Joomla\CMS\Document\HtmlDocument->_fetchTemplate() JROOT/libraries/src/Document/HtmlDocument.php:622
19 Joomla\CMS\Document\HtmlDocument->parse() JROOT/libraries/src/Application/CMSApplication.php:1057
20 Joomla\CMS\Application\CMSApplication->render() JROOT/libraries/src/Application/SiteApplication.php:732
21 Joomla\CMS\Application\SiteApplication->render() JROOT/libraries/src/Application/CMSApplication.php:311
22 Joomla\CMS\Application\CMSApplication->execute() JROOT/includes/app.php:58
23 require_once() JROOT/index.php:32

Regards
Stefan

Last edit: 2 months 1 week ago by smart web.

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

  • Posts: 51
  • Thank you received: 7
  • Hikashop Business
2 months 1 week ago #363748

It probably has to do with the ‘HikaShop Wishlist Module’. If I deactivate this, the page is displayed again. However, the following message is then displayed in the HikaShop Cart Module:

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /PATH_DELETED/com_hikashop/product/cart.php on line 33

By the way, this is a trilingual website with Falang. Perhaps this information will also help.

Last edit: 2 months 1 week ago by smart web.

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

  • Posts: 83007
  • Thank you received: 13398
  • MODERATOR
2 months 1 week ago #363751

Hi,

The call stack is indeed precious to understand what's going on.
The first two lines of the stack

1 () JROOT/libraries/src/Language/Text.php:281
2 sprintf() JROOT/libraries/src/Language/Text.php:281
Indicate that there is a problem with a translation.
The next line
3 Joomla\CMS\Language\Text::sprintf() JROOT/administrator/components/com_hikashop/classes/cart.php:3731
indicates that the issue is with the translation key used on the line 3731 of the file administrator/components/com_hikashop/classes/cart.php
If I look at this line number of this file in HikaShop 5.1.1 it is this line:
$cart->messages[] = array('msg' => JText::sprintf('PRODUCT_NOT_AVAILABLE', $errorMessagesProductNames[$cart_product_id]), 'product_id' => $product->product_id, 'type' => 'notice');
So this points at the translation for the key PRODUCT_NOT_AVAILABLE.
Finally, the error message

Unknown format specifier "i"

indicates that you must have a translation override for that translation key, and in it you have the text "%i". When there is a "%" with something else following, Joomla's translation system interprets it as a variable which needs to be replaced.
So, for example, the default translation for this key in english is:

PRODUCT_NOT_AVAILABLE="The product %s is not available"

There, you can see a %s and "s" stands for "string". So Joomla will replace that %s by the variable in
$errorMessagesProductNames[$cart_product_id]
and it expects it to be a string.
Here, you can see the details of formatting of translations:
docs.joomla.org/Formatted_fields_in_lang..._translation_strings
And as you can see, there is no %i so that's why you get this error.

If you want to output the character %, then either double it (like so: "%%"), or use the HTML code for it:
%
And you need to have one %s in that translation override to match with the code in HikaShop. Anything else and Joomla will complain.

Last edit: 2 months 1 week ago by nicolas.
The following user(s) said Thank You: smart web

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

  • Posts: 51
  • Thank you received: 7
  • Hikashop Business
2 months 1 week ago #363759

Nicolas, this is probably the most detailed and understandable feedback I have ever received from a support team. Many thanks for that!
Thanks to your help, the problem is solved after changing the text string.

The following user(s) said Thank You: nicolas

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

Time to create page: 0.063 seconds
Powered by Kunena Forum