Magento: Show two products on the product page - magento

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

Related

Magento I want to remove the left nav

I have created my own navigation as a CMS block that I am displaying in the left nav. I am still make certain categories visible in the menu so that they will show up in main navigation. However when I do that the left side nav pops back up. How can I remove this block or hide it?
<catalog_category_default translate="label">
<label>Catalog Category (Non-Anchor)</label>
<reference name="left">
<block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/>
</reference>
<reference name="content">
this is my theme catalog.xml file. I assumed it would be to unset this block?
Magento 1.9.3.3
use unsetChild to remove blocks in layout xml
<action method="unsetChild"><name>catalog.leftnav</name></action>
normally you would do this local.xml of your theme

One product, two paths, two templates in magento. Why?

I have a product with full path like domain.com/category/product.html and the same product with canonical path domain.com/product.html.
I use 3 columns to display this page.
<catalog_product_view translate="label">
<label>Catalog Product View (Any)</label>
<!-- Mage_Catalog -->
<reference name="root">
<action method="setTemplate"><template>page/3columns-2.phtml</template></action>
</reference>
<reference name="content">
....
</reference>
<reference name="right">
<block type="catalog/product_list_related" name="catalog.product.related" before="-" template="catalog/product/list/related.phtml"/>
</reference>
<reference name="left">
<block type="catalog/navigation" name="catalog.leftmenu" before="-" template="catalog/navigation/menu.phtml"/>
</reference>
</catalog_product_view>
This settings works for both path (I can see in view-source), BUT left column is empty for canonical path. Why??
Having different URL's for the same product like domain.com/category/product.html and domain.com/product.html is because of the settings you've made in Catalog configuration. If you would like to use URL's like domain.com/product.html only, you can set it in Settings menu, under the Catalog, open the Search Engine Optimizations tab and set Use Categories Path for Product URLs value to No.
About your question; first read my answer about having multiple categories for a product here
Your product view page must have a category related data in left block, therefore if you click on a URL like domain.com/category/product.html your session has a category id and your left block is rendered normally. If you click on a URL like domain.com/product.html, your session doesn't have a category id, so your left block looks empty.

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 I show a category list on inner pages in Magento?

In the Magento theme I am using there is a left sidebar, on the homepage the sidebar contains a category list but on inner pages (category page, product page, etc) the list isn't there. How can I replicate this block onto the product and category page so that users can choose a category from anywhere?
You can include the block in the layout(catalog.xml) under the section
Product view
<catalog_product_view translate="label">
<reference name="left">
Your block comes here
</reference>
</catalog_product_view></li>
Category Page
<catalog_category_default translate="label">
<reference name="left">
Your block comes here
</reference>
</catalog_category_default></li>
Otherwise just put in the deafult section of the catalog.xml, I am thinking that should also work.
<default>
<reference name="left">
Your block comes here
</reference>
</default>
I think the block that ususally displays the left navigation of category is
<reference name="left">
<block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/>
</reference>
Hope this helps you to some extent.
Cheers

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