I am trying to get my module to replace the 'media' section on list and grid view on category list pages with my own new one, if there is a hole in Mage knowledge its the layout xml so if someone could help :-) I am using,
<layout>
<catalog_category_view>
<reference name="head">
<action method="addItem"><type>skin_js</type><name>js/imageover.js</name></action>
</reference>
<reference name="product_list">
<block type="catalog/product_view_media" name="product.info.media" as="media" template="lewis/imageover/media.phtml"/>
</reference>
</catalog_category_view>
</layout>
but it's not working? :s debug toolbar shows my layout is being called but the changed aren't being made.
Edit: Ok with some help from the post below I got it to read my layout, but turns out on the category_list page Magento doesn't use media template the image call is made in the list.phtml file, so the only way to change it appears to be to replace that whole template file. (which seems very extreme!) is there another way to replace the image on the category list page?
What you've done here is effectively reinstantiate the media block with your template. If your changes are solely template-based, you can just <reference name="product.info.media"> the existing block instance from the layout and call <action method="setTemplate"><template>lewis/imageover/media.phtml</...>. If you have your module has a custom block class, you'll need to use your module's block class group. For more on class group notation, the factory method, etc, see Alan Storm's article on the Magento config.
Related
I have a minor bug/issue with my Magento site.
I've started to make a few group products, and all of the grouped product pages are broken.
It looks like 1 or both of the sidebars appear on the product page and "squeeze" the product info into the middle of the page.
I am using the "ultimo" theme.
Can anyone suggest how I can try and fix this myself?
I can probably fix it myself, if someone is able to point me to the correct file and suggest a code to fix.
Here is the example:
To me this page looks like it is set to the base template 3-columns rather than 2-columns-right.
Since you say it only happens with grouped products have a look in your layout xml files for the handle PRODUCT_TYPE_grouped then with this handle you will probably see something as follows.
<reference name="root">
<action method="setTemplate"><template>page/3columns</template></action>
</reference>
I guess it should be:
<reference name="root">
<action method="setTemplate"><template>page/2columns-right.phtml</template></action>
</reference>
I'm working on a module in magento admin where I would like to show the scope selector as in manage products, manage categories, system configuration for my grid edit form.
Can anyone help me how could I add that and store values in database specific to the scope selected?
By searching on the store switcher, you can see Magento adds it by adding it in the layout file:
<your_layout_handle_here>
<reference name="left">
<block type="adminhtml/store_switcher" name="store_switcher" template="store/switcher.phtml" />
</reference>
</your_layout_handle_here>
For not show the confirm alert add an action in this block as in a core
<block type="adminhtml/store_switcher" name="store_switcher" before="-">
<action method="setUseConfirm"><params>0</params></action>
</block>
I've been trying to figure this problem out for several hours now - I've made two page templates for the products one is named vxs-view.phtml and the other is view.phtml. There located in the same directory.
The solution I tried was to input
<reference name="product.info">
<action method="setTemplate"> <template>catalog/product/view/vxs-view.phtml</template></action>
</reference>
However this only works if that product is in a certain category. Is there a way I can add the pay layout to the template files in the design tab?
I've been adding this code to the front end system/custom design/ custom layout update box
Sorry I'm need to magento and still learning.
Thanks for any help
you are placing wrong reference type. Please try below code.
<module_page_action> <!- Enter your modulename_pagename_action e.g. catalog_product_info-->
<reference name="root">
<action method="setTemplate"> <template>catalog/product/view/vxs-view.phtml</template></action>
</reference>
<module_page_action>
Hope this will work for you!
Cheers!
i am following this howto to add a custom CMS page http://www.magentocommerce.com/wiki/4_-_themes_and_template_customization/0_-_theming_in_magento/adding_cms_layout_templates
the issue i am having is that i want to add a NivoSlider javascript just to this page and the only way to add it to the is to do it through the Admin -> CMS -> Pages and then change the Layout Update XML by adding the
<reference name="head">
<action method="addJs">
<script>nivo-slider/jquery.nivo.slider.js</script>
</action>
<action method="addCss">
<script>css/nivo-slider.css
</script></action>
</reference>
is there a way to add the javascript on the filesystem rather then through the Admin -> CMS -> Pages -> Page -> Layout Update XML interface?
any advise much appreciated
You can override page.xml in your layouts folder of your theme and add the script globally like,
<action method="addJs"><script>nivo-slider/jquery.nivo.slider.js</script></action>
You can just write the code directly to your CMS page in the backend as you would write it normally. You can just use <style></style> and/or <script></script> tags and write your CMS site specific code into it.
I made my own product list page based on Mage_Catalog_Block_Product_List:
app/code/local/Mage/Catalog/Block/Product/Special.php:
class Mage_Catalog_Block_Product_Special extends Mage_Catalog_Block_Product_List
{
/* Original contents */
/* Here I call addAttributeToFilter on product collection, and then... */
return $this->_productCollection;
}
I include this in a CMS page on the center column:
<reference name="content">
<block type="catalog/product_special" template="catalog/product/list.phtml" />
</reference>
The problem is: The product list shows up just fine, but I get no layered navigation in my left column.
This is quite strange, since I am using exactly the same template as normal listings.
A couple of things I have checked:
Mage_Catalog_Block_Product_Special just being a proxy class. This doesn't work. Even if I use block type "catalog/product_list" on my CMS page I will not get a layered navigation.
There are no extensions that are overriding crucial core classes.
I have also tried to create my own module and list it under for example 'mycatalog'. This results in exactly the same problem.
I have a feeling this has to do with trying to include a product listing on a CMS page but I have not been able to track down the exact problem.
Any help on this would be very much appreciated.
You need to add the Block that renders the Layers into the left column.
If you look in catalog.xml, you will see that the catalog_category_layered node includes the following:
<reference name="left">
<block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml"/>
...
</reference>
So, add that into your CMS xml layout update and that should display the Layer block on your CMS page.
If you have issues with the product list not being filtered when you click one of the filterable attributes, that is probably because the links rendered by the Layer_View Block assume that they are going to post back to a CategoryController, not a CmsController which will be rendering your CMS page. That may or may not be an issue, so report back here if it doesn't work and we can try to work through it.
Personally I would have a hidden category with all products in it and use a script to keep that updated to be all products. The script can be done with the API, slow yes, but it will work in a timely fashion for a certain level of SKU count.
layer navigation is include in category view.
You should include the part of navigation used by category, so try to insert
<reference name="left">
<block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/>
</reference>
before
<reference name="content">
I'm not sure but if it's doesn't works it should help you to understand the problem anyway
check the following pages ( they came across the same problem )
http://www.exploremagento.com/magento/some-custom-blocks-to-help-you-show-products.php
http://www.chilipepperdesign.com/2009/03/23/magento-how-to-list-all-the-products-in-a-single-category-in-a-sidebar-block