Comments (4)
@nickpiro I added following usort
in the file app/code/Harrigo/EverCrumbs/Block/Evercrumbs.php
:
usort($breadcrumbCategories, function ($a, $b) {
return strcmp($a->getLevel(), $b->getLevel());
});
foreach ($breadcrumbCategories as $category) {
It seems to solve the problem, even though we now have two sorts in a row...
from evercrumbs.
Running 2.2.9 on one server and see the same thing, but only for one specific category and its subcategories. All other categories work as expected.
According to the database, we have correct level
order, but looking at the category id
, it seems the sorting follows that order. It looks like the ordering is not taking effect and happens to work by luck on all other categories.
from evercrumbs.
@nickpiro I added following
usort
in the fileapp/code/Harrigo/EverCrumbs/Block/Evercrumbs.php
:usort($breadcrumbCategories, function ($a, $b) { return strcmp($a->getLevel(), $b->getLevel()); }); foreach ($breadcrumbCategories as $category) {
It seems to solve the problem, even though we now have two sorts in a row...
Thanks for update, now it working fine :)
from evercrumbs.
Had the same issue. This resolved it.
public function getCrumbs()
{
$evercrumbs = array();
$evercrumbs[] = array(
'label' => 'Home',
'title' => 'Go to Home Page',
'link' => $this->_storeManager->getStore()->getBaseUrl()
);
$path = $this->_catalogData->getBreadcrumbPath();
$product = $this->registry->registry('current_product');
$categoryCollection = clone $product->getCategoryCollection();
$categoryCollection->clear();
$categoryCollection->addAttributeToSort('level', $categoryCollection::SORT_ORDER_DESC)->addAttributeToFilter('path', array('like' => "1/" . $this->_storeManager->getStore()->getRootCategoryId() . "/%"));
$categoryCollection->setPageSize(1);
$breadcrumbCategories = $categoryCollection->getFirstItem()->getParentCategories();
array_pop($path);
foreach ($path as $category) {
$evercrumbs[] = array(
'label' => $category['label'],
'title' => $category['label'],
'link' => array_key_exists( 'link', $category) ? $category['link'] : ''
);
}
$evercrumbs[] = array(
'label' => $product->getName(),
'title' => $product->getName(),
'link' => ''
);
return $evercrumbs;
}
Not sure though if this is right way.
from evercrumbs.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from evercrumbs.