4 / 7
Nov 2012

Ok here's the problem. The requirement is that only one single item can be chosen for purchase. So I could use Buy Now and go straight to PayPal however I need to be able to calculate shipping and read on the forum here (as well as checked) that for the shipping calculator to work I need to include Add to Cart buttons and the View Cart cart button itself. So my question is this. If the cart needs to be present to calculate the shipping how can I at least force it to hold just one single item , so when the user clicks another Buy Now button the item inside the cart is replaced with the one just clicked. In essence I'm asking how I could manually empty the cart before adding to it, what fucntion to call. Many thanks in advance.

  • created

    Nov '12
  • last reply

    Dec '12
  • 6

    replies

  • 1.5k

    views

  • 2

    users

  • 1

    link

We don't support any way of doing that, but it might be possible for custom scripting in your site to do something like reset the cart-tracking cookie in the buyer's browser every time they add an item to it. If you'd like some help with that, we can recommend the competent, E-junkie-experienced developers listed in our directory here:

1http://www.e-junkie.com/ej/developer-directory.htm1

Thanks for your reply, but it looks like ejunkie developers have chosen to restore cookies upon consequent interaction anyway, even if destroyed on client side. So was hoping someone knows what parameter to set on the ejunkie PHP script so I can append to reset the cart's contents to zero.

Yes, every time the cart is viewed in the user's browser, it either reads their existing cart cookies (if present) or sets new ones.



However, I just remembered we support a cart customization parameter to determine the cart cookie duration, which accepts a setting of 0 days to not set a persistent cookie at all. Just add the following lines to your View Cart code on every page, just before the "// -->" line in the standard code you obtained from Seller Admin:



function EJEJC_config() {

EJEJC_CDAYS = 0;

}



In this case, buyers could add an item to their cart, calculate shipping/tax/discounts, and proceed to checkout as long as the cart is displayed, but as soon as they close the cart display, their cart would reset to empty.



A different way of going about this would use our Buy Now button to bypass the cart and take the buyer directly to instant checkout for just one item at a time. While this means we could not calculate shipping in our cart before checkout, you could just include "free" shipping in the item's price, or you may be able to have PayPal add shipping during checkout. In the latter case, make sure you enable Shipping/Buyer's Address in the product's settings at our end, and when you set up Shipping Methods in your PayPal account, you may need to set "Use the shipping fee in the transaction instead of my calculator's settings" to NO.

24 days later

Hi, thanks a lot for your help and sorry for late reply, yeah I've actually found that cookie and deleted it manually anytime Add To Cart is pressed but your solution makes things much cleaner. But there's yet another problem to it and its name is MOBILE. On mobile browsers (phones, tablet etc.) the cart won't popup but instead open as a new window/tab . This of course causes the cookies to be set outside my domain and as you can figure people can easily add multiple items this way as I no longer have control over cookies. So why is not opening as pop-up (my guess is it has to do how mobile browsers handle the JS code that is responsible for it). Is or will there be any way to force the e-junkie cart on open as pop-up mobile browsers to? otherwise I'm back to square one, I can't simply dismiss people using mobile devices.

Sorry for missing your followup earlier, not sure how that happened. On mobile devices, the cart does open in a new window/tab rather than rendering the cart overlay within your page, the same as would happen if the buyer has javascript disabled in their browser; I don't think we have any way to override that behavior for mobile devices, but I'll see if Development has any ideas.