├── .gitignore ├── app ├── code │ └── community │ │ └── BL │ │ └── CustomGrid │ │ ├── Block │ │ ├── Rewrite │ │ │ └── .gitignore │ │ ├── Custom │ │ │ ├── Grid │ │ │ │ └── Edit │ │ │ │ │ └── Tab │ │ │ │ │ ├── Columns.php │ │ │ │ │ └── Role.php │ │ │ ├── Grid.php │ │ │ └── Column │ │ │ │ ├── Config │ │ │ │ └── Form.php │ │ │ │ └── Config.php │ │ ├── Widget │ │ │ └── Grid │ │ │ │ ├── Column │ │ │ │ ├── Renderer │ │ │ │ │ ├── Sales │ │ │ │ │ │ └── Items │ │ │ │ │ │ │ └── Sub │ │ │ │ │ │ │ ├── Interface.php │ │ │ │ │ │ │ ├── Default.php │ │ │ │ │ │ │ ├── Row │ │ │ │ │ │ │ └── Default.php │ │ │ │ │ │ │ └── Abstract.php │ │ │ │ │ ├── Date.php │ │ │ │ │ ├── Datetime.php │ │ │ │ │ ├── Order │ │ │ │ │ │ ├── Items │ │ │ │ │ │ │ ├── Default.php │ │ │ │ │ │ │ └── Custom.php │ │ │ │ │ │ └── Status │ │ │ │ │ │ │ └── Color.php │ │ │ │ │ ├── Invoice │ │ │ │ │ │ └── Items │ │ │ │ │ │ │ ├── Default.php │ │ │ │ │ │ │ └── Custom.php │ │ │ │ │ ├── Shipment │ │ │ │ │ │ └── Items │ │ │ │ │ │ │ ├── Default.php │ │ │ │ │ │ │ └── Custom.php │ │ │ │ │ ├── Creditmemo │ │ │ │ │ │ └── Items │ │ │ │ │ │ │ ├── Default.php │ │ │ │ │ │ │ └── Custom.php │ │ │ │ │ ├── Product │ │ │ │ │ │ └── Inventory.php │ │ │ │ │ └── Country │ │ │ │ │ │ └── Eu.php │ │ │ │ └── Filter │ │ │ │ │ ├── Yesno.php │ │ │ │ │ ├── Datetime.php │ │ │ │ │ ├── Country │ │ │ │ │ └── Eu.php │ │ │ │ │ ├── Text.php │ │ │ │ │ └── Product │ │ │ │ │ └── Image.php │ │ │ │ ├── Form │ │ │ │ ├── Renderer │ │ │ │ │ ├── Element.php │ │ │ │ │ ├── Fieldset.php │ │ │ │ │ ├── Fieldset │ │ │ │ │ │ └── Element.php │ │ │ │ │ └── Product │ │ │ │ │ │ ├── Attribute │ │ │ │ │ │ └── Urlkey.php │ │ │ │ │ │ └── Fieldset │ │ │ │ │ │ └── Element.php │ │ │ │ ├── Helper │ │ │ │ │ └── Product │ │ │ │ │ │ ├── Wysiwyg.php │ │ │ │ │ │ └── Wysiwyg │ │ │ │ │ │ └── Content.php │ │ │ │ ├── Static │ │ │ │ │ └── Product │ │ │ │ │ │ └── Inventory.php │ │ │ │ ├── Attribute │ │ │ │ │ └── Default.php │ │ │ │ └── Container.php │ │ │ │ ├── Editor │ │ │ │ └── Renderer │ │ │ │ │ └── Abstract.php │ │ │ │ └── Columns │ │ │ │ ├── Config │ │ │ │ ├── Abstract.php │ │ │ │ └── Infos.php │ │ │ │ └── Filters.php │ │ ├── Config │ │ │ └── Form │ │ │ │ └── Element │ │ │ │ └── Multiselect.php │ │ ├── Options │ │ │ ├── Source.php │ │ │ └── Source │ │ │ │ └── Edit │ │ │ │ └── Tab │ │ │ │ ├── General.php │ │ │ │ ├── Custom.php │ │ │ │ └── Settings.php │ │ ├── Column │ │ │ └── Renderer │ │ │ │ ├── Attribute │ │ │ │ └── Config │ │ │ │ │ └── Form.php │ │ │ │ ├── Collection │ │ │ │ └── Config │ │ │ │ │ └── Form.php │ │ │ │ ├── Attribute.php │ │ │ │ ├── Collection.php │ │ │ │ ├── Config │ │ │ │ └── Form │ │ │ │ │ └── Abstract.php │ │ │ │ └── Abstract.php │ │ └── System │ │ │ └── Config │ │ │ └── Form │ │ │ └── Field │ │ │ └── Grid │ │ │ └── Exceptions.php │ │ ├── Model │ │ ├── Grid │ │ │ ├── Type │ │ │ │ ├── Api │ │ │ │ │ ├── Role.php │ │ │ │ │ └── User.php │ │ │ │ ├── Other.php │ │ │ │ ├── Invoice.php │ │ │ │ ├── Shipment.php │ │ │ │ ├── Creditmemo.php │ │ │ │ ├── Order.php │ │ │ │ ├── Permissions │ │ │ │ │ └── Role │ │ │ │ │ │ └── User.php │ │ │ │ └── Product │ │ │ │ │ └── Widget │ │ │ │ │ └── Chooser.php │ │ │ └── Rewriter │ │ │ │ └── Eval.php │ │ ├── Custom │ │ │ └── Column │ │ │ │ ├── Order │ │ │ │ ├── Customer │ │ │ │ │ └── Group.php │ │ │ │ ├── Address │ │ │ │ │ ├── Billing.php │ │ │ │ │ ├── Shipping.php │ │ │ │ │ └── Abstract.php │ │ │ │ ├── Items │ │ │ │ │ ├── Default.php │ │ │ │ │ └── Custom.php │ │ │ │ ├── Payment.php │ │ │ │ └── Base.php │ │ │ │ ├── Customer │ │ │ │ ├── Address │ │ │ │ │ ├── Billing.php │ │ │ │ │ └── Shipping.php │ │ │ │ └── Address.php │ │ │ │ ├── Invoice │ │ │ │ └── Items │ │ │ │ │ ├── Default.php │ │ │ │ │ └── Custom.php │ │ │ │ ├── Shipment │ │ │ │ └── Items │ │ │ │ │ ├── Default.php │ │ │ │ │ └── Custom.php │ │ │ │ ├── Creditmemo │ │ │ │ └── Items │ │ │ │ │ ├── Default.php │ │ │ │ │ └── Custom.php │ │ │ │ └── Simple │ │ │ │ ├── Duplicate.php │ │ │ │ └── Abstract.php │ │ ├── Reflection │ │ │ ├── Property │ │ │ │ └── Sales │ │ │ │ │ └── Order │ │ │ │ │ ├── Items.php │ │ │ │ │ ├── Invoice │ │ │ │ │ └── Items.php │ │ │ │ │ ├── Shipment │ │ │ │ │ └── Items.php │ │ │ │ │ └── Creditmemo │ │ │ │ │ └── Items.php │ │ │ └── Method │ │ │ │ └── Core │ │ │ │ └── Layout │ │ │ │ └── Generateaction.php │ │ ├── Column │ │ │ └── Renderer │ │ │ │ ├── Collection │ │ │ │ ├── Country.php │ │ │ │ ├── Ip.php │ │ │ │ ├── Number.php │ │ │ │ ├── Abstract.php │ │ │ │ ├── Store.php │ │ │ │ ├── Datetime.php │ │ │ │ ├── Date.php │ │ │ │ ├── Options.php │ │ │ │ ├── Text.php │ │ │ │ └── Source │ │ │ │ │ └── Currency.php │ │ │ │ ├── Abstract.php │ │ │ │ ├── Collection.php │ │ │ │ ├── Attribute │ │ │ │ ├── Number.php │ │ │ │ ├── Abstract.php │ │ │ │ ├── Product │ │ │ │ │ └── Image.php │ │ │ │ ├── Datetime.php │ │ │ │ └── Text.php │ │ │ │ └── Attribute.php │ │ ├── System │ │ │ └── Config │ │ │ │ ├── Source │ │ │ │ ├── Yesno.php │ │ │ │ ├── Enableddisabled.php │ │ │ │ ├── Truncate │ │ │ │ │ └── Type.php │ │ │ │ ├── Options │ │ │ │ │ └── Source.php │ │ │ │ ├── Tags │ │ │ │ │ └── Parsing │ │ │ │ │ │ └── Mode.php │ │ │ │ ├── Exceptions │ │ │ │ │ └── Handling │ │ │ │ │ │ └── Mode.php │ │ │ │ ├── Date │ │ │ │ │ └── Format.php │ │ │ │ ├── Boolean │ │ │ │ │ └── Config.php │ │ │ │ ├── Default │ │ │ │ │ └── Param │ │ │ │ │ │ └── Behaviour │ │ │ │ │ │ ├── Scalar.php │ │ │ │ │ │ └── Array.php │ │ │ │ └── Product │ │ │ │ │ └── Categories │ │ │ │ │ └── Filter │ │ │ │ │ └── Mode.php │ │ │ │ └── Backend │ │ │ │ └── Serialized │ │ │ │ └── Grid │ │ │ │ └── Exceptions.php │ │ ├── Mysql4 │ │ │ ├── Options │ │ │ │ └── Source │ │ │ │ │ └── Collection.php │ │ │ └── Grid │ │ │ │ └── Collection.php │ │ └── Session.php │ │ ├── Helper │ │ ├── Attribute.php │ │ ├── Config │ │ │ └── Editor.php │ │ ├── Js.php │ │ └── Editor.php │ │ ├── sql │ │ └── customgrid_setup │ │ │ └── mysql4-upgrade-0.8.0-0.8.4.php │ │ └── controllers │ │ ├── Custom │ │ └── Grid │ │ │ ├── Editor │ │ │ └── ProductController.php │ │ │ └── Column │ │ │ └── FilterController.php │ │ └── Column │ │ └── Renderer │ │ ├── AttributeController.php │ │ └── CollectionController.php ├── etc │ └── modules │ │ └── BL_CustomGrid.xml └── design │ └── adminhtml │ └── default │ └── default │ └── template │ └── bl │ └── customgrid │ ├── column │ └── renderer │ │ ├── collection │ │ ├── unknown.phtml │ │ └── descriptions.phtml │ │ └── attribute │ │ ├── unknown.phtml │ │ └── select.phtml │ ├── custom │ └── column │ │ └── config │ │ └── unknown.phtml │ └── widget │ └── grid │ ├── form.phtml │ ├── columns │ ├── editor.phtml │ ├── filters.phtml │ └── config │ │ └── infos.phtml │ ├── column │ └── renderer │ │ └── sales │ │ └── items │ │ └── sub │ │ ├── row │ │ └── default.phtml │ │ └── default.phtml │ └── form │ └── renderer │ └── element.phtml ├── skin └── adminhtml │ └── default │ └── default │ └── bl │ └── customgrid │ ├── images │ ├── edit.png │ ├── cancel.gif │ ├── check.png │ ├── cross.png │ ├── export.png │ ├── up-down.gif │ ├── ico_help.png │ ├── ico_infos.gif │ ├── validate.gif │ ├── arrow_down.png │ ├── arrow_left.png │ ├── bkg_box_top.jpg │ ├── bkg_window.png │ ├── grid_note_bg.gif │ ├── ico_config.png │ ├── ico_custom.gif │ ├── ico_export.gif │ ├── ico_arrow_down.gif │ ├── ico_mini_help.png │ ├── bkg_box_content.jpg │ ├── ico_mini_warning.png │ └── catalog │ │ └── product │ │ └── placeholder.jpg │ └── window │ ├── left.png │ ├── right.png │ ├── spinner.gif │ ├── top-left.png │ ├── top-right.png │ ├── bottom-left.png │ ├── bottom-right.png │ ├── button-close.png │ ├── top-middle.png │ ├── bottom-middle.png │ ├── button-maximize.png │ ├── button-minimize.png │ ├── background_buttons.gif │ └── bottom-right-fixed.png ├── composer.json ├── README.md └── modman /.gitignore: -------------------------------------------------------------------------------- 1 | /.idea -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Rewrite/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Grid/Type/Api/Role.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Grid/Type/Api/User.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/images/edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/images/edit.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/window/left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/window/left.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/images/cancel.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/images/cancel.gif -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/images/check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/images/check.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/images/cross.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/images/cross.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/images/export.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/images/export.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/images/up-down.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/images/up-down.gif -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/window/right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/window/right.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/window/spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/window/spinner.gif -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/images/ico_help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/images/ico_help.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/images/ico_infos.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/images/ico_infos.gif -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/images/validate.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/images/validate.gif -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/window/top-left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/window/top-left.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/window/top-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/window/top-right.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/images/arrow_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/images/arrow_down.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/images/arrow_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/images/arrow_left.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/images/bkg_box_top.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/images/bkg_box_top.jpg -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/images/bkg_window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/images/bkg_window.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/images/grid_note_bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/images/grid_note_bg.gif -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/images/ico_config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/images/ico_config.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/images/ico_custom.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/images/ico_custom.gif -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/images/ico_export.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/images/ico_export.gif -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/window/bottom-left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/window/bottom-left.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/window/bottom-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/window/bottom-right.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/window/button-close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/window/button-close.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/window/top-middle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/window/top-middle.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/images/ico_arrow_down.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/images/ico_arrow_down.gif -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/images/ico_mini_help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/images/ico_mini_help.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/window/bottom-middle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/window/bottom-middle.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/images/bkg_box_content.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/images/bkg_box_content.jpg -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/images/ico_mini_warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/images/ico_mini_warning.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/window/button-maximize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/window/button-maximize.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/window/button-minimize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/window/button-minimize.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/window/background_buttons.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/window/background_buttons.gif -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/window/bottom-right-fixed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/window/bottom-right-fixed.png -------------------------------------------------------------------------------- /skin/adminhtml/default/default/bl/customgrid/images/catalog/product/placeholder.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iplaydu/BL_CustomGrid/HEAD/skin/adminhtml/default/default/bl/customgrid/images/catalog/product/placeholder.jpg -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mmind/bl_customgrid", 3 | "type": "magento-module", 4 | "description": "Enhanced Admin Grids Extension for Magento", 5 | "homepage": "https://github.com/magemindcom/BL_CustomGrid", 6 | "require": { 7 | "magento-hackathon/magento-composer-installer": "*" 8 | }, 9 | "authors":[ 10 | { 11 | "name": "Mage Mind", 12 | "email": "tech@magemind.com" 13 | } 14 | ] 15 | } 16 | 17 | -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Custom/Column/Order/Customer/Group.php: -------------------------------------------------------------------------------- 1 | _extractBoolParam($params, 'use_default_behaviour')) { 9 | return array( 10 | 'type' => 'options', 11 | 'options' => Mage::getModel('customer/group')->getResourceCollection()->toOptionHash(), 12 | ); 13 | } 14 | return array(); 15 | } 16 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Helper/Attribute.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Helper_Attribute extends Mage_Core_Helper_Abstract 17 | { 18 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | MMind_BL_CustomGrid 2 | ================== 3 | 4 | Enhanced Admin Grids Extension for Magento 5 | Fork of BL_CustomGrid 6 | 7 | # Features 8 | 9 | 10 | # Contributors 11 | - Giuseppe Morelli 12 | 13 | # Stable version 14 | 15 | 0.9.0 16 | 17 | # MAGENTO Installation 18 | 19 | 20 | ### via [composer](https://getcomposer.org/download/) 21 | Add to your composer.json file this: 22 |
23 | {
24 |     ...
25 |     "require": {
26 |         "magento-hackathon/magento-composer-installer": "*",
27 |         "mmind/bl_customgrid": "0.9.0"
28 |     },
29 |     ....
30 |     "repositories": [
31 |         {
32 |             "type": "vcs",
33 |             "url": "git@github.com:magemindcom/BL_CustomGrid.git"
34 |         }
35 |     ],
36 |     .....
37 | }
-------------------------------------------------------------------------------- /app/etc/modules/BL_CustomGrid.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | true 21 | community 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Grid/Type/Other.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Grid_Type_Other 17 | extends BL_CustomGrid_Model_Grid_Type_Abstract 18 | { 19 | public function isAppliableToGrid($type, $rewritingClassName) 20 | { 21 | return true; 22 | } 23 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Custom/Grid/Edit/Tab/Columns.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Custom_Grid_Edit_Tab_Columns 17 | extends BL_CustomGrid_Block_Widget_Grid_Columns_Config 18 | { 19 | public function getIsStandAlone() 20 | { 21 | return true; 22 | } 23 | } -------------------------------------------------------------------------------- /modman: -------------------------------------------------------------------------------- 1 | app/code/community/BL/CustomGrid/ app/code/community/BL/CustomGrid/ 2 | app/design/adminhtml/default/default/layout/bl/customgrid.xml app/design/adminhtml/default/default/layout/bl/customgrid.xml 3 | app/design/adminhtml/default/default/template/bl/customgrid/ app/design/adminhtml/default/default/template/bl/customgrid/ 4 | app/etc/modules/BL_CustomGrid.xml app/etc/modules/BL_CustomGrid.xml 5 | app/locale/de_DE/BL_CustomGrid.csv app/locale/de_DE/BL_CustomGrid.csv 6 | app/locale/fr_FR/BL_CustomGrid.csv app/locale/fr_FR/BL_CustomGrid.csv 7 | js/bl/customgrid/ js/bl/customgrid/ 8 | skin/adminhtml/default/default/bl/customgrid/ skin/adminhtml/default/default/bl/customgrid/ 9 | -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Renderer/Sales/Items/Sub/Interface.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | interface BL_CustomGrid_Block_Widget_Grid_Column_Renderer_Sales_Items_Sub_Interface 17 | { 18 | public function canRender(Varien_Object $value); 19 | public function render(Varien_Object $value); 20 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Reflection/Property/Sales/Order/Items.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Reflection_Property_Sales_Order_Items 17 | extends Mage_Sales_Model_Order 18 | { 19 | public function setValue($order, $value) 20 | { 21 | $order->_items = $value; 22 | } 23 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Config/Form/Element/Multiselect.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Config_Form_Element_Multiselect 17 | extends Varien_Data_Form_Element_Multiselect 18 | { 19 | public function getName() 20 | { 21 | return Varien_Data_Form_Element_Abstract::getName(); 22 | } 23 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Custom/Column/Customer/Address/Billing.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Custom_Column_Customer_Address_Billing 17 | extends BL_CustomGrid_Model_Custom_Column_Customer_Address 18 | { 19 | public function getAddressType() 20 | { 21 | return 'billing'; 22 | } 23 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Custom/Column/Order/Address/Billing.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Custom_Column_Order_Address_Billing 17 | extends BL_CustomGrid_Model_Custom_Column_Order_Address_Abstract 18 | { 19 | public function getAddressType() 20 | { 21 | return 'billing'; 22 | } 23 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Custom/Column/Customer/Address/Shipping.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Custom_Column_Customer_Address_Shipping 17 | extends BL_CustomGrid_Model_Custom_Column_Customer_Address 18 | { 19 | public function getAddressType() 20 | { 21 | return 'shipping'; 22 | } 23 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Custom/Column/Order/Address/Shipping.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Custom_Column_Order_Address_Shipping 17 | extends BL_CustomGrid_Model_Custom_Column_Order_Address_Abstract 18 | { 19 | public function getAddressType() 20 | { 21 | return 'shipping'; 22 | } 23 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Reflection/Property/Sales/Order/Invoice/Items.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Reflection_Property_Sales_Order_Invoice_Items 17 | extends Mage_Sales_Model_Order_Invoice 18 | { 19 | public function setValue($invoice, $value) 20 | { 21 | $invoice->_items = $value; 22 | } 23 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Reflection/Property/Sales/Order/Shipment/Items.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Reflection_Property_Sales_Order_Shipment_Items 17 | extends Mage_Sales_Model_Order_Shipment 18 | { 19 | public function setValue($shipment, $value) 20 | { 21 | $shipment->_items = $value; 22 | } 23 | } -------------------------------------------------------------------------------- /app/design/adminhtml/default/default/template/bl/customgrid/column/renderer/collection/unknown.phtml: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | ?> 16 |
17 |

__('Unknown Column Type') ?>

18 |
19 |
20 | __('The requested column type does not exist...') ?> 21 |
-------------------------------------------------------------------------------- /app/design/adminhtml/default/default/template/bl/customgrid/custom/column/config/unknown.phtml: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | ?> 16 |
17 |

__('Unknown Custom Column') ?>

18 |
19 |
20 | __('The requested custom column does not exist...') ?> 21 |
-------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Reflection/Property/Sales/Order/Creditmemo/Items.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Reflection_Property_Sales_Order_Creditmemo_Items 17 | extends Mage_Sales_Model_Order_Creditmemo 18 | { 19 | public function setValue($creditmemo, $value) 20 | { 21 | $creditmemo->_items = $value; 22 | } 23 | } -------------------------------------------------------------------------------- /app/design/adminhtml/default/default/template/bl/customgrid/widget/grid/form.phtml: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | ?> 16 | getEditedInGrid()): ?> 17 |
18 | 19 | getFormHtml();?> 20 | getEditedInGrid()): ?> 21 |
22 | 23 | getChildHtml('form_after');?> -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/sql/customgrid_setup/mysql4-upgrade-0.8.0-0.8.4.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | $installer = $this; 17 | $installer->startSetup(); 18 | 19 | $installer->getConnection()->addColumn( 20 | $installer->getTable('customgrid/grid_column'), 21 | 'allow_edit', 22 | 'tinyint(1) unsigned NOT NULL default 1' 23 | ); 24 | 25 | $installer->endSetup(); -------------------------------------------------------------------------------- /app/design/adminhtml/default/default/template/bl/customgrid/column/renderer/attribute/unknown.phtml: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | ?> 16 |
17 |

__('Unknown Attribute Renderer') ?>

18 |
19 |
20 | __('The requested attribute renderer does not exist...') ?> 21 |
-------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Column/Renderer/Collection/Country.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Column_Renderer_Collection_Country 17 | extends BL_CustomGrid_Model_Column_Renderer_Collection_Abstract 18 | { 19 | public function getColumnGridValues($index, $store, $grid) 20 | { 21 | return array('type' => 'country'); 22 | } 23 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Reflection/Method/Core/Layout/Generateaction.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Reflection_Method_Core_Layout_Generateaction 17 | extends Mage_Core_Model_Layout 18 | { 19 | public function invoke($layout, $actionNode, $parent) 20 | { 21 | return $layout->_generateAction($actionNode, $parent); 22 | } 23 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Custom/Column/Order/Items/Default.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Custom_Column_Order_Items_Default 17 | extends BL_CustomGrid_Model_Custom_Column_Order_Items_Abstract 18 | { 19 | protected function _getGridColumnRenderer() 20 | { 21 | return 'customgrid/widget_grid_column_renderer_order_items_default'; 22 | } 23 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Custom/Column/Invoice/Items/Default.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Custom_Column_Invoice_Items_Default 17 | extends BL_CustomGrid_Model_Custom_Column_Invoice_Items_Abstract 18 | { 19 | protected function _getGridColumnRenderer() 20 | { 21 | return 'customgrid/widget_grid_column_renderer_invoice_items_default'; 22 | } 23 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Column/Renderer/Collection/Ip.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Column_Renderer_Collection_Ip 17 | extends BL_CustomGrid_Model_Column_Renderer_Collection_Abstract 18 | { 19 | public function getColumnGridValues($index, $store, $grid) 20 | { 21 | return array('renderer' => 'adminhtml/widget_grid_column_renderer_ip'); 22 | } 23 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Custom/Column/Shipment/Items/Default.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Custom_Column_Shipment_Items_Default 17 | extends BL_CustomGrid_Model_Custom_Column_Shipment_Items_Abstract 18 | { 19 | protected function _getGridColumnRenderer() 20 | { 21 | return 'customgrid/widget_grid_column_renderer_shipment_items_default'; 22 | } 23 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Custom/Column/Creditmemo/Items/Default.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Custom_Column_Creditmemo_Items_Default 17 | extends BL_CustomGrid_Model_Custom_Column_Creditmemo_Items_Abstract 18 | { 19 | protected function _getGridColumnRenderer() 20 | { 21 | return 'customgrid/widget_grid_column_renderer_creditmemo_items_default'; 22 | } 23 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Form/Renderer/Element.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Form_Renderer_Element 17 | extends Mage_Adminhtml_Block_Widget_Form_Renderer_Element 18 | { 19 | protected function _construct() 20 | { 21 | parent::_construct(); 22 | $this->setTemplate('bl/customgrid/widget/grid/form/renderer/element.phtml'); 23 | } 24 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Form/Renderer/Fieldset.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Form_Renderer_Fieldset 17 | extends Mage_Adminhtml_Block_Widget_Form_Renderer_Fieldset 18 | { 19 | protected function _construct() 20 | { 21 | parent::_construct(); 22 | $this->setTemplate('bl/customgrid/widget/grid/form/renderer/fieldset.phtml'); 23 | } 24 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Helper/Config/Editor.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Helper_Config_Editor 17 | extends Mage_Core_Helper_Abstract 18 | { 19 | const XML_CONFIG_SITEMAP_DELETE_FILE = 'customgrid/editor_sitemap/delete_file'; 20 | 21 | public function getSitemapDeleteFile() 22 | { 23 | return Mage::getStoreConfigFlag(self::XML_CONFIG_SITEMAP_DELETE_FILE); 24 | } 25 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Column/Renderer/Abstract.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | abstract class BL_CustomGrid_Model_Column_Renderer_Abstract 17 | extends Varien_Object 18 | { 19 | protected function _getHelper() 20 | { 21 | return Mage::helper('customgrid'); 22 | } 23 | 24 | protected function _getConfigHelper() 25 | { 26 | return Mage::helper('customgrid/config'); 27 | } 28 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/System/Config/Source/Yesno.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_System_Config_Source_Yesno 17 | { 18 | public function toOptionArray() 19 | { 20 | return array( 21 | array('value' => 1, 'label' => Mage::helper('customgrid')->__('Yes')), 22 | array('value' => 0, 'label' => Mage::helper('customgrid')->__('No')), 23 | ); 24 | } 25 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Form/Renderer/Fieldset/Element.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Form_Renderer_Fieldset_Element 17 | extends Mage_Adminhtml_Block_Widget_Form_Renderer_Fieldset_Element 18 | { 19 | protected function _construct() 20 | { 21 | parent::_construct(); 22 | $this->setTemplate('bl/customgrid/widget/grid/form/renderer/fieldset/element.phtml'); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/System/Config/Source/Enableddisabled.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_System_Config_Source_Enableddisabled 17 | { 18 | public function toOptionArray() 19 | { 20 | return array( 21 | array('value' => 1, 'label' => Mage::helper('customgrid')->__('Enabled')), 22 | array('value' => 0, 'label' => Mage::helper('customgrid')->__('Disabled')), 23 | ); 24 | } 25 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Column/Renderer/Collection.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Column_Renderer_Collection 17 | extends BL_CustomGrid_Model_Column_Renderer 18 | { 19 | protected function _construct() 20 | { 21 | $this->_acceptParameters = true; 22 | } 23 | 24 | public function getConfigType() 25 | { 26 | return BL_CustomGrid_Model_Config::TYPE_COLUMN_RENDERERS_COLLECTION; 27 | } 28 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Form/Renderer/Product/Attribute/Urlkey.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Form_Renderer_Product_Attribute_Urlkey 17 | extends Mage_Adminhtml_Block_Catalog_Form_Renderer_Attribute_Urlkey 18 | { 19 | protected function _construct() 20 | { 21 | parent::_construct(); 22 | $this->setTemplate('bl/customgrid/widget/grid/form/renderer/product/fieldset/element.phtml'); 23 | } 24 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Form/Renderer/Product/Fieldset/Element.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Form_Renderer_Product_Fieldset_Element 17 | extends Mage_Adminhtml_Block_Catalog_Form_Renderer_Fieldset_Element 18 | { 19 | protected function _construct() 20 | { 21 | parent::_construct(); 22 | $this->setTemplate('bl/customgrid/widget/grid/form/renderer/product/fieldset/element.phtml'); 23 | } 24 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Mysql4/Options/Source/Collection.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Mysql4_Options_Source_Collection 17 | extends Mage_Core_Model_Mysql4_Collection_Abstract 18 | { 19 | protected function _construct() 20 | { 21 | $this->_init('customgrid/options_source'); 22 | } 23 | 24 | public function toOptionArray() 25 | { 26 | return parent::_toOptionArray('source_id', 'name'); 27 | } 28 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Custom/Grid.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Custom_Grid 17 | extends Mage_Adminhtml_Block_Widget_Grid_Container 18 | { 19 | public function __construct() 20 | { 21 | $this->_controller = 'custom_grid'; 22 | $this->_blockGroup = 'customgrid'; 23 | $this->_headerText = $this->__('Manage Custom Grids'); 24 | parent::__construct(); 25 | $this->_removeButton('add'); 26 | } 27 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Column/Renderer/Collection/Number.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Column_Renderer_Collection_Number 17 | extends BL_CustomGrid_Model_Column_Renderer_Collection_Abstract 18 | { 19 | public function getColumnGridValues($index, $store, $grid) 20 | { 21 | return array( 22 | 'type' => 'number', 23 | 'show_number_sign' => (bool) $this->_getData('show_number_sign'), 24 | ); 25 | } 26 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Renderer/Sales/Items/Sub/Default.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Column_Renderer_Sales_Items_Sub_Default 17 | extends BL_CustomGrid_Block_Widget_Grid_Column_Renderer_Sales_Items_Sub_Abstract 18 | { 19 | protected function _construct() 20 | { 21 | parent::_construct(); 22 | $this->setTemplate('bl/customgrid/widget/grid/column/renderer/sales/items/sub/default.phtml'); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Renderer/Sales/Items/Sub/Row/Default.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Column_Renderer_Sales_Items_Sub_Row_Default 17 | extends BL_CustomGrid_Block_Widget_Grid_Column_Renderer_Sales_Items_Sub_Abstract 18 | { 19 | protected function _construct() 20 | { 21 | parent::_construct(); 22 | $this->setTemplate('bl/customgrid/widget/grid/column/renderer/sales/items/sub/row/default.phtml'); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Renderer/Date.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Column_Renderer_Date 17 | extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Date 18 | { 19 | public function render(Varien_Object $row) 20 | { 21 | try { 22 | return parent::render($row); 23 | } catch (Exception $e) { 24 | // Exception can be thrown if, eg, values do not correspond to dates 25 | return $e->getMessage(); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/System/Config/Source/Truncate/Type.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_System_Config_Source_Truncate_Type 17 | { 18 | public function toOptionArray() 19 | { 20 | $helper = Mage::helper('customgrid'); 21 | return array( 22 | array('value' => 'no', 'label' => $helper->__('No')), 23 | array('value' => 'text', 'label' => $helper->__('As Text')), 24 | array('value' => 'html', 'label' => $helper->__('As HTML')), 25 | ); 26 | } 27 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Grid/Type/Invoice.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Grid_Type_Invoice 17 | extends BL_CustomGrid_Model_Grid_Type_Sales_Abstract 18 | { 19 | public function isAppliableToGrid($type, $rewritingClassName) 20 | { 21 | return ($type == 'adminhtml/sales_invoice_grid'); 22 | } 23 | 24 | protected function _getItemsCustomColumnModel($customizable=false) 25 | { 26 | return 'customgrid/custom_column_invoice_items_'.($customizable ? 'custom' : 'default'); 27 | } 28 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Renderer/Datetime.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Column_Renderer_Datetime 17 | extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Datetime 18 | { 19 | public function render(Varien_Object $row) 20 | { 21 | try { 22 | return parent::render($row); 23 | } catch (Exception $e) { 24 | // Exception can be thrown if, eg, values do not correspond to dates 25 | return $e->getMessage(); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Grid/Type/Shipment.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Grid_Type_Shipment 17 | extends BL_CustomGrid_Model_Grid_Type_Sales_Abstract 18 | { 19 | public function isAppliableToGrid($type, $rewritingClassName) 20 | { 21 | return ($type == 'adminhtml/sales_shipment_grid'); 22 | } 23 | 24 | protected function _getItemsCustomColumnModel($customizable=false) 25 | { 26 | return 'customgrid/custom_column_shipment_items_'.($customizable ? 'custom' : 'default'); 27 | } 28 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Grid/Type/Creditmemo.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Grid_Type_Creditmemo 17 | extends BL_CustomGrid_Model_Grid_Type_Sales_Abstract 18 | { 19 | public function isAppliableToGrid($type, $rewritingClassName) 20 | { 21 | return ($type == 'adminhtml/sales_creditmemo_grid'); 22 | } 23 | 24 | protected function _getItemsCustomColumnModel($customizable=false) 25 | { 26 | return 'customgrid/custom_column_creditmemo_items_'.($customizable ? 'custom' : 'default'); 27 | } 28 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Session.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Session 17 | extends Mage_Core_Model_Session_Abstract 18 | { 19 | protected $_now; 20 | 21 | protected function _construct() 22 | { 23 | parent::_construct(); 24 | $this->_now = date('Y-m-d H:i:s'); 25 | } 26 | 27 | public function addMessage(Mage_Core_Model_Message_Abstract $message) 28 | { 29 | $message->setIdentifier(uniqid().'|'.$this->_now); 30 | return parent::addMessage($message); 31 | } 32 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Options/Source.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Options_Source 17 | extends Mage_Adminhtml_Block_Widget_Grid_Container 18 | { 19 | public function __construct() 20 | { 21 | $this->_controller = 'options_source'; 22 | $this->_blockGroup = 'customgrid'; 23 | $this->_headerText = $this->__('Manage Options Source'); 24 | parent::__construct(); 25 | } 26 | 27 | protected function getAddButtonLabel() 28 | { 29 | return $this->__('Add New Options Source'); 30 | } 31 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/System/Config/Source/Options/Source.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_System_Config_Source_Options_Source 17 | { 18 | protected $_options; 19 | 20 | public function toOptionArray() 21 | { 22 | if (!$this->_options) { 23 | $this->_options = Mage::getResourceModel('customgrid/options_source_collection') 24 | ->load()->toOptionArray(); 25 | array_unshift($this->_options, array('value' => '', 'label' => '')); 26 | } 27 | return $this->_options; 28 | } 29 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/System/Config/Source/Tags/Parsing/Mode.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_System_Config_Source_Tags_Parsing_Mode 17 | { 18 | public function toOptionArray() 19 | { 20 | $helper = Mage::helper('customgrid'); 21 | return array( 22 | array('value' => 0, 'label' => $helper->__('No')), 23 | array('value' => 'block', 'label' => $helper->__('With CMS blocks templates processor')), 24 | array('value' => 'page', 'label' => $helper->__('With CMS pages templates processor')), 25 | ); 26 | } 27 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Column/Renderer/Collection/Abstract.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | abstract class BL_CustomGrid_Model_Column_Renderer_Collection_Abstract 17 | extends BL_CustomGrid_Model_Column_Renderer_Abstract 18 | { 19 | /** 20 | * Return values to be used for column configuration in grid block 21 | * 22 | * @param string $index Column index 23 | * @param Mage_Core_Model_Store $store Current store 24 | * @param BL_CustomGrid_Model_Grid $grid Grid model 25 | * @return array 26 | */ 27 | abstract public function getColumnGridValues($index, $store, $grid); 28 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Filter/Yesno.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Column_Filter_Yesno 17 | extends BL_CustomGrid_Block_Widget_Grid_Column_Filter_Select 18 | { 19 | protected function _getOptions() 20 | { 21 | return array( 22 | array( 23 | 'value' => 1, 24 | 'label' => Mage::helper('customgrid')->__('Yes'), 25 | ), 26 | array( 27 | 'value' => 0, 28 | 'label' => Mage::helper('customgrid')->__('No'), 29 | ), 30 | ); 31 | } 32 | } -------------------------------------------------------------------------------- /app/design/adminhtml/default/default/template/bl/customgrid/widget/grid/columns/editor.phtml: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | ?> 16 | getGridBlock(); 18 | $_gridModel = $this->getGridModel(); 19 | ?> 20 | -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Editor/Renderer/Abstract.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | abstract class BL_CustomGrid_Block_Widget_Grid_Editor_Renderer_Abstract 17 | extends Mage_Adminhtml_Block_Abstract 18 | { 19 | protected $_defaultValue = null; 20 | 21 | protected function _construct() 22 | { 23 | parent::_construct(); 24 | $this->_defaultValue = Mage::helper('customgrid')->__('Updated'); 25 | } 26 | 27 | abstract protected function _getRenderedValue(); 28 | 29 | protected function _toHtml() 30 | { 31 | return $this->_getRenderedValue(); 32 | } 33 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Column/Renderer/Attribute/Config/Form.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Column_Renderer_Attribute_Config_Form 17 | extends BL_CustomGrid_Block_Column_Renderer_Config_Form_Abstract 18 | { 19 | protected function _getFormId() 20 | { 21 | return 'column_renderer_attribute_options_form'; 22 | } 23 | 24 | public function getRenderer() 25 | { 26 | if (!$renderer = Mage::registry('current_attribute_column_renderer')) { 27 | Mage::throwException($this->__('Renderer is not specified')); 28 | } 29 | return $renderer; 30 | } 31 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Grid/Type/Order.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Grid_Type_Order 17 | extends BL_CustomGrid_Model_Grid_Type_Sales_Abstract 18 | { 19 | public function isAppliableToGrid($type, $rewritingClassName) 20 | { 21 | return ($type == 'adminhtml/sales_order_grid'); 22 | } 23 | 24 | protected function _isOrdersGrid() 25 | { 26 | return true; 27 | } 28 | 29 | protected function _getItemsCustomColumnModel($customizable=false) 30 | { 31 | return 'customgrid/custom_column_order_items_'.($customizable ? 'custom' : 'default'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/design/adminhtml/default/default/template/bl/customgrid/widget/grid/column/renderer/sales/items/sub/row/default.phtml: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | ?> 16 | getValue()->getItemValues(); 18 | $_valuesHtml = $this->getValue()->getValuesHtml(); 19 | ?> 20 | 21 | 22 | getItemValueCssClasses($_itemValue, 'value_align')): ?> class=""> 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Column/Renderer/Attribute/Number.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Column_Renderer_Attribute_Number 17 | extends BL_CustomGrid_Model_Column_Renderer_Attribute_Abstract 18 | { 19 | public function isAppliableToColumn($attribute, $grid) 20 | { 21 | return in_array($attribute->getBackendType(), array('decimal', 'int')); 22 | } 23 | 24 | public function getColumnGridValues($attribute, $store, $grid) 25 | { 26 | return array( 27 | 'type' => 'number', 28 | 'show_number_sign' => (bool) $this->_getData('show_number_sign'), 29 | ); 30 | } 31 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Column/Renderer/Collection/Config/Form.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Column_Renderer_Collection_Config_Form 17 | extends BL_CustomGrid_Block_Column_Renderer_Config_Form_Abstract 18 | { 19 | protected function _getFormId() 20 | { 21 | return 'column_renderer_collection_options_form'; 22 | } 23 | 24 | public function getRenderer() 25 | { 26 | $renderer = Mage::registry('current_collection_column_renderer'); 27 | if (!$renderer) { 28 | Mage::throwException($this->__('Renderer is not specified')); 29 | } 30 | return $renderer; 31 | } 32 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Grid/Type/Permissions/Role/User.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Grid_Type_Permissions_Role_User 17 | extends BL_CustomGrid_Model_Grid_Type_Abstract 18 | { 19 | public function isAppliableToGrid($type, $rewritingClassName) 20 | { 21 | return (($type == 'adminhtml/permissions_role_grid_user') 22 | || ($type == 'adminhtml/api_role_grid_user')); 23 | } 24 | 25 | public function beforeGridPrepareCollection($grid, $firstTime=true) 26 | { 27 | // Avoid "Mage registry key "RID" already exists" exception 28 | Mage::unregister('RID'); 29 | return $this; 30 | } 31 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Filter/Datetime.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Column_Filter_Datetime 17 | extends Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Datetime 18 | { 19 | public function getValue($index=null) 20 | { 21 | if (is_array($value = $this->_getData('value'))) { 22 | if (!empty($value['to']) && !($value['to'] instanceof Zend_Date)) { 23 | $value['to'] = null; 24 | $this->setData('value', $value); 25 | } 26 | } else { 27 | $this->setData('value', null); 28 | } 29 | return parent::getValue($index); 30 | } 31 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Custom/Column/Customer/Address.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | abstract class BL_CustomGrid_Model_Custom_Column_Customer_Address 17 | extends BL_CustomGrid_Model_Custom_Column_Simple_Abstract 18 | { 19 | abstract public function getAddressType(); 20 | 21 | public function getAttributeCode() 22 | { 23 | return $this->getModelParam('attribute_code'); 24 | } 25 | 26 | public function addFieldToGridCollection($alias, $params, $block, $collection) 27 | { 28 | $collection->joinAttribute($alias, 'customer_address/'.$this->getAttributeCode(), 'default_'.$this->getAddressType(), null, 'left'); 29 | return $this; 30 | } 31 | } -------------------------------------------------------------------------------- /app/design/adminhtml/default/default/template/bl/customgrid/widget/grid/columns/filters.phtml: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | ?> 16 | getColumns() ?> 17 | 18 | 19 | 20 | 21 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
22 | getHeader() ?> 23 |
getFilterHtml() ?>
32 | -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/System/Config/Source/Exceptions/Handling/Mode.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_System_Config_Source_Exceptions_Handling_Mode 17 | { 18 | public function toOptionArray() 19 | { 20 | $helper = Mage::helper('customgrid'); 21 | return array( 22 | array( 23 | 'value' => BL_CustomGrid_Helper_Config::GRID_EXCEPTION_HANDLING_EXCLUDE, 24 | 'label' => $helper->__('Exclude'), 25 | ), 26 | array( 27 | 'value' => BL_CustomGrid_Helper_Config::GRID_EXCEPTION_HANDLING_ALLOW, 28 | 'label' => $helper->__('Allow'), 29 | ), 30 | ); 31 | } 32 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/System/Config/Source/Date/Format.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_System_Config_Source_Date_Format 17 | { 18 | public function toOptionArray() 19 | { 20 | $helper = Mage::helper('customgrid'); 21 | return array( 22 | array('value' => Mage_Core_Model_Locale::FORMAT_TYPE_SHORT, 'label' => $helper->__('Short')), 23 | array('value' => Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, 'label' => $helper->__('Medium')), 24 | array('value' => Mage_Core_Model_Locale::FORMAT_TYPE_LONG, 'label' => $helper->__('Long')), 25 | array('value' => Mage_Core_Model_Locale::FORMAT_TYPE_FULL, 'label' => $helper->__('Full')), 26 | ); 27 | } 28 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Column/Renderer/Attribute.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Column_Renderer_Attribute 17 | extends BL_CustomGrid_Model_Column_Renderer 18 | { 19 | protected function _construct() 20 | { 21 | $this->_acceptParameters = true; 22 | } 23 | 24 | public function getConfigType() 25 | { 26 | return BL_CustomGrid_Model_Config::TYPE_COLUMN_RENDERERS_ATTRIBUTE; 27 | } 28 | 29 | public function getRenderersInstances() 30 | { 31 | $types = array(); 32 | foreach ($this->getElementsArray() as $type) { 33 | $types[$type['code']] = $this->getElementInstanceByCode($type['code']); 34 | } 35 | return $types; 36 | } 37 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Helper/Js.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Helper_Js extends Mage_Core_Helper_Abstract 17 | { 18 | public function prepareHtmlForJsOutput($html, $canTrim=false) 19 | { 20 | $parts = preg_split('#\r\n|\r[^\n]|\n#', ($canTrim ? trim($html) : $html)); 21 | $result = ''; 22 | $first = true; 23 | 24 | foreach ($parts as $part) { 25 | $result .= ($first ? '' : "\r\n+ ") . '\'' 26 | . str_replace(array('\\', '\'', '/'), array('\\\\', '\\\'', '\\/'), ($canTrim ? trim($part) : $part)) 27 | . '\''; 28 | $first = false; 29 | } 30 | 31 | return ($result !== '' ? $result : '\'\''); 32 | } 33 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/System/Config/Form/Field/Grid/Exceptions.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_System_Config_Form_Field_Grid_Exceptions 17 | extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract 18 | { 19 | public function __construct() 20 | { 21 | $this->addColumn('block_type', array( 22 | 'label' => $this->__('Block Type'), 23 | 'style' => 'width:200px', 24 | )); 25 | $this->addColumn('rewriting_class_name', array( 26 | 'label' => $this->__('Rewriting Class'), 27 | 'style' => 'width:200px', 28 | )); 29 | 30 | $this->_addAfter = false; 31 | $this->_addButtonLabel = $this->__('Add Exception'); 32 | parent::__construct(); 33 | } 34 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Grid/Type/Product/Widget/Chooser.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Grid_Type_Product_Widget_Chooser 17 | extends BL_CustomGrid_Model_Grid_Type_Abstract 18 | { 19 | public function isAppliableToGrid($type, $rewritingClassName) 20 | { 21 | return ($type == 'adminhtml/catalog_product_widget_chooser'); 22 | } 23 | 24 | public function matchGridBlock($blockType, $blockId, $model) 25 | { 26 | /* 27 | Block ID seems to be too much varying to be able to rely on, 28 | so let's assume all choosers share the same config, and this should be OK 29 | (and at least, far better from creating as much customizations as widgets...) 30 | */ 31 | return ($blockType == $model->getBlockType()); 32 | } 33 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Columns/Config/Abstract.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | abstract class BL_CustomGrid_Block_Widget_Grid_Columns_Config_Abstract 17 | extends Mage_Adminhtml_Block_Widget 18 | { 19 | public function getFormKey() 20 | { 21 | return Mage::getSingleton('core/session')->getFormKey(); 22 | } 23 | 24 | protected function _toHtml() 25 | { 26 | if (($model = $this->getGridModel()) 27 | && ((!$this->getNeedExistingModel() || !$this->getIsNewModel()) 28 | && ($this->getDisplayableWithoutBlock() 29 | || (($block = $this->getGridBlock()) 30 | && Mage::helper('customgrid')->isRewritedGrid($block))))) { 31 | return parent::_toHtml(); 32 | } 33 | return ''; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Filter/Country/Eu.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Column_Filter_Country_Eu 17 | extends BL_CustomGrid_Block_Widget_Grid_Column_Filter_Yesno 18 | { 19 | public function getCondition() 20 | { 21 | $value = $this->getValue(); 22 | 23 | if (is_null($value) || ($value === '')) { 24 | return null; 25 | } 26 | 27 | $value = (bool) $value; 28 | $euCountries = $this->getColumn()->getEuCountries(); 29 | 30 | if (!is_array($euCountries) || empty($euCountries)) { 31 | return ($value ? array('eq' => -1) : null); 32 | } 33 | 34 | $condition = ($value ? 'in' : 'nin'); 35 | return array($condition => $euCountries); 36 | } 37 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Column/Renderer/Attribute.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Column_Renderer_Attribute 17 | extends BL_CustomGrid_Block_Column_Renderer_Abstract 18 | { 19 | protected function _getController() 20 | { 21 | return 'column_renderer_attribute'; 22 | } 23 | 24 | protected function _getFormId() 25 | { 26 | return 'column_renderer_attribute_options_form'; 27 | } 28 | 29 | public function getFormHtml() 30 | { 31 | $html = '
' . $this->getRenderer()->getHelp() . '
'; 32 | $html .= parent::getFormHtml(); 33 | return $html; 34 | } 35 | 36 | public function getRenderer() 37 | { 38 | return Mage::registry('current_attribute_column_renderer'); 39 | } 40 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Column/Renderer/Collection.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Column_Renderer_Collection 17 | extends BL_CustomGrid_Block_Column_Renderer_Abstract 18 | { 19 | protected function _getController() 20 | { 21 | return 'column_renderer_collection'; 22 | } 23 | 24 | protected function _getFormId() 25 | { 26 | return 'column_renderer_collection_options_form'; 27 | } 28 | 29 | public function getFormHtml() 30 | { 31 | $html = '
' . $this->getRenderer()->getHelp() . '
'; 32 | $html .= parent::getFormHtml(); 33 | return $html; 34 | } 35 | 36 | public function getRenderer() 37 | { 38 | return Mage::registry('current_collection_column_renderer'); 39 | } 40 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Column/Renderer/Config/Form/Abstract.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | abstract class BL_CustomGrid_Block_Column_Renderer_Config_Form_Abstract 17 | extends BL_CustomGrid_Block_Config_Form_Abstract 18 | { 19 | abstract public function getRenderer(); 20 | 21 | protected function _getFormCode() 22 | { 23 | return $this->getRenderer()->getCode(); 24 | } 25 | 26 | public function addConfigFields($fieldset) 27 | { 28 | $renderer = $this->getRenderer(); 29 | $module = $renderer->getModule(); 30 | $this->_translationHelper = Mage::helper($module ? $module : 'customgrid'); 31 | 32 | foreach ($renderer->getParameters() as $parameter) { 33 | $this->_addConfigField($fieldset, $parameter); 34 | } 35 | 36 | return $this; 37 | } 38 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/System/Config/Backend/Serialized/Grid/Exceptions.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_System_Config_Backend_Serialized_Grid_Exceptions 17 | extends Mage_Adminhtml_Model_System_Config_Backend_Serialized 18 | { 19 | protected function _beforeSave() 20 | { 21 | // Clean given value by removing "__empty" and incomplete sub values 22 | $value = $this->getValue(); 23 | 24 | if (is_array(($value))) { 25 | unset($value['__empty']); 26 | foreach ($value as $key => $exception) { 27 | if (trim($exception['block_type']) == '') { 28 | unset($value[$key]); 29 | } 30 | } 31 | } else { 32 | $value = array(); 33 | } 34 | 35 | $this->setValue($value); 36 | parent::_beforeSave(); 37 | } 38 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Column/Renderer/Collection/Store.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Column_Renderer_Collection_Store 17 | extends BL_CustomGrid_Model_Column_Renderer_Collection_Abstract 18 | { 19 | public function getColumnGridValues($index, $store, $grid) 20 | { 21 | return array( 22 | 'filter' => 'customgrid/widget_grid_column_filter_store', 23 | 'renderer' => 'customgrid/widget_grid_column_renderer_store', 24 | 'skip_website' => (bool) $this->_getData('skip_website'), 25 | 'skip_store' => (bool) $this->_getData('skip_store'), 26 | 'skip_store_view' => (bool) $this->_getData('skip_store_view'), 27 | 'skip_all_views' => (bool) $this->_getData('skip_all_views'), 28 | 'flat_value_key' => $this->_getData('flat_value_key'), 29 | ); 30 | } 31 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/System/Config/Source/Boolean/Config.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_System_Config_Source_Boolean_Config 17 | { 18 | static protected $_options = null; 19 | 20 | public function getOptions() 21 | { 22 | if (is_null(self::$_options)) { 23 | self::$_options = array( 24 | array( 25 | 'label' => Mage::helper('customgrid')->__('Use Config'), 26 | 'value' => 0 27 | ), 28 | array( 29 | 'label' => Mage::helper('customgrid')->__('Yes'), 30 | 'value' => 1 31 | ), 32 | array( 33 | 'label' => Mage::helper('customgrid')->__('No'), 34 | 'value' => 2 35 | ), 36 | ); 37 | } 38 | return self::$_options; 39 | } 40 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/controllers/Custom/Grid/Editor/ProductController.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Custom_Grid_Editor_ProductController 17 | extends Mage_Adminhtml_Controller_Action 18 | { 19 | public function wysiwygAction() 20 | { 21 | $elementId = $this->getRequest()->getParam('element_id', md5(microtime())); 22 | $storeId = $this->getRequest()->getParam('store_id', 0); 23 | $storeMediaUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); 24 | 25 | $content = $this->getLayout()->createBlock('customgrid/widget_grid_form_helper_product_wysiwyg_content', '', array( 26 | 'editor_element_id' => $elementId, 27 | 'store_id' => $storeId, 28 | 'store_media_url' => $storeMediaUrl, 29 | )); 30 | 31 | $this->getResponse()->setBody($content->toHtml()); 32 | } 33 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Custom/Column/Simple/Duplicate.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Custom_Column_Simple_Duplicate 17 | extends BL_CustomGrid_Model_Custom_Column_Simple_Abstract 18 | { 19 | public function getDuplicatedField() 20 | { 21 | return $this->getModelParam('duplicated_field'); 22 | } 23 | 24 | public function addFieldToGridCollection($alias, $params, $block, $collection) 25 | { 26 | $helper = $this->_getCollectionHelper(); 27 | $mainAlias = $helper->getCollectionMainTableAlias($collection); 28 | list($adapter, $qi) = $this->_getCollectionAdapter($collection, true); 29 | $field = $this->getDuplicatedField(); 30 | $collection->getSelect()->columns(array($alias => $mainAlias.'.'.$field)); 31 | $helper->addFilterToCollectionMap($collection, $qi($mainAlias.'.'.$field), $alias); 32 | return $this; 33 | } 34 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Renderer/Order/Items/Default.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Column_Renderer_Order_Items_Default 17 | extends BL_CustomGrid_Block_Widget_Grid_Column_Renderer_Sales_Items_Abstract 18 | { 19 | protected function _getItemsBlockType() 20 | { 21 | return 'adminhtml/sales_order_view_items'; 22 | } 23 | 24 | protected function _getActionLayoutHandle() 25 | { 26 | return 'adminhtml_sales_order_view'; 27 | } 28 | 29 | protected function _getItemsBlockLayoutName() 30 | { 31 | return 'order_items'; 32 | } 33 | 34 | protected function _getItemsBlockDefaultTemplate() 35 | { 36 | return 'sales/order/view/items.phtml'; 37 | } 38 | 39 | protected function _prepareItemsBlock(Varien_Object $row) 40 | { 41 | $this->setOrder($row); 42 | return $this; 43 | } 44 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Column/Renderer/Collection/Datetime.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Column_Renderer_Collection_Datetime 17 | extends BL_CustomGrid_Model_Column_Renderer_Collection_Abstract 18 | { 19 | public function getColumnGridValues($index, $store, $grid) 20 | { 21 | $values = array( 22 | 'filter' => 'customgrid/widget_grid_column_filter_datetime', 23 | 'renderer' => 'customgrid/widget_grid_column_renderer_datetime', 24 | 'filter_time' => ($this->_getData('filter_time') ? true : false), 25 | ); 26 | 27 | if ($format = $this->_getData('format')) { 28 | try { 29 | $values['format'] = Mage::app()->getLocale()->getDateTimeFormat($format); 30 | } catch (Exception $e) { 31 | $values['format'] = null; 32 | } 33 | } 34 | 35 | return $values; 36 | } 37 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/System/Config/Source/Default/Param/Behaviour/Scalar.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_System_Config_Source_Default_Param_Behaviour_Scalar 17 | { 18 | public function toOptionArray() 19 | { 20 | $helper = Mage::helper('customgrid'); 21 | return array( 22 | array( 23 | 'value' => BL_CustomGrid_Model_Grid::GRID_DEFAULT_PARAM_DEFAULT, 24 | 'label' => $helper->__('Default (Last Set Value is Used)'), 25 | ), 26 | array( 27 | 'value' => BL_CustomGrid_Model_Grid::GRID_DEFAULT_PARAM_FORCE_ORIGINAL, 28 | 'label' => $helper->__('Force Original Value'), 29 | ), 30 | array( 31 | 'value' => BL_CustomGrid_Model_Grid::GRID_DEFAULT_PARAM_FORCE_CUSTOM, 32 | 'label' => $helper->__('Force Custom Value'), 33 | ), 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Custom/Column/Order/Payment.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Custom_Column_Order_Payment 17 | extends BL_CustomGrid_Model_Custom_Column_Simple_Table 18 | { 19 | public function initConfig() 20 | { 21 | parent::initConfig(); 22 | $this->addExcludedVersions('1.4.0.*'); 23 | return $this; 24 | } 25 | 26 | public function getTableName() 27 | { 28 | return 'sales/order_payment'; 29 | } 30 | 31 | public function getJoinConditionMainField() 32 | { 33 | return (($field = parent::getJoinConditionMainField()) ? $field : 'entity_id'); 34 | } 35 | 36 | public function getJoinConditionTableField() 37 | { 38 | return (($field = parent::getJoinConditionTableField()) ? $field : 'parent_id'); 39 | } 40 | 41 | public function getTableFieldName() 42 | { 43 | return $this->getModelParam('payment_field'); 44 | } 45 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Custom/Column/Shipment/Items/Custom.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Custom_Column_Shipment_Items_Custom 17 | extends BL_CustomGrid_Model_Custom_Column_Shipment_Items_Abstract 18 | { 19 | protected function _isCustomizableList() 20 | { 21 | return true; 22 | } 23 | 24 | public function getItemValues() 25 | { 26 | if (!$this->hasData('item_values')) { 27 | $baseValues = array( 28 | 'name' => 'Name', 29 | 'sku' => 'SKU', 30 | 'quantity' => 'Qty', 31 | ); 32 | $this->setData('item_values', $this->_getItemValuesList($baseValues, array(), 'blcg_custom_column_shipment_items_custom_values')); 33 | } 34 | return $this->_getData('item_values'); 35 | } 36 | 37 | protected function _getGridColumnRenderer() 38 | { 39 | return 'customgrid/widget_grid_column_renderer_shipment_items_custom'; 40 | } 41 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Column/Renderer/Attribute/Abstract.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | abstract class BL_CustomGrid_Model_Column_Renderer_Attribute_Abstract 17 | extends BL_CustomGrid_Model_Column_Renderer_Abstract 18 | { 19 | /** 20 | * Return whether this renderer can be used to render a grid attribute column 21 | * 22 | * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute Column attribute 23 | * @param BL_CustomGrid_Model_Grid $grid Grid model 24 | * @return bool 25 | */ 26 | abstract public function isAppliableToColumn($attribute, $grid); 27 | 28 | /** 29 | * Return values to be used for column configuration in grid block 30 | * 31 | * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute Column attribute 32 | * @param Mage_Core_Model_Store $store Current store 33 | * @param BL_CustomGrid_Model_Grid $grid Grid model 34 | * @return array 35 | */ 36 | abstract public function getColumnGridValues($attribute, $store, $grid); 37 | } -------------------------------------------------------------------------------- /app/design/adminhtml/default/default/template/bl/customgrid/widget/grid/column/renderer/sales/items/sub/default.phtml: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | ?> 16 | getValue()->getItemValues(); 18 | $_rowsHtml = $this->getValue()->getRowsHtml(); 19 | ?> 20 | 21 | 22 | getValue()->getHideHeader()): ?> 23 | 24 | 25 | getItemValueCssClasses($_itemValue, 'header_align')): ?> class="">htmlEscape($_itemValue['name']) ?> 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 |
-------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Renderer/Invoice/Items/Default.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Column_Renderer_Invoice_Items_Default 17 | extends BL_CustomGrid_Block_Widget_Grid_Column_Renderer_Sales_Items_Abstract 18 | { 19 | protected function _getItemsBlockType() 20 | { 21 | return 'adminhtml/sales_order_invoice_view_items'; 22 | } 23 | 24 | protected function _getActionLayoutHandle() 25 | { 26 | return 'adminhtml_sales_order_invoice_view'; 27 | } 28 | 29 | protected function _getItemsBlockLayoutName() 30 | { 31 | return 'invoice_items'; 32 | } 33 | 34 | protected function _getItemsBlockDefaultTemplate() 35 | { 36 | return 'sales/order/invoice/view/items.phtml'; 37 | } 38 | 39 | protected function _prepareItemsBlock(Varien_Object $row) 40 | { 41 | Mage::unregister('current_invoice'); 42 | Mage::register('current_invoice', $row); 43 | return $this; 44 | } 45 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Renderer/Shipment/Items/Default.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Column_Renderer_Shipment_Items_Default 17 | extends BL_CustomGrid_Block_Widget_Grid_Column_Renderer_Sales_Items_Abstract 18 | { 19 | protected function _getItemsBlockType() 20 | { 21 | return 'adminhtml/sales_order_shipment_view_items'; 22 | } 23 | 24 | protected function _getActionLayoutHandle() 25 | { 26 | return 'adminhtml_sales_order_shipment_view'; 27 | } 28 | 29 | protected function _getItemsBlockLayoutName() 30 | { 31 | return 'shipment_items'; 32 | } 33 | 34 | protected function _getItemsBlockDefaultTemplate() 35 | { 36 | return 'sales/order/shipment/view/items.phtml'; 37 | } 38 | 39 | protected function _prepareItemsBlock(Varien_Object $row) 40 | { 41 | Mage::unregister('current_shipment'); 42 | Mage::register('current_shipment', $row); 43 | return $this; 44 | } 45 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Custom/Column/Order/Base.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Custom_Column_Order_Base 17 | extends BL_CustomGrid_Model_Custom_Column_Simple_Table 18 | { 19 | public function initConfig() 20 | { 21 | parent::initConfig(); 22 | 23 | // Those versions don't have the sales_flat_order_grid table 24 | $this->addExcludedVersions('1.4.0.*'); 25 | 26 | return $this; 27 | } 28 | 29 | public function getTableName() 30 | { 31 | return 'sales/order'; 32 | } 33 | 34 | public function getJoinConditionMainField() 35 | { 36 | return (($field = parent::getJoinConditionMainField()) ? $field : 'entity_id'); 37 | } 38 | 39 | public function getJoinConditionTableField() 40 | { 41 | return (($field = parent::getJoinConditionTableField()) ? $field : 'entity_id'); 42 | } 43 | 44 | public function getTableFieldName() 45 | { 46 | return $this->getModelParam('order_field'); 47 | } 48 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Renderer/Creditmemo/Items/Default.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Column_Renderer_Creditmemo_Items_Default 17 | extends BL_CustomGrid_Block_Widget_Grid_Column_Renderer_Sales_Items_Abstract 18 | { 19 | protected function _getItemsBlockType() 20 | { 21 | return 'adminhtml/sales_order_creditmemo_view_items'; 22 | } 23 | 24 | protected function _getActionLayoutHandle() 25 | { 26 | return 'adminhtml_sales_order_creditmemo_view'; 27 | } 28 | 29 | protected function _getItemsBlockLayoutName() 30 | { 31 | return 'creditmemo_items'; 32 | } 33 | 34 | protected function _getItemsBlockDefaultTemplate() 35 | { 36 | return 'sales/order/creditmemo/view/items.phtml'; 37 | } 38 | 39 | protected function _prepareItemsBlock(Varien_Object $row) 40 | { 41 | Mage::unregister('current_creditmemo'); 42 | Mage::register('current_creditmemo', $row); 43 | return $this; 44 | } 45 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Renderer/Order/Items/Custom.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Column_Renderer_Order_Items_Custom 17 | extends BL_CustomGrid_Block_Widget_Grid_Column_Renderer_Sales_Items_Custom_Abstract 18 | { 19 | protected function _getItemsBlockType() 20 | { 21 | return 'adminhtml/sales_order_view_items'; 22 | } 23 | 24 | protected function _getActionLayoutHandle() 25 | { 26 | return 'adminhtml_sales_order_view'; 27 | } 28 | 29 | protected function _getItemsBlockLayoutName() 30 | { 31 | return 'order_items'; 32 | } 33 | 34 | protected function _getItemsBlockDefaultTemplate() 35 | { 36 | return 'sales/order/view/items.phtml'; 37 | } 38 | 39 | protected function _prepareItemsBlock(Varien_Object $row) 40 | { 41 | $this->_getItemsBlock()->setOrder($row); 42 | return $this; 43 | } 44 | 45 | protected function _getRowKey() 46 | { 47 | return 'order'; 48 | } 49 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Form/Helper/Product/Wysiwyg.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Form_Helper_Product_Wysiwyg 17 | extends Mage_Adminhtml_Block_Catalog_Helper_Form_Wysiwyg 18 | { 19 | public function getAfterElementHtml() 20 | { 21 | $html = Varien_Data_Form_Element_Textarea::getAfterElementHtml(); 22 | if ($this->getIsWysiwygEnabled()) { 23 | $disabled = ($this->getDisabled() || $this->getReadonly()); 24 | $html .= Mage::getSingleton('core/layout') 25 | ->createBlock('adminhtml/widget_button', '', array( 26 | 'label' => Mage::helper('catalog')->__('WYSIWYG Editor'), 27 | 'type' => 'button', 28 | 'disabled' => $disabled, 29 | 'class' => ($disabled) ? 'disabled' : '', 30 | 'onclick' => 'catalogWysiwygEditor.open(\''.Mage::helper('adminhtml')->getUrl('customgrid/custom_grid_editor_product/wysiwyg').'\', \''.$this->getHtmlId().'\')' 31 | ))->toHtml(); 32 | } 33 | return $html; 34 | } 35 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Renderer/Invoice/Items/Custom.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Column_Renderer_Invoice_Items_Custom 17 | extends BL_CustomGrid_Block_Widget_Grid_Column_Renderer_Sales_Items_Custom_Abstract 18 | { 19 | protected function _getItemsBlockType() 20 | { 21 | return 'adminhtml/sales_order_invoice_view_items'; 22 | } 23 | 24 | protected function _getActionLayoutHandle() 25 | { 26 | return 'adminhtml_sales_order_invoice_view'; 27 | } 28 | 29 | protected function _getItemsBlockLayoutName() 30 | { 31 | return 'invoice_items'; 32 | } 33 | 34 | protected function _getItemsBlockDefaultTemplate() 35 | { 36 | return 'sales/order/invoice/view/items.phtml'; 37 | } 38 | 39 | protected function _prepareItemsBlock(Varien_Object $row) 40 | { 41 | Mage::unregister('current_invoice'); 42 | Mage::register('current_invoice', $row); 43 | return $this; 44 | } 45 | 46 | protected function _getRowKey() 47 | { 48 | return 'invoice'; 49 | } 50 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Grid/Rewriter/Eval.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Grid_Rewriter_Eval 17 | extends BL_CustomGrid_Model_Grid_Rewriter_Abstract 18 | { 19 | protected function _isEvalDisabled() 20 | { 21 | if (extension_loaded('suhosin')) { 22 | // This does not check suhosin.executor.eval.whitelist or blacklist 23 | return (@ini_get('suhosin.executor.disable_eval') == '1'); 24 | } 25 | return false; 26 | } 27 | 28 | protected function _rewriteGrid($blcgClass, $originalClass, $gridType) 29 | { 30 | if (!$this->_isEvalDisabled()) { 31 | try { 32 | eval($this->_getRewriteCode($blcgClass, $originalClass, $gridType)); 33 | } catch (Exception $e) { 34 | Mage::throwException(Mage::helper('customgrid')->__('An error occured while eval()ing the rewrite code : "%s"', $e->getMessage())); 35 | } 36 | } else { 37 | Mage::throwException(Mage::helper('customgrid')->__('eval() is not available on your server')); 38 | } 39 | return $this; 40 | } 41 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Renderer/Shipment/Items/Custom.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Column_Renderer_Shipment_Items_Custom 17 | extends BL_CustomGrid_Block_Widget_Grid_Column_Renderer_Sales_Items_Custom_Abstract 18 | { 19 | protected function _getItemsBlockType() 20 | { 21 | return 'adminhtml/sales_order_shipment_view_items'; 22 | } 23 | 24 | protected function _getActionLayoutHandle() 25 | { 26 | return 'adminhtml_sales_order_shipment_view'; 27 | } 28 | 29 | protected function _getItemsBlockLayoutName() 30 | { 31 | return 'shipment_items'; 32 | } 33 | 34 | protected function _getItemsBlockDefaultTemplate() 35 | { 36 | return 'sales/order/shipment/view/items.phtml'; 37 | } 38 | 39 | protected function _prepareItemsBlock(Varien_Object $row) 40 | { 41 | Mage::unregister('current_shipment'); 42 | Mage::register('current_shipment', $row); 43 | return $this; 44 | } 45 | 46 | protected function _getRowKey() 47 | { 48 | return 'shipment'; 49 | } 50 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Renderer/Creditmemo/Items/Custom.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Column_Renderer_Creditmemo_Items_Custom 17 | extends BL_CustomGrid_Block_Widget_Grid_Column_Renderer_Sales_Items_Custom_Abstract 18 | { 19 | protected function _getItemsBlockType() 20 | { 21 | return 'adminhtml/sales_order_creditmemo_view_items'; 22 | } 23 | 24 | protected function _getActionLayoutHandle() 25 | { 26 | return 'adminhtml_sales_order_creditmemo_view'; 27 | } 28 | 29 | protected function _getItemsBlockLayoutName() 30 | { 31 | return 'creditmemo_items'; 32 | } 33 | 34 | protected function _getItemsBlockDefaultTemplate() 35 | { 36 | return 'sales/order/creditmemo/view/items.phtml'; 37 | } 38 | 39 | protected function _prepareItemsBlock(Varien_Object $row) 40 | { 41 | Mage::unregister('current_creditmemo'); 42 | Mage::register('current_creditmemo', $row); 43 | return $this; 44 | } 45 | 46 | protected function _getRowKey() 47 | { 48 | return 'creditmemo'; 49 | } 50 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Renderer/Sales/Items/Sub/Abstract.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Column_Renderer_Sales_Items_Sub_Abstract 17 | extends Mage_Adminhtml_Block_Template 18 | implements BL_CustomGrid_Block_Widget_Grid_Column_Renderer_Sales_Items_Sub_Interface 19 | { 20 | public function canRender(Varien_Object $value) 21 | { 22 | return true; 23 | } 24 | 25 | public function render(Varien_Object $value) 26 | { 27 | $this->setValue($value); 28 | return parent::toHtml(); 29 | } 30 | 31 | public function getItemValueCssClasses(array $value, $alignmentKey=null) 32 | { 33 | $classes = array(); 34 | 35 | if (isset($value['last']) && $value['last']) { 36 | $classes[] = 'last'; 37 | } 38 | if (!empty($alignmentKey) && isset($value[$alignmentKey])) { 39 | if (in_array($value[$alignmentKey], array('left', 'center', 'right'))) { 40 | $classes[] = 'a-'.$value[$alignmentKey]; 41 | } 42 | } 43 | 44 | return implode(' ', $classes); 45 | } 46 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/controllers/Custom/Grid/Column/FilterController.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Custom_Grid_Column_FilterController 17 | extends Mage_Adminhtml_Controller_Action 18 | { 19 | public function categoriesAction() 20 | { 21 | $this->loadLayout(); 22 | 23 | if ($block = $this->getLayout()->getBlock('customgrid.filter.categories.chooser')) { 24 | $jsObject = $this->getRequest()->getParam('js_object', null); 25 | $categoryIds = array_unique(explode(',', $this->getRequest()->getParam('ids', null))); 26 | $block->setJsObject($jsObject)->setCategoryIds($categoryIds); 27 | } 28 | 29 | $this->renderLayout(); 30 | } 31 | 32 | public function categoriesJsonAction() 33 | {; 34 | $this->getResponse()->setBody( 35 | $this->getLayout()->createBlock('customgrid/widget_grid_column_filter_product_categories_chooser') 36 | ->setCategoryIds(array_unique(explode(',', $this->getRequest()->getParam('ids', null)))) 37 | ->getCategoryChildrenJson($this->getRequest()->getParam('category')) 38 | ); 39 | } 40 | } -------------------------------------------------------------------------------- /app/design/adminhtml/default/default/template/bl/customgrid/column/renderer/attribute/select.phtml: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | ?> 16 |
17 | 22 |
23 | getParamsTargetId() != ''): ?> 24 | 27 | -------------------------------------------------------------------------------- /app/design/adminhtml/default/default/template/bl/customgrid/widget/grid/columns/config/infos.phtml: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | ?> 16 |
getStartDisplayed()): ?> style="display:none;"> 17 |
18 |
19 | __('Grid Informations:') ?> 20 |
21 |
22 | 23 | getGridInformations() as $_infos): ?> 24 | 25 | 26 | 27 | 28 | getIsNewModel()): ?> 29 | 30 | 31 |
:
__('Discovery Mode') ?>
32 |
33 |
34 |
35 |
-------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Custom/Column/Config/Form.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Custom_Column_Config_Form 17 | extends BL_CustomGrid_Block_Config_Form_Abstract 18 | { 19 | public function getCustomColumn() 20 | { 21 | if (!$column = Mage::registry('current_custom_column')) { 22 | Mage::throwException($this->__('Custom column is not specified')); 23 | } 24 | return $column; 25 | } 26 | 27 | protected function _getFormId() 28 | { 29 | return 'custom_column_config_options_form'; 30 | } 31 | 32 | protected function _getFormCode() 33 | { 34 | return $this->getCustomColumn()->getId(); 35 | } 36 | 37 | public function addConfigFields($fieldset) 38 | { 39 | $column = $this->getCustomColumn(); 40 | $module = $column->getModule(); 41 | $this->_translationHelper = Mage::helper($module ? $module : 'customgrid'); 42 | 43 | if (!$column->getAllowCustomization()) { 44 | return $this; 45 | } 46 | foreach ($column->getCustomParamsConfig() as $parameter) { 47 | $this->_addConfigField($fieldset, $parameter); 48 | } 49 | 50 | return $this; 51 | } 52 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Filter/Text.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Column_Filter_Text 17 | extends Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Text 18 | { 19 | public function getCondition() 20 | { 21 | $helper = Mage::helper('core/string'); 22 | $value = $this->getValue(); 23 | $length = $helper->strlen($value); 24 | $expr = ''; 25 | 26 | $singleWc = $this->getColumn()->getSingleWildcard(); 27 | $multipleWc = $this->getColumn()->getMultipleWildcard(); 28 | 29 | for ($i=0; $i<$length; $i++) { 30 | $char = $helper->substr($value, $i, 1); 31 | 32 | if ($char === $singleWc) { 33 | $expr .= '_'; 34 | } elseif ($char === $multipleWc) { 35 | $expr .= '%'; 36 | } elseif (($char === '%') || ($char === '_')) { 37 | $expr .= '\\'.$char; 38 | } elseif ($char == '\\') { 39 | $expr .= '\\\\'; 40 | } else { 41 | $expr .= $char; 42 | } 43 | } 44 | 45 | return array('like' => (!$this->getColumn()->getExactFilter() ? '%'.$expr.'%' : $expr)); 46 | } 47 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Columns/Filters.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Columns_Filters 17 | extends Mage_Adminhtml_Block_Template 18 | { 19 | protected function _construct() 20 | { 21 | parent::_construct(); 22 | $this->setTemplate('bl/customgrid/widget/grid/columns/filters.phtml'); 23 | } 24 | 25 | public function getColumns() 26 | { 27 | $columns = array(); 28 | 29 | if ($gridBlock = $this->getGridBlock()) { 30 | foreach ($gridBlock->getColumns() as $column) { 31 | if ($column->getBlcgFilterOnly()) { 32 | $columns[] = $column; 33 | } 34 | } 35 | } 36 | 37 | return $columns; 38 | } 39 | 40 | protected function _toHtml() 41 | { 42 | if (!$this->getIsNewGridModel() 43 | && ($gridBlock = $this->getGridBlock()) 44 | && $gridBlock->getFilterVisibility()) { 45 | return parent::_toHtml(); 46 | } 47 | return ''; 48 | } 49 | 50 | // @todo next step: either enable sortability, either only apply filters, do not select values when it's not needed (eg for attribute columns and custom columns with sub-queries) 51 | } -------------------------------------------------------------------------------- /app/design/adminhtml/default/default/template/bl/customgrid/column/renderer/collection/descriptions.phtml: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | ?> 16 | getDescriptionsOutput()): ?> 17 | _setDescriptionsOutput(true) ?> 18 | 29 | 37 | -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Column/Renderer/Collection/Date.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Column_Renderer_Collection_Date 17 | extends BL_CustomGrid_Model_Column_Renderer_Collection_Abstract 18 | { 19 | public function getColumnGridValues($index, $store, $grid) 20 | { 21 | $values = array( 22 | /* 23 | Use datetime filter, as there doesnt seem to be any inconvenience for it, 24 | and because using a simple date filter can cause problems when we have date fields 25 | stored on datetime database values, and for which there a time is set, different than 0:00, 26 | depending on timezone, which lead to excluding rows from search that should be taken 27 | */ 28 | 'filter' => 'customgrid/widget_grid_column_filter_datetime', 29 | 'renderer' => 'customgrid/widget_grid_column_renderer_date', 30 | 'filter_time' => false, 31 | ); 32 | 33 | if ($format = $this->_getData('format')) { 34 | try { 35 | $values['format'] = Mage::app()->getLocale()->getDateFormat($format); 36 | } catch (Exception $e) { 37 | $values['format'] = null; 38 | } 39 | } 40 | 41 | return $values; 42 | } 43 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/System/Config/Source/Product/Categories/Filter/Mode.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_System_Config_Source_Product_Categories_Filter_Mode 17 | { 18 | public function toOptionArray() 19 | { 20 | $helper = Mage::helper('customgrid'); 21 | return array( 22 | array( 23 | 'value' => BL_CustomGrid_Model_Custom_Column_Product_Categories::FILTER_MODE_ONE_CHOOSEN, 24 | 'label' => $helper->__('The filtered products must belong to at least one chosen category'), 25 | ), 26 | array( 27 | 'value' => BL_CustomGrid_Model_Custom_Column_Product_Categories::FILTER_MODE_ALL_CHOOSEN, 28 | 'label' => $helper->__('The filtered products must belong to all chosen categories'), 29 | ), 30 | array( 31 | 'value' => BL_CustomGrid_Model_Custom_Column_Product_Categories::FILTER_MODE_NONE_CHOOSEN, 32 | 'label' => $helper->__('The filtered products must not belong to any of the chosen categories'), 33 | ), 34 | array( 35 | 'value' => BL_CustomGrid_Model_Custom_Column_Product_Categories::FILTER_MODE_CUSTOM, 36 | 'label' => $helper->__('Custom'), 37 | ), 38 | ); 39 | } 40 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Columns/Config/Infos.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Columns_Config_Infos 17 | extends BL_CustomGrid_Block_Widget_Grid_Columns_Config_Abstract 18 | { 19 | protected function _construct() 20 | { 21 | parent::_construct(); 22 | $this->setTemplate('bl/customgrid/widget/grid/columns/config/infos.phtml'); 23 | } 24 | 25 | public function getGridInformations() 26 | { 27 | $block = $this->getGridBlock(); 28 | $model = $this->getGridModel(); 29 | $helper = Mage::helper('customgrid'); 30 | 31 | return array( 32 | array('label' => $helper->__('Block Type'), 'value' => $model->getBlockType()), 33 | array('label' => $helper->__('Grid Type'), 'value' => $model->getTypeModelName($helper->__('none'))), 34 | array('label' => $helper->__('Rewriting Class'), 'value' => $model->getRewritingClassName()), 35 | array('label' => $helper->__('Module Name'), 'value' => $model->getModuleName()), 36 | array('label' => $helper->__('Controller Name'), 'value' => $model->getControllerName()), 37 | array('label' => $helper->__('Block ID'), 'value' => ($block ? $block->getId() : $model->getBlockId())), 38 | ); 39 | } 40 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Options/Source/Edit/Tab/General.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Options_Source_Edit_Tab_General 17 | extends Mage_Adminhtml_Block_Widget_Form 18 | { 19 | protected function _prepareForm() 20 | { 21 | $source = Mage::registry('current_options_source'); 22 | 23 | $form = new Varien_Data_Form(); 24 | $fieldset = $form->addFieldset('general', array('legend' => $this->__('General'))); 25 | 26 | if (!$source->getId()) { 27 | $fieldset->addField('type', 'hidden', array( 28 | 'name' => 'type', 29 | 'value' => $this->getRequest()->getParam('type', null), 30 | )); 31 | } 32 | 33 | $fieldset->addField('name', 'text', array( 34 | 'name' => 'name', 35 | 'label' => $this->__('Name'), 36 | 'title' => $this->__('Name'), 37 | 'class' => 'required-entry', 38 | 'required' => true, 39 | )); 40 | 41 | $fieldset->addField('description', 'textarea', array( 42 | 'name' => 'description', 43 | 'label' => $this->__('Description'), 44 | 'title' => $this->__('Description'), 45 | )); 46 | 47 | $form->setValues($source->getData()); 48 | $this->setForm($form); 49 | } 50 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Column/Renderer/Attribute/Product/Image.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Column_Renderer_Attribute_Product_Image 17 | extends BL_CustomGrid_Model_Column_Renderer_Attribute_Abstract 18 | { 19 | public function isAppliableToColumn($attribute, $grid) 20 | { 21 | return ($attribute->getFrontendModel() == 'catalog/product_attribute_frontend_image'); 22 | } 23 | 24 | public function getColumnGridValues($attribute, $store, $grid) 25 | { 26 | return array( 27 | 'filter' => 'customgrid/widget_grid_column_filter_product_image', 28 | 'renderer' => 'customgrid/widget_grid_column_renderer_product_image', 29 | 'display_images' => (bool)$this->_getData('display_images'), 30 | 'display_images_urls' => (bool)$this->_getData('display_images_urls'), 31 | 'original_image_link' => (bool)$this->_getData('original_image_link'), 32 | 'image_width' => $this->_getData('image_width'), 33 | 'image_height' => $this->_getData('image_height'), 34 | 'browser_resize_only' => (bool)$this->_getData('browser_resize_only'), 35 | 'filter_on_name' => (bool)$this->_getData('filter_on_name'), 36 | 'attribute_code' => $attribute->getAttributeCode(), 37 | ); 38 | } 39 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Form/Helper/Product/Wysiwyg/Content.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Form_Helper_Product_Wysiwyg_Content 17 | extends Mage_Adminhtml_Block_Widget_Form 18 | { 19 | protected function _prepareForm() 20 | { 21 | $form = new Varien_Data_Form(array( 22 | 'id' => 'wysiwyg_edit_form', 23 | 'action' => $this->_getData('action'), 24 | 'method' => 'post', 25 | )); 26 | 27 | $config['document_base_url'] = $this->_getData('store_media_url'); 28 | $config['store_id'] = $this->_getData('store_id'); 29 | $config['add_variables'] = false; 30 | $config['add_widgets'] = false; 31 | $config['add_directives'] = true; 32 | $config['use_container'] = true; 33 | $config['container_class'] = 'hor-scroll'; 34 | 35 | $form->addField($this->_getData('editor_element_id'), 'editor', array( 36 | 'name' => 'content', 37 | 'style' => 'width:725px; height:460px', 38 | 'required' => true, 39 | 'force_load' => true, 40 | 'config' => Mage::helper('customgrid/editor')->getWysiwygConfig($config) 41 | )); 42 | 43 | $this->setForm($form); 44 | return parent::_prepareForm(); 45 | } 46 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Custom/Column/Invoice/Items/Custom.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Custom_Column_Invoice_Items_Custom 17 | extends BL_CustomGrid_Model_Custom_Column_Invoice_Items_Abstract 18 | { 19 | protected function _isCustomizableList() 20 | { 21 | return true; 22 | } 23 | 24 | public function getItemValues() 25 | { 26 | if (!$this->hasData('item_values')) { 27 | $baseValues = array( 28 | 'name' => 'Name', 29 | 'sku' => 'SKU', 30 | 'quantity' => 'Qty', 31 | 'tax_amount' => 'Tax Amount', 32 | 'discount_amount' => 'Discount Amount', 33 | 'row_total' => 'Row Total', 34 | ); 35 | 36 | $amountsKeys = array( 37 | 'tax_amount', 38 | 'discount_amount', 39 | 'row_total', 40 | ); 41 | 42 | $this->setData('item_values', $this->_getItemValuesList($baseValues, $amountsKeys, 'blcg_custom_column_invoice_items_custom_values')); 43 | } 44 | return $this->_getData('item_values'); 45 | } 46 | 47 | protected function _getGridColumnRenderer() 48 | { 49 | return 'customgrid/widget_grid_column_renderer_invoice_items_custom'; 50 | } 51 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Custom/Column/Creditmemo/Items/Custom.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Custom_Column_Creditmemo_Items_Custom 17 | extends BL_CustomGrid_Model_Custom_Column_Creditmemo_Items_Abstract 18 | { 19 | protected function _isCustomizableList() 20 | { 21 | return true; 22 | } 23 | 24 | public function getItemValues() 25 | { 26 | if (!$this->hasData('item_values')) { 27 | $baseValues = array( 28 | 'name' => 'Name', 29 | 'sku' => 'SKU', 30 | 'quantity' => 'Qty', 31 | 'tax_amount' => 'Tax Amount', 32 | 'discount_amount' => 'Discount Amount', 33 | 'row_total' => 'Row Total', 34 | ); 35 | 36 | $amountsKeys = array( 37 | 'tax_amount', 38 | 'discount_amount', 39 | 'row_total', 40 | ); 41 | 42 | $this->setData('item_values', $this->_getItemValuesList($baseValues, $amountsKeys, 'blcg_custom_column_creditmemo_items_custom_values')); 43 | } 44 | return $this->_getData('item_values'); 45 | } 46 | 47 | protected function _getGridColumnRenderer() 48 | { 49 | return 'customgrid/widget_grid_column_renderer_creditmemo_items_custom'; 50 | } 51 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Options/Source/Edit/Tab/Custom.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Options_Source_Edit_Tab_Custom 17 | extends Mage_Adminhtml_Block_Widget_Form 18 | implements Mage_Adminhtml_Block_Widget_Tab_Interface 19 | { 20 | protected function _prepareForm() 21 | { 22 | $source = Mage::registry('current_options_source'); 23 | 24 | $form = new Varien_Data_Form(); 25 | $fieldset = $form->addFieldset('custom_list', array('legend' => $this->__('Custom List'))); 26 | 27 | $fieldset->addField('options', 'text', array( 28 | 'name' => 'options', 29 | 'label' => $this->__('Options List'), 30 | 'class' => 'required-entry', 31 | 'value' => $source->getData('options'), 32 | )); 33 | 34 | $form->getElement('options')->setRenderer( 35 | $this->getLayout()->createBlock('customgrid/options_source_edit_tab_custom_list') 36 | ); 37 | 38 | $this->setForm($form); 39 | } 40 | 41 | public function getTabLabel() 42 | { 43 | return $this->__('Custom List'); 44 | } 45 | 46 | public function getTabTitle() 47 | { 48 | return $this->__('Custom List'); 49 | } 50 | 51 | public function canShowTab() 52 | { 53 | return true; 54 | } 55 | 56 | public function isHidden() 57 | { 58 | return false; 59 | } 60 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Column/Renderer/Abstract.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | abstract class BL_CustomGrid_Block_Column_Renderer_Abstract 17 | extends Mage_Adminhtml_Block_Widget_Form_Container 18 | { 19 | abstract protected function _getController(); 20 | abstract protected function _getFormId(); 21 | abstract public function getRenderer(); 22 | 23 | public function __construct() 24 | { 25 | parent::__construct(); 26 | 27 | $this->_blockGroup = 'customgrid'; 28 | $this->_controller = $this->_getController(); 29 | $this->_mode = 'config'; 30 | $this->_headerText = $this->getRenderer()->getName(); 31 | 32 | $this->removeButton('reset'); 33 | $this->removeButton('back'); 34 | $this->_updateButton('save', 'label', $this->__('Apply Configuration')); 35 | $this->_updateButton('save', 'id', 'insert_button'); 36 | $this->_updateButton('save', 'onclick', 'blcgRendererConfig.insertParams()'); 37 | 38 | $this->_formScripts[] = 'blcgRendererConfig = new blcg.Renderer.Config("' . $this->_getFormId() . '", "' 39 | . $this->getRequest()->getParam('renderer_target_id') . '");'; 40 | } 41 | 42 | protected function _beforeToHtml() 43 | { 44 | if ($formBlock = $this->getChild('form')) { 45 | $formBlock->setConfigParams($this->getConfigParams()); 46 | } 47 | return parent::_beforeToHtml(); 48 | } 49 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Renderer/Product/Inventory.php: -------------------------------------------------------------------------------- 1 | getColumn()->getFieldType(); 10 | 11 | if ($this->getColumn()->getCanUseConfig()) { 12 | if ($row->getData($this->getColumn()->getUseConfigIndex())) { 13 | $useConfig = true; 14 | 15 | if ($this->getColumn()->getFieldName() == 'min_sale_qty') { 16 | $data = Mage::helper('cataloginventory/minsaleqty') 17 | ->getConfigValue(Mage_Customer_Model_Group::CUST_GROUP_ALL); 18 | } else { 19 | $data = Mage::getStoreConfig($this->getColumn()->getSystemConfigPath()); 20 | } 21 | } 22 | } 23 | if (!$useConfig) { 24 | $data = $row->getData($this->getColumn()->getIndex()); 25 | } 26 | if ($fieldType == 'boolean') { 27 | $data = Mage::helper('customgrid')->__($data ? 'Yes' : 'No'); 28 | } elseif ($fieldType == 'decimal') { 29 | $data *= 1; 30 | } elseif (($fieldType == 'options') 31 | && is_array($hash = $this->getColumn()->getOptionsHash()) 32 | && isset($hash[$data])) { 33 | $data = $hash[$data]; 34 | } 35 | 36 | $data = strval($data); 37 | 38 | if ($useConfig) { 39 | if (($text = $this->getColumn()->getUseConfigPrefix()) !== '') { 40 | $data = $text . ' ' . $data; 41 | } 42 | if (($text = $this->getColumn()->getUseConfigSuffix()) !== '') { 43 | $data .= ' ' . $text; 44 | } 45 | } 46 | 47 | return $data; 48 | } 49 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Renderer/Country/Eu.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Column_Renderer_Country_Eu 17 | extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract 18 | { 19 | protected function _render(Varien_Object $row, $displayFormat) 20 | { 21 | if ($displayFormat === '') { 22 | $displayFormat = '{is_eu_country}'; 23 | } 24 | 25 | $code = $this->_getValue($row); 26 | $searches = array('{is_eu_country}', '{country_code}', '{country_name}'); 27 | $replaces = array($this->__('No'), $code, $code); 28 | $countries = $this->getColumn()->getAllCountries(); 29 | 30 | if (is_array($countries) && isset($countries[$code])) { 31 | $replaces[0] = $this->__($countries[$code]->getIsEu() ? 'Yes' : 'No'); 32 | $replaces[2] = $countries[$code]->getName(); 33 | } 34 | 35 | return str_replace($searches, $replaces, $displayFormat); 36 | } 37 | 38 | public function render(Varien_Object $row) 39 | { 40 | return $this->_render($row, strval($this->getColumn()->getBaseDisplayFormat())); 41 | } 42 | 43 | public function renderExport(Varien_Object $row) 44 | { 45 | if (($displayFormat = strval($this->getColumn()->getExportDisplayFormat())) !== '') { 46 | return $this->_render($row, $displayFormat); 47 | } 48 | return $this->render($row); 49 | } 50 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Form/Static/Product/Inventory.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Form_Static_Product_Inventory 17 | extends BL_CustomGrid_Block_Widget_Grid_Form_Static_Default 18 | { 19 | protected function _getProductInventoryData($product, $field) 20 | { 21 | if ($product->getStockItem()) { 22 | return $product->getStockItem()->getDataUsingMethod($field); 23 | } 24 | return Mage::getStoreConfig(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_ITEM . $field); 25 | } 26 | 27 | protected function _prepareAddedField($id, $type, $name, $editedConfig, $field) 28 | { 29 | if (isset($editedConfig['inventory_field'])) { 30 | if ($editedConfig['inventory_field'] == 'qty') { 31 | $entity = $this->getEditedEntity(); 32 | $qtyValue = $this->_getProductInventoryData($entity, 'qty')*1; 33 | 34 | $field->setValue($qtyValue) 35 | ->setAfterElementHtml( 36 | $field->getAfterElementHtml() 37 | . '' 38 | ); 39 | } 40 | } 41 | return parent::_prepareAddedField($id, $type, $name, $editedConfig, $field); 42 | } 43 | 44 | protected function _initFormValues() 45 | { 46 | return $this; 47 | } 48 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Mysql4/Grid/Collection.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Mysql4_Grid_Collection 17 | extends Mage_Core_Model_Mysql4_Collection_Abstract 18 | { 19 | protected function _construct() 20 | { 21 | $this->_init('customgrid/grid'); 22 | } 23 | 24 | protected function _afterLoad() 25 | { 26 | parent::_afterLoad(); 27 | $this->walk('afterLoad'); 28 | } 29 | 30 | public function addColumnsToResult() 31 | { 32 | $gridIds = array(); 33 | foreach ($this as $grid) { 34 | $gridIds[] = $grid->getId(); 35 | } 36 | 37 | if (!empty($gridIds)) { 38 | $read = $this->getResource()->getReadConnection(); 39 | $columns = $read->fetchAll($read->select() 40 | ->from($this->getTable('customgrid/grid_column') 41 | ->columns('*') 42 | ->columns(array('is_visible' => new Zend_Db_Expr('IF(is_visible=2, 1, is_visible)'))) 43 | ->columns(array('filter_only' => new Zend_Db_Expr('IF(is_visible=2, 1, 0)'))) 44 | ->where('grid_id IN ?', $gridIds)) 45 | ->order(array('order', 'asc'))); 46 | 47 | foreach ($columns as $column) { 48 | if ($this->getItemById($column['grid_id'])) { 49 | $this->getItemById($column['grid_id'])->addColumn($column); 50 | } 51 | } 52 | } 53 | 54 | return $this; 55 | } 56 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Custom/Column/Order/Address/Abstract.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | abstract class BL_CustomGrid_Model_Custom_Column_Order_Address_Abstract 17 | extends BL_CustomGrid_Model_Custom_Column_Simple_Table 18 | { 19 | public function initConfig() 20 | { 21 | parent::initConfig(); 22 | $this->addExcludedVersions('1.4.0.*'); 23 | return $this; 24 | } 25 | 26 | public function getAppliedFlagKey($alias, $params, $block, $collection, $table) 27 | { 28 | return $table.'/'.$this->getAddressType(); 29 | } 30 | 31 | public function getTableName() 32 | { 33 | return 'sales/order_address'; 34 | } 35 | 36 | public function getJoinConditionMainField() 37 | { 38 | return (($field = parent::getJoinConditionMainField()) ? $field : 'entity_id'); 39 | } 40 | 41 | public function getJoinConditionTableField() 42 | { 43 | return (($field = parent::getJoinConditionTableField()) ? $field : 'parent_id'); 44 | } 45 | 46 | public function getTableFieldName() 47 | { 48 | return $this->getModelParam('address_field'); 49 | } 50 | 51 | abstract public function getAddressType(); 52 | 53 | public function getAdditionalJoinConditions($alias, $params, $block, $collection, $mainAlias, $tableAlias) 54 | { 55 | list($adapter, $qi) = $this->_getCollectionAdapter($collection, true); 56 | return array($adapter->quoteInto($qi($tableAlias.'.address_type').' = ?', $this->getAddressType())); 57 | } 58 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Column/Renderer/Collection/Options.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Column_Renderer_Collection_Options 17 | extends BL_CustomGrid_Model_Column_Renderer_Collection_Abstract 18 | { 19 | public function getColumnGridValues($index, $store, $grid) 20 | { 21 | if (($sourceId = $this->_getData('source_id')) 22 | && ($source = Mage::getModel('customgrid/options_source')->load($sourceId)) 23 | && $source->getId()) { 24 | $options = $source->getOptionsArray(); 25 | } else { 26 | $options = array(); 27 | } 28 | 29 | $implodedSeparator = $this->_getData('imploded_separator'); 30 | if (empty($implodedSeparator) && ($implodedSeparator != '0')) { 31 | $implodedSeparator = ','; 32 | } 33 | 34 | return array( 35 | 'filter' => 'customgrid/widget_grid_column_filter_select', 36 | 'renderer' => 'customgrid/widget_grid_column_renderer_options', 37 | 'options' => $options, 38 | 'boolean_filter' => (bool) $this->_getData('boolean_filter'), 39 | 'display_full_path' => (bool) $this->_getData('display_full_path'), 40 | 'options_separator' => $this->_getData('options_separator'), 41 | 'imploded_values' => (bool) $this->_getData('imploded_values'), 42 | 'imploded_separator' => $implodedSeparator, 43 | 'show_missing_option_values' => (bool) $this->_getData('show_missing'), 44 | ); 45 | } 46 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Custom/Column/Config.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Custom_Column_Config 17 | extends Mage_Adminhtml_Block_Widget_Form_Container 18 | { 19 | public function __construct() 20 | { 21 | parent::__construct(); 22 | 23 | $this->_blockGroup = 'customgrid'; 24 | $this->_controller = 'custom_column'; 25 | $this->_mode = 'config'; 26 | $this->_headerText = $this->getCustomColumn()->getName(); 27 | 28 | $this->removeButton('reset'); 29 | $this->removeButton('back'); 30 | $this->_updateButton('save', 'label', $this->__('Apply Configuration')); 31 | $this->_updateButton('save', 'id', 'insert_button'); 32 | $this->_updateButton('save', 'onclick', 'blcgCustomColumnForm.insertParams()'); 33 | 34 | $this->_formScripts[] = 'blcgCustomColumnForm = new blcg.CustomColumn.Form("custom_column_config_options_form", "' 35 | . $this->getRequest()->getParam('renderer_target_id') . '");'; 36 | } 37 | 38 | public function getCustomColumn() 39 | { 40 | if (!$column = Mage::registry('current_custom_column')) { 41 | Mage::throwException($this->__('Custom column is not specified')); 42 | } 43 | return $column; 44 | } 45 | 46 | protected function _beforeToHtml() 47 | { 48 | if ($formBlock = $this->getChild('form')) { 49 | $formBlock->setConfigParams($this->getConfigParams()); 50 | } 51 | return parent::_beforeToHtml(); 52 | } 53 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/System/Config/Source/Default/Param/Behaviour/Array.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_System_Config_Source_Default_Param_Behaviour_Array 17 | { 18 | public function toOptionArray() 19 | { 20 | $helper = Mage::helper('customgrid'); 21 | return array( 22 | array( 23 | 'value' => BL_CustomGrid_Model_Grid::GRID_DEFAULT_PARAM_DEFAULT, 24 | 'label' => $helper->__('Default (Last Set Value is Used)'), 25 | ), 26 | array( 27 | 'value' => BL_CustomGrid_Model_Grid::GRID_DEFAULT_PARAM_FORCE_ORIGINAL, 28 | 'label' => $helper->__('Force Original Value'), 29 | ), 30 | array( 31 | 'value' => BL_CustomGrid_Model_Grid::GRID_DEFAULT_PARAM_FORCE_CUSTOM, 32 | 'label' => $helper->__('Force Custom Value'), 33 | ), 34 | array( 35 | 'value' => BL_CustomGrid_Model_Grid::GRID_DEFAULT_PARAM_MERGE_DEFAULT, 36 | 'label' => $helper->__('Merge Values (Natural Order)'), 37 | ), 38 | array( 39 | 'value' => BL_CustomGrid_Model_Grid::GRID_DEFAULT_PARAM_MERGE_BASE_ORIGINAL, 40 | 'label' => $helper->__('Merge Values (Custom on Original)'), 41 | ), 42 | array( 43 | 'value' => BL_CustomGrid_Model_Grid::GRID_DEFAULT_PARAM_MERGE_BASE_CUSTOM, 44 | 'label' => $helper->__('Merge Values (Original on Custom)'), 45 | ), 46 | ); 47 | } 48 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Column/Renderer/Collection/Text.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Column_Renderer_Collection_Text 17 | extends BL_CustomGrid_Model_Column_Renderer_Collection_Abstract 18 | { 19 | public function getColumnGridValues($index, $store, $grid) 20 | { 21 | $values = array( 22 | 'filter' => 'customgrid/widget_grid_column_filter_text', 23 | 'renderer' => 'customgrid/widget_grid_column_renderer_text', 24 | 'exact_filter' => (bool) $this->_getData('exact_filter'), 25 | 'truncate' => $this->_getData('truncate'), 26 | 'truncate_at' => intval($this->_getData('truncate_at')), 27 | 'truncate_ending' => $this->_getData('truncate_ending'), 28 | 'truncate_exact' => (bool) $this->_getData('truncate_exact'), 29 | 'escape_html' => (bool) $this->_getData('escape_html'), 30 | 'nl2br' => (bool) $this->_getData('nl2br'), 31 | 'parse_tags' => $this->_getData('parse_tags'), 32 | ); 33 | 34 | $strHelper = Mage::helper('core/string'); 35 | 36 | if ($strHelper->strlen($singleWc = strval($this->_getData('single_wildcard'))) === 1) { 37 | $values['single_wildcard'] = $singleWc; 38 | } 39 | if (($strHelper->strlen($multipleWc = strval($this->_getData('multiple_wildcard'))) === 1) 40 | && ($multipleWc !== $singleWc)) { 41 | $values['multiple_wildcard'] = $multipleWc; 42 | } 43 | 44 | return $values; 45 | } 46 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Custom/Column/Order/Items/Custom.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Custom_Column_Order_Items_Custom 17 | extends BL_CustomGrid_Model_Custom_Column_Order_Items_Abstract 18 | { 19 | protected function _isCustomizableList() 20 | { 21 | return true; 22 | } 23 | 24 | public function getItemValues() 25 | { 26 | if (!$this->hasData('item_values')) { 27 | $baseValues = array( 28 | 'name' => 'Name', 29 | 'sku' => 'SKU', 30 | 'original_price' => 'Original Price', 31 | 'status' => 'Status', 32 | 'quantity' => 'Qty', 33 | 'tax_amount' => 'Tax Amount', 34 | 'tax_percent' => 'Tax Percent', 35 | 'discount_amount' => 'Discount Amount', 36 | 'row_total' => 'Row Total', 37 | ); 38 | 39 | $amountsKeys = array( 40 | 'original_price', 41 | 'tax_amount', 42 | 'tax_percent', 43 | 'discount_amount', 44 | 'row_total', 45 | ); 46 | 47 | $this->setData('item_values', $this->_getItemValuesList($baseValues, $amountsKeys, 'blcg_custom_column_order_items_custom_values')); 48 | } 49 | return $this->_getData('item_values'); 50 | } 51 | 52 | protected function _getGridColumnRenderer() 53 | { 54 | return 'customgrid/widget_grid_column_renderer_order_items_custom'; 55 | } 56 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Custom/Column/Simple/Abstract.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | abstract class BL_CustomGrid_Model_Custom_Column_Simple_Abstract 17 | extends BL_CustomGrid_Model_Custom_Column_Abstract 18 | { 19 | abstract public function addFieldToGridCollection($alias, $params, $block, $collection); 20 | 21 | public function shouldForceFieldOrder($collection, $block, $model, $id, $alias, $params, $store, $renderer=null) 22 | { 23 | return (($block->blcg_getSort(false) === $id) 24 | && $this->_getGridHelper()->isEavEntityGrid($block, $model)); 25 | } 26 | 27 | public function addSortToGridCollection($id, $alias, $block, $collection) 28 | { 29 | $collection->getSelect()->order(new Zend_Db_Expr($alias.' '.$block->blcg_getDir())); 30 | return $this; 31 | } 32 | 33 | protected function _applyToGridCollection($collection, $block, $model, $id, $alias, $params, $store, $renderer=null) 34 | { 35 | $block->blcg_addCollectionCallback( 36 | self::GC_EVENT_AFTER_SET, 37 | array($this, 'addFieldToGridCollection'), 38 | array($alias, $params), 39 | true 40 | ); 41 | 42 | if ($this->shouldForceFieldOrder($collection, $block, $model, $id, $alias, $params, $store, $renderer)) { 43 | $block->blcg_addCollectionCallback( 44 | self::GC_EVENT_AFTER_SET, 45 | array($this, 'addSortToGridCollection'), 46 | array($id, $alias), 47 | true 48 | ); 49 | } 50 | 51 | return $this; 52 | } 53 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Helper/Editor.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Helper_Editor 17 | extends Mage_Core_Helper_Abstract 18 | { 19 | protected function _getRequest() 20 | { 21 | return Mage::app()->getRequest(); 22 | } 23 | 24 | protected function _cleanWysiwygConfig(&$value, $key, $infos) 25 | { 26 | if (is_string($value)) { 27 | $value = str_replace('/'.$infos['own_route_name'].'/', '/'.$infos['base_route_name'].'/', $value); 28 | } 29 | } 30 | 31 | public function getWysiwygConfig($config=array()) 32 | { 33 | $config = Mage::getSingleton('cms/wysiwyg_config')->getConfig($config); 34 | $data = $config->getData(); 35 | 36 | array_walk_recursive($data, array($this, '_cleanWysiwygConfig'), array( 37 | 'own_route_name' => 'customgrid', 38 | 'base_route_name' => (string)Mage::app()->getConfig()->getNode('admin/routers/adminhtml/args/frontName'), 39 | )); 40 | 41 | $config->setData($data); 42 | return $config; 43 | } 44 | 45 | public function filterDateValue($value) 46 | { 47 | $filterInput = new Zend_Filter_LocalizedToNormalized(array( 48 | 'date_format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT) 49 | )); 50 | $filterInternal = new Zend_Filter_NormalizedToLocalized(array( 51 | 'date_format' => Varien_Date::DATE_INTERNAL_FORMAT 52 | )); 53 | 54 | $value = $filterInput->filter($value); 55 | $value = $filterInternal->filter($value); 56 | 57 | return $value; 58 | } 59 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Form/Attribute/Default.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Form_Attribute_Default 17 | extends BL_CustomGrid_Block_Widget_Grid_Form 18 | { 19 | public function getIsRequiredValueEdit() 20 | { 21 | if ($attribute = $this->getEditedAttribute()) { 22 | return $attribute->getIsRequired(); 23 | } 24 | return false; 25 | } 26 | 27 | protected function _prepareForm() 28 | { 29 | $form = $this->_createForm(); 30 | $form->setDataObject($this->getEditedEntity()); 31 | 32 | $config = $this->getEditedConfig(); 33 | $entity = $this->getEditedEntity(); 34 | $attribute = $this->getEditedAttribute(); 35 | 36 | $fieldset = $form->addFieldset('base_fieldset', array( 37 | 'legend' => $this->__('%s : %s', $this->getEditedEntityName(), $attribute->getFrontendLabel()) 38 | . ($attribute->getIsRequired() ? ' ('.$this->__('Required').')' : ''), 39 | 'class' => 'fieldset-wide blcg-editor-fieldset', 40 | )); 41 | $this->_setFieldset(array($attribute), $fieldset); 42 | 43 | $form->addValues($entity->getData()); 44 | $form->setFieldNameSuffix($config['values_key']); 45 | $this->setForm($form); 46 | return $this; 47 | } 48 | 49 | protected function _beforeToHtml() 50 | { 51 | if (is_object($this->getEditedAttribute())) { 52 | return parent::_beforeToHtml(); 53 | } else { 54 | $this->_canDisplay = false; 55 | return $this; 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Column/Renderer/Attribute/Datetime.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Column_Renderer_Attribute_Datetime 17 | extends BL_CustomGrid_Model_Column_Renderer_Attribute_Abstract 18 | { 19 | public function isAppliableToColumn($attribute, $grid) 20 | { 21 | return ($attribute->getBackendType() == 'datetime'); 22 | } 23 | 24 | public function getColumnGridValues($attribute, $store, $grid) 25 | { 26 | $values = array( 27 | 'filter' => 'customgrid/widget_grid_column_filter_datetime', 28 | ); 29 | 30 | if ($attribute->getFrontendInput() == 'date') { 31 | $values['renderer'] = 'customgrid/widget_grid_column_renderer_date'; 32 | $values['filter_time'] = false; 33 | 34 | if ($format = $this->_getData('format')) { 35 | try { 36 | $values['format'] = Mage::app()->getLocale()->getDateFormat($format); 37 | } catch (Exception $e) { 38 | $values['format'] = null; 39 | } 40 | } 41 | } else { 42 | $values['renderer'] = 'customgrid/widget_grid_column_renderer_datetime'; 43 | $values['filter_time'] = ($this->_getData('filter_time') ? true : false); 44 | 45 | if ($format = $this->_getData('format')) { 46 | try { 47 | $values['format'] = Mage::app()->getLocale()->getDateTimeFormat($format); 48 | } catch (Exception $e) { 49 | $values['format'] = null; 50 | } 51 | } 52 | } 53 | 54 | return $values; 55 | } 56 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Column/Renderer/Attribute/Text.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Column_Renderer_Attribute_Text 17 | extends BL_CustomGrid_Model_Column_Renderer_Attribute_Abstract 18 | { 19 | public function isAppliableToColumn($attribute, $grid) 20 | { 21 | return true; 22 | } 23 | 24 | public function getColumnGridValues($attribute, $store, $grid) 25 | { 26 | $values = array( 27 | 'filter' => 'customgrid/widget_grid_column_filter_text', 28 | 'renderer' => 'customgrid/widget_grid_column_renderer_text', 29 | 'exact_filter' => (bool) $this->_getData('exact_filter'), 30 | 'truncate' => $this->_getData('truncate'), 31 | 'truncate_at' => intval($this->_getData('truncate_at')), 32 | 'truncate_ending' => $this->_getData('truncate_ending'), 33 | 'truncate_exact' => (bool) $this->_getData('truncate_exact'), 34 | 'escape_html' => (bool) $this->_getData('escape_html'), 35 | 'nl2br' => (bool) $this->_getData('nl2br'), 36 | 'parse_tags' => $this->_getData('parse_tags'), 37 | ); 38 | 39 | $strHelper = Mage::helper('core/string'); 40 | 41 | if ($strHelper->strlen($singleWc = strval($this->_getData('single_wildcard'))) === 1) { 42 | $values['single_wildcard'] = $singleWc; 43 | } 44 | if (($strHelper->strlen($multipleWc = strval($this->_getData('multiple_wildcard'))) === 1) 45 | && ($multipleWc !== $singleWc)) { 46 | $values['multiple_wildcard'] = $multipleWc; 47 | } 48 | 49 | return $values; 50 | } 51 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Filter/Product/Image.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Column_Filter_Product_Image 17 | extends Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Abstract 18 | { 19 | public function getHtml() 20 | { 21 | if ($this->getColumn()->getFilterOnName()) { 22 | $html = '
'; 23 | } else { 24 | $hasValue = !is_null($this->getValue()); 25 | $mustExist = ($hasValue && (bool)$this->getValue()); 26 | $html = ''; 31 | } 32 | return $html; 33 | } 34 | 35 | public function getCondition() 36 | { 37 | if (is_null($this->getValue())) { 38 | return null; 39 | } 40 | if ($this->getColumn()->getFilterOnName()) { 41 | return parent::getCondition(); 42 | } else { 43 | if ((bool)$this->getValue()) { 44 | return array('nin' => array('no_selection', '')); 45 | } else { 46 | return array(array('null' => 1), array('in' => array('no_selection', ''))); 47 | } 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Form/Container.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Form_Container 17 | extends Mage_Adminhtml_Block_Widget_Form_Container 18 | { 19 | public function __construct() 20 | { 21 | parent::__construct(); 22 | $this->removeButton('back'); 23 | $this->removeButton('reset'); 24 | $this->removeButton('delete'); 25 | $this->removeButton('save'); 26 | $this->_blockGroup = null; 27 | $this->setTemplate('bl/customgrid/widget/grid/form/container.phtml'); 28 | 29 | $this->_addButton('save', array( 30 | 'label' => Mage::helper('adminhtml')->__('Save'), 31 | 'onclick' => 'blcgGridEditForm.submit();', 32 | 'class' => 'save', 33 | ), 1); 34 | } 35 | 36 | public function setChildForm(Mage_Core_Block_Abstract $block) 37 | { 38 | $this->setChild('form', $block); 39 | return $this; 40 | } 41 | 42 | public function getFormElementId() 43 | { 44 | if ($form = $this->getChild('form')) { 45 | return $form->getForm()->getId(); 46 | } 47 | return 'edit-form'; 48 | } 49 | 50 | public function getEditorJsObjectName() 51 | { 52 | if ($objectName = $this->getRequest()->getParam('editor_js_object_name', false)) { 53 | if ($this->getRequest()->getParam('is_external', false)) { 54 | $objectName = 'parent.'.$objectName; 55 | } 56 | } 57 | return $objectName; 58 | } 59 | 60 | public function getFormHtml() 61 | { 62 | if ($this->getChild('form')) { 63 | return parent::getFormHtml(); 64 | } 65 | return ''; 66 | } 67 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Options/Source/Edit/Tab/Settings.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Options_Source_Edit_Tab_Settings 17 | extends Mage_Adminhtml_Block_Widget_Form 18 | { 19 | protected function _prepareLayout() 20 | { 21 | $this->setChild('continue_button', 22 | $this->getLayout()->createBlock('adminhtml/widget_button') 23 | ->setData(array( 24 | 'label' => $this->__('Continue'), 25 | 'onclick' => "setSettings('".$this->getContinueUrl()."', 'options_source_type')", 26 | 'class' => 'save', 27 | )) 28 | ); 29 | return parent::_prepareLayout(); 30 | } 31 | 32 | protected function _prepareForm() 33 | { 34 | $form = new Varien_Data_Form(); 35 | $fieldset = $form->addFieldset('settings', array( 36 | 'legend' => $this->__('Options Source Creation Settings') 37 | )); 38 | 39 | $fieldset->addField('options_source_type', 'select', array( 40 | 'label' => $this->__('Type'), 41 | 'title' => $this->__('Type'), 42 | 'name' => 'type', 43 | 'value' => '', 44 | 'values' => Mage::getModel('customgrid/options_source')->getTypesAsOptionHash(true) 45 | )); 46 | 47 | $fieldset->addField('continue_button', 'note', array( 48 | 'text' => $this->getChildHtml('continue_button'), 49 | )); 50 | 51 | $this->setForm($form); 52 | } 53 | 54 | public function getContinueUrl() 55 | { 56 | return $this->getUrl('*/*/new', array( 57 | '_current' => true, 58 | 'type' => '{{type}}' 59 | )); 60 | } 61 | } -------------------------------------------------------------------------------- /app/design/adminhtml/default/default/template/bl/customgrid/widget/grid/form/renderer/element.phtml: -------------------------------------------------------------------------------- 1 | 38 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 39 | */ 40 | ?> 41 | getElement() ?> 42 | getEditedInGrid()): ?> 43 | getNoSpan() !== true): ?> 44 | 45 | 46 | getLabelHtml() ?> 47 | 48 | getElementHtml() ?> 49 | getEditedInGrid()): ?> 50 | getNoSpan() !== true): ?> 51 | 52 | 53 | 54 | getIsRequiredValueEdit()): ?> 55 |  * 56 | 57 | -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Custom/Grid/Edit/Tab/Role.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Custom_Grid_Edit_Tab_Role 17 | extends Mage_Adminhtml_Block_Widget_Form 18 | { 19 | protected function _prepareForm() 20 | { 21 | $grid = Mage::registry('custom_grid'); 22 | $role = $this->getRole(); 23 | $roleId = $role->getId(); 24 | $config = $grid->getRolesConfig($roleId); 25 | 26 | $form = new Varien_Data_Form(); 27 | $form->setHtmlIdPrefix('role_'.$roleId.'_'); 28 | $form->setFieldNameSuffix('role['.$roleId.']'); 29 | 30 | // @todo for profiles 31 | /* 32 | $fieldset = $form->addFieldset('role_'.$roleId.'_fieldset_settings', array( 33 | 'legend' => $this->__('Settings', $role->getRoleName()), 34 | 'class' => 'fielset-wide' 35 | )); 36 | */ 37 | 38 | $fieldset = $form->addFieldset('role_'.$roleId.'_fieldset_permissions', array( 39 | 'legend' => $this->__('Permissions', $role->getRoleName()), 40 | 'class' => 'fieldset-wide' 41 | )); 42 | 43 | $options = Mage::getModel('customgrid/system_config_source_boolean_config')->getOptions(); 44 | 45 | foreach ($grid->getGridActions() as $actionId => $actionLabel) { 46 | $fieldset->addField('permissions['.$actionId.']', 'select', array( 47 | 'name' => 'permissions['.$actionId.']', 48 | 'label' => $actionLabel, 49 | 'title' => $actionLabel, 50 | 'values' => $options, 51 | 'value' => (isset($config['permissions'][$actionId]) ? $config['permissions'][$actionId] : null), 52 | )); 53 | } 54 | 55 | $this->setForm($form); 56 | return parent::_prepareForm(); 57 | } 58 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/controllers/Column/Renderer/AttributeController.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Column_Renderer_AttributeController 17 | extends Mage_Adminhtml_Controller_Action 18 | { 19 | protected function _initRenderer() 20 | { 21 | if ($code = $this->getRequest()->getParam('code')) { 22 | $renderer = Mage::getSingleton('customgrid/column_renderer_attribute')->getConfigAsObject($code); 23 | if ($renderer->isEmpty()) { 24 | $renderer = null; 25 | } 26 | } else { 27 | $renderer = null; 28 | } 29 | Mage::register('current_attribute_column_renderer', $renderer); 30 | return $renderer; 31 | } 32 | 33 | public function indexAction() 34 | { 35 | if ($renderer = $this->_initRenderer()) { 36 | $this->loadLayout('empty'); 37 | 38 | if (($params = $this->getRequest()->getParam('params')) 39 | && ($block = $this->getLayout()->getBlock('column_renderer_attribute'))) { 40 | $params = Mage::getSingleton('customgrid/column_renderer_attribute')->decodeParameters($params); 41 | $block->setConfigParams($params); 42 | } 43 | 44 | $this->renderLayout(); 45 | } else { 46 | $this->loadLayout(array( 47 | 'empty', 48 | strtolower($this->getFullActionName()), 49 | 'customgrid_column_renderer_attribute_unknown', 50 | ))->renderLayout(); 51 | } 52 | } 53 | 54 | public function buildConfigAction() 55 | { 56 | $params = $this->getRequest()->getPost('parameters', array()); 57 | $encoded = Mage::getSingleton('customgrid/column_renderer_attribute')->encodeParameters($params); 58 | $this->getResponse()->setBody($encoded); 59 | } 60 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/controllers/Column/Renderer/CollectionController.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Column_Renderer_CollectionController 17 | extends Mage_Adminhtml_Controller_Action 18 | { 19 | protected function _initRenderer() 20 | { 21 | if ($code = $this->getRequest()->getParam('code')) { 22 | $renderer = Mage::getSingleton('customgrid/column_renderer_collection')->getConfigAsObject($code); 23 | if ($renderer->isEmpty()) { 24 | $renderer = null; 25 | } 26 | } else { 27 | $renderer = null; 28 | } 29 | Mage::register('current_collection_column_renderer', $renderer); 30 | return $renderer; 31 | } 32 | 33 | public function indexAction() 34 | { 35 | if ($renderer = $this->_initRenderer()) { 36 | $this->loadLayout('empty'); 37 | 38 | if (($params = $this->getRequest()->getParam('params')) 39 | && ($block = $this->getLayout()->getBlock('column_renderer_collection'))) { 40 | $params = Mage::getSingleton('customgrid/column_renderer_collection')->decodeParameters($params); 41 | $block->setConfigParams($params); 42 | } 43 | 44 | $this->renderLayout(); 45 | } else { 46 | $this->loadLayout(array( 47 | 'empty', 48 | strtolower($this->getFullActionName()), 49 | 'customgrid_column_renderer_collection_unknown', 50 | ))->renderLayout(); 51 | } 52 | } 53 | 54 | public function buildConfigAction() 55 | { 56 | $params = $this->getRequest()->getPost('parameters', array()); 57 | $encoded = Mage::getSingleton('customgrid/column_renderer_collection')->encodeParameters($params); 58 | $this->getResponse()->setBody($encoded); 59 | } 60 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Block/Widget/Grid/Column/Renderer/Order/Status/Color.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Block_Widget_Grid_Column_Renderer_Order_Status_Color 17 | extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Text 18 | { 19 | protected function _renderRow(Varien_Object $row, $forExport=false) 20 | { 21 | $return = ''; 22 | $options = $this->getColumn()->getOptions(); 23 | $colors = $this->getColumn()->getOptionsColors(); 24 | 25 | if (!is_array($colors)) { 26 | $colors = array(); 27 | } 28 | if (!empty($options) && is_array($options)) { 29 | $value = $row->getData($this->getColumn()->getIndex()); 30 | 31 | if (isset($options[$value])) { 32 | $return = $options[$value]; 33 | } else { 34 | $return = $value; 35 | } 36 | if (!$forExport && isset($colors[$value])) { 37 | $elementId = Mage::helper('core')->uniqHash('blcg-gcr-osc-'); 38 | $onlyCell = ((bool)$this->getColumn()->getOnlyCell() ? 'true' : 'false'); 39 | 40 | $return .= '' 41 | . ''; 45 | } 46 | } 47 | 48 | return $return; 49 | } 50 | 51 | public function render(Varien_Object $row) 52 | { 53 | return $this->_renderRow($row); 54 | } 55 | 56 | public function renderExport(Varien_Object $row) 57 | { 58 | return $this->_renderRow($row, true); 59 | } 60 | } -------------------------------------------------------------------------------- /app/code/community/BL/CustomGrid/Model/Column/Renderer/Collection/Source/Currency.php: -------------------------------------------------------------------------------- 1 | 13 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 14 | */ 15 | 16 | class BL_CustomGrid_Model_Column_Renderer_Collection_Source_Currency 17 | { 18 | protected $_optionArray = null; 19 | protected $_optionHash = null; 20 | 21 | public function toOptionArray() 22 | { 23 | if (is_null($this->_optionArray)) { 24 | $currencies = Mage::app()->getLocale()->getOptionCurrencies(); 25 | $codes = Mage::getModel('directory/currency')->getConfigAllowCurrencies(); 26 | $options = array(); 27 | 28 | foreach ($currencies as $currency) { 29 | if (in_array($currency['value'], $codes)) { 30 | $options[] = $currency; 31 | } 32 | } 33 | 34 | array_unshift($options, 35 | array( 36 | 'value' => BL_CustomGrid_Model_Column_Renderer_Collection_Price::CURRENCY_TYPE_BASE, 37 | 'label' => Mage::helper('customgrid')->__('Use Base Currency'), 38 | ), 39 | array( 40 | 'value' => BL_CustomGrid_Model_Column_Renderer_Collection_Price::CURRENCY_TYPE_COLUMN, 41 | 'label' => Mage::helper('customgrid')->__('Use Column Currency'), 42 | ) 43 | ); 44 | 45 | $this->_optionArray = $options; 46 | } 47 | return $this->_optionArray; 48 | } 49 | 50 | public function toOptionHash() 51 | { 52 | if (is_null($this->_optionHash)) { 53 | $options = $this->toOptionArray(); 54 | $this->_optionHash = array(); 55 | 56 | foreach ($options as $option) { 57 | $this->_optionHash[$option['value']] = $option['label']; 58 | } 59 | } 60 | return $this->_optionHash; 61 | } 62 | } --------------------------------------------------------------------------------