February 2, 2016 1:26 pm
image_round

Create a Magento Custom grid – Frontend

Step 1

Create a layout for action index: app/design/frontend/base/default/modulename.xml

<layout version="0.1.0">
<modulename_index_index>
<reference name="content">
<block type="modulename/blockname" name="modulename" template="modulename/modulename.phtml" />
</reference>
</modulename_index_index>
</layout>

Step 2

app/code/local/Packagename/Modulename/controllers/IndexController.php

class Packagename_Modulename_IndexController extends Mage_Core_Controller_Front_Action
{

  public function indexAction()
  {
    $this->loadLayout();
    $this->renderLayout();
  }
}

 Step 3

app/code/local/Packagename/Modulename/Block/Blockname.php

class Packagename_Modulename_Block_Blockname extends Mage_Core_Block_Template
{
      public function __construct()
      {
           parent::__construct();
           $collection = Mage::getModel('modelname/modelname')->getCollection();
           $this->setCollection($collection);
       }
}

 Step 4

<?php echo $this->getPagerHtml() ?>
<table id="my-data-table" class="data-table">
<colgroup>
<col width="1">
<col width="1">
<col>
</colgroup>
<thead>
<tr class="first last">
<th><?php echo $this->__('No.')?></th>
<th><?php echo $this->__('Name')?></th>
<th><?php echo $this->__('Time')?></th>
</tr>
</thead>
<tbody>
<?php foreach($this->getCollection() as $data): ?>
<tr>
<td><?php echo $person->getData('id')?></td>
<td><?php echo $person->getData('name')?></td>
<td><?php echo Mage::helper('core')->formatDate($data->getData('time'))?></td>
</tr>
<?php endforeach ?>
</tbody>
</table>
<?php echo $this->getPagerHtml() ?>
<script type="text/javascript">decorateTable('my-data-table')</script>

Step 5

app/code/local/Packagename/Modulename/Block/Blockname.php

public function _prepareLayout()
{
     parent::_prepareLayout();
     $pager = $this->getLayout()->createBlock('page/html_pager', 'block.pager')->setCollection($this->getCollection());
     $this->setChild('pager', $pager);
     return $this;
}
public function getPagerHtml()
{
     return $this->getChildHtml('pager');
}

Create a Magento Custom grid – Frontend

Step 1

Create a layout for action index: app/design/frontend/base/default/modulename.xml

<layout version="0.1.0">
<modulename_index_index>
<reference name="content">
<block type="modulename/blockname" name="modulename" template="modulename/modulename.phtml" />
</reference>
</modulename_index_index>
</layout>

Step 2

app/code/local/Packagename/Modulename/controllers/IndexController.php

class Packagename_Modulename_IndexController extends Mage_Core_Controller_Front_Action
{

  public function indexAction()
  {
    $this->loadLayout();
    $this->renderLayout();
  }
}

 Step 3

app/code/local/Packagename/Modulename/Block/Blockname.php

class Packagename_Modulename_Block_Blockname extends Mage_Core_Block_Template
{
      public function __construct()
      {
           parent::__construct();
           $collection = Mage::getModel('modelname/modelname')->getCollection();
           $this->setCollection($collection);
       }
}

 Step 4

<?php echo $this->getPagerHtml() ?>
<table id="my-data-table" class="data-table">
<colgroup>
<col width="1">
<col width="1">
<col>
</colgroup>
<thead>
<tr class="first last">
<th><?php echo $this->__('No.')?></th>
<th><?php echo $this->__('Name')?></th>
<th><?php echo $this->__('Time')?></th>
</tr>
</thead>
<tbody>
<?php foreach($this->getCollection() as $data): ?>
<tr>
<td><?php echo $person->getData('id')?></td>
<td><?php echo $person->getData('name')?></td>
<td><?php echo Mage::helper('core')->formatDate($data->getData('time'))?></td>
</tr>
<?php endforeach ?>
</tbody>
</table>
<?php echo $this->getPagerHtml() ?>
<script type="text/javascript">decorateTable('my-data-table')</script>

Step 5

app/code/local/Packagename/Modulename/Block/Blockname.php

public function _prepareLayout()
{
     parent::_prepareLayout();
     $pager = $this->getLayout()->createBlock('page/html_pager', 'block.pager')->setCollection($this->getCollection());
     $this->setChild('pager', $pager);
     return $this;
}
public function getPagerHtml()
{
     return $this->getChildHtml('pager');
}
February 2, 2016 1:12 pm
image_round

Resetting forgotten phpmyadmin password

Simply change or reset your MySQL root password by doing the following:

Stop the MySQL server

sudo service mysql stop

Start mysqld

sudo mysqld --skip-grant-tables &

Login to MySQL as root

mysql -u root mysql

Change MYSECRET with your new root password

UPDATE user SET Password=PASSWORD('MYSECRET') WHERE User='root'; FLUSH PRIVILEGES; exit;

Kill mysqld

sudo pkill mysqld

Start mysql

sudo service mysql start

Login to phpmyadmin as root with your new password

Resetting forgotten phpmyadmin password

Simply change or reset your MySQL root password by doing the following:

Stop the MySQL server

sudo service mysql stop

Start mysqld

sudo mysqld --skip-grant-tables &

Login to MySQL as root

mysql -u root mysql

Change MYSECRET with your new root password

UPDATE user SET Password=PASSWORD('MYSECRET') WHERE User='root'; FLUSH PRIVILEGES; exit;

Kill mysqld

sudo pkill mysqld

Start mysql

sudo service mysql start

Login to phpmyadmin as root with your new password