Bug 21174 - Change default behavior to open OPAC cart in one click
Summary: Change default behavior to open OPAC cart in one click
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Alex Buckley
QA Contact: Testopia
URL:
Keywords:
Depends on: 21479
Blocks:
  Show dependency treegraph
 
Reported: 2018-08-08 03:44 UTC by Alex Buckley
Modified: 2018-10-26 13:19 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 21174 - Implemented syspref to enable the loading of cart popup on one click (6.80 KB, patch)
2018-08-08 05:18 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 21174 - Implemented syspref to enable the loading of cart popup on one click (9.24 KB, patch)
2018-08-10 03:40 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 21174: (alternate) Sysprefs to enable the opening of OPAC cart in one click (3.69 KB, patch)
2018-08-10 14:43 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 21174 - Added missing atomicupdate (2.38 KB, patch)
2018-08-19 21:40 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 21174 - Syspref for choosing to load cart popup upon one click on the cart icon. (5.41 KB, patch)
2018-08-19 22:36 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 21174: (alternate) Sysprefs to enable the opening of OPAC cart in one click (3.75 KB, patch)
2018-08-19 22:42 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 21174 - Syspref for choosing to load cart popup upon one click on the cart icon. (5.41 KB, patch)
2018-08-19 22:43 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 21174 - Syspref for choosing to load cart popup upon one click on the cart icon. (6.28 KB, patch)
2018-08-19 22:53 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 21174 - Open the OPAC cart with one click by default (4.36 KB, patch)
2018-09-30 09:01 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 21174: Open the OPAC cart with one click by default (4.42 KB, patch)
2018-10-01 13:21 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 21174: Removed MSG_IN_YOUR_CART and its usage in OPAC JS (2.14 KB, patch)
2018-10-03 02:14 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 21174: Open the OPAC cart with one click by default (4.51 KB, patch)
2018-10-09 16:39 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21174: Removed MSG_IN_YOUR_CART and its usage in OPAC JS (2.23 KB, patch)
2018-10-09 16:39 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21174: (follow-up) Removed MSG_IN_YOUR_CART and its usage in OPAC JS (1.33 KB, patch)
2018-10-09 16:39 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21174: Open the OPAC cart with one click by default (4.55 KB, patch)
2018-10-10 22:01 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21174: Removed MSG_IN_YOUR_CART and its usage in OPAC JS (2.27 KB, patch)
2018-10-10 22:01 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 21174: (follow-up) Removed MSG_IN_YOUR_CART and its usage in OPAC JS (1.38 KB, patch)
2018-10-10 22:01 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Buckley 2018-08-08 03:44:20 UTC
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.
Comment 1 Alex Buckley 2018-08-08 05:18:39 UTC
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
Comment 2 Alex Buckley 2018-08-08 05:19:14 UTC
I will amend the commit message shortly to contain a test plan.
Comment 3 Alex Buckley 2018-08-10 03:40:50 UTC
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
Comment 4 Alex Buckley 2018-08-10 03:42:08 UTC
Amended commit added containing a test plan.
Comment 5 Owen Leonard 2018-08-10 14:43:51 UTC
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.
Comment 6 Owen Leonard 2018-08-10 14:48:05 UTC
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.
Comment 7 Katrin Fischer 2018-08-10 14:58:11 UTC
+1 for asking the mailing list, the current behaviour causes a bit of confusion here and there
Comment 8 Alex Buckley 2018-08-19 21:40:51 UTC
Created attachment 78006 [details] [review]
Bug 21174 - Added missing atomicupdate

Sponsored-By: Toi Ohomai Institute of Technology, New Zealand
Comment 9 Alex Buckley 2018-08-19 22:36:54 UTC
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
Comment 10 Alex Buckley 2018-08-19 22:42:56 UTC
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>
Comment 11 Alex Buckley 2018-08-19 22:43:18 UTC
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
Comment 12 Alex Buckley 2018-08-19 22:53:41 UTC
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
Comment 13 Alex Buckley 2018-08-19 23:07:38 UTC
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
Comment 14 Josef Moravec 2018-08-20 08:27:51 UTC
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 ;)
Comment 15 Elaine Bradtke 2018-08-20 17:25:40 UTC
Yes, the fewer clicks the better. Thanks!
Comment 16 Katrin Fischer 2018-08-26 17:19:08 UTC
Fewer clicks++
Comment 17 Jesse Maseto 2018-09-14 23:21:23 UTC
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
Comment 18 Katrin Fischer 2018-09-29 09:33:28 UTC
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!
Comment 19 Alex Buckley 2018-09-30 09:01:34 UTC
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
Comment 20 Alex Buckley 2018-09-30 09:05:23 UTC
(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 :)
Comment 21 Owen Leonard 2018-10-01 13:21:41 UTC
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>
Comment 22 Jonathan Druart 2018-10-02 12:37:46 UTC
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).
Comment 23 Jonathan Druart 2018-10-02 12:42:52 UTC
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)
Comment 24 Jonathan Druart 2018-10-02 20:37:17 UTC
(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).
Comment 25 Alex Buckley 2018-10-03 02:13:47 UTC
(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.
Comment 26 Alex Buckley 2018-10-03 02:14:13 UTC
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
Comment 27 Alex Buckley 2018-10-03 02:15:23 UTC
Can the additional patch removing unneccessary code related to the MSG_IN_YOUR_CODE message please be tested. Thanks :)
Comment 28 Jonathan Druart 2018-10-09 16:39:33 UTC
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>
Comment 29 Jonathan Druart 2018-10-09 16:39:40 UTC
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>
Comment 30 Jonathan Druart 2018-10-09 16:39:45 UTC
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>
Comment 31 Katrin Fischer 2018-10-10 22:01:06 UTC
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>
Comment 32 Katrin Fischer 2018-10-10 22:01:12 UTC
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>
Comment 33 Katrin Fischer 2018-10-10 22:01:18 UTC
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>
Comment 34 Nick Clemens 2018-10-17 19:23:26 UTC
Awesome work all!

Pushed to master for 18.11
Comment 35 Martin Renvoize 2018-10-26 13:19:07 UTC
Enhancement, will not be backported to 18.05.x series.