Skip to content

Commit

Permalink
Compatible 2.4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
phutx committed Sep 26, 2022
1 parent 44452d1 commit e95d2e8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
14 changes: 4 additions & 10 deletions Block/Adminhtml/SeoChecker/CheckForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
use Magento\Catalog\Api\CategoryRepositoryInterface;
use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Catalog\Model\ProductFactory;
use Magento\Cms\Block\Adminhtml\Page\Grid\Renderer\Action\UrlBuilder;
use Magento\Cms\Helper\Page;
use Magento\Cms\Model\PageFactory;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\View\Element\Template;
Expand All @@ -45,7 +45,7 @@ class CheckForm extends Template
protected $_template = 'seocheck.phtml';

/**
* @var UrlBuilder
* @var Page
*/
protected $cmsUrl;

Expand Down Expand Up @@ -88,7 +88,7 @@ class CheckForm extends Template
*/
public function __construct(
Context $context,
UrlBuilder $cmsUrl,
Page $cmsUrl,
PageFactory $cmsPageFactory,
ProductFactory $productFactory,
ProductRepositoryInterface $productRepository,
Expand All @@ -115,13 +115,11 @@ public function __construct(
public function getLink()
{
$id = $this->_request->getParam('id');
$storeCode = $this->_storeManager->getStore()->getCode();
$storeId = $this->_request->getParam('store');
$actionName = $this->_request->getFullActionName();
if ($storeId === 0 || $storeId === null) {
$defaultStore = $this->_storeManager->getDefaultStoreView();
$storeId = $defaultStore->getId();
$storeCode = $defaultStore->getCode();
}
switch ($actionName) {
case 'catalog_product_edit':
Expand All @@ -135,11 +133,7 @@ public function getLink()
break;
case 'cms_page_edit':
$pageId = $this->_request->getParam('page_id');
$url = $this->cmsUrl->getUrl(
$this->cmsPageFactory->create()->load($pageId)->getIdentifier(),
$storeId,
$storeCode
);
$url = $this->cmsUrl->getPageUrl($pageId);
break;
default:
$url = '';
Expand Down
8 changes: 5 additions & 3 deletions Plugin/SeoRender.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,11 +357,13 @@ public function showProductStructuredData()
);

if ($sourceItemList = $this->sourceItemsBySku->execute($product->getSku())) {
$stockQty = [];
$stockQty = 0;
foreach ($sourceItemList as $source) {
$stockQty[] = (int) $source['quantity'];
if ($source->getSourceCode() != 'default') {
$stockQty += (int) $source['quantity'];
}
}
$stockItem = max($stockQty);
$stockItem = $stockQty;
}

$priceValidUntil = $currentProduct->getSpecialToDate();
Expand Down

0 comments on commit e95d2e8

Please sign in to comment.