adobe / asset-share-commons

A modern, open-source asset share reference implementation built on Adobe Experience Manager (AEM)
https://opensource.adobe.com/asset-share-commons/
Apache License 2.0
88 stars 107 forks source link

Asset added to cart via details page overriding previous image in cart #404

Open itzmuthu opened 5 years ago

itzmuthu commented 5 years ago

Describe the bug Asset added to cart via details page overriding previous image in cart

Environment

To Reproduce Steps to reproduce the behavior:

  1. open home page http://localhost:4502/content/asset-share-commons/en/light.html in chrome browser

  2. open two assets in next tab. now URL of the each tab will be like Browser TAB 1 URL: http://localhost:4502/content/asset-share-commons/en/light.html?layout=card&p.offset=0&p.limit=48 Browser TAB 2 URL: http://localhost:4502/content/asset-share-commons/en/light/details/image.html/content/dam/asset-share-commons/en/public/pictures/sarah-dorweiler-357959.jpg Browser TAB 3 URL: http://localhost:4502/content/asset-share-commons/en/light/details/image.html/content/dam/asset-share-commons/en/public/pictures/helena-hertz-256396.jpg

  3. now add asset in TAB 2 to cart. now cart count is 1

  4. now add asset in TAB 3 to cart. now again cart count is 1. this asset overriding asset added to cart in tab2.

Expected behavior At above step 4, cart count should be 2 instead of 1

Screenshots refer attached screenshot

cartIssue.docx

godanny86 commented 5 years ago

Hi @itzmuthu I can reproduce this bug. TBH I don't think we had considered this scenario when developing/testing the cart functionality.

I think it should just be a matter of checking the local storage before* opening the Cart dialog. Will investigate further. Feel free to look into a solution in parallel, I would start by looking at these files:

https://github.com/Adobe-Marketing-Cloud/asset-share-commons/blob/develop/ui.apps/src/main/content/jcr_root/apps/asset-share-commons/clientlibs/clientlib-contexthub/cart/store.assetsharecommonscart.js

https://github.com/Adobe-Marketing-Cloud/asset-share-commons/blob/develop/ui.apps/src/main/content/jcr_root/apps/asset-share-commons/clientlibs/clientlib-site/js/cart/cart.js