Magento Store - Horizontal Items in Grid - magento

In Magento how do I specify how many products I would like displayed horizontally in the grid. By default it is 3 and I can't see where to change this (I would like to set it to 2).
Thanks,
Alan.

Difficult to find comprehensive instruction for Magento 1.4 with theming changes and local.xml, however there's possibly a bug with the columns in grid view as noted here:
http://www.lotusseedsdesign.com/blog/change-grid-view-column-4-product-listing
I got by with this in local.xml for a one column page/4 column grid:
<?xml version="1.0" encoding="UTF-8"?>
<layout>
<!-- Other template tweaks here -->
<catalog_category_default>
<reference name="content">
<reference name="category.products">
<reference name="product_list">
<action method="addColumnCountLayoutDepend"><layout>empty</layout><count>4</count></action>
<action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>4</count></action>
</reference>
</reference>
</reference>
</catalog_category_default>

in the catalog.xml layout file you can add an 'action' tag inside the product-list block that will set the number of columns... the template (list.phtml) will call it as get[Something], so you want to have the method="set[Something]" in the layout file be the same. The class the methods are being called on is in app/code/core/Mage/Catalog/Block/Product/List.php ... I think. catalog.xml has in it some commented out examples of using 'action' for doing paging, so you should be able to copy those. Bit vague...but no code handy to look at.

Related

How to remove right sidebar in magento 1.9

I installed magento 1.9.
After installed widget and slieshow, my page look like this,
Here i want to remove recently viewed products and compare products.
So i removed in app/design/frontend/modern/layout/catalog.xml ,(these lines i removed)
<block type="catalog/product_compare_sidebar" before="cart_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>
But still stays sidebar.
can anyone help me?
go to magento admin click on cms home page , click on design now select layout 1 column now save and refresh page
To remove from Home Page to to Admin panel CMS/PAGES/Home Page then go to Design Tab there the first option is Layout. Change it to 1 column. SO it will change the layout of (only )Home Page to one column without left and right.
<div class="MagicSlideshow" data-options="width: 400px; height:187px;">
use this code
I just had this same problem, and was able to remove the compare block using xml.
In my situation, I did not want change to a 1-column layout because of what I've already done with the right-col layout.
Solution:
Copy "catalog.xml" from /app/design/frontend/base/default/layout or /app/design/frontend/rwd/default/layout if you're using the new rwd theme.
Go to line 55 and remove or comment out the entire <reference name="right"> block:
<reference name="right">
<block type="catalog/product_compare_sidebar" before="cart_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>
<!--<block type="core/template" name="right.permanent.callout" template="callouts/right_col.phtml">-->
<!--<action method="setImgSrc"><src>images/media/col_right_callout.jpg</src></action>-->
<!--<action method="setImgAlt" translate="alt" module="catalog"><alt>Keep your eyes open for our special Back to School items and save A LOT!</alt></action>-->
<!--</block>-->
</reference>
Go to line 178 (for rwd_default) or 165 (for base_default) and remove or comment out the <customer_account_index> block of code:
<customer_account_index>
<reference name="right">
<action method="unsetChild"><name>catalog.compare.sidebar</name></action>
</reference>
Save the file into your custom theme layout folder as "catalog.xml".
You can unset the compare side bar in the layout file of your theme. I added a new file in
/app/design/frontend/myTheme/layout/local.xml
where I unset the compare side bar using:
<?xml version="1.0" encoding="UTF-8"?>
<layout>
<default>
<action method="unsetChild"><name>catalog.compare.sidebar</name></action>
</default>
</layout>
Don't edit the default files as they will get overwritten on update.

Vote and Compare Blocks need to be taken out in magento

I have some troubles in /checkout/cart page with taking out two blocks:
- compare products block
- voting block
I cant remove them from right sidebar
at current layout xml
/layout/checkout.xml
There is only MY ONE adding template to right sidedar
<reference name="right">
my adding template code here
</reference>
also I have just removed all adding templates to right sidebar from
/layout/page.xml
and as a result I see these two blocks (compare and voting) at right bar anyway (
Let me know where can They be removed by me from ?
Thanks
I hope you're using local.xml to do your customizations.
In local.xml
<default>
<!--other codes-->
<remove name="catalog.compare.sidebar" />
<remove name="right.poll" />
<!--other codes-->
</default>
if need to remove from checkout - cart page only and retain on other pages then use <checkout_cart_index> handler instead of and use "unSetChild". Remember <remove> will completely remove the block.
I found out where was problem )
Magento layouts include one of this
/layout/poll.xml
and There I saw these lines
<!-- Mage_Poll -->
<reference name="right">
<block type="poll/activePoll" name="right.poll">
<action method="setPollTemplate"><template>poll/active.phtml</template><type>poll</type></action>
<action method="setPollTemplate"><template>poll/result.phtml</template><type>results</type></action>
</block>
</reference>
</default>
after commented it They disappeared )

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 Category Pages Layout Set to 2 Col but 3 is showing?

I have just start to design a template for Magento 1.6, It is a fresh install and I have made a folder for the app and skin! I am only creating files for the sections I need to edit for leaving the base template to do the rest. The only files I have edited are left_callout.phtml and header.phtml also I have edited the checkout.xml to move the My Cart to the left sidebar.
I have gone into the admin and changed the default category to 2 Columns and Left Sidebar as you can see in the image below:
http://i.stack.imgur.com/HQlLQ.jpg
But when I view the categories in the frontend it still shows 3 columns with both sidebars as you can see in the image below:
http://i.stack.imgur.com/70Xnf.jpg
I have disabled the cache in the admin! And I havn't edited the the XML files other than the checkout.xml Anyone know why this is happening? Also how come the otions are greyed out in the sub categories as you can see in the image above.
Write this code in local.xml (If not,then create) :-Path :-magento_folder/app/design/frontend/mytheme(your_package)/neo(your_theme)/layout/local.xmlTry this :
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
</default>
<catalog_category_default>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
</catalog_category_default>
</layout>
Set layout 1column.phtml2columns-right.phtml3columns.phtmlBetween template-tag depending on your requirements.Onclicking any category,the page you will see should have the above selected layout templateHope this may help you.
I think you should edit page.xml and change under <default>
<block type="page/html" name="root" output="toHtml" template="page/3columns.phtml">`
to
<block type="page/html" name="root" output="toHtml" template="page/2columns-left.phtml">`
Maybe this help http://www.magentocommerce.com/boards/viewthread/16838/

Magento - use an alternate "price.phtml" (in addition to the existing one)

I am looking for a way to have an alternate template/catalog/product/price.phml used in one specific location, and to continue using the existing price.phtml file in all other locations.
To explain further, I need to display the regular price, and then another special price right below it - but only on the product page (for the main product being displayed). This special price is not a price that can be calculated by the catalog price rules, so I wrote my own module to do the calculation. So, everywhere that I am displaying prices I want to display with the regular ol' template/catalog/product/price.phtml file... but for the product page (the main product - not the related, upsells, etc) I want to use my own custom template/catalog/product/price-custom.phtml template file. Can anybody help?
Normally I just look in the layout xml files (for example catalog.xml) to find these types of things, but price.phtml is kinda special - it isn't that simple. And for the life of me I can't figure out if there is an easy way to swap it out conditionally on the page being viewed. I am aware that I can just update price.phtml to always print out this extra price, and then use css to hide the price everywhere, but I would rather not do that if possible.
(Also you may want to know that I only have simple products.)
This can be done in a layout XML file:
<layout>
<PRODUCT_TYPE_simple>
<reference name="product.clone_prices">
<action method="setTemplate">
<template>catalog/product/price-custom.phtml</template>
</action>
</reference>
</PRODUCT_TYPE_simple>
</layout>
Create a local.xml file, put it in app/frontend/default/YOURTEMPLATE/layout
In the local.xml file, add:
<?xml version="1.0" encoding="UTF-8"?>
<layout>
<!-- Override price template on product view page -->
<PRODUCT_TYPE_simple>
<reference name="product.info.simple">
<action method="setTemplate">
<template>catalog/product/price_product_page.phtml</template>
</action>
</reference>
</PRODUCT_TYPE_simple>
<!-- /Override price template on product view page -->
</layout>
Create a copy of catalog/product/price.phtml and put it in YOURTEMPLATE/templates/product/product_price_page.phtml
This will override the price.phtml in the template, and replace it with product_price_page.phtml
Or in your php block.
See example here :
Mage_Catalog_Block_Product_Abstract
protected $_priceBlockDefaultTemplate = 'catalog/product/price.phtml';
protected $_tierPriceDefaultTemplate = 'catalog/product/view/tierprices.phtml';
I had a similar requirement recently, where a different price template for the product page was the preferred solution.
The price block appears to be something of a special case in Magento (in the RWD theme at least), it's defined in catalog.xml as simply a block type and name within the <default/> handle:
<block type="catalog/product_price_template" name="catalog_product_price_template" />
If you look around at how some core layout files set the price template, you'll find examples like this (from bundle.xml):
<reference name="catalog_product_price_template">
<action method="addPriceBlockType">
<type>bundle</type>
<block>bundle/catalog_product_price</block>
<template>bundle/catalog/product/price.phtml</template>
</action>
</reference>
They call a method called addPriceBlockType which you can find in Mage_Catalog_Block_Product_Abstract
Based on this and after a little experimentation, I found the following solution worked for me:
<catalog_product_view>
<reference name="product.info">
<action method="addPriceBlockType">
<type>simple</type>
<block>catalog/product_price</block>
<template>catalog/product/price_product_page.phtml</template>
</action>
<action method="addPriceBlockType">
<type>configurable</type>
<block>catalog/product_price</block>
<template>catalog/product/price_product_page.phtml</template>
</action>
<!-- Set for each product type as necessary e.g. bundled, virtual etc... -->
</reference>
</catalog_product_view>
The proper way to achieve it :
<PRODUCT_TYPE_simple>
<reference name="product.info.simple">
<action method="addPriceBlockType"><type>simple</type><block>catalog/product_price</block><template>catalog/product/price-product-page.phtml</template></action>
</reference>
</PRODUCT_TYPE_simple>
<PRODUCT_TYPE_configurable>
<reference name="product.info.configurable">
<action method="addPriceBlockType"><type>configurable</type><block>catalog/product_price</block><template>catalog/product/price-product-page.phtml</template></action>
</reference>
</PRODUCT_TYPE_configurable>
...

Resources