[Skip to main content](#vessel-content)

#   Item-field validation error in cart-&gt;addProduct surfaces at later checkout steps

##

- **[Genr8r](/forum/user/44235-genr8r "View Genr8r's Profile")**
- [![Genr8r's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/44235-genr8r "View Genr8r's Profile") Topic Author
- [ Offline](/forum/user/44235-genr8r)

Less More

- Posts: 43
- Thank you received: 5
-
-

6 months 4 weeks ago [\#371669](#371669) by [Genr8r](/forum/user/44235-genr8r "View Genr8r's Profile")  *[Item-field validation error in cart-&gt;addProduct surfaces at later checkout steps](/forum/27-checkout/910474-item-field-validation-error-in-cart-addproduct-surfaces-at-later-checkout-steps#371669 "-- HikaShop version -- : 6.4.1 -- Joomla version -- : 6.1.0 -- PHP version -- : 8.5.5 -- Browser(s) name and version -- : Chromium 130 (Playwright) — also reproduces in any browser; not browser-specific -- Error-message(debug-mod must be tuned on) -- : no Joomla error log entry — the bug is incorrect message routing, not a PHP error. The customer sees the field's &#96;errormessage&#96; value, e.g. &quot;Please enter the year. If year does not apply, enter the word 'none'.&quot;  Hi HikaShop team,  Reporting a small bug in the standard checkout, with a suggested patch.  Bug: when validates a required item-field that's empty, the field's is written to Joomla's session message queue. The customer then sees that alert at a later checkout step (typically Payment), with no cart-row context to indicate where the error came from.  Cause: in line 1845, runs without overriding the field class's default , so calls . The cart's own loop a few lines below already handles error reporting in the right scope — the call is redundant and leaks the message into the session queue.  The Fields-step helper at already does this correctly for order fields by passing as the report mode. The cart's item-field path just needs the same treatment.  Patch (against 6.4.1; is byte-identical to 6.4.0):  Tested locally on Joomla 6.1.0 + HikaShop 6.4.1.  I searched the forum for prior reports of this specific symptom and didn't find one — apologies if I missed it.  Thanks, Brian")* was created by *[Genr8r](/forum/user/44235-genr8r "View Genr8r's Profile")*

-- HikaShop version -- : 6.4.1
-- Joomla version -- : 6.1.0
-- PHP version -- : 8.5.5
-- Browser(s) name and version -- : Chromium 130 (Playwright) — also reproduces in any browser; not browser-specific
-- Error-message(debug-mod must be tuned on) -- : no Joomla error log entry — the bug is incorrect message routing, not a PHP error. The customer sees the field's &#96;errormessage&#96; value, e.g. "Please enter the year. If year does not apply, enter the word 'none'."

Hi HikaShop team,

Reporting a small bug in the standard checkout, with a suggested patch.

**Bug:** when Code:

cart::addProduct()

validates a required item-field that's empty, the field's Code:

errormessage

is written to Joomla's session message queue. The customer then sees that alert at a later checkout step (typically Payment), with no cart-row context to indicate where the error came from.

**Cause:** in Code:

administrator/components/com_hikashop/classes/cart.php

line 1845, Code:

checkFieldsData($fields, $p['fields'], $data, 'item', $oldData)

runs without overriding the field class's default Code:

$report = true

, so Code:

hikashopFieldClass::check()

calls Code:

$app-&gt;enqueueMessage()

. The cart's own Code:

addMessage($cart, ...)

loop a few lines below already handles error reporting in the right scope — the Code:

enqueueMessage

call is redundant and leaks the message into the session queue.

The Fields-step helper at Code:

helpers/checkout/fields.php:105

already does this correctly for order fields by passing Code:

'msg'

as the report mode. The cart's item-field path just needs the same treatment.

**Patch** (against 6.4.1; Code:

addProduct

is byte-identical to 6.4.0):
Code:

--- a/administrator/components/com_hikashop/classes/cart.php +++ b/administrator/components/com_hikashop/classes/cart.php @@ -1843,7 +1843,11 @@ } $data = new stdClass(); + $previousReport = $this-&gt;fieldClass-&gt;report; + $this-&gt;fieldClass-&gt;report = 'msg'; $ok = $this-&gt;fieldClass-&gt;checkFieldsData($fields, $p['fields'], $data, 'item', $oldData); + $this-&gt;fieldClass-&gt;report = $previousReport; if(!$ok) { unset($p['fields']);

Tested locally on Joomla 6.1.0 + HikaShop 6.4.1.

I searched the forum for prior reports of this specific symptom and didn't find one — apologies if I missed it.

Thanks,
Brian

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0LzkxMDQ3NC1pdGVtLWZpZWxkLXZhbGlkYXRpb24tZXJyb3ItaW4tY2FydC1hZGRwcm9kdWN0LXN1cmZhY2VzLWF0LWxhdGVyLWNoZWNrb3V0LXN0ZXBzP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86584
- Thank you received: 14325
-
-

6 months 4 weeks ago [\#371674](#371674) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Item-field validation error in cart-&gt;addProduct surfaces at later checkout steps](/forum/27-checkout/910474-item-field-validation-error-in-cart-addproduct-surfaces-at-later-checkout-steps#371674 "-- HikaShop version -- : 6.4.1 -- Joomla version -- : 6.1.0 -- PHP version -- : 8.5.5 -- Browser(s) name and version -- : Chromium 130 (Playwright) — also reproduces in any browser; not browser-specific -- Error-message(debug-mod must be tuned on) -- : no Joomla error log entry — the bug is incorrect message routing, not a PHP error. The customer sees the field's &#96;errormessage&#96; value, e.g. &quot;Please enter the year. If year does not apply, enter the word 'none'.&quot;  Hi HikaShop team,  Reporting a small bug in the standard checkout, with a suggested patch.  Bug: when validates a required item-field that's empty, the field's is written to Joomla's session message queue. The customer then sees that alert at a later checkout step (typically Payment), with no cart-row context to indicate where the error came from.  Cause: in line 1845, runs without overriding the field class's default , so calls . The cart's own loop a few lines below already handles error reporting in the right scope — the call is redundant and leaks the message into the session queue.  The Fields-step helper at already does this correctly for order fields by passing as the report mode. The cart's item-field path just needs the same treatment.  Patch (against 6.4.1; is byte-identical to 6.4.0):  Tested locally on Joomla 6.1.0 + HikaShop 6.4.1.  I searched the forum for prior reports of this specific symptom and didn't find one — apologies if I missed it.  Thanks, Brian")*

Hello,

Thanks for the report and the very precise diagnosis with the location and the suggested fix.

You are exactly right. In &#96;cart::addProduct()&#96; the call to &#96;$this-&gt;fieldClass-&gt;checkFieldsData()&#96; was running with the field class's default &#96;report = true&#96; setting, which causes a validation failure to also be enqueued via &#96;JFactory::getApplication()-&gt;enqueueMessage()&#96;. That message lives on Joomla's session queue across the post / redirect chain, so it ends up rendered at whichever page is shown next, typically a later checkout step. The cart already builds the error in its own scoped channel right after via &#96;$this-&gt;addMessage()&#96; so the session-queue copy was a duplicate fired at the wrong moment.

The change has been included on our end using exactly the pattern you suggested. We save the current &#96;report&#96; value, force it to &#96;'msg'&#96; for the duration of the &#96;checkFieldsData()&#96; call, and restore it afterward, matching what &#96;helpers/checkout/fields.php&#96; already does for &#96;getFilteredInput()&#96;.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0LzkxMDQ3NC1pdGVtLWZpZWxkLXZhbGlkYXRpb24tZXJyb3ItaW4tY2FydC1hZGRwcm9kdWN0LXN1cmZhY2VzLWF0LWxhdGVyLWNoZWNrb3V0LXN0ZXBzP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.049 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
