Skip to content

Commit 2e89062

Browse files
authored
Merge pull request #27 from landofcoder/develop
Develop
2 parents 7ed5f03 + 6601ff0 commit 2e89062

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+584
-90
lines changed

Api/Data/TagInterface.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
namespace Lof\ProductTags\Api\Data;
33

4-
interface TagInterface
4+
interface TagInterface extends \Magento\Framework\Api\ExtensibleDataInterface
55
{
66

77
const TAG_ID = 'tag_id';
@@ -105,5 +105,6 @@ public function getProducts();
105105
*/
106106
public function setProducts($products);
107107

108+
108109

109110
}

Api/ProductLinkManagementInterface.php

100644100755
File mode changed.

Block/Adminhtml/Tags/AssignProducts.php

100644100755
File mode changed.

Block/Adminhtml/Tags/Edit/BackButton.php

100644100755
File mode changed.

Block/Adminhtml/Tags/Edit/GenericButton.php

100644100755
File mode changed.

Block/Adminhtml/Tags/Edit/SaveButton.php

100644100755
File mode changed.

Block/Adminhtml/Tags/Grid/Renderer/Action/UrlBuilder.php

100644100755
File mode changed.

Block/Adminhtml/Tags/Tab/Product.php

100644100755
File mode changed.

Block/Tag/Product/Sidebar.php

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?php
2+
/**
3+
* Copyright (c) 2019 Landofcoder
4+
*
5+
* Permission is hereby granted, free of charge, to any person obtaining a copy
6+
* of this software and associated documentation files (the "Software"), to deal
7+
* in the Software without restriction, including without limitation the rights
8+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
* copies of the Software, and to permit persons to whom the Software is
10+
* furnished to do so, subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be included in all
13+
* copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
* SOFTWARE.
22+
*/
23+
24+
namespace Lof\ProductTags\Block\Tag\Product;
25+
26+
class Sidebar extends \Magento\Framework\View\Element\Template
27+
{
28+
protected $resultPageFactory;
29+
30+
protected $_tagFactory;
31+
32+
protected $_tagcollection;
33+
34+
protected $_tagHelper;
35+
36+
public function __construct(
37+
\Magento\Framework\View\Element\Template\Context $context,
38+
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
39+
\Lof\ProductTags\Model\TagFactory $tagFactory,
40+
\Lof\ProductTags\Helper\Data $tagdata,
41+
array $data = []
42+
) {
43+
$this->resultPageFactory = $resultPageFactory;
44+
$this->_tagFactory = $tagFactory;
45+
$this->_tagHelper = $tagdata;
46+
parent::__construct($context, $data);
47+
}
48+
public function _toHtml(){
49+
if(!$this->_tagHelper->getGeneralConfig('enabled')) return;
50+
if(!$this->_tagHelper->getGeneralConfig('enable_tag_sidebar')) return;
51+
return parent::_toHtml();
52+
}
53+
function getTagHelper(){
54+
return $this->_tagHelper;
55+
}
56+
public function getTagCollection()
57+
{
58+
if(!$this->_tagcollection){
59+
$limit = $this->_tagHelper->getGeneralConfig('number_tags_sidebar');
60+
$limit = $limit?(int)$limit:10;
61+
$tag = $this->_tagFactory->create();
62+
$collection = $tag->getCollection();
63+
$collection->addFieldToFilter("status", 1);
64+
$collection->setOrder("tag_id","DESC");
65+
$collection->setPageSize($limit);
66+
//$collection->setLimit($limit);
67+
$this->_tagcollection = $collection;
68+
}
69+
return $this->_tagcollection;
70+
}
71+
}

Block/Tag/Product/TagProduct.php

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?php
2+
/**
3+
* Copyright (c) 2019 Landofcoder
4+
*
5+
* Permission is hereby granted, free of charge, to any person obtaining a copy
6+
* of this software and associated documentation files (the "Software"), to deal
7+
* in the Software without restriction, including without limitation the rights
8+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
* copies of the Software, and to permit persons to whom the Software is
10+
* furnished to do so, subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be included in all
13+
* copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
* SOFTWARE.
22+
*/
23+
24+
namespace Lof\ProductTags\Block\Tag\Product;
25+
26+
class TagProduct extends \Magento\Framework\View\Element\Template
27+
{
28+
protected $resultPageFactory;
29+
30+
protected $_tagFactory;
31+
32+
protected $_tagcollection;
33+
34+
protected $_tagHelper;
35+
36+
public function __construct(
37+
\Magento\Framework\View\Element\Template\Context $context,
38+
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
39+
\Lof\ProductTags\Model\TagFactory $tagFactory,
40+
\Lof\ProductTags\Helper\Data $tagdata,
41+
array $data = []
42+
) {
43+
$this->resultPageFactory = $resultPageFactory;
44+
$this->_tagFactory = $tagFactory;
45+
$this->_tagHelper = $tagdata;
46+
parent::__construct($context, $data);
47+
}
48+
public function _toHtml(){
49+
if(!$this->_tagHelper->getGeneralConfig('enabled')) return;
50+
if(!$this->_tagHelper->getGeneralConfig('enable_tag_on_product')) return;
51+
return parent::_toHtml();
52+
}
53+
function getTagHelper(){
54+
return $this->_tagHelper;
55+
}
56+
public function getTagCollection()
57+
{
58+
if(!$this->_tagcollection){
59+
$limit = $this->_tagHelper->getGeneralConfig('number_tags');
60+
$limit = $limit?(int)$limit:10;
61+
$tag = $this->_tagFactory->create();
62+
$collection = $tag->getCollection();
63+
$collection->addFieldToFilter("status", 1);
64+
$collection->setOrder("tag_id","DESC");
65+
$collection->setPageSize($limit);
66+
//$collection->setLimit($limit);
67+
$this->_tagcollection = $collection;
68+
}
69+
return $this->_tagcollection;
70+
}
71+
}

0 commit comments

Comments
 (0)