Route Hikashop messages to Joomla's message queue or Change Focus on errors

  • Posts: 116
  • Thank you received: 7
  • Hikashop Business
6 years 1 month ago #298957

-- HikaShop version -- : 4.0.0
-- Joomla version -- : 3.8.13
-- PHP version -- : 7.1

We are trying to find a way to either route HIkashop error/warning messages through to Joomla's message queue so we can control the location of the alerts/warnings, or maybe simply just change focus to follow the alerts as they appear on the page.

We are getting complaints from users who never see the messages because they don't scroll up the page. The Next/Final submit buttons are at the bottom of the page, and when they click on them, if any alerts are created, they are up at the top of the order form. On mobile devices especially this is problematic.

We'd like to move the messages either to the Joomla! message system where we have addressed other types of messages by using a popup/modal display of errors and warning that appear on "top" of the page and require acknowledgement from the visitor to dismiss them, or at the least relocate the alerts to appear in an area on the page where the user already has focus.

I've seen a few other older posts mention the placement of the messages, and read that it was using the Joomla! messaging system, but don't see that or know how to implement that.

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

  • Posts: 82867
  • Thank you received: 13373
  • MODERATOR
6 years 1 month ago #298965

Hi,

HikaShop indeed uses the Joomla messaging system for most of its messages.
However, for the messages returned by an ajax call (done dynamically on the page, without refresh of the whole page) it's not possible to use the Joomla messaging system and so HikaShop itself display the messages at the top of the area refreshed.
That's a good point you're raising here.
So today, I've looked at adding something to autoscroll to the error messages so that the users can easily see the error messages if they are displayed above the zone the user is looking at. I've tested it successfully on our end, so I've added it as a hot patch to the current release.
You can download the install package on our website and install it on yours to get the patch applied.

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

  • Posts: 116
  • Thank you received: 7
  • Hikashop Business
6 years 1 month ago #299022

I downloaded the latest 4.0.0 1810111854 ... these areas we're having difficulty with may not be ajax related as this happens on the Checkout page when the visitor selects the Next (continue) button to move on to the next step of the checkout.

A php method is being called, displayMessage as part of the hikashopCheckoutHelper. So I am assuming we are loading the page on the server side?

The messages are appearing in different parts of the template (e.g. address, credit card, etc.) as the page is rendered.

I'm attaching a couple of screen shots. These are divs with class "alert alert-warning"' or alert-error, etc. but I don't think they are being injected via ajax (I could be wrong)---I'm just going by the page behavior when we click Next, etc.



When this happens, the screen returns to the top of the page. The visitor doesn't know anything happened.

I was hoping we could ask, or modify, to have the Joomla! system message used for the messages created in the above referenced class, or have a designated "zone" (div id, etc.) to have them appear inside that we could put in our template.

On a smaller screen, such as a mobile device, there it appears that we just refreshed the page and the user doesn't know to scroll down to see why/where the problems are. See below...


Even on a full size desktop, most of the errors in this example are far below the viewing portal.

We're trying to "pop" them up as an overlay, or trigger the display of a module at the top of the page if errors exist that prevent the order from being submitted.

It would be nice to have an option to send these messages through to the Joomla! message queue sub-system or have some way of detecting that there is an error on the page to trigger the display of a message we could embed in a module or hidden div whenever that condition exists.

Attachments:
Last edit: 6 years 1 month ago by stratacorps.

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

  • Posts: 82867
  • Thank you received: 13373
  • MODERATOR
6 years 1 month ago #299041

Hi,

Indeed, I thought that you had activated the "show submit button" setting of the login view of your checkout workflow. With that setting activated, it adds an extra "next" button at the end of the registration/guest checkout form which processes the registration/guest form in ajax. And when the return from the ajax call has errors the errors can be higher than the viewport if your screen has a small height like it can happen on smartphones. That's what I thought you were trying to explaining in your first message and what is fixed by the patch I added.
So if your problem is with the next button which submits the whole page then this patch has no incidence on your situation.
While moving up the scroll to the error messages when the messages are higher than the viewport makes sense, I don't see how we could provide a generic fix to your situation as it is normal to have the user back at the top of the page with a full page submit and then the customer would naturally see the messages while scrolling down the page.
Now I don't know the specifics of your checkout page which makes that inpractical on a smartphone so it might be a good idea to do what you want to do in your case, but I don't think it's a good idea to do that for everyone, so I can't provide a patch like I did in my previous message.
Also, we don't want to send the messages through the joomla sub system of messages queue. One of the complaints we had with the old checkout system was precisely that all the error messages were at the top of the page and it might be hard for the customer to understand where the problem was on the page with checkout workflows with all the blocks on one page with a lot of things. So having the messages of a block directly displayed by the block itself was something we wanted to do with the new checkout system in order to answer to that problematic. And this can't be done with the Joomla sub system of messages queue.
However, since you're already doing some custom code to have the Joomla messages display as overlay notification boxes, why not add custom javascript to the checkout (with a view override of checkout/show.php for example) so that on page load, you would get all the elements with the class "alert" and display them with that overlay notification boxes system ? To me this looks like the most practical solution to your problem as we can't use the Joomla messages system on our end for these and we can't have them displayed elsewhere (at least not without changing a lot of code and structure of the checkout).

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

Time to create page: 0.085 seconds
Powered by Kunena Forum