4

I've been trying to add a minicart based on the example from Magento 1.9 Demo. When i clicked on the text, nothing happen. I was hoping to get a div drop down on click but after several attempts. It didn't work. Any advice? i'm stucked...

NOTE: I also copied minicart.phtml, items.phtml, default.phtml to the respective folders.

Checkout.xml

<reference name="header">
    <block type="checkout/cart_minicart" name="minicart_head" template="checkout/cart/minicart.phtml" before="-">
        <block type="checkout/cart_sidebar" name="minicart_content" template="checkout/cart/minicart/items.phtml">
            <action method="addItemRender"><type>default</type><block>checkout/cart_item_renderer</block><template>checkout/cart/minicart/default.phtml</template></action>
            <action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/minicart/default.phtml</template></action>
            <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/minicart/default.phtml</template></action>
            <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/minicart/default.phtml</template></action>

            <block type="core/text_list" name="cart_sidebar.cart_promotion" as="cart_promotion" translate="label" module="checkout">
                <label>Mini-cart promotion block</label>
            </block>
            <block type="core/text_list" name="cart_sidebar.extra_actions" as="extra_actions" translate="label" module="checkout">
                <label>Shopping Cart Sidebar Extra Actions</label>
            </block>
        </block>
    </block>
</reference>

Page.xml

<action method="addItem"><type>skin_js</type><name>js/minicart.js</name></action>

Header.phtml

            <!-- Cart -->

        <div class="header-minicart">
            <?php echo $this->getChildHtml('minicart_head'); ?>
        </div>

CSS

I also overwrite all the attribute needed. Still can't work.

user3749395
  • 43
  • 2
  • 6

2 Answers2

4

You are missing the skin/frontend/rwd/default/js/app.js file from your custom mini-cart implementation. In the default RWD install, all the logic for the mini-cart is in the skin/frontend/rwd/default/js/minicart.js but the control for the skip links in the header all happen in app.js:

$j('#header-cart').on('click', '.skip-link-close', function(e) {
    var parent = $j(this).parents('.skip-content');
    var link = parent.siblings('.skip-link');

    parent.removeClass('skip-active');
    link.removeClass('skip-active');

    e.preventDefault();
});

If you look at the DOM for the mini-cart elements, you will see this:

Header Mini Cart

Where data-target-element="#header-cart" is the element that the skip links JS code links into.

circlesix
  • 4,273
  • 3
  • 27
  • 57
  • i did the same but till not get minicart in header. – Sarfaraj Sipai Dec 19 '17 at 07:06
  • I would recommend posting a question that is specific to the way you are trying to get this functionality. Your comment doesn't give enough info to help de-bug, and this isn't the best place to get the info. Post your results and code in a new question. – circlesix Dec 19 '17 at 17:06
0

you need to add the part from app.js that handles the skip-link part.