Sales Order View in Admin panel
This is the layout.xml
<layout>
<adminhtml_sales_order_view>
<reference name="order_tab_info">
<block type="booking/sales_order_view_reservationbooking" name="reservationbooking" template="booking/sales/order/view/reservationbooking.phtml" />
</reference>
</adminhtml_sales_order_view>
This is the block in my module
<?php
class Actino_Booking_Block_Adminhtml_Sales_Order_View_Reservationbooking extends Mage_Core_Block_Template {
}
Here is my explanation about what i want to achieve
In core adminhtml i edited the sales/order/view/info.phtml.. I know that Never edit the core files, but this is only for test for which i want to display my template around the orders view. and then if this works I should have to create or rewrite the info.phtml.
here is my custom reservationbooking.phtml
and in info.phtml i write a code to view this layout
<?php echo $this->getChildHtml('reservationbooking');?>
This is not working. I cant see the text "reservation booking data" in sales order view. without modifying any core files ?
My question is how to add custom field in sales order view ?
Once a try
<adminhtml_sales_order_view>
<reference name="order_info">
<action method="setTemplate">
<template>yourmodule/sales/order/view/reservationbooking.phtml</template>
</action>
</reference>
</adminhtml_sales_order_view>
Create a file in the following
app/design/adminhtml/default/default/template/yourmodule/sales/order/view/reservationbooking.phtml
Now you can add your stuff to the reservationbooking.phtml inside your module, without change the core files
Related
I'm using the Catalog Permissions extension by aheadWorks to hide pricing for customers who are not logged in. However, I need to be able to hide the tier pricing as well. What would the PHP code be for this and what file would I put it in?
Tier pricing is great, but you don’t want to display every price to every customer. To show tiered pricing to logged in visitors only, go to: app/design/frontend/default/default/template/catalog/product/view/tierprices.phtml
On this file, add this PHP function
<?php if(Mage::getSingleton('customer/session')->isLoggedIn()):
The above function should be added before the following piece of code
<?php if (count($_tierPrices) > 0): ?>
Then add this code at the end.
<?php endif; ?>
Create your own layout file and inside set your own template file with the required condition.
<catalog_product_view>
<reference name="core_reference_name">
<action method="setTemplate">
<template>yournamespace/catalog/product/view.phtml</template>
</action>
</reference>
</catalog_product_view>
Hide price on Category list page, Product view page, and Compare pop up.
Override the default Magento files by basic module.
Create folder and file for basic module Hideproductprice
app/etc/modules/Hideproductprice_Hideproductprice.xml
app/code/local/Hideproductprice/Hideproductprice/controllers/IndexController.php
app/code/local/Hideproductprice/Hideproductprice/etc/config.xml
app/code/local/Hideproductprice/Hideproductprice/Block/Index.php
app/design/frontend/base/default/layout/hideproductprice.xml
app/design/frontend/base/default/template/hideproductprice/price.phtml
1: add the following code your custom module layout file
(app/design/frontend/base/default/layout/hideproductprice.xml)
<default>
<reference name="catalog_product_price_template">
<action method="addPriceBlockType"><type>simple</type><block>catalog/product_price</block><template>hideproductprice/price.phtml</template></action>
<action method="addPriceBlockType"><type>grouped</type><block>catalog/product_price</block><template>hideproductprice/price.phtml</template></action>
<action method="addPriceBlockType"><type>configurable</type><block>catalog/product_price</block><template>hideproductprice/price.phtml</template></action>
<action method="addPriceBlockType"><type>virtual</type><block>catalog/product_price</block><template>hideproductprice/price.phtml</template></action>
<action method="addPriceBlockType"><type>bundled</type><block>catalog/product_price</block><template>hideproductprice/price.phtml</template></action>
</reference>
</default>
2: Then copy the default 'price.phtml' and place it in the specified location (in our case 'hideproductprice/price.phtml'). And the place the following code on top of it.
<?php
if(!Mage::getSingleton('customer/session')->isLoggedIn()){
echo '<span class="login_for_price"><b>Login to See Price</b></span><br>';
return;
}
?>
Mage_Adminhtml_Block_Orders_Grid
/* adding customer name section */
$customerFirstNameAttr = Mage::getSingleton('customer/customer')->getResource()->getAttribute('firstname');
$collection->getSelect()
->joinLeft(
array('cusFirstnameTb' => $customerFirstNameAttr->getBackend()->getTable()),
'main_table.customer_id = cusFirstnameTb.entity_id AND cusFirstnameTb.attribute_id = '.$customerFirstNameAttr->getId(). ' AND cusFirstnameTb.entity_type_id = '.Mage::getSingleton('customer/customer')->getResource()->getTypeId(),
array('customer_name' =>'cusFirstnameTb.value')
);
/* end adding customer name section */
I'm trying to remove "recently viewed" from the home page, but I don't know where the block is called. I tried to delete reports.xml but the block stayed there. Then I tried to delete all the code in home_product_viewed.phtml and it worked, but I don't want to delete the code. I only want to delete the call to that file but I don't know where that file is called.
Goto magento backend.
Select the CMS page for homepage.
In the Design section add the below code in the Layout Update XML field
<reference name="right">
<action method="unsetChild"><alias>right.reports.product.viewed</alias></action>
</reference>
To remove it from only the home page, I would do this. Go to your /app/design/frontend/packagename/themename/layout/local.xml
and edit it like this:
<layout>
<cms_index_index>
<remove name="right.reports.product.viewed" />
</cms_index_index>
</layout>
To verify your packagname and themename, go in to admin - System - Configuration - Design.
There may already be other code inside of the layout tag which you should leave there!
This worked for me -> Using left below not right.reports.product.viewed.
Custom Layout Update
<reference name="right">
<action method="unsetChild"><alias>left.reports.product.viewed</alias></action>
</reference>
Im trying to load an file sales/guest/form.phtml for added tab left navigation tab on customer my account, via customer.xml but didn't kindly help me.
Refund
I have done somewhat similar in my old project. here is what i do :
Added a new link in My Account section from customers.xml i.e
<action method="addLink" translate="label" module="preorder"><name>Previous_Orders</name><path>preorder/index/</path><label>Previous Orders</label></action>
In your case you can use an already running module instead of preorder and change the name in above action.
In module/contollers/IndexController.php add a view as follows :
public function viewAction()
{
$this->loadLayout();
$this->renderLayout();
}
Add preorder/preorder.phtml template folder in your theme template folder.
in your theme layout folder add preorder.xml as follows:
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
</default>
<preorder_index_index>
<label>Customer My Account Previous Orders</label>
<update handle="customer_account"/>
<reference name="content">
<block type="preorder/preorder" name="preorder" template="preorder/preorder.phtml" />
</reference>
</preorder_index_index>
</layout>
Hope you ot the idea, what we have done is created a new module which loads the template on index action, you cn change the name of module "preorder" and also the action "index" while working on this.
I was very brief while writing this, Hope this helps you in someway.
I am developing a new custom module in magento. I need to customize the shopping cart page without affecting the original cart.phtml. My module name is Stallioni. I have placed the cart.phtml inside frontend/default/default/template/stallioni/checkout/cart.phtml .How can i use this cart.phtml in my new module instead of the original . I know we should change something in checkout.XML or stallioni/layout/stallioni.xml file. But no idea since i am new.I googled out a day but couldn't find.
http://blog.chapagain.com.np/magento-overriding-template-file-from-custom-module/ this link tells something but it didn't worked for me.I need your help!
If your layout.xml is working add this code in your layout
`<checkout_cart_index>
<reference name="content">
<reference name="checkout.cart">
<action method="setTemplate">
<template>default/default/template/stallioni/checkout/cart.phtml</template>
</action>
</reference>
</reference>
</checkout_cart_index>`
It should work :)
I am doing a magento customaization site, I need to add the products addtional attributes like it's type,version etc .I am new to magento , How can i add the new custom block to product details page. I have created a module , and i am using below coding.
app\code\local\SmartGrowth\CompatibleWith\Block\compatible.php
class SmartGrowth_CompatibleWith_Block_CompatibleWith extends Mage_Catalog_Block_Product_View
{
protected function _prepareLayout()
{
//$this->getProduct()->setName($this->getProduct()->getPrice());
$this->getProduct()->setName($this->getProduct()->getShortDescription());
parent::_prepareLayout();
}
}
I have used the below coding in _prepareLayout() but it seem to be repeat the block 5 times and the location of the block appeared is a probs
$block = $this->getLayout()->createBlock(
'Mage_Core_Block_Template',
'my_block_name_here',
array('template' => 'catalog/product/compatiblewith.phtml')
);
$this->getLayout()->getBlock('content')->append($block);
Please help how can i do this , I am new to magento , Any help will be appreciated.
There's no need to add the block in code, it should be done using config XML files.
Create an XML config for your module (plenty of tutorials on this).
check catalog.xml (app/design/frontend/base/default/layout/)
<catalog_product_view translate="label">
....
</catalog_product_view>
This is where the blocks are setup for display on the product view page. You can modify this using your own modules XML file, something like this:
<catalog_product_view translate="label">
<reference name="content">
<block type="compatiblewith/compatible" name="my.block" template="compatiblewith/compatible/template.phtml" />
</reference>
</catalog_product_view>
this will show your custom block on the product view page, inside the content area.
You also have an error with the naming of your block if it's called Compatible.php the class should be SmartGrowth_CompatibleWith_Block_Compatible
You can add custom template in product-shop (css class name for the section beside product image) below the Quick View area without modifying core files. in your module's layout file add this code for the required result (do replace "module" "block" with your actual module and block names):
<catalog_product_view>
<reference name="content">
<reference name="product.info">
<block type="module/block" name="module_block" as="other" template="module/block.phtml"/>
</reference>
</reference>
</catalog_product_view>
the target for custom block used is "other" which is a child html provided by default in view.phtml(/app/design/frontend/base/default/template/catalog/product/view.phtml) of magento.
Hopes it'll help.