Sidebar Cart in Magento doesn't work properly - magento

I have a sidebar cart on a magento store i am working on. It has been moved to the bottom of the site.
I have been able to show how many items are in the cart in the footer (footer is located within header.phtml), however, when you hover over the cart, it tells you that there is nothing in the cart. I have added an extension that uses Ajax to add items to the cart. When you add items to the cart, the sidebar cart then works properly, and displays the products that are currently in the cart. However, when you refresh the page, this stops working and 'nothing is in the cart'. Any ideas as to what would cause this?
The web address is
eds.beadmansolutions.co.uk

Hello please add this code on checkout.xml
<default>
<reference name="footer">
<block type="checkout/cart_sidebar" name="cart_sidebar_footer" 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>
</default>
call on footer.phtml
<?php echo $this->getChildHtml('cart_sidebar_footer') ?>

Related

Magento: Show Visitor's Recently Viewed Product

This question is somehow related to my previous question. I want the "recently viewed" section to show the products which are recently viewed by my (as a visitor). So in that way, every visitor will see their recently viewed products in that section.
Does magento provide any default functionality for this feature or do I have to do it the way I referred in my previous question.
Yes magento has its default functionality
Goto app/design/frontend/default/(yourtheme)/tempalte/reports folder
If you cant see that folder in your theme, just copy it and save it to your theme folder
you can use the below code to display in layout files
<block type="reports/product_viewed" name="left.reports.product.viewed" template="reports/product_viewed.phtml" />
To call in CMS pages (homepage)
{{block type="reports/product_viewed" name="left.reports.product.viewed" template="reports/product_viewed.phtml"}}
To call in phtml file
<?php echo $this->getLayout()->createBlock('reports/product_viewed')->setTemplate('reports/product_viewed.phtml')->tohtml(); ?>
yes , you can by simply use this
<cms_index_index>
<reference name="content">
<block type="reports/product_viewed" name="home.reports.product.viewed" alias="product_viewed" template="reports/home_product_viewed.phtml" after="product_new">
<action method="addPriceBlockType">
<type>bundle</type>
<block>bundle/catalog_product_price</block>
<template>bundle/catalog/product/price.phtml</template>
</action>
</block>
</reference>
</cms_index_index>

Hide discount code section in cart

I am writing a Magento Extension that is trying to hide the Discount Code section on the checkout cart page. I wrote the following code to replace the current cart.phtml with my custom template.
<layout version="0.1.0">
<checkout_cart_index>
<reference name="checkout.cart">
<action method="setTemplate">
<template>company/module/cart.phtml</template>
</action>
</reference>
</checkout_cart_index>
</layout>
Everything looked good until I realized it even overwrote the template the cart page uses for an empty cart. I have tried many combinations for switch the "checkout_cart_index"
name to the reference name but I cannot get it to just replace that template. I further investigated and found in the default layout it sets the cart values here:
<reference name="content">
<block type="checkout/cart" name="checkout.cart">
<action method="setCartTemplate"><value>checkout/cart.phtml</value></action>
<action method="setEmptyTemplate"><value>checkout/cart/noItems.phtml</value></action>
I tried again using "SetCartTemplate" but I cannot get it to display yet alone behave as I am intending. Any ideas?
In your layout update
<checkout_cart_index>
<reference name="checkout.cart">
<action method="setCartTemplate"><value>path/to/your/cart.phtml</value></action>
<action method="setEmptyTemplate"><value>path/to/your/noItems.phtml</value></action>
<action method="chooseTemplate"/>
</reference>
</checkout_cart_index>
chooseTemplate will choose the right template
Try to Rewrite this core class to hide the discount code section in your cart page
Mage_Sales_Model_Quote_Address_Total_Discount

Remove "my cart" from side bar in blog page only in magento

I am trying to remove the "my cart" block from the blog page in magento, but i am not being able to remove only from the blog page. Whenever i try to remove it, it removes it from the whole website.
Is there a way to remove it from only the blog page?
The code that i used:
<reference name="right">
<remove name="cart_sidebar"/>
<block type="blog/menu_sidebar" name="right.blog.menu" >
<action method="setTemplate" ifconfig="blog/menu/right" ifvalue="1">
<template>aw_blog/menu.phtml</template>
</action>
<block type="blog/tags" name="blog_tags" />
</block>
</reference>
Any help will be appreciated, thank you

Add a static block to one page checkout in Magento via local.xml

I would like to add a CMS static block (basket_shipping_message) just above the available shipping methods in my Magento checkout. I can edit the phtml file but would rather do it via my local.xml file.
The following code doesen't seem to be working, any ideas?
<checkout_onepage_index>
<reference name="content">
<reference name="shipping_method">
<block type="cms/block" name="basket_shipping_message" before="available">
<action method="setBlockId"><block_id>basket_shipping_message</block_id></action>
</block>
</reference>
</reference>
</checkout_onepage_index>
Did you call in your phtml template getChildHtml('basket_shipping_message');? That should do it. Without that magento does not render the block

Add "My Cart" to top.links magento in local.xml or checkout.xml?

Two parts to this question:
How can I add My Cart to either local.xml or checkout.xml? I have a custom template, that never had it called. Looking for where it is being removed, but not sure I am looking in the right place.
I have tried adding to local.xml
<reference name="root">
<reference name="top.links">
<action method="addCartLink"></action>
</reference>
</reference>
But it breaks magento. Basically I have a soft add to cart and want to pull the default magento "My Cart" to the header, so the ajax updates on page like it does in the default magento template.
2nd par - Where does the code for "My Cart" live to tweak it?
<reference name="top.links">
<block type="checkout/links" name="checkout_cart_link">
<action method="addCartLink"></action>
</block>
</reference>
You may have to clear your cache.

Resources