File tree Expand file tree Collapse file tree 4 files changed +19
-4
lines changed
view/frontend/templates/tag/product Expand file tree Collapse file tree 4 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -36,11 +36,17 @@ class Data extends AbstractHelper
3636 */
3737
3838 protected $ scopeConfig ;
39+ public $ _storeManager ;
3940 const XML_PATH_TAG = 'lofproductags/ ' ;
40- public function __construct (Context $ context ,ScopeConfigInterface $ scopeConfig )
41+ public function __construct (
42+ Context $ context ,
43+ ScopeConfigInterface $ scopeConfig ,
44+ \Magento \Store \Model \StoreManagerInterface $ storeManager
45+ )
4146 {
4247 parent ::__construct ($ context );
4348 $ this ->scopeConfig =$ scopeConfig ;
49+ $ this ->_storeManager =$ storeManager ;
4450 }
4551
4652 /**
@@ -55,5 +61,12 @@ public function getConfigValue($field, $storeId = null)
5561 public function getGeneralConfig ($ code , $ storeId = null )
5662 {
5763 return $ this ->getConfigValue (self ::XML_PATH_TAG .'general/ ' . $ code , $ storeId );
58- }
64+ }
65+ public function getTagUrl ($ tag_identifier ="" ){
66+ $ route = $ this ->getGeneralConfig ("route " );
67+ $ route = $ route ?$ route :"lofproducttags " ;
68+ $ url = $ route ."/ " .$ tag_identifier ;
69+ $ base_url = $ this ->_storeManager ->getStore ()->getBaseUrl ();
70+ return $ base_url .$ url ;
71+ }
5972}
Original file line number Diff line number Diff line change @@ -62,4 +62,5 @@ public function getProductsPosition()
6262 public function getRelatedReadonly (){
6363 return false ;
6464 }
65+
6566}
Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ if($tags && $tags->getSize()){
1313 <div class="block-content">
1414 <ul style="padding: 0px;" class="list-tags">
1515 <?php foreach ($ tags as $ tag ): ?>
16- <li style="list-style-type: none; float: left; margin:5px 10px; border: 1px solid #000000; border-radius: 5px; padding: 5px;"><a href="<?php echo $ tag ->getIdentifier (); ?> ">
16+ <li style="list-style-type: none; float: left; margin:5px 10px; border: 1px solid #000000; border-radius: 5px; padding: 5px;"><a href="<?php
17+ echo $ this ->getTagHelper ()->getTagUrl ($ tag ->getIdentifier ()); ?> ">
1718 <style>
1819 li:hover{
1920 background-color: #e4e4e4;
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ if($tags && $tags->getSize()){
1313 <div class="block-content">
1414 <ul style="padding: 0px;" class="list-tags">
1515 <?php foreach ($ tags as $ tag ): ?>
16- <li style="list-style-type: none; float: left; margin:5px 10px; border: 1px solid #000000; border-radius: 5px; padding: 5px;"><a href="<?php echo $ tag ->getIdentifier (); ?> ">
16+ <li style="list-style-type: none; float: left; margin:5px 10px; border: 1px solid #000000; border-radius: 5px; padding: 5px;"><a href="<?php echo $ this -> getTagHelper ()-> getTagUrl ( $ tag ->getIdentifier () ); ?> ">
1717 <style>
1818 li:hover{
1919 background-color: #e4e4e4;
You can’t perform that action at this time.
0 commit comments