View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000451 | OXID eShop (all versions) | 1. ----- eShop frontend ----- | public | 2008-12-11 16:47 | 2012-12-10 14:17 |
Reporter | dainius.bigelis | Assigned To | |||
Priority | normal | Severity | major | Reproducibility | unable to reproduce |
Status | resolved | Resolution | won't fix | ||
Summary | 0000451: The count of inherited articles in category is calculated from all the shops in Mall | ||||
Description | Subshop inherits articles from Parent shop. Then create the category in the subshop and assign inherited articles. In this case in frontend the count of articles in category is calculated from all the shops, where articles are inherited. | ||||
Additional Information | Bug is reported by our partner in the Old version eShop (EE 2.7.0.3). They are aware, that the same issue exists in the eShop 4. Please check if the same problem exists in the eShop 4 and fix if needed. In the attachment there is a solution offered for the same bug in the previous eShop version (EE 2.7.0.3) | ||||
Tags | Subshops | ||||
Attached Files | solution_for_case.txt (2,128 bytes)
In funktion SetCatArticleCount in oxutils, the shopID is being dropped so all articles are counted that is assigned in all shops. This is the solution: select count( * ) from oxobject2category WHERE oxobject2category.oxcatnid = '".$sCatId."' and oxobject2category.oxshopid = '".$myConfig->getShopId()."' and oxobject2category.oxobjectid in ... (line 3 is new). The problem of missing shopIDs has been found at different places as well. Same thing in LoadCategoryArticles() of the class oxarticlelist: $sSelect = "select $sArticleTable.* from $sArticleTable, $sO2CView as oxobject2category ".$sFilterSQLAdd; $sSelect .= "where oxobject2category.oxcatnid = '$sCatNID' "; $sSelect .= "and oxobject2category.oxshopid = '".$myConfig->getShopId()."' "; (last line is new). The select is executed in method selectString() of the class oxList and this one runs all selected articles and builds the list because of the OXID of the article: $this->aList[$object->sOXID] = $object; An object with the same OXID this way overwrites the one before in the array. This is where we could save some performance ;-) Same thing in admin. The categories come up 5 times in "Manage Articles" -> "extended"(one time each per shop) Solution: In admin/article_extend in method render(): // hightlighting main category $sMainSelect = "select $sCatView.oxid from $sO2CView left join $sCatView on $sCatView.oxid=$sO2CView.oxcatnid "; $sMainSelect .= 'where '.$sO2CView .'.oxobjectid = "'.$soxId.'" and '.$sCatView.'.oxid is not null '; $sMainSelect .= "and '.$sO2CView .'.oxshopid = '".$myConfig->getShopId()."' "; and in core/oxajaxlist.php, method createCategoryList(): $sSelect = "select * from $sO2CView as oxobject2category left join ".$sCategoriesTable.' on '.$sCategoriesTable.'.oxid=oxobject2category.oxcatnid '; $sSelect .= 'where oxobject2category.oxobjectid = "'.$sArtId.'" and '.$sCategoriesTable.'.oxid is not null '; $sSelect .= "and oxobject2category.oxshopid = '".$myConfig->getShopID()."' "; | ||||
Theme | |||||
Browser | |||||
PHP Version | |||||
Database Version | |||||
|
Thank you for clean and ready to use solution, I wish we got more of these for bug fixes :) Unfortunately the solut offers to check shopid in some queries. This would work in standard assignment case. The case when separate articles are assigned to separate categories in totaly different shops. Unfortunately (or better to say this is very cool feature) in OXID we do not only deal with direct assignments but also with shop item inheritance, it means that you can have product in the subshop even if its shopid is parent shop. We use DB views to select all shop dependent products and this info does not rely on shopid at all (we use oxshopincl and oxshopexcl fields). Same applies to categories and even to product-to-category relations. Another problem with category product counts are the fact that in order to select them "live" we would need to select all shop dependencies and it would take a long time. So this is why we cache it to oxcategory table, probably we need a separate table to cache the counts for multishops. |