Nov 29, 2011

Linux: Arch dependent binaries in noarch package

create RPM

The error was encounter where I trying to create RPM that contains binary files. This files was the binary files from nagios plugin. Solution Add the data below on the upper section of your specs file

%define _binaries_in_noarch_packages_terminate_build 0
Reference: fedora-devel

Nov 25, 2011

Magento: Overriding Model

<config>
<global>
<models>
<review_mysql4>
<rewrite>
<review>Globe_Review_Model_Mysql4_Review</review>
</rewrite>
</review_mysql4>
<review>
<rewrite>
<review>Globe_Review_Model_Review</review>
</rewrite>
</review>
</models>
</global>
<frontend>
<routers>
<review>
<args>
<modules>
<Globe_Review before="Mage_Review">Globe_Review</Globe_Review>
</modules>
</args>
</review>
</routers>
</frontend>
</config>


Reference:
Magento overriding core files blocks models resources controllers

Nov 16, 2011

Magento: Overriding Product Controller.

Edit you Package/Module/etc/config.xml



<?xml version="1.0"?>
<config>
... Your Other config here ....
<frontend>
<routers>
<catalog>
<args>
<modules>
<Package_Catalog before="Mage_Catalog">Package_Catalog</Package_Catalog>
</modules>
</args>
</catalog>
</routers>
</frontend>
</config>


Now your controller already ready.



include(Mage::getBaseDir()."/app/code/core/Mage/Catalog/controllers/ProductController.php");
class Package_Catalog_ProductController extends Mage_Catalog_ProductController
{
public function viewAction(){
echo __METHOD__;
}
}
?>



Try to access: http://192.168.101.188/catalog/product/view


Nov 15, 2011

Magento: Custom category Field.

Add one row to eav_attribute


INSERT INTO `fl_mage`.`eav_attribute`
SET
`attribute_id` =0, -- AUto
`entity_type_id`=3,
`attribute_code`='category_url',
`attribute_model`=NULL ,
`backend_model`=NULL ,
`backend_type`='varchar',
`backend_table`=NULL ,
`frontend_model` =NULL,
`frontend_input` ='text',
`frontend_label`='Url' ,
`frontend_class`=NULL ,
`source_model`=NULL ,
`is_required` '0',
`is_user_defined`='0' ,
`default_value` =NULL,
`is_unique` ='0',
`note`=''
;

Add other one row to eav_entity_attribute


INSERT INTO `fl_mage`.`eav_entity_attribute`
SET
`entity_attribute_id` =NULL,
`entity_type_id` =3,
`attribute_set_id` =3,
`attribute_group_id` =3,
`attribute_id`=163, --Must be same to eav_attribute
`sort_order`=3
;

Finally one more row to catalog_eav_attribute


INSERT INTO `catalog_eav_attribute`
SET
`attribute_id`=163,
`frontend_input_renderer`=NULL,
`is_global`=0,
`is_visible`=1,
`is_searchable`=0,
`is_filterable`=0,
`is_comparable`=0,
`is_visible_on_front`=0,
`is_html_allowed_on_front`=0,
`is_used_for_price_rules`=0,
`is_filterable_in_search`=0,
`used_in_product_listing`=0,
`used_for_sort_by`=0,
`is_configurable`=1,
`apply_to`=0,
`is_visible_in_advanced_search`=0,
`position`=0,
`is_wysiwyg_enabled`=0,
`is_used_for_promo_rules`=0
;

That's simple as is, you can find the charm there. Happy reading.

TIPS: If you are confuse try to look the eav_attribute and compare the data on your admin category page.

Reference: