Magento mini-cart not updating on product pages - magento

I am having an issue in my magento mini cart .
when i go to a product page and click on Add to cart , my mini cart does not update and show the product items on the product page but the products are added to cart once i go to the cart page.
I am creating a local.xml file for my theme and having this code here
<block type="checkout/cart_sidebar" name="custom_mini_cart" template="checkout/cart/mini.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>
and on my header.phtml
I am calling this like
$cart_html = $this->getChildHtml('custom_mini_cart');
It works fine when i go to cart page or checkout page.
product quantity and items don't show up on product page in minicart
any help will be appreciated
Thanks

Theres a slug that defines which pages this will work on.
In this case, it should be under the slug
<default>
Your code goes here.
</default>
My guess is that you have it under:
<checkout_cart_index translate="label">
I believe you probably have it under this one.
</checkout_cart_index>
What this states is that even though you're adding your content to the header. You will only be adding it to pages that are part of the cart_index
Hope this solves your issue

Related

Magento: how to add a static block AFTER product list

In a web site my boss wants me to insert a static block AFTER the product list of that category. Up to now, using the Magento front end application, the one you can see here, I have seen that I can add a static block only before the product list. How can I do to put the block after the product list for each category?
For example this is a page of the site I am working on and I would like to display the block at the bottom of the page, after the product list but before the footer links.
I think I should change some files (like page.xml or local.xml) ma I don't know how and I haven't found anything useful in the net. Can you help?
In your local.xml add the following, replacing cms_extra with the identifier of your CMS block.
<!-- Catalog Category (Anchor) -->
<catalog_category_layered>
<reference name="content">
<block type="cms/block" name="cms_extra" after="category.products">
<action method="setBlockId"><block_id>cms_extra</block_id></action>
</block>
</reference>
</catalog_category_layered>
<!-- Catalog Category (Non-Anchor) -->
<catalog_category_default>
<reference name="content">
<block type="cms/block" name="cms_extra" after="category.products">
<action method="setBlockId"><block_id>cms_extra</block_id></action>
</block>
</reference>
</catalog_category_default>
Alternatively if it needs to be a different CMS block on each category, add the following near the bottom of your catalog/product/list.phtml..
<?php
$catcode = Mage::registry('current_category')->getId();
echo $this->getLayout()->createBlock('cms/block')->setBlockId('category_block_' . $catcode .'')->toHtml();
?>
Create each category's CMS block with identifier of category_block_categoryid

Get latest or new products on home page in magento with layout update

I create new theme in Magento and want to show latest or new products on home page with pagination and number of show product. I copied catalog/product/list.phtml from it's cored file to my template so that i can customize it.
Below is code in layout update in homepage:
<reference name="content">
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
<action method="setCategoryId"><category_id>3</category_id></action>
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager"/></block>
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
</block>
</reference>
It work well with is code, but only with category I set in layout update.
<action method="setCategoryId"><category_id>3</category_id></action>
What I want is get all latest or new product from all category.
Question: how can I get latest or new products with layout update with all category or multiple category?
Open Magento admin panel
Go to CMS > Pages > Home page
Switch to the content tab
Insert the following code:
{{block type="catalog/product_new" column_count="6" products_count="12" name="home.catalog.product.new" alias="product_homepage" template="catalog/product/list.phtml"}}
Where:
column_count="6" – number of the product columns
products_count="12" – number of the displayed products
You can use
{{block type="catalog/product_new" name="home.catalog.product.new" alias="product_homepage" template="catalog/product/new.phtml"}}
Here you can ‘Set Product as New from Date’ and ‘Set Product as New to Date’ options in the ‘General’ product information page in the admin tool will be shown.
The best way to do that is by using Magento Widget.
From your CMS homepage, go to content and clic on the second item in wysiwyg menu: Insert widget.
Then, a popin appear, choose in Widget Type: Catalog New Products List.
Clic on Insert widget and it's done.
This is what I use on my homepage:
{{block type="catalog/product_list" category_id="11" num_products="16" template="catalog/random.phtml"}}
I use this on the homepage to show items from that category directly. This way I dont have duplicate content issues and the user links directly into the category.
You can see an example on our website www.SaveTheMage.com

How to show My Cart link at top links

I installed a template, and there is no My Cart link at top link.
This in checkout.xml:
<reference name="top.links">
<block type="checkout/links" name="checkout_cart_link">
<action method="addCartLink"></action>
<action method="addCheckoutLink"></action>
</block>
</reference>
I want to show it with item quantity ex: My Cart(1)
Please help me!
Best regards,
One way you can do this is within the template file add this code:
$count = $this->helper('checkout/cart')->getSummaryCount();
This will display the number of items in the cart. If you copy the template and layout files into your theme you should be able to add this in and get it working.

Magento: Show two products on the product page

I would like to show two different products on the product view page. Basically, after displaying the first product like it normally would, the page should then show another product with all it's details, images and of course the "Add to Cart" button.
Both products should be fully displayed on the product view page, so I can't use any of the existing blocks like catalog/product_list_related or catalog/product_list_upsell.
My idea was to simply add another catalog/product_view block to the catalog_product_view layout definition, like so:
catalog.xml:
<layout version="0.1.0">
...
<catalog_product_view translate="label">
...
<reference name="content">
<block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
...
</block>
</reference>
...
<!-- Changes start here -->
<reference name="content">
<block type="catalog/product_view" name="product.info2" template="catalog/product/view.phtml">
<action method="setProductId"><product_id>123</product_id></action>
</block>
</reference>
</catalog_product_view>
However, this does not seem to work. Various elements of the block don't seem to load correctly, as you can see on this screenshot:
All the product images are missing as well as the price and the buttons. Also, my call to setProductId() doesn't seem to have any effect.
You can delete this catalog.xml, then magento usa base catalog.xml

Magento - add a custom left that appear with the products only

I need to add a custom left to appear on the products pages only.
I hope if you can help
if you want them to appear on the listing page then you have to add your block here :
<catalog_category_layered translate="label">
<label>Catalog Category (Anchor)</label>
<reference name="left">
......Add your block here ..............
</reference>
but if you want it to appear on detail page too then
<catalog_product_view translate="label">
<reference name="left">
......Add your block here ..............
</reference>
You can find both these above in catalog.xml but just in case you use other than default them then you have to do it in local.xml.
Don't forget to vote up or click the answer (tick) on left If this helps you.

Resources