Magento add wishlist block to cart.phtml - magento

I have a simple question that I can't seem to find an answer for. All I'm trying to do is make the wishlist viewable when a customer goes to the shopping cart page. That's all. So when a customer clicks on the cart button it takes them to their shopping cart page and they can see their items in their cart plus all the items on their wishlist. There doesn't seem to be any tutorials for this anywhere. I'm sure the answer is fairly simple but I'm relatively new to Magento.
Thanks

local.xml
<checkout_cart_index>
<reference name="content">
<reference name="checkout.cart">
<block type="wishlist/customer_sidebar" name="wishlist_sidebar" as="wishlist" after="cart_sidebar" template="wishlist/sidebar.phtml"/>
</reference>
</reference>
</checkout_cart_index>
cart.phtml
<?php echo $this->getChildHtml('wishlist'); ?>

Untested, but should work: In your theme's local.xml, inside the <layout></layout> node, it should work to use this:
<checkout_cart_index>
<reference name="content">
<reference name="checkout.cart">
<block type="wishlist/customer_sidebar" name="wishlist_sidebar" as="wishlist" after="cart_sidebar" template="wishlist/sidebar.phtml" />
</reference>
</reference>
</checkout_cart_index>
If you look at base/default/layout/checkout.xml, you can see that the coupon- and shipping-block are in the same position. After that, go to your theme's checkout/cart.phtml and add a line:
<?php
echo $this->getChildHtml('wishlist_sidebar');
?>
...anywhere in this file.
Maybe you want to give the block another name other than wishlist_sidebar or use another template file than wishlist/sidebar.phtml. Just change the XML accordingly.

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

how to display recently viewed products list on product details page - magento

I have used mobileshoppe theme for magento and trying to display recently viewed product list at product details page but some how its not working...
Added code below at catalog.xml
<catalog_product_view translate="label">
<reference name="content">
<block type="reports/product_viewed" name="product.recently.viewed" as="product_recently_viewed" template="reports/product_viewed.phtml"/>
</reference>
</catalog_product_view>
and below code at app\design\frontend\default\mobileshoppe\template\catalog\product\ view.phtml
<?php echo $this->getChildHtml('product_recently_viewed') ?>
I have tried the same with default theme and its also not working, can any one help me to figure out this issue ?
Thanks...
On the the product detail template (view.phtml) you have to be more specific in the xml where you want to place the block. See the example below using local.xml in the theme layout directory (app/design/frontend/your package/your theme/layout/local.xml) to insert the block. Here's an example from a site I'm working on. Ironically we are having problems with it displaying consistently, which I'm trying to figure out right now, but this is working most of the time! Try getting more specific in your catalog.xml and it should work. The xml is in local.xml, the echo is in catalog/product/view.phtml
<?php echo $this->getChildHtml('recently_viewed') ?>
<catalog_product_view>
<reference name="content">
<reference name="product.info">
<block type="reports/product_viewed" name="left.reports.product.viewed" template="reports/product_viewed.phtml" as="recently_viewed" />
</reference>
</reference>
Can you please replace xml reference content to left.
Instead of this
<reference name="content">
Use below and check
<reference name="left">
As it is a part of sidebar so it should work with left / right column as you want to display in page.
Cheers!

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

getChildHtml('content') in magento?

Anybody please help me
I can't find getChildHtml('content')
I'm new in magento?
Where is getChildHtml('content') in magento?
see
<reference name="content">
<block type="catalog/navigation" name="catalog.leftnav1" template="catalog/navigation/left_nav.phtml"/>
</reference>
writing the above code will display all the contents in left_nav.phtml(php+html[view part]) in the content part of that page.
Mainly there are :
<reference name="left">--->display in left side of page
<reference name="right">--->display in right side of page
<reference name="head">--->display in head side of page
<reference name="content">--->display in middle of page
getChildHtml('content')--->will display all page declared under <reference name="content"> in the middle part of the called layout page.
This is a slight overview of your doubt.Make an effort to learn from googling.Good Luck
You may get childhtml('content') in every layout.phtml files like 1column.phtml and other in app/rwd/default/page

Magento: product specfic designs through 'Custom Layout Update'

If I want to control how each product is displayed (i.e. a custom design when specified) my first thought is to do this:
Create a custom view.phtml in template/catalog/product/my_view.phtml
Navigate in the admin to Product->Design->Custom Layout Update
Add this block:
<reference name="content">
<action method="setTemplate">
<template>catalog/product/view_print.phtml</template>
</action>
</reference>
But the template is never loaded, only the default view.phtml. Is this the correct method? I need to be able to do this in the product settings.
Found the answer:
<reference name="product.info">
<action method="setTemplate"><template>catalog/product/NEW_VIEW.phtml</template></action>
</reference>
Navigate in the admin to Product->Design->Custom Layout Update > Add the below custom block. > It works for all the stores.
"<reference name="product.info">
<block type="namespace_modulename/catalog_product_list_custom"
name="catalog.product.modulename" as="modulename" after="tierprices"
template="modulename/catalog/product/modulename.phtml"/>
</reference> "
Add the below code in view.phtml
<?php echo $this->getChildHtml('modulename'); ?>

Resources