Friday, December 10, 2010

Adding TInyMCE Editor in Magento Custom Module

I've created an custom module from module creator but i couldnot displayed tinymce wysiwyg editor in admin page ?

though modulecreator guys has added default field of "content" for editor:

$fieldset->addField('contentdesc', 'editor', array(
'name' => 'contentdesc',
'label' => Mage::helper('getthelooks')->__('Description'),
'title' => Mage::helper('getthelooks')->__('Description'),
'style' => 'width:500px; height:300px;',
'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(),
'wysiwyg' => true,
'required' => true,
));

but even i change wysiwyg to true it didnt worked. module creator has forgot that to enable wysiwyg we also needed js for that

so here is complete simple layout xml file :





1










js_cssprototype/windows/themes/default.css
js_cssprototype/windows/themes/magento.css










change getthelooks to your custom module name and enjoy!

Product grid Magento

$this->getLayout()->createBlock('adminhtml/catalog_product_grid', 'product.grid')->toHtml()

GET ATTRIBUTE VALUE MAGENTO

if($_product->getResource()->getAttribute('webexcusive')->getFrontend()->getValue($_product) == 'Yes') {

Tuesday, December 7, 2010

Magento Print your Static BLOCK

getLayout()->createBlock('cms/block')->setBlockId('BLOCK IDENTIFIER')->toHtml() ?>

Friday, December 3, 2010

static block in categories view magento

Display Any static Block of magento

$this->getLayout()->createBlock('cms/block')->setBlockId('YOUR BLOCK NAME')->toHtml()

categories view and product listin after particular cat level with quickview product details







$_helper = $this->helper('catalog/output');
$_category = $this->getCurrentCategory();
$cat = Mage::getModel('catalog/category')->load($_category->getId());
$subcats = $cat->getChildren();
$subcat= explode(',',$subcats);
$_columnCount=3;
$_collectionSize = count($subcat);

$catlevel=$_category->getLevel();
// $_category->setDisplayMode('PAGE');


if($subcats!="" && $catlevel<4){>




{
$_subcategory = Mage::getModel('catalog/category')->load($subCatid);
if($_subcategory->getIsActive())
{
$caturl = $_subcategory->getURL();
$this_current_category = Mage::registry('current_category');
$parentCategory = Mage::getModel('catalog/category')->load($_category->getParentId());
$products = Mage::getResourceModel('catalog/product_collection')->addCategoryFilter($_subcategory)->addAttributeToSelect('*');
?>










}
}
?>

elf Cosmetics

getImageUrl()):?>
" title="getName(); ?>">getImageUrl()?>" width="193" height="129">

" title="getName(); ?>">/skin/frontend/base/default/images/catalog/product/placeholder/small_image.jpg">



$subcats1 = $_subcategory->getChildren();
$subcat1= explode(',',$subcats1);
if($subcats1!=""){
foreach($subcat1 as $subCatid1) {
$_subcategory1 = Mage::getModel('catalog/category')->load($subCatid1);
?>
getURL()?>">getName()?>





}
else
{ //product display

$cat = Mage::getModel('catalog/category')->load($_category->getId());
$subcats = $cat->getChildren();
$subcat= explode(',',$subcats);
foreach($subcat as $subCatid){
$_subcategory = Mage::getModel('catalog/category')->load($subCatid);
if($_subcategory->getIsActive())
{
//Mage::register('current_category', $_subcategory);
echo '
'. $_subcategory->getName().'
';
$collection = $_subcategory->getProductCollection();

$products = Mage::getResourceModel('catalog/product_collection')->addCategoryFilter($_subcategory)->addAttributeToFilter('visibility', 4)->addAttributeToSelect('*');
$products->getSelect()->order(new Zend_Db_Expr('RAND()'))->limit(3);
$products->load();
$_product = null;

////////////////////////////////////////////////
?>
count()): ?>

__('There are no products matching the selection.') ?>






count() ?>












elf Cosmetics
getId()?>);" onmouseover="show_sp_button(getId()?>);" class="depttitle dept_box">







$script='



////////////////////////////////////////////////
}
}

?>

$script.="";
echo $script;
?>

}
?>



Product collection magento

Get product list of any categories with "not visible individually" filter

Limit product listing to 3 only


$products = Mage::getResourceModel('catalog/product_collection')->addCategoryFilter($_subcategory)->addAttributeToFilter('visibility', 4)->addAttributeToSelect('*');

$products->getSelect()->order(new Zend_Db_Expr('RAND()'))->limit(3);
$products->load();