Commit 3a34c456 by halweg

feat: 图片上传完成

parent 088b3c6d
......@@ -196,14 +196,11 @@ class Topmenu extends JoshineMenu
if ($childLevel == 0) {
$html = "<div class=\"level{$childLevel} {$childrenWrapClass}\">";
$html .= "<div class=\"row\">
<ul class=\"subchildmenu mega-columns joshine-clearfix joshine-col-lg-{$columns}\">
<ul class=\"subchildmenu mega-columns joshine-clearfix joshine-col-lg-{$columns} {$child->getMenuImage()}\">
{$this->_getHtml($child, $childrenWrapClass, $limit, $colStops)}
</ul>
<div class=\" pull-right \">".
" " //$this->getLayout()->createBlock(\Magento\Cms\Block\Block::class)->setBlockId('catpic')
."</div>
</div>
</div>";
</ul>";
$html .= $this->appendImage($child);
$html .= "</div></div>";
} else {
$html .= '<ul class="level' . $childLevel . '">';
$html .= $this->_getHtml($child, $childrenWrapClass, $limit, $colStops);
......@@ -212,4 +209,20 @@ class Topmenu extends JoshineMenu
return $html;
}
private function appendImage($child)
{
$html = "";
if (!$child->getMenuImage()) {
return $html;
}
if ($child->getMenuImage()) {
$html .= "<div class=\" pull-right \">";
$html .= "<img src='{$child->getMenuImage()}'/>";
$html .= "</div>";
}
return $html;
}
}
......@@ -148,6 +148,7 @@ class Topmenu extends Menu
'submenu_columns_total' => $category->getData('submenu_columns_total'),
'self_columns' => $category->getData('self_columns'),
'submenu_columns_single' => $category->getData('submenu_columns_single'),
'menu_image' => $category->getData('menu_image'),
'has_active' => in_array((string)$categoryId, explode('/', (string)$currentCategory->getPath()), true),
'is_active' => $categoryId == $currentCategory->getId(),
'is_category' => true,
......@@ -175,6 +176,7 @@ class Topmenu extends Menu
$collection->addAttributeToSelect('submenu_columns_total');
$collection->addAttributeToSelect('submenu_columns_single');
$collection->addAttributeToSelect('self_columns');
$collection->addAttributeToSelect('menu_image');
$collection->addFieldToFilter('path', ['like' => '1/' . $rootId . '/%']); //load only from store root
$collection->addAttributeToFilter('include_in_menu', 1);
$collection->addIsActiveFilter();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment