문제

I am using Magento1.9.2.4. I remove the minicart from header and insert it in customer footer phtml file, As the work of remove and insert has been done by XML.

Mini cart is working fine, the only issue is that Count on mini cart are wrong, If I disable BlockHTML cache the counts are showing accurate.

I am using Porto theme, I did the below: my theme's layout local.xml:

<default>
        <reference name="header">
          <action method="unsetChild"><name>minicart</name></action>
        </reference>

        <reference name="footer">
          <action method="insert"><block>minicart</block></action>
          <action method="setTemplate"><template>page/html/custom_footer.phtml</template></action>
       </reference>
</default>

My custom_footer.phtml file:

<li id="cart_custom" class="list-top cart cart_custom"> 
<a href="<?php echo $cart; ?>">
    <div class="cart-area">
        <?php 
        echo $this->getChildHtml('minicart'); //MiniCart
        ?>
    </div>
    <?php echo "<img src='".Mage::getBaseUrl('media').trim("icon_cart").".png'/>"; ?>
    <span><?php echo $this->__('Cart') ?></span>
</a>
</li>

Suggest how can I fix it.

도움이 되었습니까?

해결책

I've tried your local.xml code with little modification in my local machine with magento 1.9.3.4 and get it working. Please try following code

<default>
        <reference name="header">
            <action method="unsetChild"><name>minicart_head</name></action>
        </reference>
        <reference name="footer">
            <action method="unsetData"><key>cache_lifetime</key></action>
            <action method="unsetData"><key>cache_tags</key></action>
            <action method="insert"><block>minicart_head</block></action>
        </reference>
</default>

Let me know if you are still having a issue

다른 팁

Update your custom_footer.phtml as follows.

<li id="cart_custom" class="list-top cart cart_custom"> <a href="<?php echo $cart; ?>">
<div class="cart-area">
    <?php echo $this->getChildHtml('minicart', false); //MiniCart ?>
</div>
<?php echo "<img src='".Mage::getBaseUrl('media').trim("icon_cart").".png'/>"; ?>
<span><?php echo $this->__('Cart') ?></span></a>
</li>

Clear the cache and refresh.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top