Welcome to Snippi.net

Welcome to Snippi.net. Place to share Magento code snippets.

Feel free to register and submit your own code snippets. Making so will hopefully help speed up collective community learning process with Magento eCommerce platform.

Set Magento Pdf support chinese

Public snippet   |  Code orientation PHP  |   Tested for Magento version 1.4.1.1 No description given for this code snippet.
//app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php

    protected function _setFontRegular($object, $size = 7)
 
    {
        $font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() .

Retrieve Grid data as CSV

Public snippet   |  Code orientation PHP  |   Tested for Magento version 1.4.1.1 No description given for this code snippet.
//..\app\code\core\Mage\Adminhtml\Block\Widget\Grid.php

/**
     * Retrieve Grid data as CSV
     *
     * @return string
     */
    public function getCsv()
    {
        $csv = '';
        $this->_isExport = true;
        $this->_prepareGrid();
        $this->getCollection()->getSelect()->limit();
        $this->getCollection()->setPageSize(0);
        $this->getCollection()->loa

Show Invoice And Items Ordered In Order Grid

Public snippet   |  Code orientation PHP  |   Tested for Magento version 1.4.1.1 No description given for this code snippet.
//..\app\code\local\Mage\Adminhtml\Block\Sales\Order\Grid.php

$this->addColumn('order_invoice_id', array(
            'header'    => Mage::helper('sales')->__('Invoice #'),
            'index'     => 'invoice_id',
            'type'      => 'text',
			'width' => '100px',
        ));
		
		$this->addColumn('items_ordered', array(
            'header'    => Mage::helper('sales')->__('Items

MySQL Map of Entity Attributes

Public snippet   |  Code orientation SQL  |   Tested for Magento version 1.4.1 MySQL query which shows eav attributes and their associated entities. Assumes no table name prefix.
SELECT a.attribute_id, t.entity_type_code, a.attribute_code FROM eav_entity_type t JOIN eav_attribute a ON a.entity_type_id = t.entity_type_id

Total snippets

158

Who's new

  • Naguripisto
  • Stolenfinche
  • anhreg
  • HamuroGTRx
  • almotaRom
 
Magento Code Snippets by the developers for developers :) | Established & Maintained by Branko Ajzele from ActiveCodeline