• What is Catalog Target Rule?
  • Explanation of feature with some example.
  • Directory Structure & Configuration files required/used?
  • What Data Base Tables are involved with this Module?
  • Schema related to Data Base Table
  • Explanation of each Data Base Table field
  • Important SQL Queries related to this Module
  • Call Stack for these queries / Code Stack & its explanation
  • Important flow-chart related to Catalog Target Rule
  • List of classes with important function list related to Catalog Target Rule
  • Explanation of those important functions.
  • Indexing related aspect on this Module
  • How to manage Catalog Target Rule via Admin.
  • Known issues for Catalog Target Rule
  • Important references related to Catalog Target Rule
  • Sample data related to Data Base Tables
  • What is Catalog Target Rule?

    Catalog Target Rules are discount rules that apply to product. This helps in offering promotion via discount on your catalog by applying certain conditions.

    • Catalogrule is the one by which we can assign discount to the products in our store:
    • Applying discount of 25% if a product is of some specific Brand or Applying discount to product if Price greater then say 50 USD.
    • Catalogrule can be applied using condition criterias like : Price, Manufacturer, Brand......
    • Catalogrule have the feature of defining data range.

    In Magento apart from Catalog Target Rule we can also promote using

    Shopping Cart price Rules. To see How shopping cart Price Rules can be handled check this Blog.

    Explanation of feature with some example.

    • For providing automated catalog price to the products “ Mage_CatalogRule” core module is used.
    • There are some conditions which define a subset of the catalog to which price rule apply. Each rule defined has certain date range within which the rule is used.
    • Also this rule has been set to certain customer groups. Catalog rules are defined on a website level.
    • If a website has several store views, then catalog price rule will apply to them all. The catalog price rule management interface is found in back-end under Promotions => Catalog Price Rules.

    Directory Structure & Configuration files required/used?
    magento target rule directory structure
    What Data Base Tables are involved with this Module?
    Following tables are affected with target rule.
    • Catalogrule_product
    • Catalogrule
    • Catalogrule_affected_product
    • Catalogrule_customer_group
    • Catalogrule_website
    • Catalogrule_group_website
    • catalogrule_product_price
    • Catalog_product_index_price
    Schema related to Data Base Table

    Database schema of catalogrule_product:

    Column
    Type
    Null
    Default
    Links to
    Comments
    rule_product_id
    int(10)
    No
    Rule Product Id
    rule_id
    int(10)
    No
    0
    catalogrule -> rule_id
    Rule Id
    from_time
    int(10)
    No
    0
    From Time
    to_time
    int(10)
    No
    0
    To time
    customer_group_id
    smallint(5)
    No
    0
    customer_group -> customer_group_id
    Customer Group Id
    product_id
    int(10)
    No
    0
    catalog_product_entity -> entity_id
    Product Id
    action_operator
    varchar(10)
    Yes
    to_fixed
    Action Operator
    action_amount
    decimal(12,4)
    No
    0.0000
    Action Amount
    action_stop
    smallint(6)
    No
    0
    Action Stop
    sort_order
    int(10)
    No
    0
    Sort Order
    website_id
    smallint(5)
    No
    core_website -> website_id
    Website Id
    sub_simple_action
    varchar(32)
    Yes
    NULL
    Simple Action For Subitems
    sub_discount_amount
    decimal(12,4)
    No
    0.0000
    Discount Amount For Subitems

    Database schema of database table 'catalogrule':

    Column
    Type
    Null
    Default
    Comments
    MIME
    rule id
    int(10)
    No
    Rule Id
    name
    varchar(255)
    Yes
    NULL
    Name
    discription
    text
    Yes
    NULL
    Discription
    from_date
    date
    Yes
    NULL
    From Date
    to_date
    date
    Yes
    NULL
    To Date
    is_active
    smallint(6)
    No
    0
    Is Acitve
    actions_serialized
    mediumtext
    Yes
    NULL
    Actions Serialized
    conditions_serialized
    mediumtext
    Yes
    NULL
    Conditions Serialized
    stop_rule_processing
    smallint(10)
    No
    0
    Sort Order
    simle_action
    varchar(32)
    Yes
    NULL
    Simple Action

    Database schema of database table catalogrule_affected_product:

    Column
    Type
    Null
    Default
    Comments
    MIME
    product_id
    int(10)
    No
    Product Id

    Database schema of catalogrule_customer_group:

    Column
    Type
    Null
    Default
    Links to
    Comments
    MIME
    rule_id
    int(10)
    No
    catalogrule -> rule_id
    Rule Id
    customer_group_id
    smallint(5)
    No
    customer_group -> customer_group_id
    Customer Group Id

    Database schema of table Catalogrule_website:

    Column
    Type
    Null
    Default
    Links to
    Comments
    MIME
    rule_id
    int(10)
    No
    catalogrule -> rule_id
    Rule Id
    website_id
    smallint(5)
    No
    core_website -> website_id
    Website Id

    Database schema of table Catalogrule_group_website:

    Column
    Type
    Null
    Default
    Links to
    Comments
    MIME
    rule_id
    int(10)
    No
    0
    catalogrule -> rule_id
    Rule Id
    customer_group_id
    smallint(5)
    No
    0
    customer_group -> customer_group_id 
    Customer Group Id
    web_id
    smallint(5)
    No
    0
    core_website -> website_id 
    Website Id 

    Database schema of table catalogrule_product_price:

    Column
    Type
    Null
    Default
    Links to
    Comments
    MIME
    rule_product_price_id
    int(10)
    No
    Rule Product PriceId 
    rule_date
    date
    No
    0000-00-00 
    Rule Date
    customer_group_id
    smallint(5)
    No
    0
    customer_group -> customer_group_id
    Customer Group Id
    product_id
    int(10)
    No
    0
    catalog_product_entity -> entity_id
    Product Id
    rule_price
    decimal(12,4)
    No
    0.0000 
    Rule Price 
    website_id
    smallint(5)
    No
    core_website -> website_id
    Website Id
    latest_start_date
    date
    Yes
    Null
    Latest StartDate
    earliest_end_date
    date
    Yes
    Null
    Earliest EndDate 

    Database schema of table Catalog_product_index_price:

    Column
    Type
    Null
    Default
    Links to
    Comments
    MIME
    entity_id
    int(10)
    No
    0
    catalog_product_entity -> entity_id 
    Entity ID 
    customer_group_id
    smallint(5)
    No
    0
    customer_group -> customer_group_id
    Customer Group Id
    website_id
    smallint(5)
    No
    core_website -> website_id
    Website Id
    tax_class_id
    smallint(5)
    Yes
    0
    Tax Class ID
    price
    decimal(12,4)
    Yes
    Null
    Price 
    final_price
    decimal(12,4)
    Yes
    Null
    Final Price 
    min_price
    decimal(12,4)
    Yes
    Null
    Min Price 
    Max_price
    decimal(12,4)
    Yes
    Null
    Max Price 
    tier_price
    decimal(12,4)
    Yes
    Null
    Tier Price 
    group_price
    decimal(12,4)
    Yes
    Null
    Group Price 
    Explanation of each Data Base Table field
    Description of each field in the 'catalogrule_product' table
    • rule_product_id: id of the product to which rule is applied.
    • rule_id: id of the rule.
    • from_time: The time from which the rule has been applied to the product.
    • to_time: The time upto which the rule has been applied to the products.
    • customer_group_id: make sure that prices are available for the customers groups you selected in the rule settings in the backend.
    • product_id: The id of product to which rule is applied.
    • website_id: the id of our website.
    Description of each field in the 'catalogrule' table
    • rule_id: id of the rule.
    • name: name of the rule.
    • description: description of the rule which is set from admin.
    • from_time: The time from which the rule has been applied to the product.
    • to_time: The time upto which the rule has been applied to the products.
    • is active: it is the status tab of rule which is set from admin.If it is active then value is 1. and if it is inactive then it is 0.
    • conditions_serialised: The conditions of the rule which we set from admin.
    • action_serialised:
    • top_rules_processing: it is the tab “stop further rule processing ”in rule setting from admin.
    • sort order: It is the priority to the rule which is set from admin.
    • simple_action: It is the 'action' tab of the rule from admin.
    • discount_amount: the 'discount Amount' tab of rule from admin in which we set discount.
    • sub_is enable: this is the 'Enable Discount to subproducts' tab of rule from admin.
    • sub_simple_action: It is the 'action' tab from admin display when 'Enable Discount to subproducts' is set to 'yes'. Here action is by percent,by fixed amount.
    • sub_discount_amount: it is discount amount of the rule.

    Description of the field in the 'catalogrule_affected_product' table

    • product_id: The id of product to which rule is applied.
    • Note: There is no sample data for 'catalogrule_affected_product' table.

    Description of the field in the 'catalogrule_product_price' table

    • rule_product_price_id: id of the 'rule product price'.
    • rule_date:for each product magento stores three rows for three days. i.e. Current day,previous day,and next day. Thus it helps the system work exactly with many time zones or even when the cron job is missed.
    • customer_group_id:make sure that prices are available for the customers groups you selected in the rule settings in the backend.
    • product_id:the id of product.
    • rule_price:the final price of product after applying disount by rule.
    • website_id:the id of our website.
    • latest_start_date:If this columns is null,then the rule is not limited by a date range.Otherwise latest_start_date is earlier date or the same as the current date.
    • earliest_end_dateIf this columns is null,then the rule is not limited by a date range.Otherwise earliest_end_date is later date or the same as the current day.

    Description of the field in the 'catalogrule_group_website' table

    • rule_id: id of the rule.
    • customer_group_id:make sure that prices are available for the customers groups you selected in the rule settings in the backend.
    • website_id:the id of our website.

    Description of the field in the 'catalogrule_website' table

    • rule_id: id of the rule.
    • website_id:the id of our website.

    Description of the field in the 'catalogrule_customer_group' table

    • rule_id: id of the rule.
    • customer_group_id:make sure that prices are available for the customers groups you selected in the rule settings in the backend.

    Description of the field in the 'catalog_product_index_price' table

    • entity_id: A unique identifier for an entity, uniquely identifying and distinguishing a particular entity instance from other similar entities (typically of the same type or class).
    • customer_group_id: make sure that prices are available for the customers groups you selected in the rule settings in the backend.
    • website_id: the id of our website.
    • tax_class_id: It is the id of the tax class assigned to the product.
    • price: It is the price of the product.
    • final_price: It is the final price after applying rule to the product.
    • min_price: It is the minimum price assign of the product.
    • max_price: It is the maximum price of the product.
    • tier_price: It is the tier price of the product assigned from admin.
    • group_price: It is the group price of the product assigned from admin.

    Important SQL Queries related to this Module
    SQL queries related to database table 'catalogrule_product': Action: Edit and save product from admin: 1) SQL: DELETE FROM `catalogrule_product` WHERE (rule_id = '8') AND (product_id IN ('52'))
    2)SQL: INSERT INTO `catalogrule_product` 
    (`rule_id`,`from_time`,`to_time`,
    `website_id`,`customer_group_id`,
    `product_id`,
    `action_operator`,`action_amount`,
    `action_stop`,`sort_order`,
    `sub_simple_action`,
    `sub_discount_amount`) 
    VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
    BIND: array ( 
      0 => '9', 
      1 => 1405900800, 
      2 => 1406764799, 
      3 => '1', 
      4 => '0', 
      5 => 197, 
      6 => 'by_percent', 
      7 => 10, 
      8 => 0, 
      9 => 0, 
      10 => '', 
      11 => 0, 
      
    ) 
    

    Action: Save and apply rule from admin :-

    1)SQL: DELETE FROM `catalogrule_product` WHERE (rule_id = '8')

    strong>2) SQL: INSERT INTO `catalogrule_product`

    (`rule_id`,`from_time`,`to_time`,
    `website_id`,`customer_group_id`,`product_id`,
    `action_operator`,`action_amount`,
    `action_stop`,`sort_order`,
    `sub_simple_action`,`sub_discount_amount`)
     VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?),
    BIND: array ( 
      0 => '8', 
      1 => 1240704000, 
      2 => 0, 
      3 => '1', 
      4 => '5', 
      5 => 27, 
      6 => 'by_percent', 
      7 => 25, 
      8 => 0, 
      9 => 0, 
      10 => '', 
      11 => 0,  
    ) 
    

    Action: Import product from admin :-

    1)SQL: DELETE FROM `catalogrule_product` WHERE (rule_id = '8') AND (product_id IN ('191', '192', '193', '194'))

    SQL queries related to database table 'catalogrule:-

    Action:-Save and apply rule  from admin :-

    1) SQL: INSERT INTO `catalogrule` (`name`, `description`, `from_date`, `to_date`, `is_active`, `conditions_serialized`, `actions_serialized`, `stop_rules_processing`, `sort_order`, `simple_action`, `discount_amount`, `sub_is_enable`, `sub_simple_action`, `sub_discount_amount`) VALUES (?, ?, '2014-07-01', '2014-07-31', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) BIND: array ( 0 => '10 % discount', 1 => NULL, 2 => 1, 3 => 'a:7:{s:4:"type";s:34:"catalogrule/rule_condition_combine"; s:9:"attribute";N;s:8:"operator";N;s:5:"value"; s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:" all";s:10:"conditions"; a:1:{i:0;a:5:{s:4:"type";s:34: "catalogru/rule_condition_product";s:9: "attribute";s:12:"category_ids";s:8:"operator"; s:2:"==";s:5:"value";s:2:"10";s:18: "is_value_processed";b:0;}}}', 4 => 'a:4:{s:4:"type";s:34: "catalogrule/rule_action_collection" ;s:9:"attribute";N;s:8:" operator";s:1:"=";s:5:"value";N;}', 5 => 0, 6 => 1, 7 => 'by_percent', 8 => 60, 9 => 0, 10 => 'by_percent', 11 => 0, )

    Action:Import product from admin :-

    1) SQL: SELECT `main_table`.* FROM `catalogrule` AS `main_table` WHERE (is_active = '1')

    SQL queries related to database table 'Catalogrule_affected_product':-

    Action:- Edit and save product from admin :-

    1)SQL: DELETE FROM `catalogrule_affected_product`

    Action: Save and apply rule from admin :-

    1)SQL: DELETE FROM `catalogrule_affected_product`

    SQL queries related to database table 'Catalogrule_customer_group':

    Action:- Save and apply rule from admin :-

    1) SQL: DELETE FROM `catalogrule_customer_group` WHERE (rule_id IN (9) AND customer_group_id NOT IN ('0', '1', '2', '3', '5', '6'))

    2)SQL: INSERT INTO `catalogrule_customer_group`
     (`customer_group_id`,
    `rule_id`) 
    VALUES (?, ?), (?, ?), (?, ?), (?, ?), (?, ?), 
    (?, ?) ON DUPLICATE KEY UPDATE rule_id = VALUES(`rule_id`) 
    BIND: array ( 
      0 => '0', 
      1 => 9, 
      2 => '1', 
      3 => 9, 
      4 => '2', 
      5 => 9, 
      6 => '3', 
      7 => 9, 
      8 => '5', 
      9 => 9, 
      10 => '6', 
      11 => 9, 
    ) 
    

    3) SQL: SELECT `catalogrule_customer_group`.`customer_group_id` FROM `catalogrule_customer_group` WHERE (rule_id = '8')

    Action:- Import product from admin :-

    1) SQL: SELECT `catalogrule_customer_group`.`customer_group_id` FROM `catalogrule_customer_group` WHERE (rule_id = '9')

    SQL queries related to database table 'Catalogrule_website':-

    Action:- Edit and save product from admin :-

    1) SQL: SELECT `catalogrule_website`.`website_id` FROM `catalogrule_website` WHERE (rule_id = '8')

    Action:- Save and apply rule from admin :-

    1) SQL: DELETE FROM `catalogrule_website` WHERE (rule_id IN (9) AND website_id NOT IN ('1', '2'))

    2) SQL: INSERT INTO `catalogrule_website` 
    (`website_id`,`rule_id`) VALUES 
    (?, ?), (?, ?) ON DUPLICATE KEY UPDATE rule_id = VALUES
    (`rule_id`) 
    BIND: array ( 
      0 => '1', 
      1 => 9, 
      2 => '2', 
      3 => 9, 
    ) 
    

    3) SQL: SELECT `catalogrule_website`.`website_id` FROM `catalogrule_website` WHERE (rule_id = '8')

    Action:- Import product from admin :-

    1) SQL: SELECT `catalogrule_website`.`website_id` FROM `catalogrule_website` WHERE (rule_id = '8')

    SQL queries related to database table 'Catalogrule_group_website':-

    Action:-Edit and save product from admin :-

    1) SQL: DELETE FROM `catalogrule_group_website`

    2) SQL: INSERT INTO `catalogrule_group_website` 
    SELECT DISTINCT `catalogrule_product`.
    `rule_id`, `catalogrule_product`.
    `customer_group_id`,`catalogrule_product`.
    `website_id` FROM `catalogrule_product` 
    WHERE(1405926000 >= from_time) 
    AND 
    (IF((to_time = 0), 1, 1405926000 <= to_time)) 
    

    SQL queries related to database table 'Catalogrule_product_price':

    Action:-Edit and save product from admin :-

    1) SQL: DELETE FROM `catalogrule_product_price` WHERE (product_id = '52')

    2) SQL: INSERT INTO `catalogrule_product_price` 
    SELECT NULL AS `rule_product_price_id`, 
    `dates`.`rule_date`, `t`.
    `customer_group_id`, `t`.
    `product_id`, MIN(rule_price)
     AS `rule_price`,1 AS `website_id`,
     `t`.`latest_start_date`,
     `t`.`earliest_end_date` 
    FROM (SELECT `cppt`.`customer_group_id`, `cppt`.`product_id`, 
    CASE  WHEN IFNULL((@group_id), 
    'N/A') != cppt.grouped_id THEN
     @price := CASE `cppt`.
    `action_operator` WHEN 
    'to_percent' THEN cppt.
    price * cppt.action_amount/100 
    WHEN 'by_percent' THEN cppt.price 
    * (1 - cppt.action_amount/100) WHEN 
    'to_fixed' THEN 
    IF((cppt.action_amount < cppt.price),
     cppt.action_amount, cppt.price) 
    WHEN 'by_fixed' THEN 
    IF((0 > cppt.price - cppt.action_amount)
    , 0, cppt.price - cppt.action_amount)
     END WHEN IFNULL((@group_id), 'N/A')
     = cppt.grouped_id AND 
    IFNULL((@action_stop), 0) = 0 
    THEN @price := CASE `cppt`.
    `action_operator` 
    WHEN 'to_percent' 
    THEN @price * cppt.action_amount/100 
    WHEN 'by_percent' THEN @price *
     (1 - cppt.action_amount/100) WHEN 'to_fixed' 
    THEN IF((cppt.action_amount < @price),
     cppt.action_amount, @price) 
    WHEN 'by_fixed' THEN IF
    ((0 > @price - cppt.action_amount), 
    0, @price - cppt.action_amount) 
    END ELSE @price := @price END AS 
    `rule_price`, `cppt`.`from_date` 
    AS `latest_start_date`, `cppt`.
    `to_date` AS `earliest_end_date`, 
    CASE  WHEN IFNULL((@group_id), 'N/A') 
    != cppt.grouped_id THEN @action_stop 
    := cppt.action_stop WHEN IFNULL
    ((@group_id), 'N/A') = cppt.grouped_id 
    THEN @action_stop := IFNULL
    ((@action_stop), 0) + cppt.action_stop END,
     @group_id := cppt.grouped_id, `cppt`.
    `from_time`, `cppt`.`to_time` 
    FROM `catalogrule_product_price_tmp` 
    AS `cppt` ORDER BY `cppt`.
    `grouped_id` ASC, `cppt`.`sort_order`
     ASC, `cppt`.`rule_product_id` ASC) AS 
    `t`
    INNER JOIN (SELECT DATE_ADD
    (FROM_UNIXTIME(1405926000), 
    INTERVAL -1 DAY) AS rule_date 
    UNION SELECT FROM_UNIXTIME(1405926000) 
    AS rule_date UNION SELECT DATE_ADD
    (FROM_UNIXTIME(1405926000), 
    INTERVAL 1 DAY) AS rule_date) 
    AS `dates` ON 1=1 WHERE 
    (UNIX_TIMESTAMP(dates.rule_date) 
    >= from_time) AND (IF((to_time = 0),
     1, UNIX_TIMESTAMP(dates.rule_date) 
    <= to_time)) GROUP BY `customer_group_id`, 
    	`product_id`, 
    	`dates`.`rule_date` 
    

    Action:-Save and apply rule from admin :-

    1) SQL: DELETE FROM `catalogrule_product_price` WHERE (website_id = '1')

    2) SQL: INSERT INTO 
    `catalogrule_product_price` 
    SELECT NULL AS `rule_product_price_id`, 
    `dates`.`rule_date`, 
    `t`.`customer_group_id`,
     `t`.`product_id`, 
    MIN(rule_price) 
    AS`rule_price`, 
    1 AS `website_id`, 
    `t`.`latest_start_date`,
     `t`.`earliest_end_date` 
    FROM (SELECT `cppt`.`customer_group_id`, 
    `cppt`.`product_id`, 
    CASE  WHEN IFNULL((@group_id), 
    'N/A') != cppt.grouped_id THEN
     @price := CASE `cppt`.
    `action_operator` 
    WHEN 'to_percent' 
    THEN cppt.price * 
    cppt.action_amount/100 WHEN
     'by_percent' THEN cppt.price *
     (1 - cppt.action_amount/100) WHEN
     'to_fixed' THEN
     IF((cppt.action_amount < cppt.price), 
    cppt.action_amount, cppt.price)
     WHEN 'by_fixed' THEN IF
    ((0 > cppt.price - cppt.action_amount),
     0, cppt.price - cppt.action_amount)
     END WHEN IFNULL((@group_id), 'N/A') 
    = cppt.grouped_id 
    AND IFNULL((@action_stop), 0) 
    = 0 THEN @price := CASE 
    `cppt`.`action_operator` 
    WHEN 'to_percent' THEN 
    @price * cppt.action_amount/100 
    WHEN 'by_percent' 
    THEN @price * (1 - cppt.action_amount/100) 
    WHEN 'to_fixed' THEN 
    IF((cppt.action_amount < @price),
     cppt.action_amount, @price) 
    WHEN 'by_fixed' THEN IF
    ((0 > @price - cppt.action_amount), 0, 
    @price - cppt.action_amount)
     END ELSE @price := @price 
    END AS `rule_price`, `cppt`.
    `from_date` AS `latest_start_date`, 
    `cppt`.`to_date` AS `earliest_end_date`, 
    CASE WHEN IFNULL((@group_id), 'N/A')
     != cppt.grouped_id THEN @action_stop 
    := cppt.action_stop WHEN IFNULL((@group_id),
     'N/A') = cppt.grouped_id THEN 
    @action_stop := IFNULL((@action_stop), 0)
     + cppt.action_stop END, 
    @group_id := cppt.grouped_id, 
    `cppt`.`from_time`, `cppt`.`to_time` 
    FROM `catalogrule_product_price_tmp` AS `cppt` 
    ORDER BY `cppt`.`grouped_id` ASC, 
    `cppt`.`sort_order` ASC, `cppt`.
    `rule_product_id` ASC) AS `t` 
     INNER JOIN 
    (SELECT DATE_ADD(FROM_UNIXTIME(1405926000), 
    INTERVAL -1 DAY)
     AS rule_date UNION SELECT 
    FROM_UNIXTIME(1405926000)
     AS rule_date UNION SELECT DATE_ADD
    (FROM_UNIXTIME(1405926000),
     INTERVAL 1 DAY) AS rule_date) 
    AS `dates` ON 1=1 WHERE 
    (UNIX_TIMESTAMP(dates.rule_date) 
    >= from_time) AND (IF((to_time = 0), 
    1, UNIX_TIMESTAMP(dates.rule_date) 
    <= to_time))
     GROUP BY `customer_group_id`, 
    	`product_id`, 
    	`dates`.`rule_date` 
    

    SQL queries related to database table 'Catalog_product_index _price':

    Action:-Edit and save product from admin :-

    1) SQL: DELETE `index_price`  FROM 
    `catalog_product_index_price` AS `index_price` 
     LEFT JOIN `catalog_product_index_price_tmp` AS 
    `ip_tmp` ON index_price.entity_id = ip_tmp.
    entity_id AND index_price.website_id = ip_tmp.
    website_id WHERE (ip_tmp.entity_id IS NULL) AND 
    (index_price.entity_id IN('197')) 
    2)SQL: INSERT INTO `catalog_product_index_price`.
    
    (`entity_id`, `customer_group_id`, `website_id`, 
    `tax_class_id`, `price`, `final_price`, `min_price`,
     `max_price`, `tier_price`, `group_price`) 
    SELECT `catalog_product_index_price_tmp`.
    `entity_id`, `catalog_product_index_price_tmp`.
    `customer_group_id`, 
    `catalog_product_index_price_tmp`.
    `website_id`,`catalog_product_index_price_tmp`.
    `tax_class_id`, 
    `catalog_product_index_price_tmp`.
    `price`, 
    `catalog_product_index_price_tmp`.
    `final_price`, 
    `catalog_product_index_price_tmp`.
    `min_price`, 
    `catalog_product_index_price_tmp`.
    `max_price`, 
    `catalog_product_index_price_tmp`.
    `tier_price`, 
    `catalog_product_index_price_tmp`.
    `group_price` FROM 
    `catalog_product_index_price_tmp`
     ON DUPLICATE KEY UPDATE 
    `entity_id` = VALUES
    (`entity_id`),
     `customer_group_id` = VALUES
    (`customer_group_id`), 
    `website_id` = VALUES
    (`website_id`), 
    `tax_class_id` = VALUES
    (`tax_class_id`), 
    `price` = VALUES
    (`price`),
     `final_price` = VALUES
    (`final_price`), 
    `min_price` = VALUES
    (`min_price`), 
    `max_price` = VALUES
    (`max_price`),
     `tier_price` = VALUES
    (`tier_price`),
     `group_price` = VALUES
    (`group_price`) 
    Call Stack for these queries / Code Stack & its explanation
    Call stack for database table “catalogrule_product”

    DELETE Query

    Action:- Edit and save product from admin

    #1
     Magento_Db_Adapter_Pdo_Mysql[Varien_Db_Adapter_Pdo_Mysql]22
    #000000000a4f4475000000001abd2494#->_debugStat
    (2, 'DELETE FROM `cat...', array(),&Varien_Db_Statement_Pdo_Mysql
    #000000000a4f4696000000001abd2494#)called at 
    [lib\Varien\Db\Adapter\Pdo\Mysql.php:433] 
    
    
    #2
     Magento_Db_Adapter_Pdo_Mysql[Varien_Db_Adapter_Pdo_Mysql]
    #000000000a4f4475000000001abd2494#->
    query('DELETE FROM `cat...') 
    called at [lib\Zend\Db\Adapter\Abstract.php:661] 
    
    #3
     Magento_Db_Adapter_Pdo_Mysql[Zend_Db_Adapter_Abstract]
    #000000000a4f4475000000001abd2494#->
    delete('catalogrule_prod...', array
    ('rule_id = ?' => 8,'product_id IN 
    (?...' => array(52))) 
    called at 
    [app\code\core\Mage\CatalogRule\Model\Resource\
    Rule.php:164] 
    
    #4
    Mage_CatalogRule_Model_Resource_Rule
    #000000000a4f4779000000001abd2494#->
    cleanProductData(8, array(52)) 
    called at 
    [app\code\core\Mage\CatalogRule\Model\Resource\
    Rule.php:774] 
    
    #5 
     Mage_CatalogRule_Model_Resource_Rule
    #000000000a4f4779000000001abd2494#->
    applyToProduct(&Mage_CatalogRule_Model_Rule
    #000000000a4f475a000000001abd2494#, &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#, 
    array(1)) 
    called at 
    [app\code\core\Mage\CatalogRule\Model\
    Rule.php:346] 
    
    #6 
    Mage_CatalogRule_Model_Rule
    #000000000a4f474f000000001abd2494#->
    applyAllRulesToProduct
    (&Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#) 
    called at 
    [app\code\core\Mage\CatalogRule\Model\
    Observer.php:53]
     
    #7 
    Mage_CatalogRule_Model_Observer
    #000000000a4f4774000000001abd2494#->
    applyAllRulesOnProduct
    (&Varien_Event_Observer
    #000000000a4f473c000000001abd2494#) 
    called at 
    [app\code\core\Mage\Core\Model\App.php:1338] 
    
    #8
    Mage_Core_Model_App#000000000a4f446f000000001abd2494
    #->
    _callObserverMethod
    (&Mage_CatalogRule_Model_Observer
    #000000000a4f4774000000001abd2494#, 
    'applyAllRulesOnP...',
     &Varien_Event_Observer
    #000000000a4f473c000000001abd2494#) 
    called at 
    [app\code\core\Mage\Core\Model\App.php:1317]
     
    #9 
     Mage_Core_Model_App#000000000a4f446f000000001abd2494
    #->dispatchEvent
    ('catalog_product_...', array('data_object' => 
    &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#, 
    'product' => 
    &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#)) 
    called at 
    [app\Mage.php:447] 
    
    #10
    Mage::dispatchEvent('catalog_product_...', 
    array
    ('data_object' => 
    &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494\#, 
    'product' => 
    &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#)) 
    called at 
    [app\code\core\Mage\Core\Model\Abstract.php:344] 
    
    #11 
    Mage_Catalog_Model_Product
    [Mage_Core_Model_Abstract]
    #000000000a4f45c7000000001abd2494
    #->afterCommitCallback() 
    
    #12
    call_user_func(array
    (&Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#, 
    'afterCommitCallb...')) 
    called at [app\code\core\Mage\Core\Model\Resource\
    Abstract.php:110] 
    
    #13
    Mage_Catalog_Model_Resource_Product
    [Mage_Core_Model_Resource_Abstract]
    #000000000a4f4512000000001abd2494#->commit()
     called at [app\code\core\Mage\Core\Model\
    Abstract.php:322] 
    
    #14
    Mage_Catalog_Model_Product[Mage_Core_Model_Abstract]
    #000000000a4f45c7000000001abd2494
    #->save() 
    called at [app\code\core\Mage\Adminhtml\
    controllers\Catalog\ProductController.php:728] 
    
    #15
     Mage_Adminhtml_Catalog_ProductController
    #000000000a4f44cb000000001abd2494
    #->saveAction() 
    called at 
    [app\code\core\Mage\Core\Controller
    \Varien\Action.php:418] 
    

    INSERT Query

    Action:- Edit and save product from admin AFF: 6 TIME: 0.0020 TRACE:

    #1 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #000000004fcc58cd00000000c23ec589#->_
    debugStat(2, 'INSERT INTO `cat...',
     array
    (9, 1405900800, 1406764799, 1, 0, 197,
     'by_percent', 10, 0, 0, '', 0, 9, 
    1405900800, 1406764799, 1, 1, 197, 
    'by_percent',
     10, 0, 0, '', 0, 9, 
    1405900800, 1406764799, 
    1, 2, 197, 
    'by_percent', 10, 0, 0, '', 0, 9, 
    1405900800, 1406764799, 1, 3, 197, 
    'by_percent', 10, 0, 0, '', 0, 9,
     1405900800, 1406764799, 1, 5, 197,
     'by_percent', 10, 0, 0, '', 0, 9, 
    1405900800, 1406764799, 1, 6, 197, 
    'by_percent', 10, 0, 0, '', 0),
     &Varien_Db_Statement_Pdo_Mysql
    #000000004fcc5b8b00000000c23ec589#)
    called at 
    [lib/Varien/Db/Adapter/Pdo/Mysql.php:433] 
    
    #2
    Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #000000004fcc58cd00000000c23ec589#->query
    ('INSERT INTO `cat...', 
    array(9, 1405900800, 1406764799, 1, 0, 197, 
    'by_percent', 10, 0, 0, '', 0, 9, 
    1405900800, 1406764799, 1, 1, 197,
     'by_percent', 
    10, 0, 0, '', 0, 9, 1405900800, 
    1406764799, 1, 2, 197, 
    'by_percent', 10, 0, 0, '', 0, 9, 
    1405900800, 1406764799, 1, 3, 197, 
    'by_percent', 10, 0, 0, '', 0, 9, 
    1405900800, 1406764799, 1, 5, 197,
     'by_percent', 10, 0, 0, '', 0, 9, 
    1405900800, 1406764799, 1, 6, 197, 
    'by_percent', 
    10, 0, 0, '', 0)) 
    called at 
    [lib/Varien/Db/Adapter/Pdo/Mysql.php:1983] 
    
    #3
    Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #000000004fcc58cd00000000c23ec589#->
    insertArray
    ('catalogrule_prod...', 
    array
    ('rule_id', 'from_time', 'to_time',
     'website_id', 
    'customer_group_i...', 'product_id', 
    'action_operator',
    'action_amount','action_stop', 
    'sort_order', 'sub_simple_actio...', 
    'sub_discount_amo...'), 
    array(array(9, 1405900800,
     1406764799, 1, 0, 197, 
    'by_percent', 10, 0, 0, '', 0),
     array(9, 1405900800, 1406764799, 
    1, 1, 197, 'by_percent', 10, 0, 0, '', 0), 
    array(9, 1405900800, 1406764799, 
    1, 2, 197, 'by_percent', 10, 0, 0, '',0))) 
    called at
     [lib/Varien/Db/Adapter/Pdo/Mysql.php:1956]
     
    #4
    Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #000000004fcc58cd00000000c23ec589#->
    insertMultiple
    ('catalogrule_prod...', 
    array(array('rule_id' => 9, 
    'from_time' => 1405900800, 
    'to_time' => 1406764799, 
    'website_id' => 1, 
    'customer_group_i...' => 0, 
    'product_id' => 197, 
    'action_operator' => 
    'by_percent', 
    'action_amount' => 10, 
    'action_stop' => 0, 
    'sort_order' => 0,
     'sub_simple_actio...' => '',
     'sub_discount_amo...' => 0))) 
    called at 
    [app/code/core/Mage/CatalogRule/Model/
    Resource/Rule.php:313]
     
    #5
    Mage_CatalogRule_Model_Resource_Rule
    #000000004fcc5bcd00000000c23ec589#->
    insertRuleData(&Mage_CatalogRule_Model_Rule
    #000000004fcc5a0d00000000c23ec589#,
     array(1), array(array(1))) 
    called at 
    [app/code/core/Mage/CatalogRule/Model/
    Resource/Rule.php:786]
    
    #6
    Mage_CatalogRule_Model_Resource_Rule
    #000000004fcc5bcd00000000c23ec589
    #->applyToProduct(&Mage_CatalogRule_Model_Rule
    #000000004fcc5a0d00000000c23ec589#,
     &Mage_Catalog_Model_Product
    #000000004fcc597500000000c23ec589
    #,
     array(1)) 
    called at
     [app/code/core/Mage/CatalogRule/
    Model/Rule.php:346]
    
    #7
    Mage_CatalogRule_Model_Rule
    #000000004fcc5a0e00000000c23ec589#->
    applyAllRulesToProduct
    (&Mage_Catalog_Model_Product
    #000000004fcc597500000000c23ec589#) 
    called at 
    [app/code/core/Mage/CatalogRule/Model/
    Observer.php:53]
     
    #8
    Mage_CatalogRule_Model_Observer #000000004fcc5a1500000000c23ec589#-> applyAllRulesOnProduct (&Varien_Event_Observer #000000004fcc5a2e00000000c23ec589#) called at [app/code/core/Mage/Core/Model/App.php:1338] #9 Mage_Core_Model_App #000000004fcc58de00000000c23ec589#-> _callObserverMethod (&Mage_CatalogRule_Model_Observer #000000004fcc5a1500000000c23ec589#, 'applyAllRulesOnP...', &Varien_Event_Observer #000000004fcc5a2e00000000c23ec589# called at [app/code/core/Mage/Core/Model/App.php:1317] #10 Mage_Core_Model_App #000000004fcc58de00000000c23ec589#->dispatchEvent ('catalog_product_...', array ('data_object' => &Mage_Catalog_Model_Product #000000004fcc597500000000c23ec589#, 'product' => &Mage_Catalog_Model_Product #000000004fcc597500000000c23ec589#)) called at [app/Mage.php:447] #11 Mage::dispatchEvent ('catalog_product_...', array ('data_object' => &Mage_Catalog_Model_Product #000000004fcc597500000000c23ec589#, 'product' => &Mage_Catalog_Model_Product #000000004fcc597500000000c23ec589#)) called at [app/code/core/Mage/Core/Model/ Abstract.php:344] #12 Mage_Catalog_Model_Product [Mage_Core_Model_Abstract] #000000004fcc597500000000c23ec589#-> afterCommitCallback() #13 call_user_func(array (&Mage_Catalog_Model_Product #000000004fcc597500000000c23ec589#, ' afterCommitCallb...')) called at [app/code/core/Mage/Core/Model/Resource/ Abstract.php:110] #14 Mage_Catalog_Model_Resource_Product [Mage_Core_Model_Resource_Abstract] #000000004fcc595800000000c23ec589#->commit() called at [app/code/core/Mage/Core/Model/Abstract.php:322] #15 Mage_Catalog_Model_Product [Mage_Core_Model_Abstract] #000000004fcc597500000000c23ec589#-> save() called at [app/code/core/Mage/Adminhtml/controllers/ Catalog/ProductController.php:728] #16 Mage_Adminhtml_Catalog_ProductController #000000004fcc587a00000000c23ec589#-> saveAction() called at [app/code/core/Mage/Core/Controller/ Varien/Action.php:418]

    DELETE Query
    Action: Save and apply rule from admin

    AFF: 23

    TIME: 0.0526

    TRACE:

    #1 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #0000000051ad9f90000000001df5c15a
    #->_debugStat
    (2, 'DELETE FROM `cat...', array(),
     &Varien_Db_Statement_Pdo_Mysql
    #0000000051ad9d98000000001df5c15a#) 
    called at 
    [lib\Varien\Db\Adapter\Pdo\Mysql.php:433] 
    
    #2 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #0000000051ad9f90000000001df5c15a#->
    query('DELETE FROM `cat...') 
    called at 
    [lib\Zend\Db\Adapter\Abstract.php:661] 
    
    #3 Magento_Db_Adapter_Pdo_Mysql
    [Zend_Db_Adapter_Abstract]
    #0000000051ad9f90000000001df5c15a
    #->delete('catalogrule_prod...', array
    ('rule_id = ?' => 8)) 
    called at 
    [app\code\core\Mage\CatalogRule\Model\
    Resource\Rule.php:164] 
    
    #4 Mage_CatalogRule_Model_Resource_Rule
    #0000000051ad9e71000000001df5c15a#->
    cleanProductData(8) 
    called at 
    [app\code\core\Mage\CatalogRule\Model\
    Resource\Rule.php:334] 
    
    #5 Mage_CatalogRule_Model_Resource_Rule
    #0000000051ad9e71000000001df5c15a#->
    updateRuleProductData
    (&Mage_CatalogRule_Model_Rule
    #0000000051ad9d8f000000001df5c15a#) 
    
    #6 call_user_func_array(array
    (&Mage_CatalogRule_Model_Resource_Rule
    #0000000051ad9e71000000001df5c15a
    #, 'updateRuleProduc...'), array
    (&Mage_CatalogRule_Model_Rule
    #0000000051ad9d8f000000001df5c15a#)) 
    called at 
    [lib\Varien\Data\Collection.php:466] 
    
    #7 Mage_CatalogRule_Model_Resource_Rule_Collection
    [Varien_Data_Collection]
    #0000000051ad9dba000000001df5c15a
    #->walk(array(&Mage_CatalogRule_Model
    _Resource_Rule
    #0000000051ad9e71000000001df5c15a
    #, 'updateRuleProduc...')) 
    called at 
    [app\code\core\Mage\CatalogRule\Model\
    Rule.php:317] 
    
    #8 Mage_CatalogRule_Model_Rule
    #0000000051ad9d87000000001df5c15a
    #->applyAll() 
    called at 
    [app\code\core\Mage\Adminhtml\controllers\
    Promo\CatalogController.php:297] 
    
    #9 Mage_Adminhtml_Promo_CatalogController
    #0000000051ad9de6000000001df5c15a#->
    applyRulesAction() 
    called at [app\code\core\Mage\Core\Controller
    \Varien\Action.php:418] 
    

    Call stack for database table “Catalogrule_affected_product”:-

    Action:- Edit and save product from admin :-

    DELETE Query :-

    SQL: DELETE FROM `catalogrule_affected_product` AFF: 0 TIME: 0.0005 TRACE:
    #1 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #000000000a4f4475000000001abd2494
    #->_debugStat
    (2, 'DELETE FROM `cat...', array(), 
    &Varien_Db_Statement_Pdo_Mysql
    #000000000a4f472a000000001abd2494#) 
    called at 
    [lib\Varien\Db\Adapter\Pdo\Mysql.php:433] 
    
    #2 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #000000000a4f4475000000001abd2494
    #->query('DELETE FROM `cat...') 
    called at 
    [lib\Zend\Db\Adapter\Abstract.php:661] 
    
    #3 Magento_Db_Adapter_Pdo_Mysql
    [Zend_Db_Adapter_Abstract]
    #000000000a4f4475000000001abd2494
    #->delete('catalogrule_affe...') 
    called at 
    [app\code\core\Mage\CatalogRule\
    Model\Action\Index\Refresh.php:646] 
    
    #4 Mage_CatalogRule_Model_Action_Index_Refresh_Row
    [Mage_CatalogRule_Model_Action_Index_Refresh]
    #000000000a4f477c000000001abd2494#->
    _prepareAffectedProduct() 
    called at 
    [app\code\core\Mage\CatalogRule\Model\
    Action\Index\Refresh.php:131] 
    
    #5 Mage_CatalogRule_Model_Action_Index_Refresh_Row
    [Mage_CatalogRule_Model_Action_Index_Refresh]
    #000000000a4f477c000000001abd2494#->execute() 
    called at 
    [app\code\core\Mage\CatalogRule\Model\Resource\
    Rule.php:592] 
    
    #6 Mage_CatalogRule_Model_Resource_Rule
    #000000000a4f4779000000001abd2494
    #->_reindexCatalogRule(&Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#) 
    called at 
    [app\code\core\Mage\CatalogRule\Model\Resource
    \Rule.php:545] 
    
    #7 Mage_CatalogRule_Model_Resource_Rule
    #000000000a4f4779000000001abd2494
    #->applyAllRules
    (&Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#) 
    called at 
    [app\code\core\Mage\CatalogRule\Model
    \Rule.php:349] 
    
    #8 Mage_CatalogRule_Model_Rule
    #000000000a4f474f000000001abd2494#->
    applyAllRulesToProduct
    (&Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#) 
    called at 
    [app\code\core\Mage\CatalogRule\Model\
    Observer.php:53] 
    
    #9 Mage_CatalogRule_Model_Observer
    #000000000a4f4774000000001abd2494#->
    applyAllRulesOnProduct
    (&Varien_Event_Observer
    #000000000a4f473c000000001abd2494#) 
    called at 
    [app\code\core\Mage\Core\Model\
    App.php:1338] 
    
    #10 Mage_Core_Model_App
    #000000000a4f446f000000001abd2494
    #->_callObserverMethod
    (&Mage_CatalogRule_Model_Observer
    #000000000a4f4774000000001abd2494
    #, 'applyAllRulesOnP...', 
    &Varien_Event_Observer
    #000000000a4f473c000000001abd2494#) 
    called at 
    [app\code\core\Mage\Core\Model\
    App.php:1317] 
    
    #11 Mage_Core_Model_App
    #000000000a4f446f000000001abd2494
    #->dispatchEvent('catalog_product_...',
     array('data_object' => &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#,
     'product' => &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#)) 
    called at 
    [app\Mage.php:447] 
    
    #12 Mage::dispatchEvent('catalog_product_...', array
    ('data_object' => &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#, 
    'product' => &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#)) 
    called at 
    [app\code\core\Mage\Core\Model\Abstract.php:344] 
    
    #13 Mage_Catalog_Model_Product
    [Mage_Core_Model_Abstract]
    #000000000a4f45c7000000001abd2494#
    ->afterCommitCallback() 
    
    #14 call_user_func(array
    (&Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#,
     'afterCommitCallb...')) 
    called at 
    [app\code\core\Mage\Core\Model\
    Resource\Abstract.php:110] 
    
    #15 Mage_Catalog_Model_Resource_Product
    [Mage_Core_Model_Resource_Abstract]
    #000000000a4f4512000000001abd2494#->commit() 
    called at 
    [app\code\core\Mage\Core\Model\
    Abstract.php:322] 
    
    #16 Mage_Catalog_Model_Product
    [Mage_Core_Model_Abstract]
    #000000000a4f45c7000000001abd2494
    #->save() 
    called at 
    [app\code\core\Mage\Adminhtml\controllers
    \Catalog\ProductController.php:728] 
    
    #17 Mage_Adminhtml_Catalog_ProductController
    #000000000a4f44cb000000001abd2494
    #->saveAction() 
    called at 
    [app\code\core\Mage\Core\Controller\
    Varien\Action.php:418] 
    

    Action:- Save and apply rule from admin :-

    DELETE Query:-

    AFF: 0
    TIME: 0.0060
    TRACE:
    #1 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #0000000051ad9f90000000001df5c15a
    #->_debugStat(2, 'DELETE FROM `cat...', array(),
     &Varien_Db_Statement_Pdo_Mysql
    #0000000051ad9d81000000001df5c15a#) 
    called at 
    [lib\Varien\Db\Adapter\Pdo\Mysql.php:433] 
    
    #2 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #0000000051ad9f90000000001df5c15a
    #->query('DELETE FROM `cat...')
     called at 
    [lib\Zend\Db\Adapter\Abstract.php:661] 
    
    #3 Magento_Db_Adapter_Pdo_Mysql
    [Zend_Db_Adapter_Abstract]
    #0000000051ad9f90000000001df5c15a
    #->delete('catalogrule_affe...') 
    called at 
    [app\code\core\Mage\CatalogRule\Model\Action
    \Index\Refresh.php:646] 
    
    #4 Mage_CatalogRule_Model_Action_Index_Refresh
    #0000000051ad9d90000000001df5c15a
    #->_prepareAffectedProduct() 
    called at 
    [app\code\core\Mage\CatalogRule\Model\Action\
    Index\Refresh.php:131] 
    
    #5 Mage_CatalogRule_Model_Action_Index_Refresh
    #0000000051ad9d90000000001df5c15a
    #->execute() 
    called at
     [app\code\core\Mage\CatalogRule\Model\
    Resource\Rule.php:592] 
    
    #6 Mage_CatalogRule_Model_Resource_Rule
    #0000000051ad9e71000000001df5c15a
    #->_reindexCatalogRule(NULL) 
    called at 
    [app\code\core\Mage\CatalogRule\Model\
    Resource\Rule.php:545] 
    
    #7 Mage_CatalogRule_Model_Resource_Rule
    #0000000051ad9e71000000001df5c15a
    #->applyAllRules() 
    called at 
    [app\code\core\Mage\CatalogRule\Model\
    Rule.php:318] 
    
    #8 Mage_CatalogRule_Model_Rule
    #0000000051ad9d87000000001df5c15a
    #->applyAll() 
    called at 
    [app\code\core\Mage\Adminhtml\controllers\
    Promo\CatalogController.php:297] 
    #9 Mage_Adminhtml_Promo_CatalogController
    #0000000051ad9de6000000001df5c15a
    #->applyRulesAction()
     called at
     [app\code\core\Mage\Core\Controller\
    Varien\Action.php:418] 
    

    * Call stack for database table “Catalogrule_customer_group ”:-

    Action:- Save and apply rule from admin :-

    * DELETE Query:-

    AFF: 0
    TIME: 0.0012
    TRACE:
    #1 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #0000000051ad9f90000000001df5c15a
    #->_debugStat(2, 'DELETE FROM `cat...', 
    array(), &Varien_Db_Statement_Pdo_Mysql
    #0000000051ad9d8c000000001df5c15a#) 
    called at 
    [lib\Varien\Db\Adapter\Pdo\Mysql.php:433] 
    
    #2 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #0000000051ad9f90000000001df5c15a
    #->query('DELETE FROM `cat...') 
    called at 
    [lib\Zend\Db\Adapter\Abstract.php:661] 
    
    #3 Magento_Db_Adapter_Pdo_Mysql
    [Zend_Db_Adapter_Abstract]
    #0000000051ad9f90000000001df5c15a
    #->delete('catalogrule_cust...', 
    'rule_id IN (9) A...') 
    called at 
    [app\code\core\Mage\Rule\Model\Resource\
    Abstract.php:178] 
    
    #4 Mage_CatalogRule_Model_Resource_Rule
    [Mage_Rule_Model_Resource_Abstract]
    #0000000051ad9e71000000001df5c15a
    #->bindRuleToEntity(9, 
    array(0, 1, 2, 3, 5, 6), 
    'customer_group') 
    called at 
    [app\code\core\Mage\CatalogRule\Model\Resource\
    Rule.php:140] 
    
    #5 
    Mage_CatalogRule_Model_Resource_Rule
    #0000000051ad9e71000000001df5c15a
    #->_afterSave(&Mage_CatalogRule_Model_Rule
    #0000000051ad9e22000000001df5c15a#) 
    called at 
    [app\code\core\Mage\Core\Model\Resource\Db\
    Abstract.php:463] 
    
    #6 Mage_CatalogRule_Model_Resource_Rule
    [Mage_Core_Model_Resource_Db_Abstract]
    #0000000051ad9e71000000001df5c15a
    #->save(&Mage_CatalogRule_Model_Rule
    #0000000051ad9e22000000001df5c15a#) 
    called at 
    [app\code\core\Mage\Core\Model
    \Abstract.php:318] 
    
    #7 Mage_CatalogRule_Model_Rule
    [Mage_Core_Model_Abstract]
    #0000000051ad9e22000000001df5c15a
    #->save() 
    called at 
    [app\code\core\Mage\Adminhtml\controllers
    \Promo\CatalogController.php:156] 
    
    #8 Mage_Adminhtml_Promo_CatalogController
    #0000000051ad9f2e000000001df5c15a
    #->saveAction() 
    called at 
    

    INSERT Query:-

    Action:-Import product from admin

    AFF: 6
    TIME: 0.0113
    TRACE:
     #1 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #0000000051ad9f90000000001df5c15a
    #->_debugStat(2, 'INSERT INTO `cat...',
     array(0, 9, 1, 9, 2, 9, 3, 9, 5, 9, 6, 9), 
    &Varien_Db_Statement_Pdo_Mysql
    #0000000051ad9d8c000000001df5c15a#) 
    called at 
    [lib\Varien\Db\Adapter\Pdo\Mysql.php:433] 
    
    #2 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #0000000051ad9f90000000001df5c15a
    #->query('INSERT INTO `cat...', 
    array(0, 9, 1, 9, 2, 9, 3, 9, 5, 9, 6, 9)) 
    called at 
    [lib\Varien\Db\Adapter\Pdo\Mysql.php:1919] 
    
    #3 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #0000000051ad9f90000000001df5c15a
    #->insertOnDuplicate
    ('catalogrule_cust...', 
    array(array('customer_group_i...' => 0, 
    'rule_id' => 9), 
    array('customer_group_i...' => 1, 
    'rule_id' => 9), 
    array('customer_group_i...' => 2, 
    'rule_id' => 9), 
    array('customer_group_i...' => 3, 
    'rule_id' => 9), 
    array('customer_group_i...' => 5, 
    'rule_id' => 9), 
    array('customer_group_i...' => 6, 
    'rule_id' => 9)), 
    array('rule_id'))
     called at 
    [app\code\core\Mage\Rule\Model\Resource\
    Abstract.php:171] 
    #4 Mage_CatalogRule_Model_Resource_Rule
    [Mage_Rule_Model_Resource_Abstract]
    #0000000051ad9e71000000001df5c15a
    #->
    bindRuleToEntity
    (9, array(0, 1, 2, 3, 5, 6), 
    'customer_group') called at 
    [app\code\core\Mage\CatalogRule\Model\
    Resource\Rule.php:140] 
    
    #5 Mage_CatalogRule_Model_Resource_Rule
    #0000000051ad9e71000000001df5c15a
    #->_afterSave
    (&Mage_CatalogRule_Model_Rule
    #0000000051ad9e22000000001df5c15a#) 
    called at 
    [app\code\core\Mage\Core\Model\Resource\
    Db\Abstract.php:463] 
    #6 Mage_CatalogRule_Model_Resource_Rule
    [Mage_Core_Model_Resource_Db_Abstract]
    #0000000051ad9e71000000001df5c15a
    #->save(&Mage_CatalogRule_Model_Rule
    #0000000051ad9e22000000001df5c15a#) 
    called at 
    [app\code\core\Mage\Core\Model\Abstract.php:318] 
    
    #7 Mage_CatalogRule_Model_Rule
    [Mage_Core_Model_Abstract]
    #0000000051ad9e22000000001df5c15a
    #->save() 
    called at 
    [app\code\core\Mage\Adminhtml\controllers\Promo\
    CatalogController.php:156] 
    
    #8 Mage_Adminhtml_Promo_CatalogController
    #0000000051ad9f2e000000001df5c15a
    #->saveAction() 
    called at 
    [app\code\core\Mage\Core\Controller\Varien\
    Action.php:418] 
    

    SELECT Query:-

    Action: Edit and save product from admin

    AFF: 1
    TIME: 0.0008
    TRACE:
     #1 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #0000000051ad9f90000000001df5c15a
    #->_debugStat(2, 'SELECT `catalogr...', array(), 
    &Varien_Db_Statement_Pdo_Mysql
    #0000000051ad9da3000000001df5c15a#) 
    called at 
    [lib\Varien\Db\Adapter\Pdo\Mysql.php:433] 
    
    #2 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #0000000051ad9f90000000001df5c15a
    #->query(&Varien_Db_Select
    #0000000051ad9d98000000001df5c15a#, 
    array()) 
    called at 
    [lib\Zend\Db\Adapter\Abstract.php:791] 
    
    #3 Magento_Db_Adapter_Pdo_Mysql
    [Zend_Db_Adapter_Abstract]
    #0000000051ad9f90000000001df5c15a
    #->fetchCol(&Varien_Db_Select
    #0000000051ad9d98000000001df5c15a#) 
    called at 
    [app\code\core\Mage\Rule\Model\Resource\
    Abstract.php:241] 
    
    #4 Mage_CatalogRule_Model_Resource_Rule
    [Mage_Rule_Model_Resource_Abstract]
    #0000000051ad9e71000000001df5c15a
    #->getAssociatedEntityIds
    (8, 'customer_group') 
    called at 
    [app\code\core\Mage\Rule\Model\Resource\
    Abstract.php:263] 
    
    #5 Mage_CatalogRule_Model_Resource_Rule
    [Mage_Rule_Model_Resource_Abstract]
    #0000000051ad9e71000000001df5c15a
    #->getCustomerGroupIds(8) 
    called at 
    [app\code\core\Mage\CatalogRule\Model\
    Rule.php:191] 
    
    #6 Mage_CatalogRule_Model_Rule
    #0000000051ad9d8f000000001df5c15a
    #->getCustomerGroupIds() 
    called at 
    [app\code\core\Mage\CatalogRule\Model\
    Resource\Rule.php:210] 
    
    #7 Mage_CatalogRule_Model_Resource_Rule
    #0000000051ad9e71000000001df5c15a
    #->insertRuleData(&Mage_CatalogRule_Model_Rule
    #0000000051ad9d8f000000001df5c15a#, 
    array(1)) 
    called at 
    [app\code\core\Mage\CatalogRule\Model\
    Resource\Rule.php:351] 
    
    #8 Mage_CatalogRule_Model_Resource_Rule
    #0000000051ad9e71000000001df5c15a
    #->updateRuleProductData
    (&Mage_CatalogRule_Model_Rule
    #0000000051ad9d8f000000001df5c15a#) 
    
    #9 call_user_func_array(array
    (&Mage_CatalogRule_Model_Resource_Rule
    #0000000051ad9e71000000001df5c15a#, 
    'updateRuleProduc...'), array
    (&Mage_CatalogRule_Model_Rule
    #0000000051ad9d8f000000001df5c15a#)) 
    called at 
    [lib\Varien\Data\Collection.php:466] 
    #10 Mage_CatalogRule_Model_Resource_Rule_Collection
    [Varien_Data_Collection]
    #0000000051ad9dba000000001df5c15a
    #->walk(array(&Mage_CatalogRule_Model_Resource_Rule
    #0000000051ad9e71000000001df5c15a#, 
    'updateRuleProduc...')) 
    called at 
    [app\code\core\Mage\CatalogRule\Model\
    Rule.php:317] 
    
    #11 Mage_CatalogRule_Model_Rule
    #0000000051ad9d87000000001df5c15a#->
    applyAll() 
    called at 
    [app\code\core\Mage\Adminhtml\controllers
    \Promo\CatalogController.php:297] 
    
    #12 Mage_Adminhtml_Promo_CatalogController
    #0000000051ad9de6000000001df5c15a
    #->applyRulesAction() 
    called at 
    [app\code\core\Mage\Core\Controller\
    varien\Action.php:418] 
    

    Action:- Import product from admin :-
    * SELECT Query :-

    AFF: 6
    TIME: 0.0006
    TRACE:
    #1 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #000000007202495600000000fd1cd49b
    #->_debugStat(2, 'SELECT `catalogr...', 
    array(), &Varien_Db_Statement_Pdo_Mysql
    #0000000072024a1c00000000fd1cd49b#) 
    called at 
    [lib/Varien/Db/Adapter/Pdo/Mysql.php:433] 
    
    #2 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #000000007202495600000000fd1cd49b
    #->query(&Varien_Db_Select
    #0000000072024aef00000000fd1cd49b#, 
    array()) 
    called at 
    [lib/Zend/Db/Adapter/Abstract.php:791] 
    
    #3 Magento_Db_Adapter_Pdo_Mysql
    [Zend_Db_Adapter_Abstract]
    #000000007202495600000000fd1cd49b
    #->fetchCol(&Varien_Db_Select
    #0000000072024aef00000000fd1cd49b#) 
    called at 
    [app/code/core/Mage/Rule/Model/Resource/
    Abstract.php:241] 
    
    #4 Mage_CatalogRule_Model_Resource_Rule
    [Mage_Rule_Model_Resource_Abstract]
    #0000000072024af800000000fd1cd49b
    #->getAssociatedEntityIds(9, 'customer_group') 
    called at 
    [app/code/core/Mage/Rule/Model/Resource/
    Abstract.php:263] 
    
    #5 Mage_CatalogRule_Model_Resource_Rule
    [Mage_Rule_Model_Resource_Abstract]
    #0000000072024af800000000fd1cd49b
    #->getCustomerGroupIds(9) 
    called at 
    [app/code/core/Mage/CatalogRule/Model
    /Rule.php:191] 
    
    #6 Mage_CatalogRule_Model_Rule
    #0000000072024b1b00000000fd1cd49b
    #->getCustomerGroupIds() 
    called at 
    [app/code/core/Mage/CatalogRule/Model/
    Resource/Rule.php:210] 
    
    #7 Mage_CatalogRule_Model_Resource_Rule
    #0000000072024af800000000fd1cd49b
    #->insertRuleData(&Mage_CatalogRule_Model_Rule
    #0000000072024b1b00000000fd1cd49b#,
     array(1)) 
    called at 
    [app/code/core/Mage/CatalogRule/Model/
    Resource/Rule.php:351] 
    
    #8 Mage_CatalogRule_Model_Resource_Rule
    #0000000072024af800000000fd1cd49b
    #->updateRuleProductData
    (&Mage_CatalogRule_Model_Rule
    #0000000072024b1b00000000fd1cd49b#)
     called at 
    [app/code/core/Mage/CatalogRule/Model/
    Observer.php:394] 
    
    #9 Mage_CatalogRule_Model_Observer
    #0000000072024a8300000000fd1cd49b#->
    createCatalogRulesRelations
    (&Varien_Event_Observer
    #0000000072024ba500000000fd1cd49b#) 
    called at 
    [app/code/core/Mage/Core/Model/
    App.php:1338] 
    
    #10 Mage_Core_Model_App
    #000000007202494500000000fd1cd49b
    #->_callObserverMethod
    (&Mage_CatalogRule_Model_Observer
    #0000000072024a8300000000fd1cd49b#, 
    'createCatalogRul...',
     &Varien_Event_Observer
    #0000000072024ba500000000fd1cd49b#) 
    called at 
    [app/code/core/Mage/Core/Model
    /App.php:1317] 
    
    #11 Mage_Core_Model_App
    #000000007202494500000000fd1cd49b#->
    dispatchEvent('catalog_product_...', 
    array('adapter'=>Enterprise_ImportExport_
    Model_Import_Entity_Product
    #00000000720248da00000000fd1cd49b#)) 
    called at 
    [app/Mage.php:447] 
    
    #12 Mage::dispatchEvent
    ('catalog_product_...', array
    ('adapter' => &Enterprise_
    ImportExport_Model_Import_
    Entity_Product
    #00000000720248da00000000fd1cd49b#)) 
    called at 
    [app/code/core/Mage/ImportExport/Model/
    Import/Entity/Product.php:362] 
    
    #13 Enterprise_ImportExport_Model_
    Import_Entity_Product
    [Mage_ImportExport_Model_Import_Entity_Product]
    #00000000720248da00000000fd1cd49b
    #->_importData() 
    called at 
    [app/code/core/Mage/ImportExport/Model/
    Import/Entity/Abstract.php:522] 
    
    #14 Enterprise_ImportExport_Model_Import_Entity_Product
    [Mage_ImportExport_Model_Import_Entity_Abstract]
    #00000000720248da00000000fd1cd49b
    #->importData() 
    called at 
    [app/code/core/Mage/ImportExport/Model/
    Import.php:325] 
    #15 Mage_ImportExport_Model_Import
    #0000000072024a3f00000000fd1cd49b
    #->importSource() 
    called at 
    [app/code/core/Mage/ImportExport/controllers/
    Adminhtml/ImportController.php:106] 
    
    #16 Mage_ImportExport_Adminhtml_ImportController
    #000000007202491b00000000fd1cd49b
    #->startAction() 
    called at 
    [app/code/core/Mage/Core/Controller/Varien/
    Action.php:418] 
    

    * Call stack for database table “Catalogrule_website”:-

    Action:- Edit and save product from admin :-

    SELECT Query:-

    AFF: 1

    TIME: 0.0010

    TRACE:

    #1 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #000000000a4f4475000000001abd2494
    #->_debugStat(2, 'SELECT `catalogr...', array(), 
    &Varien_Db_Statement_Pdo_Mysql
    #000000000a4f4772000000001abd2494#) 
    called at 
    [lib\Varien\Db\Adapter\Pdo\Mysql.php:433] 
    
    #2 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #000000000a4f4475000000001abd2494
    #->query(&Varien_Db_Select
    #000000000a4f469f000000001abd2494#, 
    array()) 
    called at
     [lib\Zend\Db\Adapter\Abstract.php:791] 
    
    #3 Magento_Db_Adapter_Pdo_Mysql
    [Zend_Db_Adapter_Abstract]
    #000000000a4f4475000000001abd2494
    #->fetchCol(&Varien_Db_Select
    #000000000a4f469f000000001abd2494#) 
    called at 
    [app\code\core\Mage\Rule\Model\
    Resource\Abstract.php:241] 
    
    #4 Mage_CatalogRule_Model_Resource_Rule
    [Mage_Rule_Model_Resource_Abstract]
    #000000000a4f4779000000001abd2494
    #->getAssociatedEntityIds(8, 'website')
     called at 
    [app\code\core\Mage\Rule\Model\
    Resource\Abstract.php:252] 
    
    #5 Mage_CatalogRule_Model_Resource_Rule
    [Mage_Rule_Model_Resource_Abstract]
    #000000000a4f4779000000001abd2494
    #->getWebsiteIds(8)
     called at 
    [app\code\core\Mage\Rule\
    Model\Abstract.php:452] 
    
    #6 Mage_CatalogRule_Model_Rule
    [Mage_Rule_Model_Abstract]
    #000000000a4f475a000000001abd2494
    #->getWebsiteIds() 
    called at 
    [app\code\core\Mage\CatalogRule\
    Model\Rule.php:345] 
    
    #7 Mage_CatalogRule_Model_Rule
    #000000000a4f474f000000001abd2494#->
    applyAllRulesToProduct
    (&Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#) 
    called at 
    [app\code\core\Mage\CatalogRule\
    Model\Observer.php:53] 
    
    #8 Mage_CatalogRule_Model_Observer
    #000000000a4f4774000000001abd2494#->
    applyAllRulesOnProduct
    (&Varien_Event_Observer
    #000000000a4f473c000000001abd2494#) 
    called at 
    [app\code\core\Mage\Core\
    Model\App.php:1338] 
    
    #9 Mage_Core_Model_App
    #000000000a4f446f000000001abd2494#->
    _callObserverMethod
    (&Mage_CatalogRule_Model_Observer
    #000000000a4f4774000000001abd2494#, 
    'applyAllRulesOnP...', 
    &Varien_Event_Observer
    #000000000a4f473c000000001abd2494#) 
    called at 
    [app\code\core\Mage\Core\Model
    \App.php:1317] 
    
    #10 Mage_Core_Model_App
    #000000000a4f446f000000001abd2494
    #->dispatchEvent('catalog_product_...', 
    array('data_object' => &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#, 
    'product' => &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#)) 
    called at 
    [app\Mage.php:447] 
    
    #11 Mage::dispatchEvent('catalog_product_...',
     array('data_object' => &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#, 
    'product' => &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#)) 
    called at 
    [app\code\core\Mage\Core\Model\Abstract.php:344] 
    
    #12 Mage_Catalog_Model_Product
    [Mage_Core_Model_Abstract]
    #000000000a4f45c7000000001abd2494
    #->afterCommitCallback() 
    
    #13 call_user_func(array(&Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#,
     'afterCommitCallb...')) 
    called at
     [app\code\core\Mage\Core\Model\Resource\
    Abstract.php:110] 
    
    #14 Mage_Catalog_Model_Resource_Product
    [Mage_Core_Model_Resource_Abstract]
    #000000000a4f4512000000001abd2494#->
    commit() 
    called at 
    [app\code\core\Mage\Core\Model\Abstract.php:322] 
    
    #15 Mage_Catalog_Model_Product
    [Mage_Core_Model_Abstract]
    #000000000a4f45c7000000001abd2494
    #->save() 
    called at 
    [app\code\core\Mage\Adminhtml\controllers\
    Catalog\ProductController.php:728] 
    #16 Mage_Adminhtml_Catalog_ProductController
    #000000000a4f44cb000000001abd2494#->
    saveAction() 
    called at 
    [app\code\core\Mage\Core\Controller\
    Varien\Action.php:418] 
    

    Action:- Save and apply rule from admin :-
    DELETE Query:-

    AFF: 0
    TIME: 0.0007
    TRACE:
     #1 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #0000000051ad9f90000000001df5c15a
    #->_debugStat(2, 'DELETE FROM `cat...',
     array(), &Varien_Db_Statement_Pdo_Mysql
    #0000000051ad9e73000000001df5c15a#)
     called at 
    [lib\Varien\Db\Adapter\Pdo\Mysql.php:433] 
    
    #2 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #0000000051ad9f90000000001df5c15a
    #->query('DELETE FROM `cat...') 
    called at
     [lib\Zend\Db\Adapter\Abstract.php:661] 
    
    #3 Magento_Db_Adapter_Pdo_Mysql
    [Zend_Db_Adapter_Abstract]
    #0000000051ad9f90000000001df5c15a
    #->delete('catalogrule_webs...', 
    'rule_id IN (9) A...')
     called at 
    [app\code\core\Mage\Rule\Model\Resource\
    Abstract.php:178] 
    
    #4 Mage_CatalogRule_Model_Resource_Rule
    [Mage_Rule_Model_Resource_Abstract]
    #0000000051ad9e71000000001df5c15a
    #->bindRuleToEntity
    (9, array(1, 2), 'website') 
    called at 
    [app\code\core\Mage\CatalogRule\Model\
    Resource\Rule.php:132] 
    
    #5 Mage_CatalogRule_Model_Resource_Rule
    #0000000051ad9e71000000001df5c15a
    #->_afterSave(&Mage_CatalogRule_Model_Rule
    #0000000051ad9e22000000001df5c15a#)
     called at 
    [app\code\core\Mage\Core\Model\Resource\
    Db\Abstract.php:463] 
    
    #6 Mage_CatalogRule_Model_Resource_Rule
    [Mage_Core_Model_Resource_Db_Abstract]
    #0000000051ad9e71000000001df5c15a
    #->save(&Mage_CatalogRule_Model_Rule
    #0000000051ad9e22000000001df5c15a#) 
    called at 
    [app\code\core\Mage\Core\Model\
    Abstract.php:318] 
    
    #7 Mage_CatalogRule_Model_Rule
    [Mage_Core_Model_Abstract]
    #0000000051ad9e22000000001df5c15a
    #->save() 
    called at 
    [app\code\core\Mage\Adminhtml\controllers\
    Promo\CatalogController.php:156] 
    
    #8 Mage_Adminhtml_Promo_CatalogController
    #0000000051ad9f2e000000001df5c15a
    #->saveAction() 
    called at
     [app\code\core\Mage\Core\Controller\
    Varien\Action.php:418] 
     

    * INSERT Query:-

    AFF: 2
    TIME: 0.0088
    TRACE:
     #1 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #0000000051ad9f90000000001df5c15a
    #->_debugStat(2, 'INSERT INTO `cat...',
     array(1, 9, 2, 9), 
    &Varien_Db_Statement_Pdo_Mysql
    #0000000051ad9e73000000001df5c15a#)
     called at
     [lib\Varien\Db\Adapter\Pdo\
    Mysql.php:433] 
    
    #2 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #0000000051ad9f90000000001df5c15a
    #->query('INSERT INTO `cat...', 
    array(1, 9, 2, 9))
     called at 
    [lib\Varien\Db\Adapter\Pdo\Mysql.php:1919] 
    
    #3 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #0000000051ad9f90000000001df5c15a
    #->insertOnDuplicate('catalogrule_webs...',
     array(array('website_id' => 1, 
    'rule_id' => 9), 
    array('website_id' => 2, 'rule_id' => 9)),
     array('rule_id'))
     called at 
    [app\code\core\Mage\Rule\Model\
    Resource\Abstract.php:171] 
    
    #4 Mage_CatalogRule_Model_Resource_Rule
    [Mage_Rule_Model_Resource_Abstract]
    #0000000051ad9e71000000001df5c15a
    #->bindRuleToEntity
    (9, array(1, 2), 'website')
     called at 
    [app\code\core\Mage\CatalogRule\Model
    \Resource\Rule.php:132] 
    
    #5 Mage_CatalogRule_Model_Resource_Rule
    #0000000051ad9e71000000001df5c15a
    #->_afterSave
    (&Mage_CatalogRule_Model_Rule
    #0000000051ad9e22000000001df5c15a#) 
    called at 
    [app\code\core\Mage\Core\Model\Resource\Db\
    Abstract.php:463] 
    
    #6 Mage_CatalogRule_Model_Resource_Rule
    [Mage_Core_Model_Resource_Db_Abstract]
    #0000000051ad9e71000000001df5c15a
    #->save(&Mage_CatalogRule_Model_Rule
    #0000000051ad9e22000000001df5c15a#) 
    called at 
    [app\code\core\Mage\Core\Model\
    Abstract.php:318] 
    
    #7 Mage_CatalogRule_Model_Rule
    [Mage_Core_Model_Abstract]
    #0000000051ad9e22000000001df5c15a
    #->save()
     called at 
    [app\code\core\Mage\Adminhtml\controllers\
    Promo\CatalogController.php:156] 
    
    #8 Mage_Adminhtml_Promo_CatalogController
    #0000000051ad9f2e000000001df5c15a
    #->saveAction() 
    called at 
    [app\code\core\Mage\Core\Controller\
    Varien\Action.php:418] 
    

    * SELECT Query :-

    AFF: 1
    TIME: 0.0009
    TRACE:
    #1 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #0000000051ad9f90000000001df5c15a
    #->_debugStat(2, 'SELECT `catalogr...',
     array(), 
    &Varien_Db_Statement_Pdo_Mysql
    #0000000051ad9da3000000001df5c15a#) 
    called at 
    [lib\Varien\Db\Adapter\Pdo\Mysql.php:433] 
    
    #2 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #0000000051ad9f90000000001df5c15a
    #->query(&Varien_Db_Select
    #0000000051ad9d98000000001df5c15a
    #, array()) 
    called at 
    [lib\Zend\Db\Adapter\Abstract.php:791] 
    
    #3 Magento_Db_Adapter_Pdo_Mysql
    [Zend_Db_Adapter_Abstract]
    #0000000051ad9f90000000001df5c15a
    #->fetchCol(&Varien_Db_Select
    #0000000051ad9d98000000001df5c15a#)
     called at 
    [app\code\core\Mage\Rule\Model\
    Resource\Abstract.php:241] 
    
    #4 Mage_CatalogRule_Model_Resource_Rule
    [Mage_Rule_Model_Resource_Abstract]
    #0000000051ad9e71000000001df5c15a
    #->getAssociatedEntityIds(8, 'website') 
    called at [app\code\core\Mage\Rule\Model\
    Resource\Abstract.php:252] 
    
    #5 Mage_CatalogRule_Model_Resource_Rule
    [Mage_Rule_Model_Resource_Abstract]
    #0000000051ad9e71000000001df5c15a
    #->getWebsiteIds(8)
     called at 
    [app\code\core\Mage\Rule\Model\Abstract.php:452] 
    
    #6 Mage_CatalogRule_Model_Rule
    [Mage_Rule_Model_Abstract]
    #0000000051ad9d8f000000001df5c15a
    #->getWebsiteIds() 
    called at 
    [app\code\core\Mage\CatalogRule\
    Model\Resource\Rule.php:342] 
    
    #7 Mage_CatalogRule_Model_Resource_Rule
    #0000000051ad9e71000000001df5c15a
    #->updateRuleProductData
    (&Mage_CatalogRule_Model_Rule
    #0000000051ad9d8f000000001df5c15a#) 
    
    #8 call_user_func_array(array
    (&Mage_CatalogRule_Model_Resource_Rule
    #0000000051ad9e71000000001df5c15a#, 
    'updateRuleProduc...'), array
    (&Mage_CatalogRule_Model_Rule
    #0000000051ad9d8f000000001df5c15a#)) 
    called at 
    [lib\Varien\Data\Collection.php:466] 
    
    #9 Mage_CatalogRule_Model_Resource_Rule_Collection
    [Varien_Data_Collection]
    #0000000051ad9dba000000001df5c15a
    #->walk(array
    (&Mage_CatalogRule_Model_Resource_Rule
    #0000000051ad9e71000000001df5c15a#, 
    'updateRuleProduc...')) 
    called at 
    [app\code\core\Mage\CatalogRule\
    Model\Rule.php:317] 
    
    #10 Mage_CatalogRule_Model_Rule
    #0000000051ad9d87000000001df5c15a#->
    applyAll() 
    called at 
    [app\code\core\Mage\Adminhtml\
    controllers\
    Promo\CatalogController.php:297] 
    
    #11 Mage_Adminhtml_Promo_CatalogController
    #0000000051ad9de6000000001df5c15a
    #->applyRulesAction() 
    called at
     [app\code\core\Mage\Core\Controller\
    Varien\Action.php:418] 
    

    Action:- Import product from admin :-
    SELECT Query:-

    AFF: 1
    TIME: 0.0007
    TRACE:
     #1 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #000000007202495600000000fd1cd49b
    #->_debugStat(2, 'SELECT `catalogr...', 
    array(),
     &Varien_Db_Statement_Pdo_Mysql
    #0000000072024a8500000000fd1cd49b#) 
    called at 
    [lib/Varien/Db/Adapter/Pdo/Mysql.php:433] 
    
    #2 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #000000007202495600000000fd1cd49b
    #->query(&Varien_Db_Select
    #0000000072024b2800000000fd1cd49b#,
     array())
     called at 
    [lib/Zend/Db/Adapter/Abstract.php:791] 
    
    #3 Magento_Db_Adapter_Pdo_Mysql
    [Zend_Db_Adapter_Abstract]
    #000000007202495600000000fd1cd49b
    #->fetchCol(&Varien_Db_Select
    #0000000072024b2800000000fd1cd49b#) 
    called at 
    [app/code/core/Mage/Rule/Model/Resource
    /Abstract.php:241] 
    
    #4 Mage_CatalogRule_Model_Resource_Rule
    [Mage_Rule_Model_Resource_Abstract]
    #0000000072024af800000000fd1cd49b
    #->getAssociatedEntityIds(8, 'website')
    called at 
    [app/code/core/Mage/Rule/Model/Resource/
    Abstract.php:252] 
    
    #5 Mage_CatalogRule_Model_Resource_Rule
    [Mage_Rule_Model_Resource_Abstract]
    #0000000072024af800000000fd1cd49b
    #->getWebsiteIds(8) 
    called at
     [app/code/core/Mage/Rule/Model/
    Abstract.php:452] 
    
    #6 Mage_CatalogRule_Model_Rule
    [Mage_Rule_Model_Abstract]
    #0000000072024af900000000fd1cd49b
    #->getWebsiteIds()
     called at 
    [app/code/core/Mage/CatalogRule/Model/
    Resource/Rule.php:342] 
    
    #7 Mage_CatalogRule_Model_Resource_Rule
    #0000000072024af800000000fd1cd49b
    #->updateRuleProductData
    (&Mage_CatalogRule_Model_Rule
    #0000000072024af900000000fd1cd49b#)
     called at
     [app/code/core/Mage/CatalogRule/Model/
    Observer.php:394] 
    
    #8 Mage_CatalogRule_Model_Observer
    #0000000072024a8300000000fd1cd49b
    #->createCatalogRulesRelations
    (&Varien_Event_Observer
    #0000000072024ba500000000fd1cd49b#) 
    called at [app/code/core/Mage/Core/
    Model/App.php:1338] 
    
    #9 Mage_Core_Model_App
    #000000007202494500000000fd1cd49b#->
    _callObserverMethod
    (&Mage_CatalogRule_Model_Observer
    #0000000072024a8300000000fd1cd49b#, 
    'createCatalogRul...', 
    &Varien_Event_Observer
    #0000000072024ba500000000fd1cd49b#)
     called at
     [app/code/core/Mage/Core/
    Model/App.php:1317] 
    
    #10 Mage_Core_Model_App
    #000000007202494500000000fd1cd49b
    #->dispatchEvent
    ('catalog_product_...', array
    ('adapter' => &Enterprise_ImportExport
    _Model_Import_Entity_Product
    #00000000720248da00000000fd1cd49b#))
     called at 
    [app/Mage.php:447] 
    
    #11 Mage::dispatchEvent
    ('catalog_product_...', array('adapter' =>
     &Enterprise_ImportExport_Model_Import_Entity
    _Product
    #00000000720248da00000000fd1cd49b#)) 
    called at 
    [app/code/core/Mage/ImportExport/
    Model/Import/
    Entity/Product.php:362] 
    
    #12 Enterprise_ImportExport_Model_Import_Entity
    _Product[Mage_ImportExport_Model_Import_Entity_
    Product]
    #00000000720248da00000000fd1cd49b#->
    _importData()
     called at 
    [app/code/core/Mage/ImportExport/Model/
    Import/Entity/Abstract.php:522] 
    
    #13 Enterprise_ImportExport_Model_
    Import_Entity_Product
    [Mage_ImportExport_Model_Import_Entity_Abstract]
    #00000000720248da00000000fd1cd49b#->
    importData() 
    called at 
    [app/code/core/Mage/ImportExport/
    Model/Import.php:325] 
    #14 Mage_ImportExport_Model_Import
    #0000000072024a3f00000000fd1cd49b#->
    importSource()
     called at 
    [app/code/core/Mage/ImportExport/
    controllers/Adminhtml/
    ImportController.php:106] 
    
    #15 Mage_ImportExport_Adminhtml_ImportController
    #000000007202491b00000000fd1cd49b#->startAction() 
    called at 
    [app/code/core/Mage/Core/Controller/
    Varien/Action.php:418] 
    

    * Call stack for database table “Catalogrule_group_website”:-
    Action:-Edit and save product from admin :-
    DELETE Query :-

    AFF: 1
    TIME: 0.0365
    TRACE:
    
     #1 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #000000000a4f4475000000001abd2494
    #->_debugStat(2, 'DELETE FROM 
    `cat...', array(), 
    &Varien_Db_Statement_Pdo_Mysql
    #000000000a4f4712000000001abd2494#) 
    called at
     [lib\Varien\Db\Adapter\Pdo\Mysql.php:433] 
    
    #2 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #000000000a4f4475000000001abd2494
    #->query('DELETE FROM `cat...')
     called at 
    [lib\Zend\Db\Adapter\Abstract.php:661] 
    
    #3 Magento_Db_Adapter_Pdo_Mysql
    [Zend_Db_Adapter_Abstract]
    #000000000a4f4475000000001abd2494
    #->delete('catalogrule_grou...', array())
     called at
     [app\code\core\Mage\CatalogRule\Model\
    Action\Index\Refresh.php:598] 
    
    #4 Mage_CatalogRule_Model_Action_Index_Refresh_Row
    [Mage_CatalogRule_Model_Action_Index_Refresh]
    #000000000a4f477c000000001abd2494#->
    _prepareGroupWebsite(1405926000)
     called at 
    [app\code\core\Mage\CatalogRule\Model\
    Action\Index\Refresh.php:130] 
    
    #5 Mage_CatalogRule_Model_Action_Index_Refresh_Row
    [Mage_CatalogRule_Model_Action_Index_Refresh]
    #000000000a4f477c000000001abd2494#->execute() 
    called at 
    [app\code\core\Mage\CatalogRule\Model\
    Resource\Rule.php:592] 
    
    #6 Mage_CatalogRule_Model_Resource_Rule
    #000000000a4f4779000000001abd2494
    #->_reindexCatalogRule
    (&Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#) 
    called at 
    [app\code\core\Mage\CatalogRule\Model\
    Resource\Rule.php:545] 
    
    #7 Mage_CatalogRule_Model_Resource_Rule
    #000000000a4f4779000000001abd2494
    #->applyAllRules(&Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#) 
    called at 
    [app\code\core\Mage\CatalogRule\Model\
    Rule.php:349] 
    
    #8 Mage_CatalogRule_Model_Rule
    #000000000a4f474f000000001abd2494#->
    applyAllRulesToProduct
    (&Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#)
     called at 
    [app\code\core\Mage\CatalogRule\Model\
    Observer.php:53] 
    #9 Mage_CatalogRule_Model_Observer
    #000000000a4f4774000000001abd2494#->
    applyAllRulesOnProduct
    (&Varien_Event_Observer
    #000000000a4f473c000000001abd2494#) 
    called at [app\code\core\Mage\Core\
    Model\App.php:1338] 
    
    #10 Mage_Core_Model_App
    #000000000a4f446f000000001abd2494#->
    _callObserverMethod
    (&Mage_CatalogRule_Model_Observer
    #000000000a4f4774000000001abd2494#, 
    'applyAllRulesOnP...', 
    &Varien_Event_Observer
    #000000000a4f473c000000001abd2494#) 
    called at 
    [app\code\core\Mage\Core\Model\
    App.php:1317] 
    
    #11 Mage_Core_Model_App
    #000000000a4f446f000000001abd2494
    #->dispatchEvent('catalog_product_...',
     array('data_object' => 
    &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#, 
    'product' => &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#)) 
    called at 
    [app\Mage.php:447] 
    
    #12 Mage::dispatchEvent
    ('catalog_product_...', 
    array('data_object' => 
    &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#, 
    'product' => &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#)) 
    called at 
    [app\code\core\Mage\Core\Model\
    Abstract.php:344] 
    
    #13 Mage_Catalog_Model_Product
    [Mage_Core_Model_Abstract]
    #000000000a4f45c7000000001abd2494
    #->afterCommitCallback() 
    
    #14 call_user_func(array
    (&Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#, 
    'afterCommitCallb...')) 
    called at
     [app\code\core\Mage\Core\Model\
    Resource\Abstract.php:110] 
    
    #15 Mage_Catalog_Model_Resource_Product
    [Mage_Core_Model_Resource_Abstract]
    #000000000a4f4512000000001abd2494
    #->commit()
     called at 
    [app\code\core\Mage\Core\Model\
    Abstract.php:322] 
    
    #16 Mage_Catalog_Model_Product
    [Mage_Core_Model_Abstract]
    #000000000a4f45c7000000001abd2494
    #->save() 
    called at
     [app\code\core\Mage\Adminhtml\
    controllers\
    Catalog\ProductController.php:728] 
    
    #17 Mage_Adminhtml_Catalog_ProductController
    #000000000a4f44cb000000001abd2494
    #->saveAction() 
    called at 
    [app\code\core\Mage\Core\Controller\
    Varien\Action.php:418] 
    
    #18 Mage_Adminhtml_Catalog_ProductController
    [Mage_Core_Controller_Varien_Action]
    #000000000a4f44cb000000001abd2494
    #->dispatch('save') 
    called at 
    [app\code\core\Mage\Core\Controller\Varien\
    Router\Standard.php:250] 
    
    #19 Mage_Core_Controller_Varien_Router_Admin
    [Mage_Core_Controller_Varien_Router_Standard]
    #000000000a4f4451000000001abd2494
    #->match(&Mage_Core_Controller_Request_Http
    #000000000a4f4452000000001abd2494#)
     called at 
    [app\code\core\Mage\Core\Controller\
    Varien\Front.php:172] 
    
    #20 Mage_Core_Controller_Varien_Front
    #000000000a4f443b000000001abd2494
    #->dispatch() 
    called at 
    [app\code\core\Mage\Core\Model\
    App.php:354] 
    
    #21 Mage_Core_Model_App
    #000000000a4f446f000000001abd2494
    #->run(array('scope_code' => '', 
    'scope_type' => 'store', 'options' => 
    array())) 
    called at 
    [app\Mage.php:683] 
    
    #22 Mage::run('', 'store') 
    called at [index.php:87] 
    

    INSERT Query:-

    AFF: 1
    TIME: 0.0267
    TRACE:
     #1 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #000000000a4f4475000000001abd2494
    #->_debugStat(2, 'INSERT INTO `cat...',
     array(),
     &Varien_Db_Statement_Pdo_Mysql
    #000000000a4f4711000000001abd2494#) 
    called at 
    [lib\Varien\Db\Adapter\Pdo\
    Mysql.php:433] 
    
    #2 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #000000000a4f4475000000001abd2494
    #->query('INSERT INTO `cat...') 
    called at [app\code\core\Mage\CatalogRule\
    Model\Action\Index\Refresh.php:614] 
    
    #3 Mage_CatalogRule_Model_Action_Index_Refresh_Row
    [Mage_CatalogRule_Model_Action_Index_Refresh]
    #000000000a4f477c000000001abd2494#->
    _prepareGroupWebsite(1405926000) 
    called at [app\code\core\Mage\CatalogRule\Model\
    Action\Index\Refresh.php:130] 
    
    #4 Mage_CatalogRule_Model_Action_Index_Refresh_Row
    [Mage_CatalogRule_Model_Action_Index_Refresh]
    #000000000a4f477c000000001abd2494#->execute()
     called at [app\code\core\Mage\CatalogRule\
    Model\Resource\Rule.php:592] 
    #5 Mage_CatalogRule_Model_Resource_Rule
    #000000000a4f4779000000001abd2494
    #->_reindexCatalogRule
    (&Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#) 
    called at
     [app\code\core\Mage\CatalogRule\Model\
    Resource\Rule.php:545] 
    
    #6 Mage_CatalogRule_Model_Resource_Rule
    #000000000a4f4779000000001abd2494
    #->applyAllRules
    (&Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#) 
    called at 
    [app\code\core\Mage\CatalogRule\Model
    \Rule.php:349] 
    
    #7 Mage_CatalogRule_Model_Rule
    #000000000a4f474f000000001abd2494#->
    applyAllRulesToProduct
    (&Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#) 
    called at 
    [app\code\core\Mage\CatalogRule\Model\
    Observer.php:53] 
    
    #8 Mage_CatalogRule_Model_Observer
    #000000000a4f4774000000001abd2494#->
    applyAllRulesOnProduct
    (&Varien_Event_Observer
    #000000000a4f473c000000001abd2494#) 
    called at 
    [app\code\core\Mage\Core\Model\
    App.php:1338] 
    
    #9 Mage_Core_Model_App
    #000000000a4f446f000000001abd2494#->
    _callObserverMethod
    (&Mage_CatalogRule_Model_Observer
    #000000000a4f4774000000001abd2494#,
     'applyAllRulesOnP...',
     &Varien_Event_Observer
    #000000000a4f473c000000001abd2494#)
    called at 
    [app\code\core\Mage\Core\Model\
    App.php:1317] 
    
    #10 Mage_Core_Model_App
    #000000000a4f446f000000001abd2494
    #->dispatchEvent('catalog_product_...', 
    array('data_object' =>
     &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#, 
    'product' => &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#)) 
    called at [
    app\Mage.php:447] 
    
    #11 Mage::dispatchEvent
    ('catalog_product_...', 
    array('data_object' => 
    &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#,
     'product' => &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#))
     called at 
    [app\code\core\Mage\Core\Model\
    Abstract.php:344] 
    
    #12 Mage_Catalog_Model_Product
    [Mage_Core_Model_Abstract]
    #000000000a4f45c7000000001abd2494
    #->afterCommitCallback() 
    
    #13 call_user_func(array
    (&Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#,
    'afterCommitCallb...')) 
    called at
    [app\code\core\Mage\Core\Model\
    Resource\Abstract.php:110] 
    
    #14 Mage_Catalog_Model_Resource_Product
    [Mage_Core_Model_Resource_Abstract]
    #000000000a4f4512000000001abd2494
    #->commit() 
    called at 
    [app\code\core\Mage\Core\Model\
    Abstract.php:322] 
    
    #15 Mage_Catalog_Model_Product
    [Mage_Core_Model_Abstract]
    #000000000a4f45c7000000001abd2494
    #->save() 
    called at 
    [app\code\core\Mage\Adminhtml\
    controllers\Catalog\
    ProductController.php:728] 
    
    #16 Mage_Adminhtml_Catalog_ProductController
    #000000000a4f44cb000000001abd2494
    #->saveAction() 
    called at 
    [app\code\core\Mage\Core\Controller\
    Varien\Action.php:418] 
    

    * Call stack for database table “catalogrule_product_price”:- Action:-Edit and save product from admin :-
    * DELETE Query:-

    AFF: 0
    TIME: 0.0006
    TRACE:
    #1 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #000000000a4f4475000000001abd2494
    #->_debugStat
    (2, 'DELETE FROM `cat...', array(),
     &Varien_Db_Statement_Pdo_Mysql
    #000000000a4f4750000000001abd2494#) 
    called at 
    [lib\Varien\Db\Adapter\Pdo\
    Mysql.php:433] 
    
    #2 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #000000000a4f4475000000001abd2494
    #->query('DELETE FROM `cat...') 
    called at 
    [lib\Zend\Db\Adapter\Abstract.php:661] 
    
    #3 Magento_Db_Adapter_Pdo_Mysql
    [Zend_Db_Adapter_Abstract]
    #000000000a4f4475000000001abd2494
    #->delete
    ('catalogrule_prod...', 
    array('product_id = \'52...')) 
    called at 
    [app\code\core\Mage\CatalogRule\Model\
    Resource\Rule.php:779] 
    
    #4 Mage_CatalogRule_Model_Resource_Rule
    #000000000a4f4779000000001abd2494
    #->applyToProduct(&Mage_CatalogRule_Model_Rule
    #000000000a4f475a000000001abd2494#, 
    &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#, 
    array(1)) 
    called at 
    [app\code\core\Mage\CatalogRule\Model\
    Rule.php:346] 
    
    #5 Mage_CatalogRule_Model_Rule
    #000000000a4f474f000000001abd2494#->
    applyAllRulesToProduct
    (&Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#)
     called at 
    [app\code\core\Mage\CatalogRule\Model\
    Observer.php:53] 
    
    #6 Mage_CatalogRule_Model_Observer
    #000000000a4f4774000000001abd2494#->
    applyAllRulesOnProduct
    (&Varien_Event_Observer
    #000000000a4f473c000000001abd2494#) 
    called at 
    [app\code\core\Mage\Core\Model\
    App.php:1338] 
    
    #7 Mage_Core_Model_App
    #000000000a4f446f000000001abd2494#->
    _callObserverMethod
    (&Mage_CatalogRule_Model_Observer
    #000000000a4f4774000000001abd2494#, 
    'applyAllRulesOnP...', 
    &Varien_Event_Observer
    #000000000a4f473c000000001abd2494#) 
    called at 
    [app\code\core\Mage\Core\Model\App.php:1317] 
    
    #8 Mage_Core_Model_App
    #000000000a4f446f000000001abd2494
    #->dispatchEvent
    ('catalog_product_...', 
    array('data_object' =>
     &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#, 
    'product' => &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#)) 
    called at 
    [app\Mage.php:447] 
    
    #9 Mage::dispatchEvent
    ('catalog_product_...', 
    array('data_object' => &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#, 
    'product' => 
    &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#)) 
    called at 
    [app\code\core\Mage\Core\Model\Abstract.php:344] 
    
    #10 Mage_Catalog_Model_Product
    [Mage_Core_Model_Abstract]
    #000000000a4f45c7000000001abd2494
    #->afterCommitCallback() 
    
    #11 call_user_func(array(&Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#,
     'afterCommitCallb...'))
     called at 
    [app\code\core\Mage\Core\Model\Resource\
    Abstract.php:110] 
    
    #12 Mage_Catalog_Model_Resource_Product
    [Mage_Core_Model_Resource_Abstract]
    #000000000a4f4512000000001abd2494
    #->commit() 
    called at 
    [app\code\core\Mage\Core\Model\Abstract.php:322] 
    
    #13 Mage_Catalog_Model_Product
    [Mage_Core_Model_Abstract]
    #000000000a4f45c7000000001abd2494
    #->save()
     called at 
    [app\code\core\Mage\Adminhtml\controllers
    \Catalog\ProductController.php:728] 
    
    #14 Mage_Adminhtml_Catalog_ProductController
    #000000000a4f44cb000000001abd2494
    #->saveAction() 
    called at
     [app\code\core\Mage\Core\Controller\Varien\
    Action.php:418] 
    
    #15 Mage_Adminhtml_Catalog_ProductController
    [Mage_Core_Controller_Varien_Action]
    #000000000a4f44cb000000001abd2494
    #->dispatch('save') 
    called at 
    [app\code\core\Mage\Core\Controller\Varien\Router\
    Standard.php:250] 
    
    #16 Mage_Core_Controller_Varien_Router_Admin
    [Mage_Core_Controller_Varien_Router_Standard]
    #000000000a4f4451000000001abd2494#->match
    (&Mage_Core_Controller_Request_Http
    #000000000a4f4452000000001abd2494#)
     called at 
    [app\code\core\Mage\Core\Controller\Varien\
    Front.php:172] 
    
    #17 Mage_Core_Controller_Varien_Front
    #000000000a4f443b000000001abd249
    #->dispatch() 
    called at 
    [app\code\core\Mage\Core\Model\App.php:354] 
    
    #18 Mage_Core_Model_App
    #000000000a4f446f000000001abd2494
    #->run(array('scope_code' => '',
     'scope_type' => 'store',
     'options' => array())) 
    called at
     [app\Mage.php:683] 
    
    #19 Mage::run('', 'store')
     called at
     [index.php:87] 
    

    INSERT Query:-

    AFF: 0
    TIME: 0.0031
    TRACE:
    #1 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #000000000a4f4475000000001abd2494
    #->_debugStat
    (2, 'INSERT INTO `cat...', array(),
     &Varien_Db_Statement_Pdo_Mysql
    #000000000a4f4716000000001abd2494#) 
    called at 
    [lib\Varien\Db\Adapter\Pdo\
    Mysql.php:433] 
    
    #2 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #000000000a4f4475000000001abd2494
    #->query('INSERT INTO `cat...') 
    called at 
    [app\code\core\Mage\CatalogRule\Model\Action
    \Index\Refresh.php:571] 
    
    #3 Mage_CatalogRule_Model_Action_Index_Refresh_Row
    [Mage_CatalogRule_Model_Action_Index_Refresh]
    #000000000a4f477c000000001abd2494
    #->_fillIndexData(&Mage_Core_Model_Website
    #000000000a4f445a000000001abd2494#, 1405926000)
     called at 
    [app\code\core\Mage\CatalogRule\Model\Action\
    Index\Refresh.php:590] 
    
    #4 Mage_CatalogRule_Model_Action_Index_Refresh_Row
    [Mage_CatalogRule_Model_Action_Index_Refresh]
    #000000000a4f477c000000001abd2494
    #->_reindex(&Mage_Core_Model_Website
    #000000000a4f445a000000001abd2494#, 1405926000) 
    called at [app\code\core\Mage\CatalogRule\Model\
    Action\Index\Refresh.php:126] 
    
    #5 Mage_CatalogRule_Model_Action_Index_Refresh_Row
    [Mage_CatalogRule_Model_Action_Index_Refresh]
    #000000000a4f477c000000001abd2494
    #->execute() 
    called at
     [app\code\core\Mage\CatalogRule\Model\Resource\
    Rule.php:592] 
    
    #6 Mage_CatalogRule_Model_Resource_Rule
    #000000000a4f4779000000001abd2494
    #->_reindexCatalogRule
    (&Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#)
     called at 
    [app\code\core\Mage\CatalogRule\Model\Resource\
    Rule.php:545] 
    
    #7 Mage_CatalogRule_Model_Resource_Rule
    #000000000a4f4779000000001abd2494
    #->applyAllRules(&Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#)
     called at
     [app\code\core\Mage\CatalogRule\Model\
    Rule.php:349] 
    #8 Mage_CatalogRule_Model_Rule
    #000000000a4f474f000000001abd2494#->
    applyAllRulesToProduct
    (&Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#) 
    called at 
    [app\code\core\Mage\CatalogRule\Model\
    Observer.php:53] 
    
    #9 Mage_CatalogRule_Model_Observer
    #000000000a4f4774000000001abd2494#->
    applyAllRulesOnProduct
    (&Varien_Event_Observer
    #000000000a4f473c000000001abd2494#) 
    called at 
    [app\code\core\Mage\Core\Model\App.php:1338] 
    #10 Mage_Core_Model_App
    #000000000a4f446f000000001abd2494#->
    _callObserverMethod
    (&Mage_CatalogRule_Model_Observer
    #000000000a4f4774000000001abd2494#,
     'applyAllRulesOnP...', 
    &Varien_Event_Observer
    #000000000a4f473c000000001abd2494#) 
    called at 
    [app\code\core\Mage\Core\Model\App.php:1317] 
    
    #11 Mage_Core_Model_App
    #000000000a4f446f000000001abd2494
    #->dispatchEvent('catalog_product_...', 
    array('data_object' => 
    &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#, 
    'product' => &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#)) 
    called at 
    [app\Mage.php:447] 
    
    #12 Mage::dispatchEvent
    ('catalog_product_...', 
    array('data_object' => 
    &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#,
    'product' => &Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#))
    called at 
    [app\code\core\Mage\Core\Model\
    Abstract.php:344] 
    
    #13 Mage_Catalog_Model_Product
    [Mage_Core_Model_Abstract]
    #000000000a4f45c7000000001abd2494
    #->afterCommitCallback() 
    
    #14 call_user_func(array(&Mage_Catalog_Model_Product
    #000000000a4f45c7000000001abd2494#, 
    'afterCommitCallb...'))
     called at
     [app\code\core\Mage\Core\Model\Resource\
    Abstract.php:110] 
    
    #15 Mage_Catalog_Model_Resource_Product
    [Mage_Core_Model_Resource_Abstract]
    #000000000a4f4512000000001abd2494
    #->commit() 
    called at
     [app\code\core\Mage\Core\Model\
    Abstract.php:322] 
    
    #16 Mage_Catalog_Model_Product
    [Mage_Core_Model_Abstract]
    #000000000a4f45c7000000001abd2494
    #->save() 
    called at 
    [app\code\core\Mage\Adminhtml\controllers\
    Catalog\ProductController.php:728] 
    
    #17 Mage_Adminhtml_Catalog_ProductController
    #000000000a4f44cb000000001abd2494
    #->saveAction() 
    called at 
    [app\code\core\Mage\Core\Controller\
    Varien\Action.php:418] 
    
    #18 Mage_Adminhtml_Catalog_ProductController
    [Mage_Core_Controller_Varien_Action]
    #000000000a4f44cb000000001abd2494
    #->dispatch('save') 
    called at 
    [app\code\core\Mage\Core\Controller\Varien\Router\
    Standard.php:250] 
    
    #19 Mage_Core_Controller_Varien_Router_Admin
    [Mage_Core_Controller_Varien_Router_Standard]
    #000000000a4f4451000000001abd2494#->match
    (&Mage_Core_Controller_Request_Http
    #000000000a4f4452000000001abd2494#) 
    called at 
    [app\code\core\Mage\Core\Controller\Varien\
    Front.php:172] 
    
    #20 Mage_Core_Controller_Varien_Front
    #000000000a4f443b000000001abd2494
    #->dispatch() 
    called at 
    [app\code\core\Mage\Core\Model\App.php:354] 
    
    #21 Mage_Core_Model_App
    #000000000a4f446f000000001abd2494
    #->run(array('scope_code' => '', 
    'scope_type' => 'store', 'options'
     => array())) 
    called at 
    [app\Mage.php:683] 
    #22 Mage::run('', 'store') 
    called at
     [index.php:87]
    

    Action:-Save and apply rule from admin :-
    DELETE Query:-

    AFF: 78
    TIME: 0.0659
    TRACE:
    #1 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #0000000008c69ee90000000083f608b2
    #->_debugStat
    (2, 'DELETE FROM `cat...', array(), 
    &Varien_Db_Statement_Pdo_Mysql
    #0000000008c69cc60000000083f608b2#)
     called at 
    [lib/Varien/Db/Adapter/Pdo/Mysql.php:433] 
    #2 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #0000000008c69ee90000000083f608b2
    #->query('DELETE FROM `cat...') 
    called at 
    [lib/Zend/Db/Adapter/Abstract.php:661] 
    #3 Magento_Db_Adapter_Pdo_Mysql
    [Zend_Db_Adapter_Abstract]
    #0000000008c69ee90000000083f608b2
    #->delete('catalogrule_prod...',
     array('website_id = ?' => 1))
     called at 
    [app/code/core/Mage/CatalogRule/
    Model/Action/Index/Refresh.php:555] 
    
    #4 Mage_CatalogRule_Model_Action_Index_Refresh
    #0000000008c69cf20000000083f608b2
    #->_removeOldIndexData
    (&Mage_Core_Model_Website
    #0000000008c69ecf0000000083f608b2#) 
    called at 
    [app/code/core/Mage/CatalogRule/Model
    /Action/Index/Refresh.php:589] 
    
    #5 Mage_CatalogRule_Model_Action_Index_Refresh
    #0000000008c69cf20000000083f608b2
    #->_reindex(&Mage_Core_Model_Website
    #0000000008c69ecf0000000083f608b2#, 
    1406876400) 
    called at
     [app/code/core/Mage/CatalogRule/Model/
    Action/Index/Refresh.php:126] 
    
    #6 Mage_CatalogRule_Model_Action_Index_Refresh
    #0000000008c69cf20000000083f608b2
    #->execute()
     called at 
    [app/code/core/Mage/CatalogRule/Model/
    Resource/Rule.php:592] 
    
    #7 Mage_CatalogRule_Model_Resource_Rule
    #0000000008c69f4e0000000083f608b2
    #->_reindexCatalogRule(NULL) 
    called at 
    [app/code/core/Mage/CatalogRule/
    Model/Resource/Rule.php:545] 
    
    #8 Mage_CatalogRule_Model_Resource_Rule
    #0000000008c69f4e0000000083f608b2
    #->applyAllRules() 
    called at 
    [app/code/core/Mage/CatalogRule/
    Model/Rule.php:318] 
    #9 Mage_CatalogRule_Model_Rule
    #0000000008c69ce80000000083f608b2#->
    applyAll() called at 
    [app/code/core/Mage/Adminhtml/
    controllers/Promo/CatalogController.php:297] 
    
    #10 Mage_Adminhtml_Promo_CatalogController
    #0000000008c69c970000000083f608b2
    #->applyRulesAction() 
    called at
    [app/code/core/Mage/Core/Controller/
    Varien/Action.php:418] 
    
    #11 Mage_Adminhtml_Promo_CatalogController
    [Mage_Core_Controller_Varien_Action]
    #0000000008c69c970000000083f608b2
    #->dispatch('applyRules') 
    called at
    [app/code/core/Mage/Core/Controller/
    Varien/Router/Standard.php:250] 
    
    #12 Mage_Core_Controller_Varien_Router_Admin
    [Mage_Core_Controller_Varien_Router_Standard]
    #0000000008c69ec40000000083f608b2
    #->match(&Mage_Core_Controller_Request_Http
    #0000000008c69ec70000000083f608b2#)
     called at 
    [app/code/core/Mage/Core/Controller/
    Varien/Front.php:172] 
    
    #13 Mage_Core_Controller_Varien_Front
    #0000000008c69eae0000000083f608b2
    #->dispatch() 
    called at 
    [app/code/core/Mage/Core/Model/
    App.php:354] 
    
    #14 Mage_Core_Model_App
    #0000000008c69efa0000000083f608b2
    #->run(array('scope_code' => '', 
    'scope_type' => 'store', 'options' => 
    array())) called at [app/Mage.php:683] 
    #15 Mage::run('', 'store') 
    called at [index.php:87] 
    

    INSERT Query:-

    Action:-Save and apply rule from admin:

    AFF: 60
    TIME: 0.0749
    TRACE:
     #1 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #0000000051ad9f90000000001df5c15a
    #->_debugStat(2, 'INSERT INTO `cat...', 
    array(), &Varien_Db_Statement_Pdo_Mysql
    #0000000051ad9db3000000001df5c15a#) 
    called at
    [lib\Varien\Db\Adapter\Pdo\Mysql.php:433] 
    #2 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #0000000051ad9f90000000001df5c15a
    #->query('INSERT INTO `cat...')
     called at 
    [app\code\core\Mage\CatalogRule\Model\
    Action\Index\Refresh.php:571] 
    #3 Mage_CatalogRule_Model_Action_Index_Refresh
    #0000000051ad9d90000000001df5c15a
    #->_fillIndexData(&Mage_Core_Model_Website
    #0000000051ad9fbf000000001df5c15a#, 
    1405926000) 
    called at 
    [app\code\core\Mage\CatalogRule\Model\Action
    \Index\Refresh.php:590] 
    #4 Mage_CatalogRule_Model_Action_Index_Refresh
    #0000000051ad9d90000000001df5c15a
    #->_reindex(&Mage_Core_Model_Website
    #0000000051ad9fbf000000001df5c15a#,
     1405926000)
     called at
     [app\code\core\Mage\CatalogRule\Model\
    Action\Index\Refresh.php:126] 
    
    #5 Mage_CatalogRule_Model_Action_Index_Refresh
    #0000000051ad9d90000000001df5c15a
    #->execute()
     called at 
    [app\code\core\Mage\CatalogRule\Model\
    Resource\Rule.php:592] 
    
    #6 Mage_CatalogRule_Model_Resource_Rule
    #0000000051ad9e71000000001df5c15a
    #->_reindexCatalogRule(NULL) 
    called at 
    [app\code\core\Mage\CatalogRule\Model\
    Resource\Rule.php:545] 
    #7 Mage_CatalogRule_Model_Resource_Rule
    #0000000051ad9e71000000001df5c15a
    #->applyAllRules() 
    called at 
    [app\code\core\Mage\CatalogRule\
    Model\Rule.php:318] 
    
    #8 Mage_CatalogRule_Model_Rule
    #0000000051ad9d87000000001df5c15a
    #->applyAll() 
    called at 
    [app\code\core\Mage\Adminhtml\controllers\
    Promo\CatalogController.php:297] 
    
    #9 Mage_Adminhtml_Promo_CatalogController
    #0000000051ad9de6000000001df5c15a
    #->applyRulesAction()
     called at 
    [app\code\core\Mage\Core\Controller\
    Varien\Action.php:418] 
    
    #10 Mage_Adminhtml_Promo_CatalogController
    [Mage_Core_Controller_Varien_Action]
    #0000000051ad9de6000000001df5c15a
    #->dispatch('applyRules') 
    called at 
    [app\code\core\Mage\Core\Controller\Varien
    \Router\Standard.php:250] 
    
    #11 Mage_Core_Controller_Varien_Router_Admin
    [Mage_Core_Controller_Varien_Router_Standard]
    #0000000051ad9fb4000000001df5c15a
    #->match(&Mage_Core_Controller_Request_Http
    #0000000051ad9fb7000000001df5c15a#) 
    called at 
    [app\code\core\Mage\Core\Controller\
    Varien\Front.php:172] 
    
    #12 Mage_Core_Controller_Varien_Front
    #0000000051ad9fde000000001df5c15
    a#->dispatch() 
    called at
     [app\code\core\Mage\Core\Model\App.php:354] 
    
    #13 Mage_Core_Model_App
    #0000000051ad9f8a000000001df5c15
    a#->run(array('scope_code' => '',
     'scope_type' => 'store', 'options' =>
     array())) 
    called at 
    [app\Mage.php:683] 
    
    #14 Mage::run('', 'store') 
    called at 
    [index.php:87] 
    

    * Call stack for database table “Catalog_product_index _price”:-
    Action:-Edit and save product from admin :-
    DELETE Query:-

    AFF: 0
    TIME: 0.0006
    TRACE:
    #1 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #0000000022eac40b00000000a763a581
    #->_debugStat(2, 'DELETE `index_pr...',
     array(), 
    &Varien_Db_Statement_Pdo_Mysql
    #0000000022eac6f000000000a763a581#) 
    called at 
    [lib/Varien/Db/Adapter/Pdo/
    Mysql.php:433] 
    
    #2 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #0000000022eac40b00000000a763a581
    #->query('DELETE `index_pr...') 
    called at 
    [app/code/core/Enterprise/Catalog/
    Model/Index/Action/Product/Price/
    Abstract.php:79] 
    
    #3 Enterprise_Catalog_Model_Index_Action
    _Product_Price_Refresh_Row[Enterprise_
    Catalog_Model_Index_Action_Product_
    Price_Abstract]
    #0000000022eac6cb00000000a763a581
    #->_syncData(array(197)) 
    called at
     [app/code/core/Enterprise/Catalog/
    Model/Index/Action/Product/Price/
    Refresh/Changelog.php:125] 
    
    #4 Enterprise_Catalog_Model_Index_Action
    _Product_Price_Refresh_Row
    [Enterprise_Catalog_Model_Index_Action_Product
    _Price_Refresh_Changelog]
    #0000000022eac6cb00000000a763a581
    #->_reindex(array(197))
     called at 
    [app/code/core/Enterprise/Catalog/Model/
    Index/Action/Product/Price/Refresh/Row.php:73] 
    #5 Enterprise_Catalog_Model_Index_Action_
    Product_Price_Refresh_Row
    #0000000022eac6cb00000000a763a581#->execute() 
    called at 
    [app/code/core/Enterprise/Mview/Model
    /Client.php:109] 
    #6 Enterprise_Mview_Model_Client
    #0000000022eac6c400000000a763a581#->
    execute('enterprise_catal...', 
    array('value' => 197)) 
    called at
     [app/code/core/Enterprise/Catalog/Model/Index/Observer/Price.php:79] 
    #7 Enterprise_Catalog_Model_Index_Observer_Price
    #0000000022eac69200000000a763a581
    #->processStockItemSaveEvent(&Varien_Event_Observer
    #0000000022eac6a700000000a763a581#) 
    called at
     [app/code/core/Mage/Core/Model/App.php:1338] 
    #8 Mage_Core_Model_App
    #0000000022eac41800000000a763a581#->
    _callObserverMethod
    (&Enterprise_Catalog_Model_Index_Observer_Price
    #0000000022eac69200000000a763a581#,
     'processStockItem...',
     &Varien_Event_Observe
    r#0000000022eac6a700000000a763a581#) 
    called at 
    [app/code/core/Mage/Core/Model/App.php:1317] 
    #9 Mage_Core_Model_App
    #0000000022eac41800000000a763a581
    #->dispatchEvent
    ('cataloginventory...', array
    ('data_object' =>
     &Mage_CatalogInventory_Model_Stock_Item
    #0000000022eac63900000000a763a581#, 'item' => &Mage_CatalogInventory_Model_Stock_Item
    #0000000022eac63900000000a763a581#)) 
    called at
     [app/Mage.php:447] 
    
    #10 Mage::dispatchEvent
    ('cataloginventory...', array('data_object' => &Mage_CatalogInventory_Model_Stock_Item
    #0000000022eac63900000000a763a581#, 'item' => &Mage_CatalogInventory_Model_Stock_Item
    #0000000022eac63900000000a763a581#)) 
    called at 
    [app/code/core/Mage/Core/Model/
    Abstract.php:344] 
    
    #11 Mage_CatalogInventory_Model_Stock_Item
    [Mage_Core_Model_Abstract]
    #0000000022eac63900000000a763a581
    #->afterCommitCallback() 
    
    #12 call_user_func(array
    (&Mage_CatalogInventory_Model_Stock_Item
    #0000000022eac63900000000a763a581#,
     'afterCommitCallb...'))
     called at 
    [app/code/core/Mage/Core/Model/Resource/
    Abstract.php:110] 
    
    #13 Mage_Catalog_Model_Resource_Product
    [Mage_Core_Model_Resource_Abstract]
    #0000000022eac59e00000000a763a581#->
    commit() 
    called at
     [app/code/core/Mage/Core/Model/
    Abstract.php:322] 
    
    #14 Mage_Catalog_Model_Product
    [Mage_Core_Model_Abstract]
    #0000000022eac5b300000000a763a581
    #->save() 
    called at 
    [app/code/core/Mage/Adminhtml/controllers/
    Catalog/ProductController.php:728] 
    #15 Mage_Adminhtml_Catalog_ProductController
    #0000000022eac4bc00000000a763a581
    #->saveAction() 
    called at 
    [app/code/core/Mage/Core/Controller/Varien/
    Action.php:418] 
    #16 Mage_Adminhtml_Catalog_ProductController
    [Mage_Core_Controller_Varien_Action]
    #0000000022eac4bc00000000a763a581
    #->dispatch('save') 
    called at
     [app/code/core/Mage/Core/Controller/Varien
    /Router/Standard.php:250] 
    
    #17 Mage_Core_Controller_Varien_Router_Admin
    [Mage_Core_Controller_Varien_Router_Standard]
    #0000000022eac42600000000a763a581
    #->match
    (&Mage_Core_Controller_Request_Http
    #0000000022eac42500000000a763a581#)
     called at 
    [app/code/core/Mage/Core/Controller/
    Varien/Front.php:172] 
    
    #18 Mage_Core_Controller_Varien_Front
    #0000000022eac44c00000000a763a581#->
    dispatch() 
    called at
     [app/code/core/Mage/Core/Model/
    App.php:354] 
    #19 Mage_Core_Model_App
    #0000000022eac41800000000a763a581
    #->run(array('scope_code' => '', 
    'scope_type' => 'store', 'options' =>
     array())) c
    alled at 
    [app/Mage.php:683] 
    #20 Mage::run('', 'store')
     called at
     [index.php:87] 
    

    INSERT Query:-

    AFF: 0
    TIME: 0.0007
    TRACE:
    #1 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #0000000022eac40b00000000a763a581
    #->_debugStat
    (2, 'INSERT INTO `cat...', array(), 
    &Varien_Db_Statement_Pdo_Mysql
    #0000000022eac6ff00000000a763a581#)
     called at 
    [lib/Varien/Db/Adapter/Pdo/Mysql.php:433] 
    #2 Magento_Db_Adapter_Pdo_Mysql
    [Varien_Db_Adapter_Pdo_Mysql]
    #0000000022eac40b00000000a763a581
    #->query('INSERT INTO `cat...') 
    called at 
    [app/code/core/Enterprise/Catalog/Model/
    Index/Action/Product/Price/Abstract.php:312] 
    
    #3 Enterprise_Catalog_Model_Index_
    Action_Product_Price_Refresh_Row
    [Enterprise_Catalog_Model_Index_Action_
    Product_Price_Abstract]
    #0000000022eac6cb00000000a763a581
    #->_insertFromTable
    ('catalog_product_...', 'catalog_product_...') 
    called at 
    [app/code/core/Enterprise/Catalog/Model/Index/
    Action/Product/Price/Abstract.php:81] 
    
    #4 Enterprise_Catalog_Model_Index_Action
    _Product_Price_Refresh_Row[Enterprise_
    Catalog_Model_Index_Action_Product_Price_Abstract]
    #0000000022eac6cb00000000a763a581
    #->_syncData(array(197))
     called at 
    [app/code/core/Enterprise/Catalog/
    Model/Index/Action/Product/Price/Refresh/
    Changelog.php:125] 
    
    #5 Enterprise_Catalog_Model_Index_Action_
    Product_Price_Refresh_Row[Enterprise_
    Catalog_Model_Index_Action_Product_
    Price_Refresh_Changelog]
    #0000000022eac6cb00000000a763a581
    #->_reindex(array(197))
     called at 
    [app/code/core/Enterprise/Catalog/Model
    /Index/Action/Product/Price/Refresh/Row.php:73] 
    
    #6 Enterprise_Catalog_Model_Index_Actio
    n_Product_Price_Refresh_Row
    #0000000022eac6cb00000000a763a581
    #->execute() 
    called at
     [app/code/core/Enterprise/Mview/Model/
    Client.php:109] 
    #7 Enterprise_Mview_Model_Client
    #0000000022eac6c400000000a763a581
    #->execute('enterprise_catal...', 
    array('value' => 197)) called at
     [app/code/core/Enterprise/Catalog
    /Model/Index/Observer/Price.php:79] 
    #8 Enterprise_Catalog_Model_Index_Observer_Price
    #0000000022eac69200000000a763a581#->
    processStockItemSaveEvent
    (&Varien_Event_Observer
    #0000000022eac6a700000000a763a581#) 
    called at [app/code/core/Mage/Core/Model/
    App.php:1338] 
    #9 Mage_Core_Model_App
    #0000000022eac41800000000a763a581#->
    _callObserverMethod
    (&Enterprise_Catalog_Model_Index_Observer_Price
    #0000000022eac69200000000a763a581#, 
    'processStockItem...', &Varien_Event_Observer
    #0000000022eac6a700000000a763a581#)
     called at 
    [app/code/core/Mage/Core/Model/
    App.php:1317] 
    
    #10 Mage_Core_Model_App
    #0000000022eac41800000000a763a581
    #->dispatchEvent('cataloginventory...',
     array
    ('data_object' => &Mage_CatalogInventory
    _Model_Stock_Item
    #0000000022eac63900000000a763a581#, 
    'item' => 
    &Mage_CatalogInventory_Model_Stock_Item
    #0000000022eac63900000000a763a581#)) 
    called at 
    [app/Mage.php:447] 
    #11 Mage::dispatchEvent('cataloginventory...', 
    array
    ('data_object' => &Mage_CatalogInventory_
    Model_Stock_Item
    #0000000022eac63900000000a763a581#, 
    'item' => &Mage_CatalogInventory_Model_
    Stock_Item
    #0000000022eac63900000000a763a581#))
    called at
    [app/code/core/Mage/Core/Model/
    Abstract.php:344] 
    #12 Mage_CatalogInventory_Model_Stock
    Item[Mage_Core_Model_Abstract]
    #0000000022eac63900000000a763a581
    #->afterCommitCallback() 
    #13 call_user_func(array
    (&Mage_CatalogInventory_Model_Stock_Item
    #0000000022eac63900000000a763a581#, 
    'afterCommitCallb...'))
     called at 
    [app/code/core/Mage/Core/Model/Resource
    /Abstract.php:110] 
    #14 Mage_Catalog_Model_Resource_Product
    [Mage_Core_Model_Resource_Abstract]
    #0000000022eac59e00000000a763a581
    #->commit() 
    called at 
    [app/code/core/Mage/Core/Model/
    Abstract.php:322] 
    #15 Mage_Catalog_Model_Product
    [Mage_Core_Model_Abstract]
    #0000000022eac5b300000000a763a581
    #->save() 
    called at 
    [app/code/core/Mage/Adminhtml/controllers/
    Catalog/ProductController.php:728] 
    
    #16 Mage_Adminhtml_Catalog_ProductController
    #0000000022eac4bc00000000a763a581#->
    saveAction() called at 
    [app/code/core/Mage/
    Core/Controller/Varien/Action.php:418] 
    
    #17 Mage_Adminhtml_Catalog_ProductControlle
    r[Mage_Core_Controller_Varien_Action]
    #0000000022eac4bc00000000a763a581
    #->dispatch('save')
     called at 
    [app/code/core/Mage/Core/Controller/Varien/
    Router/Standard.php:250] 
    
    #18 Mage_Core_Controller_Varien_Router_Admin
    [Mage_Core_Controller_Varien_Router_Standard]
    #0000000022eac42600000000a763a581#->match
    (&Mage_Core_Controller_Request_Http
    #0000000022eac42500000000a763a581#) 
    called at [app/code/core/Mage/Core/
    Controller/Varien/Front.php:172] 
    #19 Mage_Core_Controller_Varien_Fron
    t#0000000022eac44c00000000a763a581
    #->dispatch() 
    called at
     [app/code/core/Mage/Core/Model/App.php:354] 
    #20 Mage_Core_Model_App
    #0000000022eac41800000000a763a581
    #->run(array('scope_code' => '',
     'scope_type' => 'store', 
    'options' => array()))
     called at 
    [app/Mage.php:683] 
    #21 Mage::run('', 'store')
     called at [index.php:87]
    
    Important flow-chart related to Catalog Target Rule
    1. Flow chart on Admin action. This flow chart explains how Data Base table catalogrule_product is affected. magento catalogrule_product table
    2. Flow chart on Admin action.This flow chart explains how Data Base table catalogrule is affected. magento catalogrule_product table
    3. Flow chart on Admin action.This flow chart explains how Data Base table catalogrule_affected_product is affected. magento catalogrule_affected_product table
    4. Flow chart on Admin action.This flow chart explains how Data Base table catalogrule_customer_group is affected. magento catalogrule_customer_group table
    5. Flow chart on Admin action.This flow chart explains how Data Base table catalogrule_website is affected. magento catalogrule_website table
    6. Flow chart on Admin action.This flow chart explains how Data Base table catalogrule_group_website is affected. magento catalogrule_group_website table
    7. Flow chart on Admin action.This flow chart explains how Data Base table catalogrule_product_price is affected. magento catalogrule_product_price table
    8. Flow chart on Admin action.This flow chart explains how Data Base table catalogrule_product_price_index is affected. magento catalog_product_price_index table
    List of classes with important function list related to Catalog Target Rule

    class:

    • Mage_CatalogRule_Model_Resource_Rule

      Functions:

      • cleanProductData
      • insertRuleData
      • applyToProduct
      • updateRuleProductData
      class:
    • Mage_CatalogRule_Model_Rule

      Functions:

      • applyAllRulesToProduct
      • applyAll()
      class:
    • Mage_CatalogRule_Model_Observer

      Functions:

      • applyAllRulesOnProduct
      • createCatalogRulesRelations
      class:
    • Mage_Adminhtml_Catalog_ProductController

      Functions:

      • saveAction()
      class:
    • Mage_Adminhtml_Promo_CatalogController

      Functions:

      • applyRulesAction()
    Explanation of those important functions.

    • cleanProductData(): This function deletes records in catalogrule/product_data by rule ID and product IDs
    • insertRuleData(): This function inserts rule data into catalogrule/rule_product table
    • applyToProduct This function apply catalog rule to product,/li>
    • updateRuleProductData This function update products which are matched for rule.
    • applyAllRulesToProduct This function apply all price rules to product
    • applyAll() This function apply all price rules, invalidate related cache and refresh price index
    • applyAllRulesOnProduct This function apply all catalog price rules for specific product
    • createCatalogRulesRelations This function create catalog rule relations for imported products
    • saveAction() This function save product action.
    • applyRulesAction() This function apply all active catalog price rules

    Indexing related aspect on this Module

    There are two indexing mode

    • 'update on save'
    • 'manual_update'

    There is no any queries obtained on actions

    • Edit and save product from admin
    • Save and apply rule from admin
    • Import product from admin.

    How to manage Catalog Target Rule via Admin.
    Setting from Magento Admin

    Go to Admin Panel -> Promotion -> Catalog Price Rules

    magento promotional rule admin

    1. Rule Information

    magento catalog target rule information admin

    • Rule Information: Enter Rule Name. You can give any name to your rule,according to your choice.
    • Description: You can add some description related to your rule or you may not because it is optional field.
    • Status: It set to Active to activate a rule otherwise is not.
    • Websites: You can select Websites to which you want to apply rules. You can select multiple websites from your store.
    • Customer Group: Select Customer Group,to which you want to apply rules. You can select more Customer Group by Pressing and Holding ctrl(control) key.
    • From Date and To Date: It specified the Time Period until which time period Price rules will valid.
    • Priority: Here you can set value '0' or '1'.Rule will apply based on priority.

    2. Set Conditions for catalog rule

    Apply condition, on which condition your rule should be apply.

    magento catlog rule condition admin

    3. Set Action for catalog rule

    magento catalog rule action admin configuration

    From Action tab, we applied discount amount for our catalog rules, after that Save and Apply Rules to apply on specific product.
    Known issues for Catalog Target Rule
    • If rule status from backend is inactive then rule not applied.
    • There is one rule which is category based, but when some new product is created in that category then rule is not applied to that product. When we goes to backend, edit and save that product again then the rule is applied to that product.
    Sample data related to Data Base Tables

    Sample data of database table “Catalogrule_product”:

    rule-product-id
    rule-id
    from-time
    to-time
    customer-group-id
    product-id
    action-operator
    action-amount
    action-stop
    sort-order
    website-id
    sub-simple-action
    sub-discount-amount
    940
    8
    1240704000
    0
    5
    27
    by-percent
    25
    0
    0
    1
    0
    941
    8
    1240704000
    0
    5
    39
    by-percent
    25
    0
    0
    1
    0
    942
    8
    1240704000
    0
    5
    83
    by-percent
    25
    0
    0
    1
    0
    943
    8
    1240704000
    0
    5
    93
    by-percent
    25
    0
    0
    1
    0




    Sample data of database table “Catalogrule”:

    rule-id
    name
    description
    from-date
    to-date
    is-active
    condition-serialized
    action-serialized
    stop-rules-processing
    sort-order
    simple-action
    discount-amount
    sub-is-enable
    sub-simple-action
    sub-discount-amount
    8
    Member Specials
    NULL
    04/26/09
    NULL
    1
    a 7:{s:4:\"type\";s:34:\"catalogrule/rule-condition-c...\"
    a 4:{s:4:\"type\";s:34:\"catalogrule/rule-condition-coll...\"
    0
    0
    by-percent
    25
    0
    by-percent
    0
    9
    10%discount
    NULL
    07/01/14
    07/31/14
    1
    a 7:{s:4:\"type\";s:34:\"catalogrule/rule-condition-c...\"
    a 4:{s:4:\"type\";s:34:\"catalogrule/rule-condition-coll...\"
    0
    1
    by-percent
    60
    0
    by-percent
    0




    Sample data of database table “Catalogrule_affected_product”:

    name
    description
    from-date
    to-date
    is-active
    condition-serialized
    action-serialized
    stop-rules-processing
    sort-order
    simple-action
    discount-amount
    sub-is-enable
    sub-simple-action
    sub-discount-amount
    Member Specials
    NULL
    2009-04-26
    NULL
    1
    a :7:{s:4:\"type\";s:34:\"catalogrule/rule-condition-c...\"
    a: 4:{s:4:\"type\";s:34:\"catalogrule/rule-condition-coll...\"
    0
    0
    by-percent
    25
    0
    by-percent
    0
    10%discount
    NULL
    2009-07-21
    2014-0-30
    1
    a:7:{s:4:\"type\";s:34:\"catalogrule/rule-condition-c...\"
    a: 4:{s:4:\"type\";s:34:\"catalogrule/rule-condition-coll...\"
    0
    1
    by-percent
    10
    0
    by-percent
    0

    Sample data of database table “Catalogrule_customer_group”

    rule-idcustomer-group-id
    90
    91
    92
    93
    85
    95
    96



    Sample data of database table “Catalogrule_website”

    rule-idwebsite-id
    81
    91
    92

    Sample data of database table “catalogrule_product_price”:

    rule-product-price-id
    rule-date
    customer-group-id
    product-id
    rule-price
    website-id
    latest-start-date
    earliest-end-date
    2285
    07/22/14
    5
    27
    2024.9925
    1
    04/26/09
    NULL
    2286
    07/23/14
    5
    27
    2024.9925
    1
    04/26/09
    NULL
    2287
    07/24/14
    5
    27
    2024.9925
    1
    04/26/09
    NULL
    2288
    07/22/14
    5
    39
    22.5
    1
    04/26/09
    NULL
    2289
    07/23/14
    5
    39
    22.5
    1
    04/26/09
    NULL

    Sample data of database table “Catalog_product_index _price” :

    entity-id
    customer-group-id
    website-id
    tax-class-id
    price Price
    final-price
    min-price
    max-price
    tier-price
    group-price
    16
    0
    1
    2
    149.99
    149.99
    149.99
    149.99
    NULL
    NULL
    16
    0
    2
    2
    149.99
    149.99
    149.99
    149.99
    NULL
    NULL
    16
    1
    1
    2
    149.99
    149.99
    149.99
    149.99
    NULL
    NULL
    16
    1
    2
    2
    149.99
    149.99
    149.99
    149.99
    NULL
    NULL
    16
    2
    1
    2
    149.99
    149.99
    149.99
    149.99
    NULL
    NULL