Skip to content
This repository was archived by the owner on Feb 8, 2023. It is now read-only.

Commit c726f5b

Browse files
authored
Merge pull request #15 from mageplaza/2.3-develop
2.3 develop
2 parents d532339 + 55d635d commit c726f5b

File tree

4 files changed

+51
-39
lines changed

4 files changed

+51
-39
lines changed

Block/Sitemap.php

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ public function getProductCollection()
141141
->addTaxPercents()
142142
->setPageSize($limit)
143143
->addAttributeToSelect('*');
144-
$this->_stockFilter->addInStockFilterToCollection($collection);
144+
if (!$this->_helper->getConfigValue('cataloginventory/options/show_out_of_stock')) {
145+
$this->_stockFilter->addInStockFilterToCollection($collection);
146+
}
145147

146148
return $collection;
147149
}
@@ -168,14 +170,23 @@ public function getCategoryUrl($categoryId)
168170

169171
/**
170172
* Get page collection
171-
* @return mixed
173+
*
174+
* @return PageCollection
175+
* @throws NoSuchEntityException
172176
*/
173177
public function getPageCollection()
174178
{
175-
return $this->pageCollection->addFieldToFilter('is_active', Page::STATUS_ENABLED)
176-
->addFieldToFilter('identifier', [
179+
$excludePages = $this->_helper->getExcludePageListing();
180+
$pageCollection = $this->pageCollection->addFieldToFilter('is_active', Page::STATUS_ENABLED)
181+
->addStoreFilter($this->_storeManager->getStore());
182+
183+
if ($this->_helper->isEnableExcludePage() && !empty($excludePages)) {
184+
$pageCollection->addFieldToFilter('identifier', [
177185
'nin' => $this->getExcludedPages()
178186
]);
187+
}
188+
189+
return $pageCollection;
179190
}
180191

181192
/**
@@ -184,11 +195,7 @@ public function getPageCollection()
184195
*/
185196
public function getExcludedPages()
186197
{
187-
if ($this->_helper->isEnableExcludePage()) {
188-
return explode(',', $this->_helper->getExcludePageListing());
189-
}
190-
191-
return ['home', 'no-route'];
198+
return explode(',', $this->_helper->getExcludePageListing());
192199
}
193200

194201
/**

Model/Sitemap.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,10 +411,11 @@ public function _getProductCollection($storeId)
411411
*/
412412
public function convertUrl($url)
413413
{
414-
if (preg_match(self::PATTERN, $url)) {
414+
if (preg_match(self::PATTERN, $url)
415+
|| strpos($url, 'http://') !== false
416+
|| strpos($url, 'https://') !== false) {
415417
return $url;
416418
}
417-
418419
return 'http://' . $url;
419420
}
420421

Model/Source/Page.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ public function __construct(CollectionFactory $pageCollectionFactory)
5151
*/
5252
public function toOptionArray()
5353
{
54-
$options = [];
54+
$options[] = [
55+
'value' => '',
56+
'label' => __('-- Please select --')
57+
];
58+
5559
/** @var Collection $collection */
5660
$collection = $this->_pageCollectionFactory->create();
5761
foreach ($collection as $item) {

composer.json

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
{
2-
"name": "mageplaza/module-sitemap",
3-
"description": "Magento 2 Google XML Sitemap extension",
4-
"require": {
5-
"mageplaza/module-core": "^1.4.5",
6-
"mageplaza/magento-2-seo-extension": "^2.1.0"
7-
},
8-
"type": "magento2-module",
9-
"version": "1.0.3",
10-
"license": "proprietary",
11-
"authors": [
12-
{
13-
"name": "Mageplaza",
14-
"email": "support@mageplaza.com",
15-
"homepage": "https://www.mageplaza.com",
16-
"role": "Technical Support"
17-
}
18-
],
19-
"autoload": {
20-
"files": [
21-
"registration.php"
22-
],
23-
"psr-4": {
24-
"Mageplaza\\Sitemap\\": ""
25-
}
26-
}
27-
}
1+
{
2+
"name": "mageplaza/module-sitemap",
3+
"description": "Magento 2 Google XML Sitemap extension",
4+
"require": {
5+
"mageplaza/module-core": "^1.4.5",
6+
"mageplaza/magento-2-seo-extension": "^2.1.0"
7+
},
8+
"type": "magento2-module",
9+
"version": "1.0.4",
10+
"license": "proprietary",
11+
"authors": [
12+
{
13+
"name": "Mageplaza",
14+
"email": "support@mageplaza.com",
15+
"homepage": "https://www.mageplaza.com",
16+
"role": "Technical Support"
17+
}
18+
],
19+
"autoload": {
20+
"files": [
21+
"registration.php"
22+
],
23+
"psr-4": {
24+
"Mageplaza\\Sitemap\\": ""
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)