Instead of having to click on the OPAC cart icon, then having to click on the 'Items in your cart: ..' box before the cart popup loads it would be nice to give libraries control if they want the cart popup to appear directly after the cart icon is clicked upon. Implementing a syspref, defaulted to 'false' to enable one click cart opening would libraries allow one click cart opening without having to manually alter the JS.
Created attachment 77550 [details] [review] Bug 21174 - Implemented syspref to enable the loading of cart popup on one click Sponsored-By: Toi Ohomai Insitute of Technology, New Zealand
I will amend the commit message shortly to contain a test plan.
Created attachment 77642 [details] [review] Bug 21174 - Implemented syspref to enable the loading of cart popup on one click Test plan: 1. In Koha OPAC click on the cart icon (making sure to have items in the cart and the dropdown box 'Items in your cart:..' appears. 2. Click this dropdown and the cart popup appears. 3. Confirm you can successfully remove items from and empty the cart 4. Apply patch 5. Restart memcached, plack and in koha-shell run ./updatedatabase.pl 6. By default the new syspref in this patch is turned off. Therefore repeat steps: 1,2,3 and confirm they work the same as before you applied the commit 7. In Koha staff client go to Administration->Global system preferences and enable the 'EnableOneClickToOpenCartPopup' preference 8. Back in the OPAC click on the cart icon (making sure to have items in the cart) and notice no 'Items in your: ..' dropdown appears instead the cart popup loads straight away. 9. Confirm the items in your cart is displayed by the cart popup 10. Confirm you can remove items from/empty the cart Sponsored-By: Toi Ohomai Insitute of Technology, New Zealand
Amended commit added containing a test plan.
Created attachment 77684 [details] [review] Bug 21174: (alternate) Sysprefs to enable the opening of OPAC cart in one click This is an alternate patch which would replace the proposed changes to masthead.inc, opac-bottom.inc, opac-basket.tt, and basket.js. This patch slightly changes the markup in masthead.inc so that the Cart link doesn't try to interpret it as a dropdown trigger, and switches out the ID attribute so that it triggers the right action from basket.js.
Alex: I think my proposed patch would simplify the change you want to make. See if it works for you. Your patch is missing an update to the database, and I think that's causing a blocking JavaScript error. I'm going to mark this failed QA for that. BUT... Does anyone really love the way it currently works? Maybe we should just make this updated interaction the default? I think it would be worth asking on the Koha mailing list.
+1 for asking the mailing list, the current behaviour causes a bit of confusion here and there
Created attachment 78006 [details] [review] Bug 21174 - Added missing atomicupdate Sponsored-By: Toi Ohomai Institute of Technology, New Zealand
Created attachment 78007 [details] [review] Bug 21174 - Syspref for choosing to load cart popup upon one click on the cart icon. Instead of OPAC users having to click on the cart icon, then having to click on the dropdown box 'Items in your cart:..' to load the cart popup with this syspref enabled OPAC users only need to click once on theOPAC cart icon and the cart popup loads. Test plan: 1. In Koha OPAC click on the cart icon (making sure to have items in the cart and the dropdown box 'Items in your cart:..' appears. 2. Click this dropdown and the cart popup appears. 3. Confirm you can successfully remove items from and empty the cart 4. Apply patch 5. Restart memcached, plack and in koha-shell run ./updatedatabase.pl 6. By default the new syspref in this patch is turned off. Therefore repeat steps: 1,2,3 and confirm they work the same as before you applied the commit 7. In Koha staff client go to Administration->Global system preferences and enable the 'EnableOneClickToOpenCartPopup' preference 8. Back in the OPAC click on the cart icon (making sure to have items in the cart) and notice no 'Items in your: ..' dropdown appears instead the cart popup loads straight away. 9. Confirm the items in your cart is displayed by the cart popup 10. Confirm you can remove items from/empty the cart Sponsored-By: Toi Ohomai Institute of Technology, New Zealand
Created attachment 78008 [details] [review] Bug 21174: (alternate) Sysprefs to enable the opening of OPAC cart in one click This is an alternate patch which would replace the proposed changes to masthead.inc, opac-bottom.inc, opac-basket.tt, and basket.js. This patch slightly changes the markup in masthead.inc so that the Cart link doesn't try to interpret it as a dropdown trigger, and switches out the ID attribute so that it triggers the right action from basket.js. Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Created attachment 78009 [details] [review] Bug 21174 - Syspref for choosing to load cart popup upon one click on the cart icon. Instead of OPAC users having to click on the cart icon, then having to click on the dropdown box 'Items in your cart:..' to load the cart popup with this syspref enabled OPAC users only need to click once on theOPAC cart icon and the cart popup loads. Test plan: 1. In Koha OPAC click on the cart icon (making sure to have items in the cart and the dropdown box 'Items in your cart:..' appears. 2. Click this dropdown and the cart popup appears. 3. Confirm you can successfully remove items from and empty the cart 4. Apply patch 5. Restart memcached, plack and in koha-shell run ./updatedatabase.pl 6. By default the new syspref in this patch is turned off. Therefore repeat steps: 1,2,3 and confirm they work the same as before you applied the commit 7. In Koha staff client go to Administration->Global system preferences and enable the 'EnableOneClickToOpenCartPopup' preference 8. Back in the OPAC click on the cart icon (making sure to have items in the cart) and notice no 'Items in your: ..' dropdown appears instead the cart popup loads straight away. 9. Confirm the items in your cart is displayed by the cart popup 10. Confirm you can remove items from/empty the cart Sponsored-By: Toi Ohomai Institute of Technology, New Zealand
Created attachment 78010 [details] [review] Bug 21174 - Syspref for choosing to load cart popup upon one click on the cart icon. Instead of OPAC users having to click on the cart icon, then having to click on the dropdown box 'Items in your cart:..' to load the cart popup with this syspref enabled OPAC users only need to click once on theOPAC cart icon and the cart popup loads. Test plan: 1. In Koha OPAC click on the cart icon (making sure to have items in the cart and the dropdown box 'Items in your cart:..' appears. 2. Click this dropdown and the cart popup appears. 3. Confirm you can successfully remove items from and empty the cart 4. Apply patch 5. Restart memcached, plack and in koha-shell run ./updatedatabase.pl 6. By default the new syspref in this patch is turned off. Therefore repeat steps: 1,2,3 and confirm they work the same as before you applied the commit 7. In Koha staff client go to Administration->Global system preferences and enable the 'EnableOneClickToOpenCartPopup' preference 8. Back in the OPAC click on the cart icon (making sure to have items in the cart) and notice no 'Items in your: ..' dropdown appears instead the cart popup loads straight away. 9. Confirm the items in your cart is displayed by the cart popup 10. Confirm you can remove items from/empty the cart Sponsored-By: Toi Ohomai Institute of Technology, New Zealand
Hi Owen and Katrin Thanks, Owen I have taken a look at your commit and signed off on it. I have also added a new commit containing the atomicupdate file and some changes to basket.js fixing a few minor bugs. Now when both commits the JS error is not being thrown, and so I have reset this back to 'Needs signoff'. Can you please take a look/test at my new commit? Additionally, as you may have seen I have asked the general and dev mailing lists about what peoples thoughts on the default cart popup opening process is, and for feedback on changing the default behavior for opening the cart popup to just clicking on the cart icon once to load the cart popup. Cheers, Alex
Hi all, about the question asked on mailing lists: I think the default behaviour change to one click to show the cart does make sense. So I am for it ;)
Yes, the fewer clicks the better. Thanks!
Fewer clicks++
PATCH DOESNT APPLY. Applying: Bug 21174: (alternate) Sysprefs to enable the opening of OPAC cart in one click Using index info to reconstruct a base tree... M koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc Falling back to patching base and 3-way merge... Auto-merging koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc CONFLICT (content): Merge conflict in koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc Failed to merge in the changes. Patch failed at 0001 Bug 21174: (alternate) Sysprefs to enable the opening of OPAC cart in one click The copy of the patch that failed is found in: /home/vagrant/kohaclone/.git/rebase-apply/patch When you have resolved this problem run "git bz apply --continue". If you would prefer to skip this patch, instead run "git bz apply --skip". To restore the original branch and stop patching run "git bz apply --abort". Patch left in /tmp/Bug-21174-alternate-Sysprefs-to-enable-the-opening-vGL1MP.patch
Hi Alex, can you provide a new patch changing the default behaviour (no syspref needed) plz? We are getting closer to the freeze dates and it would be nice to see this go in!
Created attachment 79647 [details] [review] Bug 21174 - Open the OPAC cart with one click by default Feedback from the Koha mailing list in Aug 2018 showed there was widespread concensus for making the default behaviour of the OPAC cart to be to open with one click, rather than clicking on the cart icon then on the dropdown box to load the cart popup. This commit is a combination of Owen Leonard's alternative patch (slightly changing the markup in masthead.inc) and my work to remove the dropdown elements from the template and basket.js Test plan: 1. In Koha OPAC click on the cart icon (making sure to have items in the cart and the dropdown box 'Items in your cart:..' appears. 2. Click this dropdown and the cart popup appears. 3. Confirm you can successfully remove items from and empty the cart 4. Apply patch 5. Restart memcached, and plack 6. Click on the cart icon (making sure to have items in the cart) and notice no 'Items in your: ..' dropdown appears instead the cart popup loads straight away. 7. Confirm the items in your cart are displayed by the cart popup 8. Confirm you can remove items from/empty the cart, and that as you do this the number of cart items shown by the number to the right of the cart icon changes accordingly Sponsored-By: Toi Ohomai Institute of Technology, New Zealand
(In reply to Katrin Fischer in comment 18): Thanks for the reminder Katrin! Apologies for the display. I have attached a patch making clicking on the OPAC cart icon once to load the cart popup the default behavior (no syspref), with also incorporates Owen's work from his alternative patch. Please test, as you say it would be great to get this into master :)
Created attachment 79714 [details] [review] Bug 21174: Open the OPAC cart with one click by default Feedback from the Koha mailing list in Aug 2018 showed there was widespread concensus for making the default behaviour of the OPAC cart to be to open with one click, rather than clicking on the cart icon then on the dropdown box to load the cart popup. This commit is a combination of Owen Leonard's alternative patch (slightly changing the markup in masthead.inc) and my work to remove the dropdown elements from the template and basket.js Test plan: 1. In Koha OPAC click on the cart icon (making sure to have items in the cart and the dropdown box 'Items in your cart:..' appears. 2. Click this dropdown and the cart popup appears. 3. Confirm you can successfully remove items from and empty the cart 4. Apply patch 5. Restart memcached, and plack 6. Click on the cart icon (making sure to have items in the cart) and notice no 'Items in your: ..' dropdown appears instead the cart popup loads straight away. 7. Confirm the items in your cart are displayed by the cart popup 8. Confirm you can remove items from/empty the cart, and that as you do this the number of cart items shown by the number to the right of the cart icon changes accordingly Sponsored-By: Toi Ohomai Institute of Technology, New Zealand Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Is this message became obsolete? var MSG_IN_YOUR_CART = _("Items in your cart: "); I do not manage to display it (which means we may need to remove more code).
Also found a bug: From the search result page: - "Add to cart" - "Add to cart" (another one) => Cart displays 2 elements - OK - "(remove)" => Cart displays nothing - KO must display 1 (maybe on master as well)
(In reply to Jonathan Druart from comment #23) > Also found a bug: > From the search result page: > - "Add to cart" > - "Add to cart" (another one) > => Cart displays 2 elements - OK > - "(remove)" > => Cart displays nothing - KO must display 1 > > (maybe on master as well) I have opened bug 21479 (with a fix).
(In reply to Jonathan Druart in comment #22) Hi Jonathan Yes, that message is now obsolete with the cart dropdown option now being removed. I am attaching another commit which removes the assignment of the MSG_IN_YOUR_CART (in opac-bottom.inc) and the use of it in the updateBasket() in opac-tmpl/bootstrap/js/basket.js.
Created attachment 79856 [details] [review] Bug 21174: Removed MSG_IN_YOUR_CART and its usage in OPAC JS The 'Items in your cart' message is obsolete with the cart dropdown box being removed. Therefore the assignment of this text into the MSG_IN_YOUR_CART variable (which is done in the opac-bottom.inc), and the use of the MSG_IN_YOUR_CART variable in the updateBasket() function (in the OPAC's basket.js) has been removed. Sponsored-By: Toi Ohomai Institute of Technology, New Zealand
Can the additional patch removing unneccessary code related to the MSG_IN_YOUR_CODE message please be tested. Thanks :)
Created attachment 80293 [details] [review] Bug 21174: Open the OPAC cart with one click by default Feedback from the Koha mailing list in Aug 2018 showed there was widespread concensus for making the default behaviour of the OPAC cart to be to open with one click, rather than clicking on the cart icon then on the dropdown box to load the cart popup. This commit is a combination of Owen Leonard's alternative patch (slightly changing the markup in masthead.inc) and my work to remove the dropdown elements from the template and basket.js Test plan: 1. In Koha OPAC click on the cart icon (making sure to have items in the cart and the dropdown box 'Items in your cart:..' appears. 2. Click this dropdown and the cart popup appears. 3. Confirm you can successfully remove items from and empty the cart 4. Apply patch 5. Restart memcached, and plack 6. Click on the cart icon (making sure to have items in the cart) and notice no 'Items in your: ..' dropdown appears instead the cart popup loads straight away. 7. Confirm the items in your cart are displayed by the cart popup 8. Confirm you can remove items from/empty the cart, and that as you do this the number of cart items shown by the number to the right of the cart icon changes accordingly Sponsored-By: Toi Ohomai Institute of Technology, New Zealand Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 80294 [details] [review] Bug 21174: Removed MSG_IN_YOUR_CART and its usage in OPAC JS The 'Items in your cart' message is obsolete with the cart dropdown box being removed. Therefore the assignment of this text into the MSG_IN_YOUR_CART variable (which is done in the opac-bottom.inc), and the use of the MSG_IN_YOUR_CART variable in the updateBasket() function (in the OPAC's basket.js) has been removed. Sponsored-By: Toi Ohomai Institute of Technology, New Zealand Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 80295 [details] [review] Bug 21174: (follow-up) Removed MSG_IN_YOUR_CART and its usage in OPAC JS Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 80373 [details] [review] Bug 21174: Open the OPAC cart with one click by default Feedback from the Koha mailing list in Aug 2018 showed there was widespread concensus for making the default behaviour of the OPAC cart to be to open with one click, rather than clicking on the cart icon then on the dropdown box to load the cart popup. This commit is a combination of Owen Leonard's alternative patch (slightly changing the markup in masthead.inc) and my work to remove the dropdown elements from the template and basket.js Test plan: 1. In Koha OPAC click on the cart icon (making sure to have items in the cart and the dropdown box 'Items in your cart:..' appears. 2. Click this dropdown and the cart popup appears. 3. Confirm you can successfully remove items from and empty the cart 4. Apply patch 5. Restart memcached, and plack 6. Click on the cart icon (making sure to have items in the cart) and notice no 'Items in your: ..' dropdown appears instead the cart popup loads straight away. 7. Confirm the items in your cart are displayed by the cart popup 8. Confirm you can remove items from/empty the cart, and that as you do this the number of cart items shown by the number to the right of the cart icon changes accordingly Sponsored-By: Toi Ohomai Institute of Technology, New Zealand Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 80374 [details] [review] Bug 21174: Removed MSG_IN_YOUR_CART and its usage in OPAC JS The 'Items in your cart' message is obsolete with the cart dropdown box being removed. Therefore the assignment of this text into the MSG_IN_YOUR_CART variable (which is done in the opac-bottom.inc), and the use of the MSG_IN_YOUR_CART variable in the updateBasket() function (in the OPAC's basket.js) has been removed. Sponsored-By: Toi Ohomai Institute of Technology, New Zealand Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 80375 [details] [review] Bug 21174: (follow-up) Removed MSG_IN_YOUR_CART and its usage in OPAC JS Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Awesome work all! Pushed to master for 18.11
Enhancement, will not be backported to 18.05.x series.