Roman-Fov

Untitled

Nov 26th, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 10.84 KB | None | 0 0
  1. <div class="content-container">
  2.     <div class="row">
  3.         <div class="col-xs-12 col-sm-4 col-md-3 col-lg-3">
  4.  
  5.             <div class="row">
  6.                 <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
  7.  
  8.                     <?php
  9.  
  10.                     // Разделы магазина    
  11.  
  12.                     if (Core::moduleIsActive('shop'))
  13.                     {
  14.                    
  15.                    
  16. //                  $Shop_Controller_Show = new Shop_Controller_Show(
  17. //                      Core_Entity::factory('Shop', 3)
  18. //                  );
  19. //                  $Shop_Controller_Show
  20. //                      ->xsl(
  21. //                          Core_Entity::factory('Xsl')->getByName('МагазинГруппыТоваровНаГлавнойСайт2')
  22. //                      )
  23. //                      ->groupsMode('all')
  24. //                      ->limit(0);
  25. //
  26. //                  if (is_object(Core_Page::instance()->object)
  27. //                      && get_class(Core_Page::instance()->object) == 'Shop_Controller_Show')
  28. //                  {
  29. //                      $Shop_Controller_Show->addEntity(
  30. //                          Core::factory('Core_Xml_Entity')
  31. //                              ->name('current_group_id')
  32. //                              ->value(intval(Core_Page::instance()->object->group))
  33. //                      );
  34. //                  }
  35. //
  36. //                  $Shop_Controller_Show->show();
  37.  
  38.                     // Фильтр справа               
  39.                     if (Core::moduleIsActive('shop') && isset(Core_Page::instance()->libParams['shopId']))
  40.                     {
  41.                         $oShop = Core_Entity::factory('Shop', Core_Page::instance()->libParams['shopId']);
  42.                         $Shop_Controller_Show = new Shop_Controller_Show($oShop);
  43.                         $Shop_Controller_Show
  44.                             ->xsl(
  45.                                 Core_Entity::factory('Xsl')->getByName('МагазинФильтрСайт2')
  46.                             )
  47.                             ->groupsMode('tree')
  48.                             ->limit(0)
  49.                             ->itemsProperties(TRUE);
  50.  
  51.                         if (is_object(Core_Page::instance()->object)
  52.                             && get_class(Core_Page::instance()->object) == 'Shop_Controller_Show')
  53.                         {
  54.                             $Shop_Controller_Show->group(Core_Page::instance()->object->group);
  55.                             $iCurrentShopGroup = Core_Page::instance()->object->group;
  56.                         }
  57.                         else
  58.                         {
  59.                             $iCurrentShopGroup = 0;
  60.                         }
  61.  
  62.                         $price_from = intval(Core_Array::getGet('price_from'));
  63.                         $price_to = intval(Core_Array::getGet('price_to'));
  64.  
  65.                         if ($price_from)
  66.                         {
  67.                             $Shop_Controller_Show->addEntity(
  68.                                 Core::factory('Core_Xml_Entity')
  69.                                     ->name('price_from')->value($price_from)
  70.                             );
  71.                             $Shop_Controller_Show->addCacheSignature('price_from=' . $price_from);
  72.                         }
  73.  
  74.                         if ($price_to)
  75.                         {
  76.                             $Shop_Controller_Show->addEntity(
  77.                                 Core::factory('Core_Xml_Entity')
  78.                                     ->name('price_to')->value($price_to)
  79.                             );
  80.                             $Shop_Controller_Show->addCacheSignature('price_to=' . $price_to);
  81.                         }
  82.  
  83.                         //Sorting
  84.                         if (Core_Array::getGet('sorting'))
  85.                         {
  86.                             $sorting = intval(Core_Array::getGet('sorting'));
  87.                             $Shop_Controller_Show->addEntity(
  88.                                 Core::factory('Core_Xml_Entity')
  89.                                     ->name('sorting')->value($sorting)
  90.                             );
  91.                             $Shop_Controller_Show->addCacheSignature('sorting=' . $sorting);
  92.                         }
  93.  
  94.                         //Producers
  95.                         if (Core_Array::getGet('producer_id'))
  96.                         {
  97.                             $iProducerId = intval(Core_Array::getGet('producer_id'));
  98.                             $Shop_Controller_Show->addEntity(
  99.                                 Core::factory('Core_Xml_Entity')
  100.                                     ->name('producer_id')->value($iProducerId)
  101.                             );
  102.                             $Shop_Controller_Show->addCacheSignature('producer_id=' . $iProducerId);
  103.                         }
  104.  
  105.                         // Additional properties
  106.                         $oShop_Item_Property_List = Core_Entity::factory('Shop_Item_Property_List', $oShop->id);
  107.  
  108.                         $aProperties = $oShop_Item_Property_List->Properties->findAll();
  109.  
  110.                         $aTmpProperties = array();
  111.  
  112.                         foreach ($aProperties as $oProperty)
  113.                         {
  114.                             // Св-во может иметь несколько значений
  115.                             $aPropertiesValue = Core_Array::getGet('property_' . $oProperty->id);
  116.                             if ($aPropertiesValue)
  117.                             {
  118.                                 !is_array($aPropertiesValue) && $aPropertiesValue = array($aPropertiesValue);
  119.                                 foreach ($aPropertiesValue as $sPropertyValue)
  120.                                 {
  121.                                     $aTmpProperties[] = array($oProperty, strval($sPropertyValue));
  122.                                 }
  123.                             }
  124.                             elseif (!is_null(Core_Array::getGet('property_' . $oProperty->id . '_from')))
  125.                             {
  126.                                 $tmpFrom = Core_Array::getGet('property_' . $oProperty->id . '_from');
  127.                                 $tmpTo = Core_Array::getGet('property_' . $oProperty->id . '_to');
  128.  
  129.                                 !is_array($tmpFrom) && $tmpFrom = array($tmpFrom);
  130.                                 !is_array($tmpTo) && $tmpTo = array($tmpTo);
  131.  
  132.                                 // From ... to ...
  133.                                 foreach ($tmpFrom as $iKey => $sValue)
  134.                                 {
  135.                                     $to = Core_Array::get($tmpTo, $iKey);
  136.  
  137.                                     $aTmpProperties[] = array($oProperty, array(
  138.                                         'from' => $sValue != ''
  139.                                             ? ($oProperty->type == 11 ? floatval($sValue) : intval($sValue))
  140.                                             : '',
  141.                                         'to' => $to != ''
  142.                                             ? ($oProperty->type == 11 ? floatval($to) : intval($to))
  143.                                             : ''
  144.                                     ));
  145.                                 }
  146.                             }
  147.                         }
  148.  
  149.                         if (count($aTmpProperties))
  150.                         {
  151.                             reset($aTmpProperties);
  152.                             while(list(, list($oProperty, $propertyValue)) = each($aTmpProperties))
  153.                             {
  154.                                 $tableName = $oProperty->createNewValue(0)->getTableName();
  155.  
  156.                                 $Shop_Controller_Show->shopItems()->queryBuilder()
  157.                                     ->where('shop_item_properties.property_id', '=', $oProperty->id);
  158.  
  159.                                 if (!is_array($propertyValue))
  160.                                 {
  161.                                     $Shop_Controller_Show->addEntity(
  162.                                         Core::factory('Core_Xml_Entity')
  163.                                             ->name('property_' . $oProperty->id)->value($propertyValue)
  164.                                     );
  165.                                     $Shop_Controller_Show->addCacheSignature("property{$oProperty->id}={$propertyValue}");
  166.                                 }
  167.                                 else
  168.                                 {
  169.                                     $from = trim(Core_Array::get($propertyValue, 'from'));
  170.                                     $to = trim(Core_Array::get($propertyValue, 'to'));
  171.  
  172.                                     $Shop_Controller_Show->addEntity(
  173.                                         Core::factory('Core_Xml_Entity')
  174.                                             ->name('property_' . $oProperty->id . '_from')->value($from)
  175.                                     )->addEntity(
  176.                                         Core::factory('Core_Xml_Entity')
  177.                                             ->name('property_' . $oProperty->id . '_to')->value($to)
  178.                                     );
  179.  
  180.                                     $Shop_Controller_Show
  181.                                         ->addCacheSignature("property{$oProperty->id}_from={$from}")
  182.                                         ->addCacheSignature("property{$oProperty->id}_to={$to}");
  183.                                 }
  184.                             }
  185.                         }
  186.  
  187.                         /* Количество */
  188.                         $on_page = intval(Core_Array::getGet('on_page'));
  189.                         if ($on_page > 0 && $on_page < 150)
  190.                         {
  191.                             $Shop_Controller_Show->addEntity(
  192.                                 Core::factory('Core_Xml_Entity')
  193.                                     ->name('on_page')->value($on_page)
  194.                             );
  195.                         }
  196.  
  197.                         $Shop_Controller_Show
  198.                             ->group($iCurrentShopGroup)
  199.                             ->addMinMaxPrice()
  200.                             ->show();
  201.                     }
  202.                     ?>
  203.                 </div>
  204.  
  205.                 <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
  206.                     <?php
  207.                     //Производители
  208.                     $oShop_Producer_Controller_Show = new Shop_Producer_Controller_Show(
  209.                         Core_Entity::factory('Shop', 3)
  210.                     );
  211.  
  212.                     $oShop_Producer_Controller_Show
  213.                         ->xsl(
  214.                             Core_Entity::factory('Xsl')->getByName('МенюПроизводителиСайт2')
  215.                         )
  216.                         ->limit(5)
  217.                         ->show();
  218.                     ?>
  219.                 </div>
  220.  
  221.                 <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
  222.                     <?php
  223.                     // Последний заказ
  224.                     $oShop = Core_Entity::factory('Shop', 3);
  225.  
  226.                     $Shop_Controller_Show = new Shop_Controller_Show(
  227.                         $oShop
  228.                     );
  229.  
  230.                     $Shop_Controller_Show
  231.                         ->xsl(
  232.                             Core_Entity::factory('Xsl')->getByName('МагазинПоследнийЗаказСайт2')
  233.                         )
  234.                         ->groupsMode('none')
  235.                         ->limit(0);
  236.  
  237.                     $oShop_Orders = $oShop->Shop_Orders;
  238.                     $oShop_Orders
  239.                         ->queryBuilder()
  240.                         ->where('shop_orders.paid', '=', 1)
  241.                         ->clearOrderBy()
  242.                         ->orderBy('shop_orders.id', 'DESC')
  243.                         ->limit(1);
  244.  
  245.                     $aShop_Orders = $oShop_Orders->findAll();
  246.  
  247.                     if (count($aShop_Orders))
  248.                     {
  249.                         foreach ($aShop_Orders as $oShop_Order)
  250.                         {
  251.                             $aShop_Order_Items = $oShop_Order->Shop_Order_Items->findAll();
  252.  
  253.                             foreach ($aShop_Order_Items as $oShop_Order_Item)
  254.                             {
  255.                                 if ($oShop_Order_Item->shop_item_id)
  256.                                 {
  257.                                     $oShop_Item = Core_Entity::factory('Shop_Item')->find($oShop_Order_Item->shop_item_id);
  258.  
  259.                                     !is_null($oShop_Item->id) && $Shop_Controller_Show->addEntity(
  260.                                         $oShop_Item
  261.                                             ->addForbiddenTag('text')
  262.                                             ->addForbiddenTag('description')
  263.                                             ->addForbiddenTag('shop_producer')
  264.                                             ->showXmlComments(FALSE)
  265.                                             ->showXmlAssociatedItems(FALSE)
  266.                                             ->showXmlModifications(FALSE)
  267.                                             ->showXmlSpecialprices(FALSE)
  268.                                             ->showXmlTags(FALSE)
  269.                                             ->showXmlWarehousesItems(FALSE)
  270.                                             ->showXmlSiteuser(FALSE)
  271.                                             ->showXmlProperties(FALSE)
  272.                                     );
  273.                                 }
  274.                             }
  275.  
  276.                             $Shop_Controller_Show->addEntity(
  277.                                 $oShop_Order
  278.                             );
  279.                         }
  280.  
  281.                         $Shop_Controller_Show
  282.                             ->itemsForbiddenTags(array('text'))
  283.                             ->show();
  284.                     }
  285.                     ?>
  286.                 </div>
  287.             </div><!-- /row -->
  288.             <?php
  289.             }
  290.  
  291.             // Метки
  292.             if (Core::moduleIsActive('shop') && Core::moduleIsActive('tag'))
  293.             {
  294.                 $Shop_Controller_Tag_Show = new Shop_Controller_Tag_Show(
  295.                     Core_Entity::factory('Shop', 3)
  296.                 );
  297.                 $Shop_Controller_Tag_Show
  298.                     ->xsl(
  299.                         Core_Entity::factory('Xsl')->getByName('ОблакоТэговМагазинСайт2')
  300.                     );
  301.  
  302.                 if (is_object(Core_Page::instance()->object)
  303.                     && get_class(Core_Page::instance()->object) == 'Shop_Controller_Show'
  304.                     && Core_Page::instance()->object->group)
  305.                 {
  306.                     $Shop_Controller_Tag_Show->group(Core_Page::instance()->object->group);
  307.                 }
  308.  
  309.                 if (is_object(Core_Page::instance()->object)
  310.                     && get_class(Core_Page::instance()->object) == 'Shop_Controller_Show')
  311.                 {
  312.                     $Shop_Controller_Tag_Show->show();
  313.                 }
  314.             }
  315.             ?>
  316.  
  317.             <div class="row">
  318.                 <div class="hidden-xs col-sm-12 col-md-12 col-lg-12 banner-list">
  319.                     <?php
  320.                     if (Core::moduleIsActive('advertisement'))
  321.                     {
  322.                         $Advertisement_Group_Controller_Show = new Advertisement_Group_Controller_Show(
  323.                             Core_Entity::factory('Advertisement_Group', 1)
  324.                         );
  325.  
  326.                         $Advertisement_Group_Controller_Show
  327.                             ->xsl(
  328.                                 Core_Entity::factory('Xsl')->getByName('ОтображениеБаннераСайт2')
  329.                             )
  330.                             ->show();
  331.                     }
  332.                     ?>
  333.                 </div>
  334.             </div>
  335.  
  336.             <div class="row">
  337.                 <div class="hidden-xs col-sm-12 col-md-12 col-lg-12">
  338.                     <?php
  339.                     // Опросы
  340.                     if (Core::moduleIsActive('poll'))
  341.                     {
  342.                         $Poll_Group_Controller_Show = new Poll_Group_Controller_Show(
  343.                             Core_Entity::factory('Poll_Group', 1)
  344.                         );
  345.  
  346.                         $Poll_Group_Controller_Show
  347.                             ->xsl(
  348.                                 Core_Entity::factory('Xsl')->getByName('ОтображениеОпросаБезРезультатовСайт2')
  349.                             )
  350.                             ->limit(1)
  351.                             ->rand()
  352.                             ->show();
  353.                     }
  354.                     ?>
  355.                 </div>
  356.             </div>
  357.         </div>
  358.         <?php
  359.         Core_Page::instance()->execute();
  360.         ?>
  361.     </div>
  362. </div>
Advertisement
Add Comment
Please, Sign In to add comment