Friday, March 16, 2012

Magento Bulk Update Product Description MySQL


bulk update product description before check the attribute_id in magento_eav_attribute
should be the same :)

check....
SELECT * FROM `magento_eav_attribute` where attribute_id = 66

btw i am using Magento Community Edition 1.6.2

UPDATE `magento_catalog_product_entity_text
SET value =  'this guide only and not necessarily of the 
exact size and may differ in features.' 
WHERE attribute_id =66





Thursday, March 15, 2012

Magento get Product SKU and custom attributes in Product View



Template File: A:\xampp\htdocs\gs\app\design\frontend\default\grayscale\template\catalog\product\view\attributes.phtml


what i have done is in the Product View

i am only showing attributes not equal to 'NO' or greater than zero

and added $_product->getData('range');  to get the custom attributes

and $_product->getSku('sku'); to get the sku value

refer the code file app\code\core\Mage\Catalog\Model\Product.php there are more functions you can use there


















    

Monday, March 12, 2012

Yii Multi Select

http://www.yiiframework.com/extension/multiselect/











Installation download http://www.yiiframework.com/extension/multiselect/files/multiselect.zip
and extract to extensions folder
























/**
 * JMultiSelect class file.
 *
 * PHP Version 5.1
 *
 * @package  Widget
 * @author   Segoddnja
 * @license  http://www.opensource.org/licenses/mit-license.php MIT
 * @since    1.0
 */

Yii::import('zii.widgets.jui.CJuiInputWidget');

/**
 * JMultiSelect displays a multiselect.
 *
 * JMultiSelect encapsulates the {@link http://abeautifulsite.net/blog/2008/04/jquery-multiselect/
 * jQuery MultiSelect} plugin.
 *
 * To use this widget, you may insert the following code in a view:
 *

 * $this->widget('zii.widgets.jui.CJuiDatePicker', array(
 *     'name'=>'publishDate',
 *     // additional javascript options for the date picker plugin
 *     'options'=>array(
 *         'showAnim'=>'fold',
 *     ),
 *     'htmlOptions'=>array(
 *         'style'=>'height:20px;'
 *     ),
 * ));
 * $this->widget('ext.multiselect.JMultiSelect',array(
 *      'model'=>$model,
 *      'attribute'=>'attribute',
 *      'data'=>$data,
 *      // additional javascript options for the MultiSelect plugin
 *      'options'=>array()
 * ));
 *

 *
 * By configuring the {@link options} property, you may specify the options
 * that need to be passed to the MultiSelect plugin. Please refer to
 * the {@link http://abeautifulsite.net/blog/2008/04/jquery-multiselect/#configuring MultiSelect plugin} documentation
 * for possible options (name-value pairs).
 *
 * @author segoddnja
 */

class JMultiSelect extends CJuiInputWidget
{
   
    /**
     * @var array data for generating the list options (value=>display)
     */
    public $data  = array();
   
    /**
     * @var array selected data for list
     */
    public $selected  = array();
   
    /**
     * @var array additional options for multiselect script
     */
    public $options = array();

    /**
     * Run this widget.
     * This method registers necessary javascript and renders the needed HTML code.
     */
    function run()
{
        list($name, $id) = $this->resolveNameID();
       
if (isset($this->htmlOptions['id']))
{
            $id = $this->htmlOptions['id'];
} else {
            $this->htmlOptions['id'] = $id;
}

        if (isset($this->htmlOptions['name']))
{
            $name = $this->htmlOptions['name'];
} else {
            $this->htmlOptions['name'] = $name;
}
       
if ($this->hasModel())
{
            //echo CHtml::activeDropDownList($this->model, 'citysFilter', $this->data, $this->htmlOptions);
            echo CHtml::activeDropDownList($this->model, $this->attribute, $this->data, $this->htmlOptions);
} else {
            echo CHtml::dropDownList($name, $this->selected, $this->data, $this->htmlOptions);
}
        $options = CJavaScript::encode($this->options);
        $js = "jQuery('#{$id}').multiselect($options);";
        Yii::app()->getClientScript()->registerScript(__CLASS__.'#'.$id, $js);
    }

    /**
     * Initializes the widget.
     */
    public function init() {
        parent::init();
        $this->registerScripts();
        $this->htmlOptions['multiple'] = 'multiple';
        $this->options = array_merge(array(
            'header' => false,
            'selectedList' => 4,
            'noneSelectedText' => 'Select an option',
            'selectedText' => '# selected',
        ), $this->options);
    }

    /**
     * Registers the JS and CSS Files
     */
    protected function registerScripts() {
        parent::registerCoreScripts();
        $assets = Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('ext.multiselect') . '/assets');
        $cs = Yii::app()->getClientScript();
        $cs->registerCoreScript('jquery.ui');
        $cs->registerScriptFile($assets . '/jquery.multiselect.min.js');
        $cs->registerCssFile($assets . '/jquery.multiselect.css');
    }

}

?>

Yii CGridView hide the delete button


php $this->widget('zii.widgets.grid.CGridView', array(
        'id'=>'some-grid',
        'dataProvider'=>$model->search(),
        'filter'=>$model,
        'columns'=>array(
        'id',
        'name',
        'etc',
        array(
         'class'=>'CButtonColumn',
         'template' => '{view} {update}',
        ),
)); ?>

Sunday, March 11, 2012

Installing Fedora 16 on 512MB laptop

this weekend project was to get a old laptop working. so i decided to install XP home.. the cd didnt work :( well it was the choir master's laptop

laptop configuration: DELL Inspiron 6000 512 MB RAM 40GB HDD

i tried installing Fedora 16 as my usual practice never bothered to read the "system requirements" :)) the live usb feodra didnt allow me.. gave error message "Insufficient Memory". again without reading the minimum system requirement for Fedora 15 LXDE version downloaded it, tried installing again the same error.

this time i googled what could be done.. thanks "Google" :)

this is the solution:

vi /usr/sbin/anaconda

search for needed_ram = int((isys.MIN_RAM + extra_ram) / 1024)
change that to 

needed_ram = 0 # int((isys.MIN_RAM + extra_ram) / 1024) 

or 
needed_ram = 0 

click the "install to hard disk" button. 

my next weekend project would be modify a yii web app to be fully ajax website..

Friday, March 9, 2012

a girls shirt slips on Carlton Fresh Prince's game show

Scorpions - Alien Nation






In the heat of the violence
The night's exploding everywhere
When hate pulls the trigger
The devil comes to take his share
In the garden of Eden
The time is running out so fast
Into heart of the demon
With no escape our die is cast

In the city of angels
Death is just a moment away
In the city of angels
Your future won't see the light of the day

Beware of the alien nation
Beware of the truth that they seek
They pray for eternal salvation
They pray for your soul to keep

On the eve of destruction
A reign of terror rules the street
When the heads start rolling
The devil comes to let it bleed

In the city of angels
Death is just a moment away
In the city of angels
Your future won't see the light of the day

Walk on past the alien nation
Walk on to the end of your reach
No fear of the alien nation
No fear of the hatred they preach

Don't run, there's no place to hide
Today or tomorrow it will get you
Don't move, the knife is right at your throat
And whatever you do, there's no way out
When the shroud comes down on this place
To bury us all alive
We'll know the time has come, to face the heat

Beware of the alien nation
Beware of the truth that they seek
They pray for eternal salvation
They pray for your soul to keep
Walk on past the alien nation
Walk on to the end of your reach
They pray for eternal damnation
They pray for your soul to keep

Sunday, March 4, 2012