Magento: product specfic designs through 'Custom Layout Update' - magento

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

Related

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
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.

magento add column after product tab in product view page

I am creating a custom module and want to add another tab after product description tab in product detail page. Below is my xml code for execute:
<catalog_product_view>
<reference name="product.description">
<block type="testimonial/monblock" name="stockas">
<action method="setTemplate">
<template>testimonial/viewMore.phtml</template>
</action>
</block>
</reference>
</catalog_product_view>
But it shows under price column. I want to show it under product details tab.
Any one please help me.
Just add this code after Description block in catalog.xml files
<block type="testimonial/monblock" name="stockas">
<action method="setTemplate">
<template>testimonial/viewMore.phtml</template>
</action>
</block>
you can add in the above way for any number of tabs needed hope this helps.

Magento : add external code to product view page

i have an external script in phtml and i wanna add it right under the price-box div
<layout version="0.1.0">
<catalog_product_view>
<reference name="content">
<reference name="product.info">
<block type="core/template" name="customprice" as="other" template="customprice/extJs.phtml"/>
</reference>
</reference>
</catalog_product_view>
</layout>
i have tried this in xml layout but it didn't work
any suggestion ?
the quick n dirty way, paste this in your view.phtml or whereever.
<?php echo $this->setTemplate('customprice/extJs.phtml')->toHtml(); ?>
First of all, no need for two reference when you are adding or updating some blocks locally.
Try this:
<catalog_product_view>
<reference name="product.info">
<block type="core/template" name="customprice" as="other" template="customprice/extJs.phtml"/>
</reference>
</catalog_product_view>
And in your view.phtml file call this where you want the block to appear
<?php echo $this->getChildHtml('other'); ?>
#James, there's no need to call the block defined as "other" explicitly. It is already defined in view.phtml

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: Change the block template in local.xml

I would like the product reviews page to use a different template instead of:
catalog/product/view.phtml
In review.xml, I see the file being called:
<block type="review/product_view" name="product.info" template="catalog/product/view.phtml">
Is there a way I can override that in local.xml and create a new file (ex: view2.phtml) and use that for this page?
<review_product_list>
<reference name="product.info">
<action method="setTemplate"><template>catalog/product/view2.phtml</template></action>
</reference>
</review_product_list>
Yes, you can definitely do that by writing the following code in local.xml:-
<reference name="product.info">
<action method="setTemplate"><template>catalog/product/view2.phtml</template></action>
</reference>
Here view2.phtml is your new file in the proper folder structure.
Hope it helps.

Resources