Advertisement
hecrus

CatalogMenu HTMLBlock

Jul 14th, 2021
4,700
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 3.94 KB | None | 0 0
  1. CREATE PROCEDURE [dbo].[block_catalogMenu2_get]
  2.     @code nvarchar(128),
  3.     @itemID nvarchar(256),
  4.     @parameters ExtendedDictionaryParameter readonly,  -- langID, username...
  5.     @res nvarchar(MAX) output
  6. AS
  7. BEGIN
  8.     DECLARE @s  nvarchar(MAX) = '', @t nvarchar(MAX), @temp nvarchar(MAX)
  9.    
  10.     SET @t = '<ul class="list-unstyled position-relative">'    
  11.     SELECT @temp =   STUFF(
  12.                 (
  13.                     SELECT  '
  14.                  <li class="cat-menu-item border-bottom">
  15.                    <div class="cat-menu-item-label position-relative p-2 bg-white">
  16.                       <a href="#" class="text-dark" data-url="'+dbo.cat_getCatURL(cat1.id)+'"><i class="'+isnull('fa ' + icon, 'fas fa-mobile-alt')+'"></i> '+name+'</a>                     
  17.                    </div>
  18.  
  19.                    <div class="cat-menu-item-content shadow-sm bg-white">
  20.                      <div class="d-flex flex-wrap flex-md-nowrap">
  21.                         <ul class="list-unstyled cat-menu-groups p-2">  
  22.                  '+
  23.                         (
  24.                         STUFF(
  25.                          (
  26.                             SELECT  '
  27.                           <li class="cat-menu-group">
  28.                              <header class="font-weight-bold">
  29.                                <a href="'+dbo.cat_getCatURL(cat2.id)+'" class="text-dark text-decoration-none small">'+name+'
  30.                                     <span class="ml-1 text-muted ">('+
  31.                                         CAST((SELECT COUNT (*) FROM as_cat_products p
  32.                                         INNER JOIN as_cat_categoryProducts cp ON p.id = cp.productID
  33.                                         WHERE categoryID = cat2.id) AS nvarchar) +
  34.                                     ')</span>
  35.                                     <img class="d-block mb-2 cat-menu-img" data-src="' +
  36.                                         dbo.as_cat_getImageDomain(cat2.id)+
  37.                                         isnull(dbo.rs_resourceLink('catSmallImage', cat2.id,1), '/uploads/marketplace/catDefault.jpg')+
  38.                                     '" />
  39.                                 </a>
  40.                               </header>    
  41.                            </li>
  42.                           '
  43.                             FROM    as_cat_categories cat2 WHERE parentID =cat1.id
  44.                             FOR XML PATH(''), TYPE
  45.                            ).VALUE('.','varchar(max)')
  46.                            ,1,0, '' )
  47.                         )
  48.                         + '
  49.                         </ul>
  50.                         <div class="cat-menu-additionalContent d-flex flex-wrap align-content-start p-2">
  51.                          <a href="/payment" class="m-1 text-center  flex-grow-1">Оплата</a>
  52.                          <a href="/delivery" class="m-1 text-center  flex-grow-1">Доставка</a>
  53.                          <a href="/return" class="m-1 text-center  flex-grow-1">Возврат</a>
  54.                          <a href="/service" class="m-1 text-center  flex-grow-1">Сервис</a>                        
  55.                        </div>
  56.                      </div>
  57.                     </div>
  58.                  </li>                  
  59.                  '
  60.                  
  61.                  
  62.                     FROM    as_cat_categories cat1 WHERE parentID IS NULL
  63.                     FOR XML PATH(''), TYPE
  64.                ).VALUE('.','varchar(max)')
  65.                ,1,0, ''
  66.           )
  67.     SET @t  = @t + @temp  
  68.        
  69.     SET @t  = @t  + '</ul>
  70.              '
  71.  
  72.      
  73.      
  74.       SET @res = '
  75.   <div class="cat-menu-cont hide">
  76.     <div class="cat-menu-dropdown position-relative d-inline-block">
  77.    <a href="#" class="btn-sm mx-2 btn btn-light  d-inline-block cat-menu-dropdown-toggle"><i class="fas fa-bars"></i></a>
  78.    <div class="cat-menu shadow-sm mt-1">
  79.      <header class="p-2 bg-light font-weight-bold"><i class="fas fa-list"></i> Категории</header>'
  80.    
  81.       SET @res = @res +@t
  82.       SET @res = @res + '
  83.    </div>
  84.  </div>
  85. </div>
  86.  '
  87.  
  88.    
  89. END
  90.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement