change custom product tab position in admin grid Magento - magento

Hi i have added a new product tab in admin grid by following the below link
http://inchoo.net/magento/how-to-add-custom-product-relations-in-magento/
Everything is working fine. BUt this has added the new tab at the last position in product edit section. Can you please suggest me how can i change the position of that tab.
thanks

You can use the action addTabAfter instead of addTab, then you have to specify the <after> parameter (categories, websites, upsell...).
I edited the code of your tutorial for example:
<reference name="product_tabs">
<action method="addTabAfter">
<name>custom</name>
<block>inchoo_customlinkedproducts/adminhtml_catalog_product_edit_tab</block>
<after>upsell</after>
</action>
</reference>
I hope this is fexible enough for you.

after searching a lot i have not got any default solution to change the custom tab position so i have decided to go with JavaScript.
I manage to do this with the below code
in my module file i have loaded a custom JavaScript file with the below code on product edit action and product create action
<adminhtml_catalog_product_edit>
<reference name="head">
<action method="addJs">
<script>jsoveride/accesorytab.js</script>
</action>
</reference>
</adminhtml_catalog_product_edit>
<adminhtml_catalog_product_new>
<reference name="head">
<action method="addJs">
<script>jsoveride/accesorytab.js</script>
</action>
</reference>
</adminhtml_catalog_product_new>
and in the i have use the below code
document.observe("dom:loaded", function() {
document.getElementById("product_info_tabs_crosssell").appendChild(document.getElementById("product_info_tabs_custom"));
});
and it has done my work.
If anybody gets better solution please let me know.
thanks

Related

overriding cart.phtml issue not working for notitems.phtml

Hello i working on overriding the cart.phtml and it is working fine. but the problem is that when no item left in the cart still the it showing the cart table header and footer section without any item. i want when no item is present in the cart then it will show the noitem.phtml content as it is working for default magetno functionality.
i have check many things but not working . i have update my layout.xml but not effect any thing.
My layout.xml
<layout version="0.1.0">
<checkout_cart_index>
<reference name="checkout.cart">
<action method="setTemplate"><template>itemdeletion/cart.phtml</template></action>
<action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>itemdeletion/cart/item/default.phtml</template></action>
<action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>itemdeletion/cart/item/default.phtml</template></action>
<action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>itemdeletion/cart/item/default.phtml</template></action>
</reference>
</checkout_cart_index>
</layout>
it is working for cart items but i make few more R & D and try to figure out how i can make it but i have get to add below blocks in xml
<action method="setEmptyTemplate"><value>itemdeletion/cart/noItems.phtml</value></action>
<action method="chooseTemplate"/>
but still it not working. Please help me out in this.
Thanks in advance

Hide discount code section in cart

I am writing a Magento Extension that is trying to hide the Discount Code section on the checkout cart page. I wrote the following code to replace the current cart.phtml with my custom template.
<layout version="0.1.0">
<checkout_cart_index>
<reference name="checkout.cart">
<action method="setTemplate">
<template>company/module/cart.phtml</template>
</action>
</reference>
</checkout_cart_index>
</layout>
Everything looked good until I realized it even overwrote the template the cart page uses for an empty cart. I have tried many combinations for switch the "checkout_cart_index"
name to the reference name but I cannot get it to just replace that template. I further investigated and found in the default layout it sets the cart values here:
<reference name="content">
<block type="checkout/cart" name="checkout.cart">
<action method="setCartTemplate"><value>checkout/cart.phtml</value></action>
<action method="setEmptyTemplate"><value>checkout/cart/noItems.phtml</value></action>
I tried again using "SetCartTemplate" but I cannot get it to display yet alone behave as I am intending. Any ideas?
In your layout update
<checkout_cart_index>
<reference name="checkout.cart">
<action method="setCartTemplate"><value>path/to/your/cart.phtml</value></action>
<action method="setEmptyTemplate"><value>path/to/your/noItems.phtml</value></action>
<action method="chooseTemplate"/>
</reference>
</checkout_cart_index>
chooseTemplate will choose the right template
Try to Rewrite this core class to hide the discount code section in your cart page
Mage_Sales_Model_Quote_Address_Total_Discount

How do I add the recently viewed products box to the homepage?

It is a totally easy problem, but Im not able to solve it.
I tried the following:
add layout xml to the update layout field in the backend for this cms page:
<reference name="right">
<block type="reports/product_viewed" before="right.permanent.callout" name="right.reports.product.viewed" template="reports/product_viewed.phtml" />
</reference>
or the same in the local.xml
<cms_index_index>
<reference name="right">
<block type="reports/product_viewed" before="right.permanent.callout" name="right.reports.product.viewed" template="reports/product_viewed.phtml" />
</reference>
</cms_index_index>
Thanks a lot, I know its not complicated, but I cant get it.
Here is some checks:
Check if your page is using two-column-right or three-column layout.
Clearing cache
Add your layout update to cms.xml directly and clearing cache.
Hope this help
You might have missed to echo the block in the custom home page template file?
echo $this->getChildHtml('right.reports.product.viewed');
Or may be your home page is using 2-template left or other templates where there is no 'right' content block.

Magento - changes to template file not showing up - /customer/form/register.phml

I'm making some changes to /customer/form/register.phml but they are not showing up in the frontend. Changes that I made to login.phtml and forgotpassword.phtml do show up.
I checked if magento was using a fallback from the base/default theme but it's not. I deleted register.phtml in both my theme and in the base/default theme to check what would happen: the page showed up just fine (without the changes of course).
I looks like magento gets the file from somewhere else (maybe the core). I've got no idea on how to solve this.
Thanks in advance for your help.
My Customer.xml file looks like this, I'm using magento 1.5.1
<customer_account_create translate="label">
<label>Customer Account Registration Form</label>
<remove name="right"/>
<remove name="left"/>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<reference name="content">
<block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml">
<block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" translate="label">
<label>Form Fields Before</label>
</block>
</block>
</reference>
</customer_account_create>
The best way to debug this - is to turn on template path hints.
You probably need to edit template/persistent/customer/form/register.phtml.
Yes i agree with WebFlake turn on template hints that will let you know which template file the form is being pulled from, most likely you are modifying the wrong template.
Here is a link which explains how to turn on template hints: http://vimeo.com/1067069
Use the template hints. Also, with any phtml changes you make, make sure that you have caching disabled, and flush all caches (System -> Cache Management).
I used template hints and discovered a plugin replaced the file. Enabling template hints: http://vimeo.com/1067069 helped a lot

ColorBox integration in Magento

I want to add ColorBox jQuery in my Magento website. Is there an specific method for this?
Or do I have to make the changes in .phtml files?
To add new javascript library on all your pages use layouts. Create new layout file yourmodule.xml and put there code
<default>
<reference name="head">
<action method="addItem"><type>skin_js</type><name>js/colorbox.js</name><params/></action>
<action method="addItem"><type>skin_css</type><name>js/colorbox.css</name></action>
</reference>
</default>

Resources