Extension | Kind of document | MIME Type |
---|---|---|
.aac | AAC audio file | audio/aac |
.abw | AbiWord document | application/x-abiword |
.arc | Archive document (multiple files embedded) | application/octet-stream |
.avi | AVI: Audio Video Interleave | video/x-msvideo |
.azw | Amazon Kindle eBook format | application/vnd.amazon.ebook |
.bin | Any kind of binary data | application/octet-stream |
.bz | BZip archive | application/x-bzip |
.bz2 | BZip2 archive | application/x-bzip2 |
.csh | C-Shell script | application/x-csh |
.css | Cascading Style Sheets (CSS) | text/css |
.csv | Comma-separated values (CSV) | text/csv |
.doc | Microsoft Word | application/msword |
.epub | Electronic publication (EPUB) | application/epub+zip |
.gif | Graphics Interchange Format (GIF) | image/gif |
.htm | HyperText Markup Language (HTML) | text/html |
.ico | Icon format | image/x-icon |
.ics | iCalendar format | text/calendar |
.jar | Java Archive (JAR) | application/java-archive |
.jpeg .jpg | JPEG images | image/jpeg |
.js | JavaScript (ECMAScript) | application/js |
.json | JSON format | application/json |
.mid .midi | Musical Instrument Digital Interface (MIDI) | audio/midi |
.mpeg | MPEG Video | video/mpeg |
.mpkg | Apple Installer Package | application/vnd.apple.installer+xml |
.odp | OpenDocuemnt presentation document | application/vnd.oasis.opendocument.presentation |
.ods | OpenDocuemnt spreadsheet document | application/vnd.oasis.opendocument.spreadsheet |
.odt | OpenDocument text document | application/vnd.oasis.opendocument.text |
.oga | OGG audio | audio/ogg |
.ogv | OGG video | video/ogg |
.ogx | OGG | application/ogg |
.pdf | Adobe Portable Document Format (PDF) | application/pdf |
.ppt | Microsoft PowerPoint | application/vnd.ms-powerpoint |
.rar | RAR archive | application/x-rar-compressed |
.rtf | Rich Text Format (RTF) | application/rtf |
.sh | Bourne shell script | application/x-sh |
.svg | Scalable Vector Graphics (SVG) | image/svg+xml |
.swf | Small web format (SWF) or Adobe Flash document | application/x-shockwave-flash |
.tar | Tape Archive (TAR) | application/x-tar |
.tif | Tagged Image File Format (TIFF) | image/tiff |
.ttf | TrueType Font | application/x-font-ttf |
.vsd | Microsft Visio | application/vnd.visio |
.wav | Waveform Audio Format | audio/x-wav |
.weba | WEBM audio | audio/webm |
.webm | WEBM video | video/webm |
.webp | WEBP image | image/webp |
.woff | Web Open Font Format (WOFF) | application/x-font-woff |
.xhtml | XHTML | application/xhtml+xml |
.xls | Microsoft Excel | application/vnd.ms-excel |
.xml | XML | application/xml |
.xul | XUL | application/vnd.mozilla.xul+xml |
.zip | ZIP archive | application/zip |
.3gp | 3GPP audio/video container | video/3gpp audio/3gpp if it doesn't contain video |
.3g2 | 3GPP2 audio/video container | video/3gpp2 audio/3gpp2 if it doesn't contain video |
.7z | 7-zip archive | application/x-7z-compressed |
Wednesday, December 28, 2016
MIME Types
Monday, November 28, 2016
Common Database Configuration File Locations
Please note that the information below is provided to assist you with changing the connection strings of the most commonly used database driven web applications and we cannot offer a guide on every possible software solution available.
The password needs to be changed in both files.
Wordpress configuration file location : httpdocs/wp-config.php
/** MySQL database password */ define('DB_PASSWORD', '** new password here **');
Joomla configuration file location : httpdocs/configuaration.php
var $password = '** new password here **';
Drupal configuration file location : httpdocs/sites/default/settings
$databases = array ( 'default' => array ( 'default' => [ array ( 'database' => 'database-name', 'username' => 'database-username', 'password' => '**new password here***', 'host' => 'localhost', 'port' => '', 'driver' => 'mysql', 'prefix' => '',
OSCommerce 2.2 Configuration file location : httpdocs/includes/configure.php & httpdocs/admin/includes/configure.php
define('DB_SERVER_PASSWORD', '** new password **');
The password needs to be changed in both files.
Moodle 2 configuration file location : httpdocs/config.php
$CFG->dbpass = '** new password here **';
Magento configuration file location : httpdocs/app/etc/local.xml
<password><![CDATA[** new password here ** ]]></password>
courtesy: https://www.names.co.uk/support/1304-common_database_configuration_file_locations.html
Thursday, November 17, 2016
Check if SKU exist or not,
$sku = 'sku here';
$id = Mage::getModel('catalog/product')->getIdBySku($sku);
if ($id) {
//sku exists
}
else {
//sku does not exist
}
simple???
Thursday, September 15, 2016
Wednesday, August 31, 2016
Find Browser using Javascript
// Opera 8.0+
var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
// Firefox 1.0+
var isFirefox = typeof InstallTrigger !== 'undefined';
// At least Safari 3+: "[object HTMLElementConstructor]"
var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
// Internet Explorer 6-11
var isIE = /*@cc_on!@*/false || !!document.documentMode;
// Edge 20+
var isEdge = !isIE && !!window.StyleMedia;
// Chrome 1+
var isChrome = !!window.chrome && !!window.chrome.webstore;
// Blink engine detection
var isBlink = (isChrome || isOpera) && !!window.CSS;
if(isIE)
{
setTimeout(function(){
a = parseInt(jQuery('.masonary div:nth-child(6)').css('left'));
jQuery('div[id^=masonary]:nth-child(5n),div[id^=masonary]:nth-child(6n),div[id^=masonary]:nth-child(7n)').each(function(){
reala = jQuery(this).css('left');
calca = parseInt(reala) + (a/2);
jQuery(this).css('left',calca);
});
}, 1000);
}
else
{
setTimeout(function(){jQuery('#masonary51').addClass('masonary51');},200);
}
var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
// Firefox 1.0+
var isFirefox = typeof InstallTrigger !== 'undefined';
// At least Safari 3+: "[object HTMLElementConstructor]"
var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
// Internet Explorer 6-11
var isIE = /*@cc_on!@*/false || !!document.documentMode;
// Edge 20+
var isEdge = !isIE && !!window.StyleMedia;
// Chrome 1+
var isChrome = !!window.chrome && !!window.chrome.webstore;
// Blink engine detection
var isBlink = (isChrome || isOpera) && !!window.CSS;
if(isIE)
{
setTimeout(function(){
a = parseInt(jQuery('.masonary div:nth-child(6)').css('left'));
jQuery('div[id^=masonary]:nth-child(5n),div[id^=masonary]:nth-child(6n),div[id^=masonary]:nth-child(7n)').each(function(){
reala = jQuery(this).css('left');
calca = parseInt(reala) + (a/2);
jQuery(this).css('left',calca);
});
}, 1000);
}
else
{
setTimeout(function(){jQuery('#masonary51').addClass('masonary51');},200);
}
Friday, August 12, 2016
Thursday, August 11, 2016
Overriding Magento blocks, models, helpers and controllers

There is no project that uses framework as is. Every now and then there is a need to change something, to add something new or to override something already written. Due to many reasons it’s a bad habit and bad programming if core files are modified and it’s not recommended at all. Therefore Magento brought in an excellent way how to override/overwrite those files.
We already wrote how to override magento model classes, but there’s a need to modify helpers, blocks and controllers too, both on frontend and in admin.
Overriding Magento Blocks
Let’s start with overriding core tag blocks. Suppose that in Mage_Tag_Block_Product_List class some changes have to be done. What we would like to have here is to add our own file that will extend the original file with all of its methods. All the job that has to be done is to add the code below in the current module’s config.xml:
<config>
<global>
<blocks>
<tag>
<rewrite>
<product_list>Inchoo_Tag_Block_Product_List</product_list>
</rewrite>
</tag>
</blocks>
</global>
</config>
As the class name says, a file has to be created in app/code/local/Inchoo/Tag/Block/Product/List.php and a class has to be defined:
class Inchoo_Tag_Block_Product_List extends Mage_Tag_Block_Product_List
{
// some code
}
Equivalent to the example above, the same rule can be applied for the blocks in adminhtml where we want to override Mage_Adminhtml_Block_Tag_Edit class.
<config>
<global>
<blocks>
<adminhtml>
<rewrite>
<tag_edit>Inchoo_Tag_Block_Adminhtml_Tag_Edit</tag_edit>
</rewrite>
</adminhtml>
</blocks>
</global>
</config>
With the code above in config.xml an app/code/local/Inchoo/Tag/Block/Adminhtml/Tag/Edit.php file has to be created with the class definition:
class Inchoo_Tag_Block_Adminhtml_Tag_Edit extends Mage_Adminhtml_Block_Tag_Edit
{
// some code
}
Overriding Magento Helpers
Following the same principles magento helpers can be easiliy overriden too. Code for config.xml:
<config>
<global>
<helpers>
<tag>
<rewrite>
<data>Inchoo_Tag_Helper_Data</data>
</rewrite>
</tag>
</helpers>
</global>
</config>
Next we have to create an app/code/local/Inchoo/Tag/Helper/Data.php file and to define the class:
class Inchoo_Tag_Helper_Data extends Mage_Tag_Helper_Data
{
// some code
}
Overriding Magento Models
We already wrote about overriding magento models, but what’s with resource and collection files? The same as core model file, resource and collection files can be overriden similary as other files. Files we are going to extend:
Mage_Tag_Model_Tag
Mage_Tag_Model_Resource_Tag
Mage_Tag_Model_Resource_Tag_Collection
Mage_Tag_Model_Resource_Tag
Mage_Tag_Model_Resource_Tag_Collection
Config.xml code:
<config>
<global>
<models>
<tag>
<rewrite>
<!-- Model -->
<tag>Inchoo_Tag_Model_Tag</tag>
</rewrite>
</tag>
<tag_resource>
<rewrite>
<!-- Resource -->
<tag>Inchoo_Tag_Model_Resource_Tag</tag>
<!-- Collection -->
<tag_collection>Inchoo_Tag_Model_Resource_Tag_Collection</tag_collection>
</rewrite>
</tag_resource>
</models>
</global>
</config>
Next we have to create those files:
app/code/local/Inchoo/Tag/Model/Tag.php
app/code/local/Inchoo/Tag/Model/Resource/Tag.php
app/code/local/Inchoo/Tag/Model/Resource/Tag/Collection.php.
app/code/local/Inchoo/Tag/Model/Resource/Tag.php
app/code/local/Inchoo/Tag/Model/Resource/Tag/Collection.php.
Note: This is just an example with all three overrides in one place for easier presentation. In your own projects rewrite only those files (classes) that you need.
Overriding Magento Controllers
Overriding controllers in Magento is a bit different than the rest of the examples above where they don’t quite follow magento rewrite rules as we have seen in the previous examples. How woud it go if we would like to override controllers in Mage_Tag? Let’s take a look at the code that goes into the config.xml:
<config>
<frontend>
<routers>
<tag>
<args>
<modules>
<inchoo_tag before="Mage_Tag">Inchoo_Tag</inchoo_tag>
</modules>
</args>
</tag>
</routers>
</frontend>
</config>
In the config node its child has to define whether we are changing the frontend or admin file and we define router node that will override core tag module with its arguments. In the bottom node goes the current module frontend name (inchoo_tag in my example) with the “before” or “after” attribute name with the value of which module is being overriden (Mage_Tag) and our own module name inside the tags (Inchoo_Tag).
If you noticed, there are no strict files defined. With this we have defined only the path that will look for the controller files by their names. So if we would like to override app/code/core/Mage/Tag/controllers/TagController.php a file with the same name will have to be created (app/code/local/Inchoo/Tag/controllers/TagController.php).
Class definition inside our new file:
require_once(Mage::getModuleDir('controllers','Mage_Tag').DS.'TagController.php');
class Inchoo_Tag_TagController extends Mage_Tag_TagController
{
// some code
}
Similar thing goes for adminhtml controllers. Config.xml code:
<config>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<inchoo_tag before="Mage_Adminhtml">Inchoo_Tag_Adminhtml</inchoo_tag>
</modules>
</args>
</adminhtml>
</routers>
</admin>
</config>
Create a file in app/code/local/Inchoo/Tag/controllers/Adminhtml/TagController.php and define the class:
require_once(Mage::getModuleDir('controllers','Mage_Adminhtml').DS.'TagController.php');
class Inchoo_Tag_Adminhtml_TagController extends Mage_Adminhtml_TagController
{
// some code
}
Now when we went through some magento rewrites it’s on you to write some astonishing code.
Happy coding!
courtesy : http://inchoo.net/magento/overriding-magento-blocks-models-helpers-and-controllers/
Happy coding!
courtesy : http://inchoo.net/magento/overriding-magento-blocks-models-helpers-and-controllers/
Subscribe to:
Posts (Atom)
$headBlock = $this->getLayout()->getBlock('head');
$headBlock->addJs('varien/product.js')
->addItem('js_css', 'calendar/calendar-win2k-1.css', null, null, 'can_load_calendar_js')
->addItem('js', 'calendar/calendar.js', null, null, 'can_load_calendar_js')
->addItem('js', 'calendar/calendar-setup.js', null, null, 'can_load_calendar_js')
->addItem('skin_js', 'js/bundle.js');
$this->renderLayout();