2

I'm trying to add a mini cart in a custom layout, but for some reason this cart's behavior is very strange. Sometimes it's gone, sometimes it still display's products after clearing all cache and sometimes it displaying in other layouts.

So it's never in sync with the other carts.

In made a custom block in template/page/html/storeMenu.phtml with this code:

 <?php echo $this->getChildHtml('cart_homepage')?>

This file is loaded in all layouts including the homepage layout.

In my checkout.xml file i placed this code to load the cart inside the homepage layout and to remove the sidebar cart:

<josil_homepage translate="label">
    <remove name="cart_sidebar"/>
    <reference name="catalog.topnav">
            <block type="checkout/cart_sidebar" name="cart.homepage" as="cart_homepage" template="checkout/cart/sidebar.phtml" before="-">
                <action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/sidebar/default.phtml</template></action>
                <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/sidebar/default.phtml</template></action>
                <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/sidebar/default.phtml</template></action>
                <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>
    </reference>
</josil_homepage>

I tried several configuration options, emptied all the sessions in my browser and the magento installation, but nothing is working.

Where do i have to look further?

UPDATE: For some reason, an exact copy is working on my localhost and not online..?

UPDATE2: Moved the xml from checkout.xml to page.xml. This is only working when i disable my cache. Strange thing is that when i enable my cache and flushing it, changes from my xml have been made in my store.

UPDATE3: When i change the xml reference from catalog.topnav to right or root, it works in those blocks with the cache enabled. I think it has something to do with my custom store menu block..?

  • 1
    Retracting my recommendation to move this...Based on the caching information, does your local machine have the same caching engine installed as the one on your remote host? – David Wilkins Feb 13 '14 at 16:16
  • No, i did not installed any cache on my remote host. Beside that after moving the xml from checkout.xml to page.xml it is doing the exact same thing on local and remote. I think caching was disabled all the time on localhost. – Royw Feb 13 '14 at 16:21
  • Trying to understand your second update, do you mean that when you disable cach storage, it works, or when you disable then re-enable cache storage, then it works? – David Wilkins Feb 13 '14 at 16:23
  • It only works when i disable it. – Royw Feb 13 '14 at 16:24
  • Thanks for clarifying, I am back to thinking this may benefit from being seen on the Magento stack exchange. I can flag it as such, but it will need to be moved by someone with privilege to do so. – David Wilkins Feb 13 '14 at 16:29
1

Finally found the problem:

The catalog.topnav block was an page/html_topmenu type:

<block type="page/html_topmenu" name="catalog.topnav" as="storeMenu" template="page/html/storeMenu.phtml">

apparent, this type is not supporting the cart on good way. I changed it to page/html_header, and now it's working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.