magento custom layout update - php

Does anybody know how I can call a stylesheet from my skin folder rather than it trying to point to my base path? I currently have
<reference name="head">
<action method="addCss">
<stylesheet>yourtheme/css/red.css</stylesheet>
<params>media="screen"</params>
</action>
</reference>

It's ok I'm cracking up, it's cause the css file wasn't in my skin folder - I was just looking at the view source, obviously if it doesn't find the file it defaults to the base path- doh!

Related

Left sidebar appearing on grouped product page

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>

Magento Cart Template Update Not work when first visit a page

I want to override the exist cart template since I add some module in it. I use the XML below to update the layout.
<checkout_cart_index>
<reference name="checkout.cart">
<action method="setCartTemplate">
<value>magefd/shipandpay/checkout/cart.phtml</value>
</action>
<action method="setEmptyTemplate">
<value>checkout/cart/noItems.phtml</value>
</action>
<action method="chooseTemplate"/>
<block type="fdshipandpay/checkout_cart_fee" name="magefd.shipandpay.cart.fee"
as="fee" template="magefd/shipandpay/checkout/cart/fee.phtml" />
</reference>
</checkout_cart_index>
However, the original template will be used when a new user visit the cart at first time. After they refresh, it work perfect. After session time out if the user refresh it, the same problem comes out. I don't know how it happened. Any one can help?
Just copy your .phtml file to all templates directories..eg, Default, and Base theme..Clean cache and try again..

Making a new page template for a different product page

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!

magento custom CMS page add javascript

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.

Magento List Layout XML

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.

Categories