jeffharrell / minicart

The minicart is a great way to improve your PayPal shopping cart integration.
MIT License
501 stars 209 forks source link

Can I Link Mini Cart to another Page? #82

Closed AlexHazle closed 12 years ago

AlexHazle commented 12 years ago

I'm a real newbie so sorry if its a silly question but i have built a site where customers will click the image of the item they wish to buy and a popup window appears where there is more information and the Add To Cart button is there.

My clients don't want there to be buttons on the main site, so i was wondering if there is a way to link the button in the popup to the main window if that makes any sense at all!!

Thanks,

Alex

jeffharrell commented 12 years ago

Hi Alex,

The only thing I can think of here is to have the minicart.js file loaded on both the popup and the main window. This will give you two options:

  1. The MIni Cart is setup to update itself across all tabs/windows whenever a product is added in one of them. This only works on browsers which support localStorage, so some versions of IE won't have the main window update unfortunately.
  2. You could use the Mini Cart's afterAddToCart callback (see events on the readme) on the popup and try something like opener.PAYPAL.apps.MiniCart.show(); from the popup to get the main window to update and show the cart.

They're untested, but hopefully those ideas get you pointed in the right direction.

jeffharrell commented 12 years ago

I'm tidying up and closing out this issue. Feel free to reopen if needed.

AlexHazle commented 12 years ago

Hi Jeff,   Thanks so much for your quick response to my issue (#82), sorry i haven't been in touch- I've been away. You're advice was great, at the moment I've got the problem sorted by putting a continue shopping button on the popup with an action to force the opening page to refresh, which seems to work. The code looks something like this:         (just in case you get asked about something like this again!) its not the prettiest solution but it seems to be working. I'm going to try your idea next to see if its a bit more seemless.   Thanks again,   Alex Hazle


From: Jeff Harrell notifications@github.com To: jeffharrell/MiniCart MiniCart@noreply.github.com Cc: AlexHazle alexhazle4839@btinternet.com Sent: Sunday, 2 September 2012, 5:41 Subject: Re: [MiniCart] Can I Link Mini Cart to another Page? (#82)

I'm tidying up and closing out this issue. Feel free to reopen if needed. — Reply to this email directly or view it on GitHub.