Become a member
Sign in
Waseem Ishaq
Waseem Ishaq

Waseem Ishaq

14 Following
10 Followers
  • Profile
  • Claps
  • Responses

Latest

Waseem Ishaq
Waseem Ishaq
Sep 13, 2017 · 1 min read

How to override a Magento Observer

This example is to override Mage_CatalogInventory_Model_Observer. The purpose of the overriding is NOT TO return the items of cancelled orders back to stock.

1. app/etc/modules/SD_NoItemStock.xml:

Waseem Ishaq
Waseem Ishaq
Sep 13, 2017 · 1 min read

Run Magento mysql query

$resource = Mage::getSingleton('core/resource');
$writeConnection = $resource->getConnection('core_write');
$table = $resource->getTableName('productalert/stock');
$productId = $_item->getProductId();
$date = '2099-09-12 16:38:36';
$query = "UPDATE {$table} SET stock_update_date = '{$date}' WHERE…
Waseem Ishaq
Waseem Ishaq
Sep 13, 2017 · 2 min read

magento detect inventory change

Config.xml

<events>
<cataloginventory_stock_item_save_commit_after>
<observers>
<genmato_stockupdate>
<class>genmato_stockupdate/observer</class>…
Waseem Ishaq
Waseem Ishaq
Aug 15, 2017 · 1 min read

Magento Test.php

Some time we need to test specific code in magento , debugging the whole process can be frustrating so for short cut you can use a test.php file .

Test App

require 'app/Mage.php';
if (!Mage::isInstalled()) {
echo "Application is not installed…
Waseem Ishaq
Waseem Ishaq
Aug 15, 2017 · 1 min read

Magento Orders

Where is Magento order data stored?

Orders data are saved in database tables sales_flat_order and sales_flat_order_item

Discounts are applied in Mage_SalesRule_Model_Validator

How to get item price…