The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Show cart at all times

cmccmc Member
in Help edited May 2012
This must have been asked hundreds of times, but the search facility on this board is unfortunately not as good as the excellent cart software.

In the latest version of foxycart, what is the simplest, single most easy way for a non-programmer to have the cart shown at all times?

Thanks
Comments
  • lancelance Member, Community Support Member
    @cmc,

    Do you want the entire cart with all contents shown at all times, or are you looking for something more like a "mini cart" where it shows more summary details, such as the number of products in the cart?

    Lance
  • sparkwebsparkweb Member, Integration Developer, FoxyShop, Order Desk
    edited May 2012
    Well this is what you need:

    http://wiki.foxycart.com/v/0.7.2/cart#interacting_with_the_cart
    http://wiki.foxycart.com/v/0.7.2/javascript#mini-cart_display_and_html_helper_functionality

    But I don't see any code on these pages for a non-programmer. Perhaps the Foxy guys have something stashed away somewhere....

    EDIT: you win this time @lance!
  • cmccmc Member
    I think you guys call it the mini-cart.

    Basically, something like listing 0 item(s) - £0

    Rather than just not showing anything at all.

    No doubt the script needs editing, I just need to know exactly what to edit and what replace.

    I've looked on this page http://wiki.foxycart.com/v/0.7.2/javascript#mini-cart_display_and_html_helper_functionality but is doesn't mean anything to me.

    I was hoping there was a tutorial somewhere or something
  • fc_adamfc_adam FoxyCart Team
    To achieve "0 item(s) - £0" you would simply do this:
    <p class="fc_minicart"><span class="fc_quantity"></span> item(s) - £<span class="fc_total_price"></span></p>
    

    This would only display if there is something in the cart, and show the values as required.
  • cmccmc Member
    edited May 2012
    Thanks, but you misunderstand.

    I already have a minicart.
    <div id="fc_minicart">
    <img src="assets/templates/images/basket.png" class="basket" alt="basket" />
    <a href="https://motobulbs.foxycart.com/cart?cart=view"; class="foxycart">
    <div id="cartimage">
    Checkout: 
    £
    <span id="fc_total_price"></span>
    -
    <span id="fc_quantity"></span>
    item(s)
    
    </div>
    </a>
    </div>
    

    But i want it to show all the time, even when there is nothing in the cart.
  • fc_adamfc_adam FoxyCart Team
    Ah ok - just remove
    id="fc_minicart"
    
  • cmccmc Member
    Perfect.

    I knew it would be simple in the end.

    Maybe we need get that in the documentation,or is it obvious for most people?
  • fc_adamfc_adam FoxyCart Team
    edited May 2012
    If the FC.json.product_count is greater than 0, these elements will be shown. Otherwise they'll be hidden
    That's what the wiki currently shows as the description for the fc_minicart class/id - was there anything in that that confused you? Perhaps altering the first sentence to:

    If their are 1 or more products in the customers cart (as set in FC.json.product_count), elements with this class/id will be shown. Otherwise they'll be hidden
    Does that read better? Feel free to suggest other improvements that you may have - we certainly want to make sure our documentation makes sense!
  • cmccmc Member
    I wouldn't say that document is noob friendly - I ought to know better as this is my third store, though the others were built 3 year's ago in my job.
    "Mini-Cart" Display and HTML Helper Functionality

    When the FC class is initialized (via the .init() method) and on the .cart_update() method, elements with the following classes or IDs are modified:

    #fc_minicart, .fc_minicart: If the FC.json.product_count is greater than 0, these elements will be shown. Otherwise they'll be hidden
    #fc_quantity, .fc_quantity: The inner HTML will be replaced by the value in FC.json.product_count.
    #fc_total_price, .fc_total_price: The inner HTML will be replaced by the value in FC.json.total_price, formatted using the _currency_format function (which adds decimals but doesn't add currency symbols).

    I would add some sample code and some explaination.

    e.g.

    To display a basic mini cart on your site [image to show what a basic mini cart might look like]
    Add the following code to your website where you want the mini cart to appear:
    <div id="fc_minicart">
    <a href="https://yourdomain.foxycart.com/cart?cart=view"; class="foxycart">
    Checkout: 
    £
    <span id="fc_total_price"></span>
    -
    <span id="fc_quantity"></span>
    item(s)
     
    </a>
    </div>
    

    Then break down the elements. e.g you've got the link to the cart, fc_total_price, shows the current total, fc_quantity will show the number of products.

    Then i'd add a paragraph:

    If you want the mini-cart to appear at all times even when empty, you can rename or remove "fc_minicart" and its associated <div> tags. e.g.
    <a href="https://yourdomain.foxycart.com/cart?cart=view"; class="foxycart">
    Checkout: 
    £
    <span id="fc_total_price"></span>
    -
    <span id="fc_quantity"></span>
    item(s)
     
    </a>
    

    To me that would just be a lot more friendly for non-developers. Maybe it could be included on a quick tutorial or beginners document, as the current http://wiki.foxycart.com/v/0.7.2/javascript#mini-cart_display_and_html_helper_functionality is pretty hardcore for people who little about programming.

    Hope that makes some sense.
  • lukeluke FoxyCart Team
    @cmc: are you working with a developer? We're excited to hear this is your 3rd store, but we are primarily built as a tool for developers. Our new website tries to do a better job of explaining who we are to merchants and designers also, but we still have a primary target market we focus on. That being said, we'd be happy to whisper you some developer recommendations if you're interested.
  • cmccmc Member
    Nope, just working on my own. All the setups have been pretty basic so far. The other two stores were years ago, now it's just do things for myself.

    I'm decent with HTML/CSS but know nothing of javascript.

    I manage to fumble my way through most things though. lol
  • happycloudhappycloud Member
    edited October 2013
    I'd like to see an ".fc_empty" class or something that is true when empty. I like to be able to say "your cart is empty" without a lot of work
  • winstonwinston FoxyCart Team
    @happycloud

    thanks for the recommendation. Can you go to requests.foxycart.com and add that request (if you don't see something similar)? That's how we keep track of feature requests!
Sign In or Register to comment.