Skip to content

Commit 33a069d

Browse files
committed
update feature2
1 parent 4204d83 commit 33a069d

File tree

7 files changed

+79
-28
lines changed

7 files changed

+79
-28
lines changed

Controller/Tag/Index.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace Lof\ProductTags\Controller\Adminhtml\Tag;
4+
5+
class Index extends \Magento\Backend\App\Action
6+
{
7+
protected $resultPageFactory = false;
8+
9+
public function __construct(
10+
\Magento\Backend\App\Action\Context $context,
11+
\Magento\Framework\View\Result\PageFactory $resultPageFactory
12+
)
13+
{
14+
parent::__construct($context);
15+
$this->resultPageFactory = $resultPageFactory;
16+
}
17+
18+
public function execute()
19+
{
20+
$resultPage = $this->resultPageFactory->create();
21+
$resultPage->getConfig()->getTitle()->prepend((__('Posts')));
22+
23+
return $resultPage;
24+
}
25+
26+
27+
}

Helper/Data.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Data extends AbstractHelper
3636
*/
3737

3838
protected $scopeConfig;
39-
const XML_PATH_HELLOWORLD = 'lofproductags/';
39+
const XML_PATH_TAG = 'lofproductags/';
4040
public function __construct(Context $context,ScopeConfigInterface $scopeConfig)
4141
{
4242
parent::__construct($context);
@@ -54,6 +54,6 @@ public function getConfigValue($field, $storeId = null)
5454
}
5555
public function getGeneralConfig($code, $storeId = null)
5656
{
57-
return $this->getConfigValue(self::XML_PATH_HELLOWORLD .'general/'. $code, $storeId);
57+
return $this->getConfigValue(self::XML_PATH_TAG .'general/'. $code, $storeId);
5858
}
5959
}

etc/adminhtml/menu.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<?xml version="1.0" ?>
22
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
33
<menu>
4-
<add id="Lof::top_level" module="Lof_ProductTags" resource="Magento_Backend::content" sortOrder="9999" title="Lof"/>
5-
<add action="lofproducttags/tags/index" id="Lof_ProductTags::tags_index" module="Lof_ProductTags" parent="Lof::top_level" resource="Lof_ProductTags::tags_index" sortOrder="9999" title="tags index"/>
6-
<add action="lof_producttags/tag/index" id="Lof_ProductTags::lof_producttags_tag" module="Lof_ProductTags" parent="Lof::top_level" resource="Magento_Backend::content" sortOrder="9999" title="Tag"/>
4+
<add id="Lof_ProductTags::producttags" module="Lof_ProductTags" parent="Magento_Catalog::inventory" resource="Lof_ProductTags::lofproducttags" action="lofproducttags/tag/index" sortOrder="9999" title="Product Tags"/>
75
</menu>
86
</config>

etc/adminhtml/routes.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,5 @@
44
<route frontName="lofproducttags" id="lofproducttags">
55
<module before="Magento_Backend" name="Lof_ProductTags"/>
66
</route>
7-
<route frontName="lof_producttags" id="lof_producttags">
8-
<module before="Magento_Backend" name="Lof_ProductTags"/>
9-
</route>
107
</router>
118
</config>

etc/adminhtml/system.xml

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,64 @@
1010
<resource>Lof_ProductTags::config_lof_producttags</resource>
1111
<group id="general" showInDefault="1" showInStore="1" showInWebsite="1" sortOrder="10" translate="label">
1212
<label>general</label>
13-
<field id="enable" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
13+
<field id="enabled" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
1414
<label>Enable</label>
1515
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
1616
</field>
1717
<field id="route" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
1818
<label>Route</label>
1919
<comment>This text will change your url.</comment>
2020
<depends>
21-
<field id = "enable">1</field>
21+
<field id ="enabled">1</field>
2222
</depends>
2323
</field>
24-
<field id="enable_tag_block" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
25-
<label>Enable tag block</label>
24+
<field id="enable_tag_on_product" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
25+
<label>Enable tags block</label>
2626
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
27+
<comment>show/hide product tags on product detail page.</comment>
2728
<depends>
28-
<field id = "enable">1</field>
29+
<field id ="enabled">1</field>
2930
</depends>
3031
</field>
31-
<field id="number_tag" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
32-
<label>Number tag display</label>
33-
<comment>The number of tags can be displayed on product detail page.</comment>
32+
<field id="product_tag_title" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
33+
<label>Product Tags Block Title</label>
3434
<depends>
35-
<field id = "enable">1</field>
35+
<field id ="enabled">1</field>
36+
<field id ="enable_tag_on_product">1</field>
37+
</depends>
38+
</field>
39+
<field id="number_tags" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
40+
<label>Limit tags to show</label>
41+
<depends>
42+
<field id ="enabled">1</field>
43+
<field id ="enable_tag_on_product">1</field>
44+
</depends>
45+
</field>
46+
47+
<field id="enable_tag_sidebar" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
48+
<label>Enable tag block on sidebar</label>
49+
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
50+
<comment>show/hide product tags on sidebar position.</comment>
51+
<depends>
52+
<field id ="enabled">1</field>
53+
</depends>
54+
</field>
55+
<field id="tag_sidebar_title" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
56+
<label>Sidebar Tags Block Title</label>
57+
<depends>
58+
<field id ="enabled">1</field>
59+
<field id ="enable_tag_sidebar">1</field>
60+
</depends>
61+
</field>
62+
<field id="number_tags_sidebar" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
63+
<label>Limit tags to show on sidebar</label>
64+
<depends>
65+
<field id ="enabled">1</field>
66+
<field id ="enable_tag_sidebar">1</field>
3667
</depends>
3768
</field>
3869
</group>
70+
<!-- <resource>Lof_ProductTags::lof_producttags</resource> -->
3971
</section>
4072
</system>
4173
</config>

etc/config.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
33
<default>
44
<lofproductags>
55
<general>
6-
<enabled/>
6+
<enabled>1</enabled>
7+
<route>tags</route>
8+
<enable_tag_on_product>1</enable_tag_on_product>
9+
<product_tag_title>Trending</product_tag_title>
10+
<number_tags>10</number_tags>
11+
<enable_tag_sidebar>1</enable_tag_sidebar>
12+
<tag_sidebar_title>Product Tags</tag_sidebar_title>
13+
<number_tags_sidebar>20</number_tags_sidebar>
714
</general>
815
</lofproductags>
916
</default>

etc/db_schema.xml

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)