Skip to content

Commit

Permalink
Fix missing offset error in facets
Browse files Browse the repository at this point in the history
  • Loading branch information
RBech committed Dec 20, 2018
1 parent b3fa18f commit 19371d6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion Block/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ public function getSpanAttributes()

// sort alphabetically by name
uasort($titles, function($a, $b) {
return $a['sort_order'] > $b['sort_order'];
if (isset($a['sort_order']) && isset($b['sort_order'])) {
return $a['sort_order'] > $b['sort_order'];
}

return true;
});

$spanAttributes['data-facets-titles'] = json_encode(array_filter(array_combine(array_keys($titles), array_column($titles, 'label'))));
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Clerk_Clerk" setup_version="2.6.6">
<module name="Clerk_Clerk" setup_version="2.6.7">
<sequence>
<module name="Magento_CatalogSearch"/>
</sequence>
Expand Down
4 changes: 2 additions & 2 deletions view/adminhtml/templates/facettitles.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ $values = json_decode($element->getValue(), true);
<input class="input-text" id="_orig" value="<?php echo $attribute; ?>" type="text" readonly>
</td>
<td class="col-store-view">
<input class="input-text" id="" name="<?php echo $element->getName(); ?>[<?php echo $attribute; ?>][label]" value="<?php echo $value['label']; ?>" type="text">
<input class="input-text" id="" name="<?php echo $element->getName(); ?>[<?php echo $attribute; ?>][label]" value="<?php echo isset($value['label']) ? $value['label'] : ''; ?>" type="text">
</td>
<td class="col-store-view">
<input class="input-text" id="" name="<?php echo $element->getName(); ?>[<?php echo $attribute; ?>][sort_order]" value="<?php echo $value['sort_order']; ?>" type="text">
<input class="input-text" id="" name="<?php echo $element->getName(); ?>[<?php echo $attribute; ?>][sort_order]" value="<?php echo isset($value['sort_order']) ? $value['sort_order'] : 0; ?>" type="text">
</td>
</tr>
<?php endforeach; ?>
Expand Down

0 comments on commit 19371d6

Please sign in to comment.