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..

About

Blogger templates