Magento if tax is not included on configurable product

Posted on Updated on

if tax are not included on configurable product, You have to check following attributes if query does not include them itself.


$products = Mage::getResourceModel(‘catalog/product_collection’);
$products->addAttributeToFilter(‘type_id’, array(‘eq’ => ‘configurable’));
$products->addAttributeToFilter(‘status’, 1);
$products->addAttributeToFilter(‘visibility’, 4);

foreach ($products as $product) {
$currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();

//Original Price with Tax
echo number_format(Mage::helper(‘tax’)->getPrice($product, $product->getPrice()),2, ‘.’, ”).$currency_code;

//Special Price with Tax
$product_data[‘sale_price’] = number_format(Mage::helper(‘tax’)->getPrice($product, $product->getSpecialPrice()),2, ‘.’, ”).$currency_code;


Remove specific folders and files from ubuntu trash

Posted on Updated on

sudo rm -r /home/username/.local/share/Trash/foldernametoremove/your folder name or file


Remove all in Trash

sudo rm -r /home/udana/.local/share/Trash/files/*

Create a Product Attribute and Select Options in Magento

Posted on

1. Create a Setup file in your module.

2. Add attribute and options as follows. You can remove the attribute from remove codes as follows

$installer = $this;
$setup = new Mage_Eav_Model_Entity_Setup(‘core_setup’);

//Create Attribute
$installer->addAttribute(‘catalog_product’, ‘basic_color’, array(
‘group’             => ‘General’,
‘type’              => ‘text’,
‘backend’           => ”,
‘frontend’          => ”,
‘label’             => ‘Basic Color’,
‘input’             => ‘select’,
‘class’             => ”,
‘source’            => ”,
‘global’            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
‘visible’           => true,
‘required’          => false,
‘user_defined’      => false,
‘default’           => ”,
‘searchable’        => false,
‘filterable’        => false,
‘comparable’        => false,
‘visible_on_front’  => false,
‘unique’            => false,
‘apply_to’          => ”,
‘is_configurable’   => false,
‘used_in_product_listing’ => true,
‘sort_order’        => 500,

//Add initial basic color options
$initialOptions = array(‘black’,’blue’,’green’,’red’,’grey’,’white’,’rose’,’yellow’,’purple’);
$entityTypeId     = $installer->getEntityTypeId(‘catalog_product’);
$code =’basic_color’;
$attributeId = Mage::getSingleton(‘eav/config’)->getAttribute(‘catalog_product’, ‘basic_color’)->getId();
foreach($initialOptions as $k=>$v){
‘attribute_id’ => $attributeId,
‘order’ => array($k),
‘value’ => array(array($v)


//$setup = new Mage_Eav_Model_Entity_Setup(‘core_setup’);
//$setup->removeAttribute( ‘catalog_product’, ‘basic_color’ );


Get date in Magento way

Posted on

Friday 14th of June 2013 06:29:10 PM

Following will be given the above format of date

Mage::getModel(‘core/date’)->date(‘l jS \of F Y h:i:s A’);

Get the stock status of Magento Configurable Product

Posted on Updated on

Here is a way you can get the stock status of Magento Configurable Products collection.

$products = Mage::getResourceModel(‘catalog/product_collection’);
$products->addAttributeToFilter(‘type_id’, array(‘eq’ => ‘configurable’));
$products->addAttributeToFilter(‘status’, 1);
$products->addAttributeToFilter(‘visibility’, 4);

foreach ($products as $product) {
$stockStatus = Mage::getModel(‘cataloginventory/stock_item’) ->loadByProduct($product)->getIsInStock();
print ($stockStatus);

Magento – How to create a your own dropdown for system configuration

Posted on Updated on

We can use our own system configurations in magento. Creating a drop down on our own manageable way of code will be benefited. Followings are the steps you could follow. This is only the way of magento. There are other methods too

1. Create your own module or use your existing module and Create a system configuration file
2. Add system configuration as follows

<sample_config_select translate=”label”>
<label>sample label</label>
<tooltip>adds select</tooltip>

3. create options. we follow the way of magento structure or use your own.

class YourPackage_Module_Model_Sample

public function toOptionArray()
return array(
array(‘value’ => 0, ‘label’ => Mage::helper(‘adminhtml’)->__(‘select option 1’)),
array(‘value’ => 1, ‘label’ => Mage::helper(‘adminhtml’)->__(select option 2′)));


4. See the Configuration in Admin

Sending Emails with Zend_Mail and Yahoo! SMTP

Posted on Updated on

When developers are trying to test emails with popular email service providers from the local server environments, it does not allow to send emails since they try to impose restrictions on spamming. Followings can be used to test email contact forms with Zend Framework and its mail function. It is tested and worked fine with yahoo SMTP settings but on zend framework. Here the trick was setting from email as same as the authenticated email address.

//values from  zend form elements
$sender = $form->getValue(‘name’);
$email = $form ->getValue(’email’);
$subject = $form ->getValue(‘subject’);
$message = $form ->getValue(‘message’);

$mail = new Zend_Mail();
$config = array(‘auth’ => ‘login’,’username’ => ‘’,’password’ => ‘your_password’);
$transport = new Zend_Mail_Transport_Smtp(‘’, $config);

$mail->setFrom(‘’, $sender); //should be the same email used for config
$mail->setReplyTo($email, $sender);
$mail->addTo(‘ ‘, ‘webmaster’);
$mail->setBodyHtml(’email body text in html’);
$mail->setBodyText(’email body text in text’);


cheers! 🙂