Aug 31, 2011
Aug 25, 2011
Magento: GRID Important functions
Adding Edit link on a row
Normally this is default on the magento grid already.
protected function _prepareColumns()
{
// .... Some other code here
$this->addColumn('action',
array(
'header' => Mage::helper('catalog')->__('Action'),
'width' => '50px',
'type' => 'action',
'getter' => 'getId',
'actions' => array(
array(
'caption' => Mage::helper('catalog')->__('Edit'),
'url' => array(
'base'=>'*/*/edit',
'params'=>array(),
),
'field' => 'id'
)
),
'filter' => false,
'sortable' => false,
'index' => 'stores',
)
);
}
Removing the Pager/Filter
Normally this is default on the magento grid already.
public function __construct()
{
parent::__construct();
$this->setFilterVisibility(false); // Remove Seach filtering
$this->setPagerVisibility(false); // Remove Pager of the grid
}
Adding Mass proccess on the Grid
protected function _prepareMassaction()
{
$this->setMassactionIdField('trans_id');
//$this->getMassactionBlock()->setFormFieldName('download');
$this->getMassactionBlock()->addItem('delete', array(
'label'=> Mage::helper('download')->__('Delete'),
'url' => $this->getUrl('*/*/massDelete'),
'confirm' => Mage::helper('download')->__('Are you sure?')
));
$this->getMassactionBlock()->addItem('status', array(
'label'=> Mage::helper('download')->__('Change status'),
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
'additional' => array(
'visibility' => array(
'name' => 'status',
'type' => 'select',
'class' => 'required-entry',
'label' => Mage::helper('download')->__('Status'),
'values' => array("x1" => "Yow", "x2"=>"secret")
)
)
));
}
Aug 23, 2011
Linux: Get SSL certificate
openssl s_client -connect 203.177.165.154:443
Reference: http://curl.haxx.se/docs/sslcerts.html
Magento: Exporting button on your data in a grid.
Adding Export button
In your Grid class(Package_Module_Block_Grid), find the method named _prepareColumns and add the code below.
$this->addExportType('*/*/exportCsv', Mage::helper('download')->__('CSV'));
$this->addExportType('*/*/exportXml', Mage::helper('download')->__('XML'));
$this->addExportType('*/*/exportXml', Mage::helper('download')->__('XML'));
Implement Export method/Action
In your action controller class (Package_Module_Adminhtml_DownloadController) create two methods.
class Globe_Download_Adminhtml_DownloadController extends Mage_Adminhtml_Controller_Action{
public function exportXmlAction() {
}
public function exportCvsAction() {
}
protected function _prepareDownloadResponse($fileName, $content, $contentType = 'application/octet-stream', $contentLength = null)
{
$session = Mage::getSingleton('admin/session');
if ($session->isFirstPageAfterLogin()) {
$this->_redirect($session->getUser()->getStartupPageUrl());
return $this;
}
$this->getResponse()
->setHttpResponseCode(200)
->setHeader('Pragma', 'public', true)
->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)
->setHeader('Content-type', $contentType, true)
->setHeader('Content-Length', is_null($contentLength) ? strlen($content) : $contentLength)
->setHeader('Content-Disposition', 'attachment; filename=' . $fileName)
->setHeader('Last-Modified', date('r'))
->sendHeaders(); // Need to call this method after all you send the Headers.
if (!is_null($content)) {
$this->getResponse()->setBody($content);
}
return $this;
}
}
Thanks to the other author for sharing what they knows about magento development. In this post I only put the part of the code that I understand or I use it in my application.
Rerefences:
- http://subesh.com.np/2010/03/create-download-xls-report-file-magentos-core/
- http://www.webspeaks.in/2010/08/create-admin-backend-module-in-magento.html
Zend: Join Statement and example
http://zendgeek.blogspot.com/2009/07/zend-framework-sql-joins-examples.html
Aug 21, 2011
Magento: Add custom renderer for a custom column grid
Good Example Here:
http://inchoo.net/ecommerce/magento/how-to-add-custom-renderer-for-a-custom-column-in-magento-grid/
http://inchoo.net/ecommerce/magento/how-to-add-custom-renderer-for-a-custom-column-in-magento-grid/
Aug 11, 2011
Aug 7, 2011
Linix: Create/Extract tar file
Create tar.gz file
tar -cvzf mytarfile.tar.gz <directory>
this means:
-c = create new archive
-v = be verbose
-z = compress using gzip
-f = filename to create for the new archive
Extract tar.gz file
tar -xzf mytarfile.tar.gz
Create tar.bz2 file
tar -cvjf mytarfile.tar.gz <directory>
this means:
-c = create new archive
-v = be verbose
-j = compress using bzip2
-f = filename to create for the new archive
Extract tar.bz2 file
tar -xpjf file.tar.bz2
Aug 5, 2011
Aug 3, 2011
Linux: perl-Net-SSLeay dependency error when installing Memcached with yum
Needs to update the packages.
Get data packages here depends on your system.
Get data packages here depends on your system.
wget http://packages.sw.be/perl-Net-SSLeay/perl-Net-SSLeay-1.36-1.el5.rfx.i386.rpm
wget http://packages.sw.be/perl-Net-SSLeay/perl-Net-SSLeay-1.36-1.el5.rfx.x86_64.rpm
wget http://packages.sw.be/perl-IO-Socket-SSL/perl-IO-Socket-SSL-1.34-1.el5.rfx.noarch.rpm
wget http://packages.sw.be/perl-Net-SSLeay/perl-Net-SSLeay-1.36-1.el5.rfx.x86_64.rpm
wget http://packages.sw.be/perl-IO-Socket-SSL/perl-IO-Socket-SSL-1.34-1.el5.rfx.noarch.rpm
How to install reviewboard in centOS?
Requirements:
Database:
MySQL v5.0.31 or newerWeb Server:
Apache + mod_python or fastcgi lighttpd + fastcgiStart reviewboard Installation
TO BE CONTINUED: Thanks for visiting
Aug 2, 2011
Aug 1, 2011
Subscribe to:
Posts (Atom)