In-Portal Issue Tracker - In-Portal CMS
Viewing Issue Advanced Details
398 [In-Portal CMS] Optimization task always 2009-10-17 07:12 2012-07-25 05:32
alex  
alex  
normal  
closed 5.0.1  
fixed  
 
none 5.2.0-B1  
1
0000398: Partially move kCatDBItem and CreategoryItem class contents to OnBefore/OnAfter events
Classes kCatDBItem and CreategoryItem were created before OnBefore/OnAfter events were invented. That's why most of their code is not located in them, as it should. When OnBefore/OnAfter events are used with that classes, then it in most cases lead to unpredictable behavior and hardly detectable processing logic errors.

For example you expect, that OnAfterItemCreate is called after category item is created. But it happens in the middle and after it's called category item is assigned to primary category. Created category item (in state available in OnAfterItemCreate event) won't be able to load at all, because it JOINed to CategoryItems table, where record is not present at the moment.

How this happens now:
1. kCatDBItem::Create()
2. kCatDBEventHandler::OnAfterItemCreate(&$event)
3. kCatDBItem::assignPrimaryCategory()
4. kCatDBItem::Update()
5. kCatDBEventHandler::OnAfterItemUpdate(&$event)

How this should happen:
1. kCatDBItem::Create()
2. kCatDBItem::assignPrimaryCategory()
3. kCatDBItem::Update()
4. kCatDBEventHandler::OnAfterItemUpdate(&$event)
6. kCatDBEventHandler::OnAfterItemCreate(&$event)

Because what's the point of OnAfter event if it's called in the middle and not at the end. Because of that there is no way to control what code (customized or original) will go first.
patch category_item_optimization.patch (13,857) 2011-11-01 11:04
http://tracker.in-portal.org/file_download.php?file_id=1283&type=bug
png 2011-11-04_2053.png (269,099) 2011-11-07 03:57
http://tracker.in-portal.org/file_download.php?file_id=1300&type=bug
patch category_pasting_produced_sql_error.patch (1,426) 2011-11-07 03:57
http://tracker.in-portal.org/file_download.php?file_id=1301&type=bug
patch duplicate_category_resourceid_on_import_v2.patch (1,471) 2011-12-30 06:09
http://tracker.in-portal.org/file_download.php?file_id=1446&type=bug
png ProductImportCategoryIssue.png (64,964) 2011-12-30 06:12
http://tracker.in-portal.org/file_download.php?file_id=1447&type=bug
png
Issue History
2012-07-25 05:32 alex Note Added: 0005010
2012-07-25 05:32 alex Status resolved => closed
2011-12-30 06:13 alex Changeset attached 5.2.x r14959
2011-12-30 06:12 alex File Added: ProductImportCategoryIssue.png
2011-12-30 06:12 alex Note Added: 0004363
2011-12-30 06:09 alex File Added: duplicate_category_resourceid_on_import_v2.patch
2011-11-07 04:01 alex Note Edited: 0004136 bug_revision_view_page.php?bugnote_id=0004136#r910
2011-11-07 04:00 alex Changeset attached 5.2.x r14736
2011-11-07 03:59 alex Note Added: 0004136
2011-11-07 03:57 alex File Added: category_pasting_produced_sql_error.patch
2011-11-07 03:57 alex File Added: 2011-11-04_2053.png
2011-11-01 11:12 alex Note Added: 0004114
2011-11-01 11:12 alex Status reviewed and tested => resolved
2011-11-01 11:12 alex Fixed in Version => 5.2.0-B1
2011-11-01 11:12 alex Resolution open => fixed
2011-11-01 11:12 alex Assigned To !COMMUNITY => alex
2011-11-01 11:12 alex Changeset attached 5.2.x r14719
2011-11-01 11:04 alex Status needs testing => reviewed and tested
2011-11-01 11:04 alex Note Added: 0004113
2011-11-01 11:04 alex Time Estimate Removed 2 =>
2011-11-01 11:04 alex Assigned To alex => !COMMUNITY
2011-11-01 11:04 alex Developer => alex
2011-11-01 11:04 alex Status needs work => needs testing
2011-11-01 11:04 alex File Added: category_item_optimization.patch
2011-10-22 05:37 alex Estimate Points => 1
2011-09-27 05:08 alex Time Estimate Added 2
2011-09-23 21:57 Dmitry Target Version Icebox => 5.2.0
2009-11-25 01:22 Dmitry Assigned To => alex
2009-11-25 01:22 Dmitry Status active => needs work
2009-10-17 07:12 alex Target Version => Icebox
2009-10-17 07:12 alex New Issue

Notes
(0004113)
alex   
2011-11-01 11:04   
Will test all later together.
(0004114)
alex   
2011-11-01 11:12   
Fix committed to 5.2.x branch. Commit Message:

Fixes 0000398: Partially move kCatDBItem and CreategoryItem class contents to OnBefore/OnAfter events
(0004136)
alex   
2011-11-07 03:59   
(edited on: 2011-11-07 04:01)
Patch "category_pasting_produced_sql_error.patch" fixes problem with category/category item copy/paste problem seen on "2011-11-04_2053.png" attachment.

Problem was produced by commit in this task (ResourceId field not being reset before category/category item is cloned).

(0004363)
alex   
2011-12-30 06:12   
Patch "duplicate_category_resourceid_on_import_v2.patch" solves the problem when categories on multiple deep levels were specified in product import file, that resulted category ResourceId field to be non-unique during import (e.g. 'CategoryA||CategoryB' (see ProductImportCategoryIssue.png image, provided by Dmitry).
(0005010)
alex   
2012-07-25 05:32   
Since 5.2.0 version was released.