<?php echo $_item->getName() ?>its a site that provide source code of php,javascript,mysql,ajex,css,html for different kind of tasks. it help user to solved their problem related to programing and also provide solutions of joomla , wordpress,cubrcart,drupal problems.
Thursday, 19 July 2012
get custom option name in filter.phtml(layred navigation)
Labels:
custom option,
enterprise-it,
filter,
filter.phtml,
gaming,
kapil sharma,
lt,
magento,
php,
php echo,
sysadmin
Location:
Jaipur, Rajasthan, India
Friday, 27 April 2012
Add module in artical in joomla
To insert a module inside an article, use the {loadposition xx} command, as follows:
Create a module and set its position to any value that doesn’t conflict with an existing template position. You can type in the position value instead of selecting it from the drop-down list. For example, use the position myposition.
Assign the module to the Menu Items that contain the articles that you want the module to show in. You can also just assign the module to all Menu Items.
Edit the articles where you want this module to appear and insert the text {loadposition myposition} in the article at the place where you want the module.
Create a module and set its position to any value that doesn’t conflict with an existing template position. You can type in the position value instead of selecting it from the drop-down list. For example, use the position myposition.
Assign the module to the Menu Items that contain the articles that you want the module to show in. You can also just assign the module to all Menu Items.
Edit the articles where you want this module to appear and insert the text {loadposition myposition} in the article at the place where you want the module.
wysiwyg editor in Magento Custom Module
Step 1 – Go to app/code/local/Webkul/Faq/Block here webkul is
namespace and faq is module name , under your _prepareLayout() function
add this code
public function _prepareLayout()
{
if (Mage::getSingleton(‘cms/wysiwyg_config’)->isEnabled() && ($block = $this->getLayout()->getBlock(‘head’))) {
$block->setCanLoadTinyMce(true);
}
return parent::_prepareLayout();
}
Then go to app/code/local/Webkul/Faq/Block/Adminhtml/Faq/Edit/Tab
and add following code in your _prepareForm() function below your setform() . $this->setForm($form);
$wysiwygConfig = Mage::getSingleton(‘cms/wysiwyg_config’)->getConfig(array(‘add_variables’ => false, ‘add_widgets’ => false,’files_browser_window_url’=>$this->getBaseUrl().’admin/cms_wysiwyg_images/index/’));
then define this as $fieldset
$fieldset->addField(‘body’, ‘editor’, array(
‘name’ => ‘body’,
‘label’ => Mage::helper(‘faq’)->__(‘Content’),
‘title’ => Mage::helper(‘faq’)->__(‘Content’),
‘style’ => ‘width:700px; height:500px;’,
‘state’ => ‘html’,
‘config’ => $wysiwygConfig,
‘wysiwyg’ => true,
‘required’ => true,
));
This post is original on webkul
public function _prepareLayout()
{
if (Mage::getSingleton(‘cms/wysiwyg_config’)->isEnabled() && ($block = $this->getLayout()->getBlock(‘head’))) {
$block->setCanLoadTinyMce(true);
}
return parent::_prepareLayout();
}
Then go to app/code/local/Webkul/Faq/Block/Adminhtml/Faq/Edit/Tab
and add following code in your _prepareForm() function below your setform() . $this->setForm($form);
$wysiwygConfig = Mage::getSingleton(‘cms/wysiwyg_config’)->getConfig(array(‘add_variables’ => false, ‘add_widgets’ => false,’files_browser_window_url’=>$this->getBaseUrl().’admin/cms_wysiwyg_images/index/’));
then define this as $fieldset
$fieldset->addField(‘body’, ‘editor’, array(
‘name’ => ‘body’,
‘label’ => Mage::helper(‘faq’)->__(‘Content’),
‘title’ => Mage::helper(‘faq’)->__(‘Content’),
‘style’ => ‘width:700px; height:500px;’,
‘state’ => ‘html’,
‘config’ => $wysiwygConfig,
‘wysiwyg’ => true,
‘required’ => true,
));
This post is original on webkul
Friday, 6 April 2012
magento display attribute in dropdown
Create a attribute
and then
edit app/code/core/Mage/Catalog/Block/Navigation.php
public function getAllManu()
{
$product = Mage::getModel(‘catalog/product’);
$attributes = Mage::getResourceModel(‘eav/entity_attribute_collection’)
->setEntityTypeFilter($product->getResource()->getTypeId())
->addFieldToFilter(‘attribute_code’, ‘manufacturer’); //can be changed to any attribute
$attribute = $attributes->getFirstItem()->setEntity($product->getResource());
$manufacturers = $attribute->getSource()->getAllOptions(false);
return $manufacturers;
}
and then
edit app/design/frontend/default/default/template/catalog/navigation/top.phtml
and then
edit app/code/core/Mage/Catalog/Block/Navigation.php
public function getAllManu()
{
$product = Mage::getModel(‘catalog/product’);
$attributes = Mage::getResourceModel(‘eav/entity_attribute_collection’)
->setEntityTypeFilter($product->getResource()->getTypeId())
->addFieldToFilter(‘attribute_code’, ‘manufacturer’); //can be changed to any attribute
$attribute = $attributes->getFirstItem()->setEntity($product->getResource());
$manufacturers = $attribute->getSource()->getAllOptions(false);
return $manufacturers;
}
and then
edit app/design/frontend/default/default/template/catalog/navigation/top.phtml
- <select id=“select-manufacturer” onchange=“window.location.href=this.value”>
- <option value=“#” selected=“selected”>–Select Manufacturer–</option>
- <?php foreach ($this->getAllManu() as $manufacturer): ?>
- <option value=“/catalogsearch/advanced/result/?manufacturer[]=<?php echo $manufacturer['value'] ?>”><?php echo $manufacturer['label'] ?></option>
- <?php endforeach; ?>
- </select>
captcha (alpha numeric) in php
<?php
$RandomStr = md5(microtime());// md5 to generate the random string
$ResultStr = substr($RandomStr,0,8);
$im = @imagecreate(110, 20)
or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 0, 0, 0);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, $RandomStr, $text_color);
imagejpeg($im,$ResultStr.'.jpg');
imagedestroy($im);
//echo '’.$randval.”;
?>
$RandomStr = md5(microtime());// md5 to generate the random string
$ResultStr = substr($RandomStr,0,8);
$im = @imagecreate(110, 20)
or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 0, 0, 0);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, $RandomStr, $text_color);
imagejpeg($im,$ResultStr.'.jpg');
imagedestroy($im);
//echo '’.$randval.”;
?>
Subscribe to:
Posts (Atom)