Announcement

Collapse
No announcement yet.

Remove Mini Cart if empty from Layout

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Remove Mini Cart if empty from Layout

    Hello everyone,

    1. Last night I've implemented the mini-cart on our website, however I would like it to disappear when no products are added to it, and then reappear once the item is added to it.

    2. Thought it would be nice when once the item is added to the cart, note would appear on top of bulk-area...

    Ive see both of these on stinky ink's website...

    Any ideas how to do it??

    Feel free to check it out on our website and Stinky Ink's website

    Regards,
    Rytis

    #2
    At a guess, you will be looking at custom javascript hidding and unhidding a <div>
    "If my answers frighten you then you should cease asking scary questions"

    Comment


      #3
      I imagine StinkyInk do this using a javascript function to check if there is something in the basket and then change the <display:none> style on the element controlling the mini-cart to <display:block>
      ActiveStock
      On-line, real-time stock control plug-in for Actinic V7, V8 and V9
      **New - Captcha plug-in for your Contact Us form**

      ActiveStock website
      Free 30 Day Trial
      ActiveStock Blog (including a new tutorial on a 'Sort By' function for long section pages)

      Comment


        #4
        I'm not good when it comes to javascript... could you provide some more info please... I'm happy to try out every solution you could think of.

        Comment


          #5
          this will be a good start
          http://www.learningjquery.com/2006/09/basic-show-and-hide
          "If my answers frighten you then you should cease asking scary questions"

          Comment


            #6
            I'm no JS wizz either, but I think they use the

            Code:
            id="basket_summary"
            as a trigger

            Code:
            // load the basket summary when the page is ready
            basket_summary(true);
            Code:
            function basket_summary(start) {
            
            // only show summary if there are items in the cart
            if(self.getCartItem != null) {
            if(getCartItem(3) > 0) {
            
            if($('#basket_summary').length < 1) {
            $('#sidebar').prepend("<div class=\"panel cart_overview\" id='basket_summary'><div class='panel_title'>Your Shopping Basket</div><div class='panel_content'></div></div>");
            }
            
            $basket_summary = $('#basket_summary');
            
            summary_text = getCartItem(3);
            
            // pluralize
            if(getCartItem(3) > 1) {
            summary_text += " items: ";
            }
            else {
            summary_text += " item: ";
            }
            
            summary_text += getCartItem(1);
            
            summary_text += "<br /><span>includes free uk delivery.</span>";
            
            $('.panel_content', $basket_summary)
            .empty()
            .append(summary_text)
            .append("<a style='text-align:center' href='" + cart_url + "' title='click to view your basket'><img class='view_basket_button' src='viewbasket.gif' /></a>")
            .append("<a style='text-align:center' href='" + checkout_url + "' title='click to go to checkout'><img class='checkoutbutton' src='checkout.gif' /></a>");
             } else {
             // basket has been emptied hide summary if it exists
            if($('#basket_summary').length > 0) {
            $('#basket_summary').hide('slow');
            }
            }
            }
            }
            Please bear in mind I've just lifted this from his code, so you'll have to get a much more competent person to fiddle with it or have a bash your self.

            You could always ask John at Stinky

            Rich

            Army Gore-tex
            Winter Climbing Mitts
            webD's Blog: Website design, SEO and other ramblings…
            Twitter LinkedIN

            If you think a post is good, rate it!

            Find the answers in the Knowledge Base | Have you read the User Guides

            Comment

            Working...
            X