Skip to content

Instantly share code, notes, and snippets.

View narendrakamadi's full-sized avatar

Narendra narendrakamadi

  • Pune
View GitHub Profile
<block type="cms/block" name="block_name">
<action method="setBlockId"><id>block_code</id></action>
</block>
{{block type="cms/block" block_id="block_code"}}
{{block type="catalog/product_list" category_id="79" template="catalog/product/list_random.phtml"}}
@narendrakamadi
narendrakamadi / add these in .htaccess
Created November 21, 2014 05:14
To remove index.php from url.
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{REQUEST_URI} !/system/.* [NC]
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

Magento Code Snippets

Download extension manually using mage

./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name
<?php
$config['Site'] = array(
'name' => 'My Site Name',
'sidebarMenu' => array(
// Menu for Admin
'admin' => array(
'dashboard' => array(
'icon' => 'dashboard',
'title' => 'Dashboard',
<?php
// Retrieves list of subjects grouped by standard name
$subjects = $this->Subject->find('list', array(
"fields" => array("Subject.id", "Subject.name", "Standard.name"),
"joins" => array(
array(
"table" => "standards",
"alias" => "Standard",
"type" => "INNER",
"conditions" => array("Standard.id = Subject.standard_id")
<?php
/**
* Gets list from various models
*
* @param string $modelName Model name
* @param string $key field name used in condition
* @param string $value value of field used in conditions
*
* @return json
*/