ltsecurityinc安防产品在线商城代码
This commit is contained in:
Executable
+25
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Olegnax
|
||||
* @package Olegnax_LayeredNavigation
|
||||
* @copyright Copyright (c) 2019 Olegnax (http://olegnax.com/). All rights reserved.
|
||||
* @license Proprietary License https://olegnax.com/license/
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Olegnax\LayeredNavigation\Plugin\Frontend\Magento\Catalog\Model;
|
||||
|
||||
class CategoryRepository
|
||||
{
|
||||
|
||||
public function beforeGet(
|
||||
\Magento\Catalog\Model\CategoryRepository $subject,
|
||||
$categoryId,
|
||||
$storeId = null
|
||||
) {
|
||||
if (is_array($categoryId)) {
|
||||
$categoryId = array_shift($categoryId);
|
||||
}
|
||||
return [$categoryId, $storeId];
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Olegnax\LayeredNavigation\Plugin\Frontend\Magento\Eav\Model\Entity\Collection;
|
||||
|
||||
use Closure;
|
||||
use Exception;
|
||||
use Magento\Framework\DataObject;
|
||||
|
||||
class AbstractCollection
|
||||
{
|
||||
|
||||
/**
|
||||
* @param \Magento\Eav\Model\Entity\Collection\AbstractCollection $subject
|
||||
* @param Closure $process
|
||||
* @param DataObject $dataObject
|
||||
* @return $this
|
||||
*/
|
||||
public function aroundAddItem(
|
||||
\Magento\Eav\Model\Entity\Collection\AbstractCollection $subject,
|
||||
Closure $process,
|
||||
DataObject $dataObject
|
||||
) {
|
||||
try {
|
||||
return $process($dataObject);
|
||||
} catch (Exception $e) {
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user