File tree Expand file tree Collapse file tree 5 files changed +138
-1
lines changed Expand file tree Collapse file tree 5 files changed +138
-1
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ namespace Magento \Sitemap \Model \ItemProvider ;
8
+
9
+ use Magento \Sitemap \Model \SitemapItemInterfaceFactory ;
10
+
11
+ class StoreUrl implements ItemProviderInterface
12
+ {
13
+ /**
14
+ * Sitemap item factory
15
+ *
16
+ * @var SitemapItemInterfaceFactory
17
+ */
18
+ private $ itemFactory ;
19
+
20
+ /**
21
+ * Config reader
22
+ *
23
+ * @var ConfigReaderInterface
24
+ */
25
+ private $ configReader ;
26
+
27
+ /**
28
+ * CategorySitemapItemResolver constructor.
29
+ *
30
+ * @param ConfigReaderInterface $configReader
31
+ * @param SitemapItemInterfaceFactory $itemFactory
32
+ */
33
+ public function __construct (
34
+ ConfigReaderInterface $ configReader ,
35
+ SitemapItemInterfaceFactory $ itemFactory
36
+ ) {
37
+ $ this ->itemFactory = $ itemFactory ;
38
+ $ this ->configReader = $ configReader ;
39
+ }
40
+
41
+ /**
42
+ * {@inheritdoc}
43
+ */
44
+ public function getItems ($ storeId )
45
+ {
46
+ $ items [] = $ this ->itemFactory ->create ([
47
+ 'url ' => '' ,
48
+ 'priority ' => $ this ->configReader ->getPriority ($ storeId ),
49
+ 'changeFrequency ' => $ this ->configReader ->getChangeFrequency ($ storeId ),
50
+ ]);
51
+
52
+ return $ items ;
53
+ }
54
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ namespace Magento \Sitemap \Model \ItemProvider ;
8
+
9
+ use Magento \Framework \App \Config \ScopeConfigInterface ;
10
+ use Magento \Store \Model \ScopeInterface ;
11
+
12
+ class StoreUrlConfigReader implements ConfigReaderInterface
13
+ {
14
+ /**#@+
15
+ * Xpath config settings
16
+ */
17
+ const XML_PATH_CHANGE_FREQUENCY = 'sitemap/store/changefreq ' ;
18
+ const XML_PATH_PRIORITY = 'sitemap/store/priority ' ;
19
+ /**#@-*/
20
+
21
+ /**
22
+ * Scope config
23
+ *
24
+ * @var ScopeConfigInterface
25
+ */
26
+ private $ scopeConfig ;
27
+
28
+ /**
29
+ * CategoryItemResolverConfigReader constructor.
30
+ *
31
+ * @param ScopeConfigInterface $scopeConfig
32
+ */
33
+ public function __construct (ScopeConfigInterface $ scopeConfig )
34
+ {
35
+ $ this ->scopeConfig = $ scopeConfig ;
36
+ }
37
+
38
+ /**
39
+ * {@inheritdoc}
40
+ */
41
+ public function getPriority ($ storeId )
42
+ {
43
+ return (string )$ this ->scopeConfig ->getValue (
44
+ self ::XML_PATH_PRIORITY ,
45
+ ScopeInterface::SCOPE_STORE ,
46
+ $ storeId
47
+ );
48
+ }
49
+
50
+ /**
51
+ * {@inheritdoc}
52
+ */
53
+ public function getChangeFrequency ($ storeId )
54
+ {
55
+ return (string )$ this ->scopeConfig ->getValue (
56
+ self ::XML_PATH_CHANGE_FREQUENCY ,
57
+ ScopeInterface::SCOPE_STORE ,
58
+ $ storeId
59
+ );
60
+ }
61
+ }
Original file line number Diff line number Diff line change 51
51
<comment >Valid values range from 0.0 to 1.0.</comment >
52
52
</field >
53
53
</group >
54
- <group id =" generate" translate =" label" type =" text" sortOrder =" 4" showInDefault =" 1" >
54
+ <group id =" store" translate =" label" type =" text" sortOrder =" 4" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" >
55
+ <label >Store Url Options</label >
56
+ <field id =" changefreq" translate =" label" type =" select" sortOrder =" 1" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" canRestore =" 1" >
57
+ <label >Frequency</label >
58
+ <source_model >Magento\Sitemap\Model\Config\Source\Frequency</source_model >
59
+ </field >
60
+ <field id =" priority" translate =" label comment" type =" text" sortOrder =" 2" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" canRestore =" 1" >
61
+ <label >Priority</label >
62
+ <backend_model >Magento\Sitemap\Model\Config\Backend\Priority</backend_model >
63
+ <comment >Valid values range from 0.0 to 1.0.</comment >
64
+ </field >
65
+ </group >
66
+ <group id =" generate" translate =" label" type =" text" sortOrder =" 5" showInDefault =" 1" >
55
67
<label >Generation Settings</label >
56
68
<field id =" enabled" translate =" label" type =" select" sortOrder =" 1" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" canRestore =" 1" >
57
69
<label >Enabled</label >
Original file line number Diff line number Diff line change 25
25
<changefreq >daily</changefreq >
26
26
<image_include >all</image_include >
27
27
</product >
28
+ <store >
29
+ <priority >1</priority >
30
+ <changefreq >daily</changefreq >
31
+ </store >
28
32
<generate >
29
33
<enabled >0</enabled >
30
34
<error_email />
Original file line number Diff line number Diff line change 25
25
<type name =" Magento\Sitemap\Model\ItemProvider\Composite" >
26
26
<arguments >
27
27
<argument name =" itemProviders" xsi : type =" array" >
28
+ <item name =" storeUrlProvider" xsi : type =" object" >Magento\Sitemap\Model\ItemProvider\StoreUrl</item >
28
29
<item name =" categoryProvider" xsi : type =" object" >Magento\Sitemap\Model\ItemProvider\Category</item >
29
30
<item name =" cmsPageProvider" xsi : type =" object" >Magento\Sitemap\Model\ItemProvider\CmsPage</item >
30
31
<item name =" productProvider" xsi : type =" object" >Magento\Sitemap\Model\ItemProvider\Product</item >
31
32
</argument >
32
33
</arguments >
33
34
</type >
35
+ <type name =" Magento\Sitemap\Model\ItemProvider\StoreUrl" >
36
+ <arguments >
37
+ <argument name =" configReader" xsi : type =" object" >Magento\Sitemap\Model\ItemProvider\StoreUrlConfigReader</argument >
38
+ </arguments >
39
+ </type >
34
40
<type name =" Magento\Sitemap\Model\ItemProvider\Category" >
35
41
<arguments >
36
42
<argument name =" configReader" xsi : type =" object" >Magento\Sitemap\Model\ItemProvider\CategoryConfigReader</argument >
You can’t perform that action at this time.
0 commit comments