$customer_regionid=Mage::getSingleton('checkout/session')->getQuote()->getBillingAddress()->getRegionId();
Friday, 11 July 2014
Sunday, 1 June 2014
Magento: Get Bundled Items By Bundle Product
<?php foreach ($collection as $_product){ ?>
$bundleIds = Mage::getResourceSingleton('bundle/selection')->getParentIdsByChild($productId);
/*************************Bundled product id*******************************/
$parentid=$bundleIds[0];
$_newProduct = Mage::getModel('catalog/product')->load($parentid);
} ?>
$bundleIds = Mage::getResourceSingleton('bundle/selection')->getParentIdsByChild($productId);
/*************************Bundled product id*******************************/
$parentid=$bundleIds[0];
$_newProduct = Mage::getModel('catalog/product')->load($parentid);
} ?>
Wednesday, 28 May 2014
Remove or rename add new save continue delete button from magento admin
If you don’t want to show the ‘Add New’ button in the Grid. The Add New button is present in top right corner of Grid Page.
Rename ‘Add New’ button
Here are the steps to rename the ‘Add New’ text to anything you required (for example, ‘Add Report’):-
- Go to YourNamespace -> YourModule -> Block -> Adminhtml -> YourFile.php
- Add the following code in the constructor of this file:-
$this->_addButtonLabel = Mage::helper('yourmodulename')->__('Add Report');
Remove ‘Add New’ button
Here are the steps to remove the ‘Add New’ button:-
- Go to YourNamespace -> YourModule -> Block -> Adminhtml -> YourFile.php
- Add the following code in the constructor of this file (it should be just below the call to parent constructor):-
parent::__construct();
$this->_removeButton('add');
In edit.php
parent::__construct();
$this->_removeButton('delete');
$this->_removeButton('save');
$this->_removeButton('back');
in grid.php
parent::__construct();
$this->_removeButton('add');
Tuesday, 20 May 2014
Server front issues
<FilesMatch "\.(ttf|otf|eot|woff)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
LInk:-http://red-team-design.com/firefox-doesnt-allow-cross-domain-fonts-by-default/
Monday, 19 May 2014
way to display a thumbnail image in the admin grid view?
Step 1
======================================
Create Directories (if NOT there)
app/code/local/<Mycomapname>/<Mymodule>/Block/Adminhtml/Grid/
app/code/local/<Mycomapname>/<Mymodule>/Block/Adminhtml/Grid/Renderer/
Step 2
======================================
Create a file named “Image.php” at the following location
app/code/local/<Mycomapname>/<Mymodule>/Block/Adminhtml/Grid/Renderer/
Step 3
======================================
Paste the following code into “Image.php” created above
}
======================================
Create Directories (if NOT there)
app/code/local/<Mycomapname>/<Mymodule>/Block/Adminhtml/Grid/
app/code/local/<Mycomapname>/<Mymodule>/Block/Adminhtml/Grid/Renderer/
Step 2
======================================
Create a file named “Image.php” at the following location
app/code/local/<Mycomapname>/<Mymodule>/Block/Adminhtml/Grid/Renderer/
Step 3
======================================
Paste the following code into “Image.php” created above
class <Mycomapname>_<Mymodule>_Block_Adminhtml_Grid_Renderer_Image extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
public function render(Varien_Object $row)
{
if($row->getData($this->getColumn()->getIndex())==""){
return "";
}
else{
$html = '<img ';
$html .= 'id="' . $this->getColumn()->getId() . '" ';
$html .= 'width="45" ';
$html .= 'height="35" ';
$html .= 'src="' . Mage::getBaseUrl("media") . $row->getData($this->getColumn()->getIndex()) . '"';
$html .= 'class="grid-image ' . $this->getColumn()->getInlineCss() . '"/>';
return $html;
}
}You do not need to overwrite any thing at all, just follow these simple steps instead Step 1 ====================================== Create Directories (if NOT there) app/code/local/<Mycomapname>/<Mymodule>/Block/Adminhtml/Grid/ app/code/local/<Mycomapname>/<Mymodule>/Block/Adminhtml/Grid/Renderer/ Step 2 ====================================== Create a file named “Image.php” at the following location app/code/local/<Mycomapname>/<Mymodule>/Block/Adminhtml/Grid/Renderer/ Step 3 ====================================== Paste the following code into “Image.php” created above
class <Mycomapname>_<Mymodule>_Block_Adminhtml_Grid_Renderer_Image extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_AbstractStep 4 ====================================== Open app/code/local/<Mycomapname>/<Mymodule>/Block/Adminhtml/<Mymodule>/Grid.php and paste the following code into the function protected function _prepareColumns() some where
$this->addColumn('<Tbl_Colname>', array(===================================================================
| ||
Wednesday, 23 April 2014
Get Option Value by ID in Magento
<?php
$productModel = Mage::getModel('catalog/product');
$attr = $productModel->getResource()->getAttribute("manufacturer");
if ($attr->usesSource()) {
echo $color_label = $attr->getSource()->getOptionText(45);
}
?>
Note:- manufacturer (product attribute code)
45 ==> (option value id)
$productModel = Mage::getModel('catalog/product');
$attr = $productModel->getResource()->getAttribute("manufacturer");
if ($attr->usesSource()) {
echo $color_label = $attr->getSource()->getOptionText(45);
}
?>
Note:- manufacturer (product attribute code)
45 ==> (option value id)
Thursday, 17 April 2014
Magento Currency Symbol 404's when i go to admin
/app/code/core/Mage/CurrencySymbol/etc/config.xml
<currencysymbol>Mage_CurrencySymbol_Adminhtml</currencysymbol>
Change to
<currencysymbol before="Mage_Adminhtml">Mage_CurrencySymbol_Adminhtml</currencysymbol>
<currencysymbol>Mage_CurrencySymbol_Adminhtml</currencysymbol>
Change to
<currencysymbol before="Mage_Adminhtml">Mage_CurrencySymbol_Adminhtml</currencysymbol>
Subscribe to:
Posts (Atom)