user1568811
user1568811

Reputation: 67

Magento add wishlist block to cart.phtml

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

Upvotes: 1

Views: 2653

Answers (2)

user1568811
user1568811

Reputation: 67

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'); ?>

Upvotes: 1

simonthesorcerer
simonthesorcerer

Reputation: 559

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.

Upvotes: 0

Related Questions