Skip to content

Commit

Permalink
https://github.com/cabinetsbay/site/issues/98
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed Mar 10, 2024
1 parent 40fa168 commit 9f5c19a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions Catalog/lib/category/hierarchy.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
<?php
use Magento\Catalog\Model\Category as C;

/**
* 2024-03-10
* "The result of `Magento\Catalog\Model\Category::getParentCategories()` always includes the caller":
* https://mage2.pro/t/6429
* @return C|null
*/
function df_category_ancestor_at_level(C $c, int $l) {return $l > ($l2 = df_category_level($c)) ? null : (
$l === $l2 ? $c : df_category($c->getPathIds()[$l])
);}

/**
* 2024-03-10
* 1) @uses \Magento\Catalog\Model\Category::getLevel() can return a string (e.g., "3").
* 2.1) Level 0: «Root Catalog» (undeletable, hidden in UI).
* 2.2) Level 1: «Default Category» (undeletable, can be renamed).
* @used-by cb_category_is_l2() (https://github.com/cabinetsbay/site/issues/98)
* @used-by cb_category_is_l3() (https://github.com/cabinetsbay/site/issues/98)
* @used-by df_category_ancestor_at_level()
* @used-by \Sharapov\Cabinetsbay\Block\Category\View::getRootCategoryName() (https://github.com/cabinetsbay/site/issues/98)
* @used-by \Sharapov\Cabinetsbay\Block\Category\View::level() (https://github.com/cabinetsbay/site/issues/98)
* @used-by \Sharapov\Cabinetsbay\Block\Category\View::l3() (https://github.com/cabinetsbay/site/issues/98)
Expand Down
1 change: 1 addition & 0 deletions Catalog/lib/category/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
/**
* 2019-09-08
* @see df_product()
* @used-by df_category_ancestor_at_level()
* @used-by df_category_children()
* @used-by df_category_children_map()
* @used-by \Sharapov\Cabinetsbay\Block\Category\View::l3() (https://github.com/cabinetsbay/site/issues/98)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mage2pro/core"
,"version": "10.7.2"
,"version": "10.7.3"
,"description": "Mage2.PRO core package."
,"type": "magento2-module"
,"homepage": "https://mage2.pro"
Expand Down

0 comments on commit 9f5c19a

Please sign in to comment.