Archive: May 2012

Magento: Problema de validación de formularios con IE9

Como siempre, cada versión nueva de Internet Explorer trae consigo un sin numero de problemas en aplicaciones web que tengamos desarrolladas. En esta ocasión tuvimos un problema con la validación de formularios en Magento en IE9, ya que los formularios sí mostraban los mensajes de error pero el formulario se enviaba. Lo cual generaba que se guardara información vacía o incorrecta.
Después de mucha investigación, resulta que Internet Explorer no es totalmente compatible con la versión de prototype que trae Magento por defecto.
Existen 3 soluciones:
– Actualizar la versión de prototype de la 1.6 a la 1.7, esto podría implicar que dejen de funcionar algunos otros componentes (no la he probado).
– Modificar el head de nuestro sitio, agregando la siguiente etiqueta:
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
Esto lo logramos modificando el /template/page/html/head.phtml de nuestro tema actual.
Fuente
– Si esto no funcionó, como en mi caso, trataremos de aplicar la misma solución, desde el .htaccess de nuestro sitio ubicado en /sitio/.htaccess
Aquí agregaremos la siguiente línea al comienzo del archivo:

BrowserMatch MSIE best-standards-support Header set X-UA-Compatible IE=8 env=best-standards-support

Fuente
Con esto, nuestro sitio en IE9 será interpretado como si estuviera corriendo en IE8.
Saludos

Magento: Recibir variables por url, Get o Post

Para recibir parámetros que vengan en nuestra url en Magento, lo hacemos de la siguiente forma.
Si tenemos la URL así
http://misitio.com/parametroA/5/parametroB/10
http://misitio.com?parametroA=5&parametroB=10
Lo recibimos de la siguiente manera
$this->getRequest()->getParams();
De esta manera lo recibiremos como un array asociativo con el valor de los parámetros. 
Y si queremos acceder a un parámetro en específico
$this->getRequest()->getParam('parametroA');
Saludos

Magento: Incluir javascript y css

Para poder incluir archivos javascript y Css dentro de nuestro sitio de Magento lo hacemos de podemos hacer de dos maneras.
Cabe mencionar que lo recomendable es incluir los archivos javascript dentro la carpeta /js ubicada en la raíz de nuestro sitio.
Los archivos Css se incluirán dentro de la carpeta skinfrontendPackagetemaactual
La manera de incluirlos, es editar nuestro archivo appdesignfrontendPackagetemaactuallayoutpage.xml  de nuestro tema actual, si observamos el archivo, encontraremos un tag como el siguiente:
Aquí es donde podremos incluir el archivo js o css que queramos, lográndolo de la siguiente manera.
<action method="addJs"><script>sucarpeta/script.js</script></action>
Es importante mencionar que incluyendo archivos de esta manera hará que estos archivos estén presentes durante toda la navegación desde el frontend, si lo que queremos es solamente utilizarlos para un módulo en específico, lo tendremos que hacer modificando el layout.xml propio del módulo.
Por ejemplo /layout/mimodulo.xml
Y ahí pondremos los siguientes tags dentro del handler deseado.
<mimodulo_micontroller_miaction>
    <reference name="head">
        <action method="addJs"><script>sucarpeta/script.js</script></action>
    </reference>
<mimodulo_micontroller_miaction>
Saludos.

Magento: Registry Variable

Magento nos da la posibilidad de registrar una variable que puede ser utilizada en cualquier parte del proyecto.


Es una alternativa a las variables de sesión, ya que el alcance que nos brinda es global.


Para hacerlo lo hacemos de la siguiente manera

Mage::register('mi_variable', $elvaloraAlmacenar);

Para utilizarla en cualquier parte de la aplicación hacemos esto.

Mage::registry('mi_variable);

Y para hacerle un unset lo hacemos así:

Mage::unregister('mi_variable');

Saludos.

Magento: Lista de Eventos para los Observers

Encontré esta lista de los Eventos de Magento, esto con el fin de ayudarnos a reconocer que evento nos conviene mas “escuchar” en nuestros Observers.


Aplica para la versión 1.6.0.0.

Archivo Línea Evento
cron.php 44 default
app/code/core/Mage/Adminhtml/Controller/Action.php 151 adminhtml_controller_action_predispatch_start
app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Carts.php 61 adminhtml_block_html_before
app/code/core/Mage/Adminhtml/Block/Report/Grid.php 186 adminhtml_widget_grid_filter_collection
app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Meta.php 76 adminhtml_cms_page_edit_tab_meta_prepare_form
app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Design.php 125 adminhtml_cms_page_edit_tab_design_prepare_form
app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Main.php 117 adminhtml_cms_page_edit_tab_main_prepare_form
app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Content.php 98 adminhtml_cms_page_edit_tab_content_prepare_form
app/code/core/Mage/Adminhtml/Block/Widget/Container.php 307 adminhtml_widget_container_html_before
app/code/core/Mage/Adminhtml/Block/Template.php 80 adminhtml_block_html_before
app/code/core/Mage/Adminhtml/Block/Sales/Reorder/Renderer/Action.php 55 adminhtml_customer_orders_add_action_renderer
app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tabs.php 154 adminhtml_catalog_category_tabs
app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tree.php 284 adminhtml_catalog_category_tree_is_moveable
app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tree.php 321 adminhtml_catalog_category_tree_can_add_root_category
app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tree.php 341 adminhtml_catalog_category_tree_can_add_sub_category
app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/New/Product/Attributes.php 64 adminhtml_catalog_product_edit_prepare_form
app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/New/Product/Attributes.php 80 adminhtml_catalog_product_edit_element_types
app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main.php 406 adminhtml_catalog_product_attribute_set_main_html_before
app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Toolbar/Main.php 68 adminhtml_catalog_product_attribute_set_toolbar_main_html_before
app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Main.php 71 adminhtml_product_attribute_types
app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Main.php 242 adminhtml_catalog_product_attribute_edit_prepare_form
app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Action/Attribute/Tab/Attributes.php 48 adminhtml_catalog_product_form_prepare_excluded_field_list
app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Attributes.php 135 adminhtml_catalog_product_edit_prepare_form
app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Attributes.php 153 adminhtml_catalog_product_edit_element_types
app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Price/Recurring.php 42 catalog_product_edit_form_render_recurring
app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Attributes/Create.php 85 adminhtml_catalog_product_edit_tab_attributes_create_html_before
app/code/core/Mage/Adminhtml/Block/Promo/Catalog/Edit/Tab/Main.php 197 adminhtml_promo_catalog_edit_tab_main_prepare_form
app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Actions.php 162 adminhtml_block_salesrule_actions_prepareform
app/code/core/Mage/Adminhtml/Block/Promo/Quote/Edit/Tab/Main.php 255 adminhtml_promo_quote_edit_tab_main_prepare_form
app/code/core/Mage/Adminhtml/controllers/Cms/PageController.php 139 cms_page_prepare_save
app/code/core/Mage/Adminhtml/controllers/Cms/PageController.php 199 adminhtml_cmspage_on_delete
app/code/core/Mage/Adminhtml/controllers/Cms/PageController.php 204 adminhtml_cmspage_on_delete
app/code/core/Mage/Adminhtml/controllers/CacheController.php 56 adminhtml_cache_flush_all
app/code/core/Mage/Adminhtml/controllers/CacheController.php 68 adminhtml_cache_flush_system
app/code/core/Mage/Adminhtml/controllers/CacheController.php 128 adminhtml_cache_refresh_type
app/code/core/Mage/Adminhtml/controllers/CacheController.php 145 clean_media_cache_after
app/code/core/Mage/Adminhtml/controllers/CacheController.php 169 clean_catalog_images_cache_after
app/code/core/Mage/Adminhtml/controllers/Permissions/RoleController.php 189 admin_permissions_role_prepare_save
app/code/core/Mage/Adminhtml/controllers/ReportController.php 82 on_view_report
app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreateController.php 245 adminhtml_sales_order_create_process_data
app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php 160 adminhtml_sales_order_creditmemo_register_before
app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php 304 catalog_category_prepare_save
app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php 399 catalog_controller_category_delete
app/code/core/Mage/Adminhtml/controllers/Catalog/Product/Action/AttributeController.php 145 catalog_product_to_website_change
app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php 192 catalog_product_new_action
app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php 237 catalog_product_edit_action
app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php 664 catalog_product_prepare_save
app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php 868 catalog_controller_product_delete
app/code/core/Mage/Adminhtml/controllers/Promo/CatalogController.php 114 adminhtml_controller_catalogrule_prepare_save
app/code/core/Mage/Adminhtml/controllers/Promo/QuoteController.php 114 adminhtml_controller_salesrule_prepare_save
app/code/core/Mage/Adminhtml/controllers/CustomerController.php 301 adminhtml_customer_prepare_save
app/code/core/Mage/Adminhtml/controllers/CustomerController.php 332 adminhtml_customer_save_after
app/code/core/Mage/Adminhtml/controllers/System/Config/System/StorageController.php 154 add_synchronize_message
app/code/core/Mage/Adminhtml/controllers/System/Convert/ProfileController.php 262 $adapter->getEventPrefix(
app/code/core/Mage/Adminhtml/controllers/System/ConfigController.php 160 admin_system_config_changed_section_{$section}
app/code/core/Mage/Adminhtml/controllers/System/StoreController.php 200 store_group_save
app/code/core/Mage/Adminhtml/controllers/System/StoreController.php 222 $eventName
app/code/core/Mage/Adminhtml/controllers/System/StoreController.php 431 store_delete
app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php 319 sales_convert_order_to_quote
app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php 412 sales_convert_order_item_to_quote_item
app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php 1486 checkout_submit_all_after
app/code/core/Mage/GoogleCheckout/Block/Link.php 90 googlecheckout_block_link_html_before
app/code/core/Mage/GoogleCheckout/controllers/RedirectController.php 98 googlecheckout_checkout_before
app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Checkout.php 165 google_checkout_discount_item_price
app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Callback.php 446 checkout_submit_all_after
app/code/core/Mage/Rss/Block/Wishlist.php 124 rss_wishlist_xml_callback
app/code/core/Mage/Rss/Block/Order/New.php 77 rss_order_new_collection_select
app/code/core/Mage/Rss/Block/Catalog/Review.php 74 rss_catalog_review_collection_select
app/code/core/Mage/Rss/Block/Catalog/Tag.php 92 rss_catalog_tagged_item_xml_callback
app/code/core/Mage/Rss/Block/Catalog/NotifyStock.php 85 rss_catalog_notify_stock_collection_select
app/code/core/Mage/Rss/Block/Catalog/Category.php 119 rss_catalog_category_xml_callback
app/code/core/Mage/Rss/Block/Catalog/New.php 122 rss_catalog_new_xml_callback
app/code/core/Mage/Rss/Block/Catalog/Special.php 165 rss_catalog_special_xml_callback
app/code/core/Mage/Customer/controllers/AccountController.php 322 customer_register_success
app/code/core/Mage/Customer/Helper/Data.php 275 customer_registration_is_allowed
app/code/core/Mage/Customer/Model/Address/Abstract.php 305 customer_address_format
app/code/core/Mage/Customer/Model/Session.php 75 customer_session_init
app/code/core/Mage/Customer/Model/Session.php 224 customer_login
app/code/core/Mage/Customer/Model/Session.php 252 customer_logout
app/code/core/Mage/Customer/Model/Customer.php 124 customer_customer_authenticated
app/code/core/Mage/Paypal/Model/Cart.php 318 paypal_prepare_line_items
app/code/core/Mage/Tax/Model/Calculation/Rate.php 111 tax_settings_change_after
app/code/core/Mage/Tax/Model/Calculation/Rate.php 137 tax_settings_change_after
app/code/core/Mage/Tax/Model/Calculation/Rate.php 181 tax_settings_change_after
app/code/core/Mage/Tax/Model/Calculation/Rule.php 73 tax_settings_change_after
app/code/core/Mage/Tax/Model/Calculation/Rule.php 85 tax_settings_change_after
app/code/core/Mage/Tax/Model/Calculation.php 191 tax_rate_data_fetch
app/code/core/Mage/Wishlist/controllers/IndexController.php 173 wishlist_add_product
app/code/core/Mage/Wishlist/controllers/IndexController.php 287 wishlist_update_item
app/code/core/Mage/Wishlist/controllers/IndexController.php 578 wishlist_share
app/code/core/Mage/Wishlist/Helper/Data.php 476 wishlist_items_renewed
app/code/core/Mage/Wishlist/Model/Resource/Item/Collection.php 187 wishlist_item_collection_products_after_load
app/code/core/Mage/Wishlist/Model/Wishlist.php 251 wishlist_add_item
app/code/core/Mage/Wishlist/Model/Wishlist.php 336 wishlist_product_add_after
app/code/core/Mage/Admin/Model/User.php 271 admin_user_authenticate_after
app/code/core/Mage/Admin/Model/Session.php 102 admin_session_user_login_success
app/code/core/Mage/Admin/Model/Session.php 112 admin_session_user_login_failed
app/code/core/Mage/Cms/Controller/Router.php 71 cms_controller_router_match_before
app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php 158 cms_wysiwyg_images_static_urls_allowed
app/code/core/Mage/Cms/Helper/Page.php 106 cms_page_render
app/code/core/Mage/Cms/Model/Wysiwyg/Config.php 97 cms_wysiwyg_config_prepare
app/code/core/Mage/Cms/Model/Page.php 152 cms_page_get_available_statuses
app/code/core/Mage/Persistent/controllers/IndexController.php 84 persistent_session_expired
app/code/core/Mage/Persistent/Model/Observer.php 483 persistent_session_expired
app/code/core/Mage/Core/Controller/Varien/Action.php 300 controller_action_layout_load_before
app/code/core/Mage/Core/Controller/Varien/Action.php 318 controller_action_layout_generate_xml_before
app/code/core/Mage/Core/Controller/Varien/Action.php 337 controller_action_layout_generate_blocks_before
app/code/core/Mage/Core/Controller/Varien/Action.php 349 controller_action_layout_generate_blocks_after
app/code/core/Mage/Core/Controller/Varien/Action.php 385 controller_action_layout_render_before
app/code/core/Mage/Core/Controller/Varien/Action.php 386 controller_action_layout_render_before_’.$this->getFullActionName(
app/code/core/Mage/Core/Controller/Varien/Action.php 505 controller_action_predispatch
app/code/core/Mage/Core/Controller/Varien/Action.php 511 controller_action_predispatch_’.$this->getFullActionName(
app/code/core/Mage/Core/Controller/Varien/Action.php 526 controller_action_postdispatch_’.$this->getFullActionName(
app/code/core/Mage/Core/Controller/Varien/Action.php 530 controller_action_postdispatch_’.$this->getRequest(
app/code/core/Mage/Core/Controller/Varien/Action.php 534 controller_action_postdispatch
app/code/core/Mage/Core/Controller/Varien/Action.php 543 controller_action_noroute
app/code/core/Mage/Core/Controller/Varien/Action.php 563 controller_action_nocookies
app/code/core/Mage/Core/Controller/Varien/Front.php 128 controller_front_init_before
app/code/core/Mage/Core/Controller/Varien/Front.php 147 controller_front_init_routers
app/code/core/Mage/Core/Controller/Varien/Front.php 186 controller_front_send_response_before
app/code/core/Mage/Core/Controller/Varien/Front.php 190 controller_front_send_response_after
app/code/core/Mage/Core/Controller/Response/Http.php 74 http_response_send_before
app/code/core/Mage/Core/Block/Abstract.php 237 core_block_abstract_prepare_layout_before
app/code/core/Mage/Core/Block/Abstract.php 850 core_block_abstract_to_html_before
app/code/core/Mage/Core/Block/Abstract.php 886 core_block_abstract_to_html_after
app/code/core/Mage/Core/Helper/Data.php 429 $eventName
app/code/core/Mage/Core/Model/Layout.php 433 core_layout_block_create_after
app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php 585 core_collection_abstract_load_before
app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php 587 $this->_eventPrefix.’_load_before
app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php 634 core_collection_abstract_load_after
app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php 636 $this->_eventPrefix.’_load_after
app/code/core/Mage/Core/Model/Session/Abstract.php 216 core_session_abstract_clear_messages
app/code/core/Mage/Core/Model/Session/Abstract.php 252 core_session_abstract_add_message
app/code/core/Mage/Core/Model/App.php 1160 application_clean_cache
app/code/core/Mage/Core/Model/Layout/Update.php 406 core_layout_update_updates_get_after
app/code/core/Mage/Core/Model/Abstract.php 253 model_load_before
app/code/core/Mage/Core/Model/Abstract.php 255 $this->_eventPrefix.’_load_before
app/code/core/Mage/Core/Model/Abstract.php 266 model_load_after
app/code/core/Mage/Core/Model/Abstract.php 267 $this->_eventPrefix.’_load_after
app/code/core/Mage/Core/Model/Abstract.php 343 model_save_commit_after
app/code/core/Mage/Core/Model/Abstract.php 344 $this->_eventPrefix.’_save_commit_after
app/code/core/Mage/Core/Model/Abstract.php 390 model_save_before
app/code/core/Mage/Core/Model/Abstract.php 391 $this->_eventPrefix.’_save_before
app/code/core/Mage/Core/Model/Abstract.php 465 model_save_after
app/code/core/Mage/Core/Model/Abstract.php 466 $this->_eventPrefix.’_save_after
app/code/core/Mage/Core/Model/Abstract.php 500 model_delete_before
app/code/core/Mage/Core/Model/Abstract.php 501 $this->_eventPrefix.’_delete_before
app/code/core/Mage/Core/Model/Abstract.php 528 model_delete_after
app/code/core/Mage/Core/Model/Abstract.php 529 $this->_eventPrefix.’_delete_after
app/code/core/Mage/Core/Model/Abstract.php 540 model_delete_commit_after
app/code/core/Mage/Core/Model/Abstract.php 541 $this->_eventPrefix.’_delete_commit_after
app/code/core/Mage/Core/Model/Abstract.php 568 $this->_eventPrefix.’_clear
app/code/core/Mage/Core/Model/Locale.php 139 core_locale_set_locale
app/code/core/Mage/Core/Model/Resource.php 278 resource_get_tablename
app/code/core/Mage/Api/Model/User.php 204 api_user_authenticated
app/code/core/Mage/Poll/controllers/VoteController.php 67 poll_vote_add
app/code/core/Mage/XmlConnect/controllers/CartController.php 222 checkout_cart_add_product_complete
app/code/core/Mage/XmlConnect/controllers/ReviewController.php 41 review_controller_product_init_before
app/code/core/Mage/XmlConnect/controllers/ReviewController.php 46 review_controller_product_init
app/code/core/Mage/XmlConnect/controllers/ReviewController.php 50 review_controller_product_init_after
app/code/core/Mage/XmlConnect/controllers/WishlistController.php 128 wishlist_add_product
app/code/core/Mage/XmlConnect/controllers/CheckoutController.php 299 checkout_controller_onepage_save_shipping_method
app/code/core/Mage/XmlConnect/Model/Queue.php 297 before_save_message_queue
app/code/core/Mage/CatalogIndex/Model/Resource/Price.php 138 catalogindex_prepare_price_select
app/code/core/Mage/CatalogIndex/Model/Resource/Price.php 177 catalogindex_prepare_price_select
app/code/core/Mage/CatalogIndex/Model/Resource/Price.php 231 catalogindex_prepare_price_select
app/code/core/Mage/CatalogIndex/Model/Resource/Price.php 281 catalogindex_prepare_price_select
app/code/core/Mage/CatalogIndex/Model/Indexer.php 372 catalogindex_plain_reindex_after
app/code/core/Mage/CatalogIndex/Model/Indexer.php 632 catalogindex_prepare_price_select
app/code/core/Mage/CatalogIndex/Model/Data/Abstract.php 204 catalogindex_get_minimal_price
app/code/core/Mage/Review/controllers/ProductController.php 73 review_controller_product_init_before
app/code/core/Mage/Review/controllers/ProductController.php 85 review_controller_product_init
app/code/core/Mage/Review/Model/Resource/Review/Collection.php 269 review_review_collection_load_before
app/code/core/Mage/GiftMessage/Block/Message/Inline.php 177 gift_options_prepare_items
app/code/core/Mage/GiftMessage/Model/Api.php 64 magento/app/code/core/Mage/GiftMessage/Model/Api.php
app/code/core/Mage/GiftMessage/Model/Api.php 67 checkout_controller_onepage_save_shipping_method
app/code/core/Mage/GiftMessage/Model/Api/V2.php 91 magento/app/code/core/Mage/GiftMessage/Model/Api/V2.php
app/code/core/Mage/GiftMessage/Model/Api/V2.php 94 checkout_controller_onepage_save_shipping_method
app/code/core/Mage/Payment/Block/Form/Cc.php 154 payment_form_block_to_html_before
app/code/core/Mage/Payment/Block/Info.php 166 payment_info_block_prepare_specific_information
app/code/core/Mage/Payment/Model/Method/Abstract.php 629 payment_method_is_active
app/code/core/Mage/CatalogRule/Model/Resource/Rule.php 345 catalogrule_before_apply
app/code/core/Mage/CatalogRule/Model/Resource/Rule.php 481 catalogrule_after_apply
app/code/core/Mage/SalesRule/Model/Validator.php 424 salesrule_validator_process
app/code/core/Mage/SalesRule/Model/Rule.php 384 salesrule_rule_get_coupon_types
app/code/core/Mage/SalesRule/Model/Rule/Condition/Combine.php 54 salesrule_rule_condition_combine
app/code/core/Mage/SalesRule/Model/Quote/Discount.php 86 sales_quote_address_discount_item
app/code/core/Mage/SalesRule/Model/Quote/Discount.php 92 sales_quote_address_discount_item
app/code/core/Mage/Sales/Model/Resource/Order/Address/Collection.php 69 $this->_eventPrefix . ‘_load_after
app/code/core/Mage/Sales/Model/Resource/Order/Abstract.php 142 $this->_eventPrefix . ‘_init_virtual_grid_columns
app/code/core/Mage/Sales/Model/Resource/Order/Abstract.php 167 $this->_eventPrefix . ‘_update_grid_records
app/code/core/Mage/Sales/Model/Resource/Order/Abstract.php 295 $this->_eventPrefix . ‘_save_attribute_before
app/code/core/Mage/Sales/Model/Resource/Order/Abstract.php 314 $this->_eventPrefix . ‘_save_attribute_after
app/code/core/Mage/Sales/Model/Resource/Order/Collection/Abstract.php 61 $this->_eventPrefix . ‘_set_sales_order
app/code/core/Mage/Sales/Model/Resource/Quote/Address/Collection.php 82 $this->_eventPrefix.’_load_after
app/code/core/Mage/Sales/Model/Resource/Quote/Item/Collection.php 187 prepare_catalog_product_collection_prices
app/code/core/Mage/Sales/Model/Resource/Quote/Item/Collection.php 191 sales_quote_item_collection_products_after_load
app/code/core/Mage/Sales/Model/Resource/Sale/Collection.php 154 sales_sale_collection_query_before
app/code/core/Mage/Sales/Model/Convert/Quote.php 56 sales_convert_quote_to_order
app/code/core/Mage/Sales/Model/Convert/Quote.php 74 sales_convert_quote_address_to_order
app/code/core/Mage/Sales/Model/Convert/Quote.php 94 sales_convert_quote_address_to_order_address
app/code/core/Mage/Sales/Model/Convert/Quote.php 113 sales_convert_quote_payment_to_order_payment
app/code/core/Mage/Sales/Model/Convert/Quote.php 152 sales_convert_quote_item_to_order_item
app/code/core/Mage/Sales/Model/Convert/Order.php 53 sales_convert_order_to_quote
app/code/core/Mage/Sales/Model/Quote.php 813 sales_quote_remove_item
app/code/core/Mage/Sales/Model/Quote.php 844 sales_quote_add_item
app/code/core/Mage/Sales/Model/Quote.php 924 sales_quote_product_add_after
app/code/core/Mage/Sales/Model/Quote.php 1212 $this->_eventPrefix . ‘_collect_totals_before
app/code/core/Mage/Sales/Model/Quote.php 1282 $this->_eventPrefix . ‘_collect_totals_after
app/code/core/Mage/Sales/Model/Quote.php 1622 $this->_eventPrefix . ‘_merge_before
app/code/core/Mage/Sales/Model/Quote.php 1665 $this->_eventPrefix . ‘_merge_after
app/code/core/Mage/Sales/Model/Service/Quote.php 186 checkout_type_onepage_save_order
app/code/core/Mage/Sales/Model/Service/Quote.php 191 sales_model_service_quote_submit_success
app/code/core/Mage/Sales/Model/Service/Quote.php 207 sales_model_service_quote_submit_failure
app/code/core/Mage/Sales/Model/Service/Quote.php 210 sales_model_service_quote_submit_after
app/code/core/Mage/Sales/Model/Order.php 1072 sales_order_place_before
app/code/core/Mage/Sales/Model/Order.php 1117 order_cancel_after
app/code/core/Mage/Sales/Model/Order/Payment.php 277 sales_order_payment_place_start
app/code/core/Mage/Sales/Model/Order/Payment.php 356 sales_order_payment_place_end
app/code/core/Mage/Sales/Model/Order/Payment.php 394 sales_order_payment_capture
app/code/core/Mage/Sales/Model/Order/Payment.php 535 sales_order_payment_pay
app/code/core/Mage/Sales/Model/Order/Payment.php 553 sales_order_payment_cancel_invoice
app/code/core/Mage/Sales/Model/Order/Payment.php 603 sales_order_payment_void
app/code/core/Mage/Sales/Model/Order/Payment.php 691 sales_order_payment_refund
app/code/core/Mage/Sales/Model/Order/Payment.php 797 sales_order_payment_cancel_creditmemo
app/code/core/Mage/Sales/Model/Order/Payment.php 825 sales_order_payment_cancel
app/code/core/Mage/Sales/Model/Order/Invoice.php 411 sales_order_invoice_pay
app/code/core/Mage/Sales/Model/Order/Invoice.php 481 sales_order_invoice_cancel
app/code/core/Mage/Sales/Model/Order/Invoice.php 658 sales_order_invoice_register
app/code/core/Mage/Sales/Model/Order/Item.php 506 sales_order_item_cancel
app/code/core/Mage/Sales/Model/Order/Payment/Transaction.php 417 $this->_eventPrefix . ‘_load_by_txn_id_before
app/code/core/Mage/Sales/Model/Order/Payment/Transaction.php 443 $this->_eventPrefix . ‘_load_by_txn_id_after
app/code/core/Mage/Sales/Model/Order/Creditmemo.php 421 sales_order_creditmemo_refund
app/code/core/Mage/Sales/Model/Order/Creditmemo.php 468 sales_order_creditmemo_cancel
app/code/core/Mage/Sales/Model/Quote/Payment.php 133 $this->_eventPrefix . ‘_import_data_before
app/code/core/Mage/Sales/Model/Quote/Item.php 300 sales_quote_item_qty_set_after
app/code/core/Mage/Sales/Model/Quote/Item.php 402 sales_quote_item_set_product
app/code/core/Mage/Sales/Model/Quote/Address/Total/Discount.php 80 sales_quote_address_discount_item
app/code/core/Mage/Sales/Model/Quote/Address/Total/Discount.php 111 sales_quote_address_discount_item
app/code/core/Mage/Sales/Model/Quote/Config.php 36 sales_quote_config_get_product_attributes
app/code/core/Mage/Sales/Model/Observer.php 52 clear_expired_quotes_before
app/code/core/Mage/Checkout/controllers/MultishippingController.php 344 checkout_controller_multishipping_shipping_post
app/code/core/Mage/Checkout/controllers/MultishippingController.php 545 checkout_multishipping_controller_success_action
app/code/core/Mage/Checkout/controllers/CartController.php 195 checkout_cart_add_product_complete
app/code/core/Mage/Checkout/controllers/CartController.php 336 checkout_cart_update_item_complete
app/code/core/Mage/Checkout/controllers/OnepageController.php 230 checkout_onepage_controller_success_action
app/code/core/Mage/Checkout/controllers/OnepageController.php 374 checkout_controller_onepage_save_shipping_method
app/code/core/Mage/Checkout/Helper/Data.php 276 checkout_allow_guest
app/code/core/Mage/Checkout/Model/Cart.php 264 checkout_cart_product_add_after
app/code/core/Mage/Checkout/Model/Cart.php 364 checkout_cart_update_items_before
app/code/core/Mage/Checkout/Model/Cart.php 402 checkout_cart_update_items_after
app/code/core/Mage/Checkout/Model/Cart.php 425 checkout_cart_save_before
app/code/core/Mage/Checkout/Model/Cart.php 435 checkout_cart_save_after
app/code/core/Mage/Checkout/Model/Cart.php 558 checkout_cart_product_update_after
app/code/core/Mage/Checkout/Model/Session.php 105 custom_quote_process
app/code/core/Mage/Checkout/Model/Session.php 148 checkout_quote_init
app/code/core/Mage/Checkout/Model/Session.php 197 load_customer_quote_before
app/code/core/Mage/Checkout/Model/Session.php 358 checkout_quote_destroy
app/code/core/Mage/Checkout/Model/Cart/Api.php 174 checkout_type_onepage_save_order_after
app/code/core/Mage/Checkout/Model/Cart/Api.php 184 checkout_submit_all_after
app/code/core/Mage/Checkout/Model/Type/Onepage.php 780 checkout_type_onepage_save_order_after
app/code/core/Mage/Checkout/Model/Type/Onepage.php 822 checkout_submit_all_after
app/code/core/Mage/Checkout/Model/Type/Multishipping.php 275 checkout_type_multishipping_set_shipping_items
app/code/core/Mage/Checkout/Model/Type/Multishipping.php 506 checkout_type_multishipping_create_orders_single
app/code/core/Mage/Checkout/Model/Type/Multishipping.php 528 checkout_submit_all_after
app/code/core/Mage/Checkout/Model/Type/Multishipping.php 532 checkout_multishipping_refund_all
app/code/core/Mage/Sendfriend/controllers/ProductController.php 131 sendfriend_product
app/code/core/Mage/Catalog/Block/Product/View.php 181 catalog_product_view_config
app/code/core/Mage/Catalog/Block/Product/List.php 161 catalog_block_product_list_collection
app/code/core/Mage/Catalog/Block/Product/List/Upsell.php 79 catalog_product_upsell
app/code/core/Mage/Catalog/Block/Product/View/Type/Configurable.php 157 catalog_product_type_configurable_price
app/code/core/Mage/Catalog/controllers/CategoryController.php 43 catalog_controller_category_init_before
app/code/core/Mage/Catalog/controllers/CategoryController.php 59 catalog_controller_category_init_after
app/code/core/Mage/Catalog/controllers/Product/CompareController.php 87 catalog_product_compare_add_product
app/code/core/Mage/Catalog/controllers/Product/CompareController.php 126 catalog_product_compare_remove_product
app/code/core/Mage/Catalog/Helper/Output.php 48 catalog_helper_output_construct
app/code/core/Mage/Catalog/Helper/Product/View.php 135 catalog_controller_product_view
app/code/core/Mage/Catalog/Helper/Product.php 283 catalog_controller_product_init_before
app/code/core/Mage/Catalog/Helper/Product.php 320 catalog_controller_product_init
app/code/core/Mage/Catalog/Model/Resource/Layer/Filter/Price.php 103 catalogindex_prepare_price_select
app/code/core/Mage/Catalog/Model/Resource/Layer/Filter/Price.php 108 catalog_prepare_price_select
app/code/core/Mage/Catalog/Model/Resource/Category/Flat/Collection.php 117 $this->_eventPrefix . ‘_load_before
app/code/core/Mage/Catalog/Model/Resource/Category/Flat/Collection.php 129 $this->_eventPrefix . ‘_load_after
app/code/core/Mage/Catalog/Model/Resource/Category/Flat/Collection.php 208 $this->_eventPrefix . ‘_add_is_active_filter
app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php 210 catalog_category_tree_init_inactive_category_ids
app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php 406 catalog_category_tree_move_before
app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php 443 catalog_category_tree_move_after
app/code/core/Mage/Catalog/Model/Resource/Category/Flat.php 198 catalog_category_tree_init_inactive_category_ids
app/code/core/Mage/Catalog/Model/Resource/Category/Collection.php 138 $this->_eventPrefix . ‘_load_before
app/code/core/Mage/Catalog/Model/Resource/Category/Collection.php 150 $this->_eventPrefix . ‘_load_after
app/code/core/Mage/Catalog/Model/Resource/Category/Collection.php 345 $this->_eventPrefix . ‘_add_is_active_filter
app/code/core/Mage/Catalog/Model/Resource/Category.php 364 catalog_category_change_products
app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php 430 catalog_product_flat_prepare_columns
app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php 490 catalog_product_flat_prepare_indexes
app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php 1026 catalog_product_flat_rebuild
app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php 1269 catalog_product_flat_update_product
app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price/Grouped.php 116 catalog_product_prepare_index_select
app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price/Default.php 263 prepare_catalog_product_index_select
app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price/Default.php 280 prepare_catalog_product_price_index_table
app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Decimal.php 98 prepare_catalog_product_index_select
app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Source.php 154 prepare_catalog_product_index_select
app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Source.php 228 prepare_catalog_product_index_select
app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Abstract.php 195 prepare_catalog_product_index_select
app/code/core/Mage/Catalog/Model/Resource/Product/Compare/Item/Collection.php 315 catalog_product_compare_item_collection_clear
app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php 363 catalog_product_collection_load_before
app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php 383 catalog_product_collection_load_after
app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php 831 catalog_product_collection_before_add_count_to_categories
app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php 1652 catalog_product_collection_apply_limitations_after
app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php 851 $this->_eventPrefix . ‘_after
app/code/core/Mage/Catalog/Model/Category.php 229 catalog_category_tree_move_before
app/code/core/Mage/Catalog/Model/Category.php 230 $this->_eventPrefix.’_move_before
app/code/core/Mage/Catalog/Model/Category.php 234 $this->_eventPrefix.’_move_after
app/code/core/Mage/Catalog/Model/Category.php 247 category_move
app/code/core/Mage/Catalog/Model/Product/Action.php 66 catalog_product_attribute_update_before
app/code/core/Mage/Catalog/Model/Product/Action.php 99 catalog_product_website_update_before
app/code/core/Mage/Catalog/Model/Product/Action.php 123 catalog_product_website_update
app/code/core/Mage/Catalog/Model/Product/Type/Price.php 68 catalog_product_get_final_price
app/code/core/Mage/Catalog/Model/Product/Type/Grouped/Price.php 70 catalog_product_type_grouped_price
app/code/core/Mage/Catalog/Model/Product/Type/Abstract.php 537 $eventName
app/code/core/Mage/Catalog/Model/Product/Type/Configurable/Price.php 70 catalog_product_type_configurable_price
app/code/core/Mage/Catalog/Model/Product/Status.php 217 catalog_product_status_update
app/code/core/Mage/Catalog/Model/Product.php 187 $this->_eventPrefix.’_validate_before
app/code/core/Mage/Catalog/Model/Product.php 189 $this->_eventPrefix.’_validate_after
app/code/core/Mage/Catalog/Model/Product.php 1036 catalog_model_product_duplicate
app/code/core/Mage/Catalog/Model/Product.php 1237 catalog_product_is_salable_before
app/code/core/Mage/Catalog/Model/Product.php 1247 catalog_product_is_salable_after
app/code/core/Mage/Catalog/Model/Product.php 1418 $this->_eventPrefix.’_delete_after_done
app/code/core/Mage/GoogleBase/controllers/Adminhtml/Googlebase/TypesController.php 46 controller_action_postdispatch_adminhtml
app/code/core/Mage/Log/Model/Resource/Visitor/Collection.php 240 log_visitor_collection_load_before
app/code/core/Mage/Log/Model/Resource/Log.php 56 log_log_clean_before
app/code/core/Mage/Log/Model/Resource/Log.php 64 log_log_clean_after
app/code/core/Mage/Rule/Model/Environment.php 40 rule_environment_collect
app/code/core/Mage/Eav/Block/Adminhtml/Attribute/Edit/Main/Abstract.php 177 adminhtml_block_eav_attribute_edit_form_init
app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php 824 eav_collection_abstract_load_before
app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php 343 catalog_product_import_finish_before
app/code/core/Mage/CatalogSearch/Model/Resource/Advanced.php 67 catalog_prepare_price_select
app/code/core/Mage/CatalogSearch/Model/Resource/Fulltext.php 297 catalogsearch_reset_search_result
app/code/core/Mage/Bundle/Block/Catalog/Product/View/Type/Bundle.php 162 bundle_product_view_config
app/code/core/Mage/Bundle/Model/Resource/Price/Index.php 378 catalog_product_prepare_index_select
app/code/core/Mage/Bundle/Model/Resource/Indexer/Price.php 255 catalog_product_prepare_index_select
app/code/core/Mage/Bundle/Model/Resource/Indexer/Price.php 481 prepare_catalog_product_price_index_table
app/code/core/Mage/Bundle/Model/Product/Price.php 94 catalog_product_get_final_price
app/code/core/Mage/Bundle/Model/Product/Price.php 104 prepare_catalog_product_collection_prices
app/code/core/Mage/Tag/Model/Resource/Indexer/Summary.php 214 prepare_catalog_product_index_select

Magento: Crear, Obtener variables de sesión

En Magento tenemos una forma particular de guardar variables de sesión


$miValor = "Hola Mundo";
Mage::getSingleton('core/session')->setNombreMiVariableSesion($mivalor);

Para hacer uso de nuestra variable de sesión, lo hacemos de esta manera.

$miVariable = Mage::getSingleton('core/session')->getNombreMiVariableSesion();

Saludos.

Magento: Sesiones cruzadas

Estos días tuvimos un problema con un módulo que desarrollamos, dicho módulo tenía que mostrar el nombre del usuario que inicio sesión con un simple saludo. “hola Roberto” por ejemplo.


Desafortunadamente, al momento de hacer las pruebas nos dimos cuenta que yo tenía el mensaje de bienvenida de otro usuario, y ese “error” se replicaba entre los demas usuarios, las sesiones activas en el servidor se estaban cruzando.


Después de mucho investigar nos dimos cuenta que el problema era la caché de Magento, el bloque del módulo no actualizaba la información que se generaba dinámicamente. Para solucionarlo tuvimos que sacrificar un poco el rendimiento de la página, desactivamos la Full Page Cache, y posteriormente procedimos a desactivar la caché a el bloque en especifico.


Esto lo logramos de la siguiente manera

public function _construct() {
    $this->addData(array(
         'cache_lifetime' => -1,
         'cache_tags'     => array(Mage_Catalog_Model_Product::CACHE_TAG),
    ));
} 



Este código lo ponemos en el constructor de nuestro bloque, con esto indicamos que nuestro bloque no sea almacenado en la caché de Magento, por tanto, cada petición que realicemos se generará  nuevamente sin consultar la caché.


Saludos.


Edición:


Siguiendo con la investigación, me doy cuenta que también se puede hacer mediante el .xml

<block type="modulo/bloque">
    <action method="setCacheLifeTime">
        <num>-1<num>
    </action>
</block>