Add to Basket Button?

Discussion in 'aMember Pro v.4' started by scottlott, Dec 7, 2011.

  1. scottlott

    scottlott Member

    Joined:
    Jun 17, 2010
    Messages:
    50
    How would I setup an "add to basket" button on something like my homepage outside aMember that adds the desired product to amember's cart or basket?
  2. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    There is no ready-to-go solution yet, but I can give you a suggestion if you have at least basic Javascript knowledge.
  3. scottlott

    scottlott Member

    Joined:
    Jun 17, 2010
    Messages:
    50
    Something is better than nothing, I could certainly use the help!
  4. scottlott

    scottlott Member

    Joined:
    Jun 17, 2010
    Messages:
    50
    Alex, where's the suggestion? :)
  5. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    Sorry for delay!

    We have developed a solution to add "Add to Basket" buttons to any HTML page of your website.

    1. Update file in your amember installation from attached ZIP file.

    2. Use the following HTML code to add buttons:
    PHP:
    <!-- add this code once for each page -->
    <
    script src="/amember/application/cart/views/public/js/cart.js"></script>

    <!-- 
    add buttons56 here is the aMember Product#, 1 is the qty - right now only 1 handled  -->
    <a href="#" onclick="cart.add(56, 1)">add item</a>
    <
    a href="#" onclick="cart.addAndCheckout(56, 1)">add item</a>

    Attached Files:

  6. scottlott

    scottlott Member

    Joined:
    Jun 17, 2010
    Messages:
    50
    Works PERFECT! Thanks so much!
  7. scottlott

    scottlott Member

    Joined:
    Jun 17, 2010
    Messages:
    50
    For anyone else that uses this, I had a little trouble with the code:
    PHP:
    <a href="#" onclick="cart.add(56, 1)">add item</a>
    The href="#" was a problem because of the way my website is setup (The add to cart button is essentially on a forum, and the "add to cart" button was redirecting to the forum home page, which made no sense). To resolve the issue, I set the href to redirect to my amember cart page, so my link looks like this:

    PHP:
    <a href="/amember_cart.php" onclick="cart.add(56, 1)">add item</a>
    Thanks Alex and team, you guys are second to none!
  8. thelady100

    thelady100 Member

    Joined:
    Feb 10, 2012
    Messages:
    49
    Does this also apply to the latest version of Amember? I need to add an Add to Cart button to my wordpress pages.
  9. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    Yes, it does - everything described here is implemented.
  10. thelady100

    thelady100 Member

    Joined:
    Feb 10, 2012
    Messages:
    49
    Sorry for the dumb question, but I upload it to my hosting right, and where EXACTLY? Thanks. I'm close to having everything all finished. Just have some small details to do.
  11. thelady100

    thelady100 Member

    Joined:
    Feb 10, 2012
    Messages:
    49
    I figured out where it is.
  12. emilybon

    emilybon New Member

    Joined:
    Mar 1, 2010
    Messages:
    28
    Does this still work? I can't get it to work. My main website sections are in SBI and the amember sections are in Bluehost. I want my pages in SBI to have buttons to add to basket and such, then view the basket in amember and see the products already added. But it is not working with the code given above or the code provided in amember pro shopping cart section.

    Any ideas, help?
  13. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Unfortunately all shopping cart javascript code(basket, add products, checkout etc...) will work only if you place buttons on the same domain where you have aMember installed. We will fix this restriction in future versions.
  14. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295

Share This Page