не получается вывести товар по доп. свой-ву.

#
не получается вывести товар по доп. свой-ву.
Читал, как написано в документации.
Нужно вывести товар по доп св-ву типу "Галочка".
ID св-ва 61
На главную добавил вот этот код
<?php



               $Shop_Controller_Show = new Shop_Controller_Show(
    Core_Entity::factory('Shop', 1)
);
$Shop_Controller_Show
    ->xsl(
       Core_Entity::factory('Xsl')->getByName('БлюдоДня')
    )
    ->groupsMode('none')
    ->itemsForbiddenTags(array('text'))
    ->group(FALSE)
    ->limit(3)
    ->itemsProperties  (TRUE)
    //->show()
    ;
// Объединение с нужной таблицей свойств
$Shop_Controller_Show
    ->ShopItems()
    ->queryBuilder()
    ->leftJoin('Shop_item_properties', 'Shop_items.Shop_id', '=', 'Shop_item_properties.Shop_id')
    ->leftJoin('property_value_ints', 'Shop_items.id', '=', 'property_value_ints.entity_id',
  array(
          array('AND' => array('Shop_item_properties.property_id', '=', Core_QueryBuilder::expression('`property_value_ints`.`property_id`')))
  )
    )
    // Идентификатор дополнительного свойства
    ->where('Shop_item_properties.property_id', '=', 61)
    // Значение дополнительного свойства
    ->where('property_value_ints.value', '=', '1')
    ->groupBy('Shop_items.id')
    // Количество свойств, если 1, то можно не указывать
    ->having(Core_Querybuilder::expression('COUNT(DISTINCT `Shop_item_properties`.`property_id`)'), '=', 1);
    $Shop_Controller_Show->show();






            ?>

XSL файл

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:hostcms="http://www.hostcms.ru/"
   exclude-result-prefixes="hostcms">
   <xsl:output xmlns="http://www.w3.org/TR/xhtml1/strict" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" encoding="utf-8" indent="yes" method="html" omit-xml-declaration="no" version="1.0" media-type="text/xml"/>

   <xsl:template match="/">

      <xsl:apply-templates select="shop_item"/>
   </xsl:template>

   <xsl:decimal-format name="my" decimal-separator="," grouping-separator=" "/>
   <!-- Шаблон для групп товара -->
   <xsl:template match="shop_item">
      <aside class="sidebar nopadding">
         <div class="title_block">Блюдо дня</div>
         <div class="body_block">
            <img src="{dir}{image_small}" class="img-responsive"/>
            <p class="dish_of_day_title"><a href="{url}"><xsl:value-of select="name"/></a></p>
            <div class="items_description">
                  <div id="desc_dotd{@id}" class="collapse">
                  <xsl:value-of select="description" disable-output-escaping="yes"/>
                  </div>                  
                  </div>
            <div class="shop_item_price text-center">
                     <div class="col-md-8 nopadding"><p class="price"><xsl:value-of select="format-number(price, '### ##0', 'my')"/> <xsl:value-of select="currency"/><span>(<xsl:value-of select="format-number(weight, '### ##0', 'my')"/> <xsl:value-of select="/shop/shop_measure/name"/>)</span></p> </div>
                     <div class="col-md-4 nopadding"><button data-toggle="collapse" data-target="#desc_dotd{@id}" class="desc_item">Состав</button></div>
                  </div>
                  <xsl:if test="type = 0 or (type = 1 and (digitals > 0 or digitals = -1)) or type = 2">
                     <a href="{/shop/url}cart/?add={@id}" onclick="return $.addIntoCart('{/shop/url}cart/', {@id}, 1)"><button class="shop_buy">В корзину</button></a>
                  </xsl:if>
         </div>
      </aside>

   </xsl:template>
</xsl:stylesheet>


Но ничего все ровно не выводит. Где ошибка?
theme.su - готовые сайты для HostCMS
Модератор
#
Re: не получается вывести товар по доп. свой-ву.
1. В запросах Shop_ пишем с маленькой буквы, например shop_
2. Включите XML и посмотрите, есть ли выбранные товары.
#
Re: не получается вывести товар по доп. свой-ву.
HostCMS писал(а):

Посмотрите XML, товар, который нужен в viewed
<shop id="1">
   <shop_dir_id>0</shop_dir_id>
   <shop_company_id>1</shop_company_id>
   <site_id>1</site_id>
   <name>Наше меню</name>
   <description></description>
   <yandex_market_name></yandex_market_name>
   <image_small_max_width>240</image_small_max_width>
   <image_small_max_height>215</image_small_max_height>
   <image_large_max_width>9999999</image_large_max_width>
   <image_large_max_height>9999999</image_large_max_height>
   <structure_id>42</structure_id>
   <shop_country_id>175</shop_country_id>
   <shop_currency_id>1</shop_currency_id>
   <shop_order_status_id>0</shop_order_status_id>
   <shop_measure_id>29</shop_measure_id>
   <email>admin@localhost.ru</email>
   <items_on_page>6</items_on_page>
   <url_type>1</url_type>
   <reserve>0</reserve>
   <send_order_email_admin>1</send_order_email_admin>
   <send_order_email_user>1</send_order_email_user>
   <items_sorting_field>2</items_sorting_field>
   <items_sorting_direction>0</items_sorting_direction>
   <groups_sorting_field>1</groups_sorting_field>
   <groups_sorting_direction>0</groups_sorting_direction>
   <user_id>19</user_id>
   <comment_active>1</comment_active>
   <watermark_file></watermark_file>
   <watermark_default_use_large_image>1</watermark_default_use_large_image>
   <watermark_default_use_small_image>1</watermark_default_use_small_image>
   <watermark_default_position_x>50%</watermark_default_position_x>
   <watermark_default_position_y>100%</watermark_default_position_y>
   <guid></guid>
   <format_date>%d.%m.%Y</format_date>
   <format_datetime>%d.%m.%Y %H:%M:%S</format_datetime>
   <typograph_default_items>0</typograph_default_items>
   <typograph_default_groups>0</typograph_default_groups>
   <apply_tags_automatically>1</apply_tags_automatically>
   <write_off_paid_items>1</write_off_paid_items>
   <apply_keywords_automatically>0</apply_keywords_automatically>
   <change_filename>1</change_filename>
   <attach_digital_items>1</attach_digital_items>
   <yandex_market_sales_notes_default></yandex_market_sales_notes_default>
   <siteuser_group_id>0</siteuser_group_id>
   <use_captcha>1</use_captcha>
   <group_image_small_max_width>264</group_image_small_max_width>
   <group_image_large_max_width>800</group_image_large_max_width>
   <group_image_small_max_height>161</group_image_small_max_height>
   <group_image_large_max_height>800</group_image_large_max_height>
   <producer_image_small_max_width>240</producer_image_small_max_width>
   <producer_image_large_max_width>9999999</producer_image_large_max_width>
   <producer_image_small_max_height>215</producer_image_small_max_height>
   <producer_image_large_max_height>9999999</producer_image_large_max_height>
   <preserve_aspect_ratio>1</preserve_aspect_ratio>
   <preserve_aspect_ratio_small>1</preserve_aspect_ratio_small>
   <preserve_aspect_ratio_group>1</preserve_aspect_ratio_group>
   <preserve_aspect_ratio_group_small>1</preserve_aspect_ratio_group_small>
   <reserve_hours>24</reserve_hours>
   <adult>0</adult>
   <order_admin_subject>Заказ N %1$s от %3$s в &quot;%2$s&quot;</order_admin_subject>
   <order_user_subject>Заказ N %1$s от %3$s в &quot;%2$s&quot;</order_user_subject>
   <confirm_admin_subject>Подтверждение оплаты, заказ N %1$s от %3$s в магазине &quot;%2$s&quot;</confirm_admin_subject>
   <confirm_user_subject>Подтверждение оплаты, заказ N %1$s от %3$s</confirm_user_subject>
   <cancel_admin_subject>Отмена заказа N %1$s от %3$s в магазине &quot;%2$s&quot;</cancel_admin_subject>
   <cancel_user_subject>Отмена заказа N %1$s от %3$s</cancel_user_subject>
   <deleted>0</deleted>
   <http>//pmhc</http>
   <url>/shop/</url>
   <captcha_id>75436</captcha_id>
   <items_count>0</items_count>
   <items_total_count>4</items_total_count>
   <subgroups_count>8</subgroups_count>
   <subgroups_total_count>8</subgroups_total_count>
   <siteuser_id>0</siteuser_id>
   <group>0</group>
   <page>0</page>
   <limit>3</limit>
   <viewed>
      <shop_item id="169">
         <shortcut_id>0</shortcut_id>
         <shop_tax_id>0</shop_tax_id>
         <shop_seller_id>0</shop_seller_id>
         <shop_group_id>601</shop_group_id>
         <shop_currency_id>1</shop_currency_id>
         <shop_id>1</shop_id>
         <shop_producer_id>0</shop_producer_id>
         <shop_measure_id>29</shop_measure_id>
         <type>0</type>
         <name>Молодежная [Копия от 12.04.2017 10:29:44]</name>
         <marking></marking>
         <vendorcode></vendorcode>
         <description>&lt;p&gt;Состав:&lt;/p&gt;
         &lt;p&gt;Красный соус, сыр моцарелла, мясные сардельки, болгарский перец, маринованные огурцы, крымский лук, перец халапеньо.&lt;/p&gt;</description>
         <image_large>shop_items_catalog_image166.jpg</image_large>
         <image_small>small_shop_items_catalog_image166.jpg</image_small>
         <weight>400.00</weight>
         <active>1</active>
         <siteuser_group_id>-1</siteuser_group_id>
         <sorting>0</sorting>
         <path>molodezhnaya-kopiya-ot-12042017-102944</path>
         <seo_title></seo_title>
         <seo_description></seo_description>
         <seo_keywords></seo_keywords>
         <indexing>1</indexing>
         <image_small_height>215</image_small_height>
         <image_small_width>240</image_small_width>
         <image_large_height>535</image_large_height>
         <image_large_width>800</image_large_width>
         <yandex_market>1</yandex_market>
         <yandex_market_bid>0</yandex_market_bid>
         <yandex_market_cid>0</yandex_market_cid>
         <manufacturer_warranty>0</manufacturer_warranty>
         <country_of_origin></country_of_origin>
         <yandex_market_sales_notes></yandex_market_sales_notes>
         <user_id>19</user_id>
         <siteuser_id>0</siteuser_id>
         <modification_id>0</modification_id>
         <guid>F38D0867-73A1-2277-F2F6-2D614B5452A2</guid>
         <showed>1</showed>
         <length>0.00</length>
         <width>0.00</width>
         <height>0.00</height>
         <apply_purchase_discount>1</apply_purchase_discount>
         <delivery>1</delivery>
         <pickup>1</pickup>
         <store>0</store>
         <adult>0</adult>
         <deleted>0</deleted>
         <url>/shop/piczcza/molodezhnaya-kopiya-ot-12042017-102944/</url>
         <date>10.04.2017</date>
         <datetime>10.04.2017 19:45:59</datetime>
         <start_datetime>0000-00-00 00:00:00</start_datetime>
         <end_datetime>0000-00-00 00:00:00</end_datetime>
         <dir>/upload/shop_1/1/6/9/item_169/</dir>
         <rest>0.00</rest>
         <reserved>0</reserved>
         <price>260.00</price>
         <discount>0.00</discount>
         <tax>0.00</tax>
         <price_tax>260.00</price_tax>
         <currency>руб.</currency>
         <shop_measure id="29">
            <name>г</name>
            <description>грамм</description>
            <okei>0</okei>
            <user_id>19</user_id>
         </shop_measure>
         <property_value id="173">
            <property_id>61</property_id>
            <entity_id>169</entity_id>
            <value>0</value>
            <property_dir_id>0</property_dir_id>
            <tag_name>dish_of_day</tag_name>
         </property_value>
      </shop_item>
      <shop_item id="166">
         <shortcut_id>0</shortcut_id>
         <shop_tax_id>0</shop_tax_id>
         <shop_seller_id>0</shop_seller_id>
         <shop_group_id>601</shop_group_id>
         <shop_currency_id>1</shop_currency_id>
         <shop_id>1</shop_id>
         <shop_producer_id>0</shop_producer_id>
         <shop_measure_id>29</shop_measure_id>
         <type>0</type>
         <name>Молодежная</name>
         <marking></marking>
         <vendorcode></vendorcode>
         <description>&lt;p&gt;Состав:&lt;/p&gt;
         &lt;p&gt;Красный соус, сыр моцарелла, мясные сардельки, болгарский перец, маринованные огурцы, крымский лук, перец халапеньо.&lt;/p&gt;</description>
         <image_large>shop_items_catalog_image166.jpg</image_large>
         <image_small>small_shop_items_catalog_image166.jpg</image_small>
         <weight>400.00</weight>
         <active>1</active>
         <siteuser_group_id>-1</siteuser_group_id>
         <sorting>0</sorting>
         <path>molodezhnaya</path>
         <seo_title></seo_title>
         <seo_description></seo_description>
         <seo_keywords></seo_keywords>
         <indexing>1</indexing>
         <image_small_height>215</image_small_height>
         <image_small_width>240</image_small_width>
         <image_large_height>535</image_large_height>
         <image_large_width>800</image_large_width>
         <yandex_market>1</yandex_market>
         <yandex_market_bid>0</yandex_market_bid>
         <yandex_market_cid>0</yandex_market_cid>
         <manufacturer_warranty>0</manufacturer_warranty>
         <country_of_origin></country_of_origin>
         <yandex_market_sales_notes></yandex_market_sales_notes>
         <user_id>19</user_id>
         <siteuser_id>0</siteuser_id>
         <modification_id>0</modification_id>
         <guid>813F5C4C-DB34-5E20-DECF-927794A152C2</guid>
         <showed>81</showed>
         <length>0.00</length>
         <width>0.00</width>
         <height>0.00</height>
         <apply_purchase_discount>1</apply_purchase_discount>
         <delivery>1</delivery>
         <pickup>1</pickup>
         <store>0</store>
         <adult>0</adult>
         <deleted>0</deleted>
         <url>/shop/piczcza/molodezhnaya/</url>
         <date>10.04.2017</date>
         <datetime>10.04.2017 19:45:59</datetime>
         <start_datetime>0000-00-00 00:00:00</start_datetime>
         <end_datetime>0000-00-00 00:00:00</end_datetime>
         <dir>/upload/shop_1/1/6/6/item_166/</dir>
         <rest>0.00</rest>
         <reserved>0</reserved>
         <price>260.00</price>
         <discount>0.00</discount>
         <tax>0.00</tax>
         <price_tax>260.00</price_tax>
         <currency>руб.</currency>
         <shop_measure id="29">
            <name>г</name>
            <description>грамм</description>
            <okei>0</okei>
            <user_id>19</user_id>
         </shop_measure>
         <property_value id="170">
            <property_id>61</property_id>
            <entity_id>166</entity_id>
            <value>1</value>
            <property_dir_id>0</property_dir_id>
            <tag_name>dish_of_day</tag_name>
         </property_value>
      </shop_item>
   </viewed>
   <total>1</total>
   <shop_item_properties>
      <property id="61">
         <property_dir_id>0</property_dir_id>
         <list_id>0</list_id>
         <informationsystem_id>0</informationsystem_id>
         <shop_id>0</shop_id>
         <name>Блюдо дня</name>
         <description></description>
         <type>7</type>
         <default_value>0</default_value>
         <tag_name>dish_of_day</tag_name>
         <sorting>0</sorting>
         <image_large_max_width>800</image_large_max_width>
         <image_large_max_height>800</image_large_max_height>
         <image_small_max_width>100</image_small_max_width>
         <image_small_max_height>100</image_small_max_height>
         <hide_small_image>0</hide_small_image>
         <guid>3411BD24-C384-1C64-C4FA-EAF224C18F09</guid>
         <multiple>1</multiple>
         <user_id>19</user_id>
         <prefix></prefix>
         <filter>0</filter>
         <show_in_group>1</show_in_group>
         <show_in_item>1</show_in_item>
      </property>
   </shop_item_properties>
   <shop_item id="166">
      <shortcut_id>0</shortcut_id>
      <shop_tax_id>0</shop_tax_id>
      <shop_seller_id>0</shop_seller_id>
      <shop_group_id>601</shop_group_id>
      <shop_currency_id>1</shop_currency_id>
      <shop_id>1</shop_id>
      <shop_producer_id>0</shop_producer_id>
      <shop_measure_id>29</shop_measure_id>
      <type>0</type>
      <name>Молодежная</name>
      <marking></marking>
      <vendorcode></vendorcode>
      <description>&lt;p&gt;Состав:&lt;/p&gt;
      &lt;p&gt;Красный соус, сыр моцарелла, мясные сардельки, болгарский перец, маринованные огурцы, крымский лук, перец халапеньо.&lt;/p&gt;</description>
      <image_large>shop_items_catalog_image166.jpg</image_large>
      <image_small>small_shop_items_catalog_image166.jpg</image_small>
      <weight>400.00</weight>
      <active>1</active>
      <siteuser_group_id>-1</siteuser_group_id>
      <sorting>0</sorting>
      <path>molodezhnaya</path>
      <seo_title></seo_title>
      <seo_description></seo_description>
      <seo_keywords></seo_keywords>
      <indexing>1</indexing>
      <image_small_height>215</image_small_height>
      <image_small_width>240</image_small_width>
      <image_large_height>535</image_large_height>
      <image_large_width>800</image_large_width>
      <yandex_market>1</yandex_market>
      <yandex_market_bid>0</yandex_market_bid>
      <yandex_market_cid>0</yandex_market_cid>
      <manufacturer_warranty>0</manufacturer_warranty>
      <country_of_origin></country_of_origin>
      <yandex_market_sales_notes></yandex_market_sales_notes>
      <user_id>19</user_id>
      <siteuser_id>0</siteuser_id>
      <modification_id>0</modification_id>
      <guid>813F5C4C-DB34-5E20-DECF-927794A152C2</guid>
      <showed>81</showed>
      <length>0.00</length>
      <width>0.00</width>
      <height>0.00</height>
      <apply_purchase_discount>1</apply_purchase_discount>
      <delivery>1</delivery>
      <pickup>1</pickup>
      <store>0</store>
      <adult>0</adult>
      <deleted>0</deleted>
      <url>/shop/piczcza/molodezhnaya/</url>
      <date>10.04.2017</date>
      <datetime>10.04.2017 19:45:59</datetime>
      <start_datetime>0000-00-00 00:00:00</start_datetime>
      <end_datetime>0000-00-00 00:00:00</end_datetime>
      <dir>/upload/shop_1/1/6/6/item_166/</dir>
      <rest>0.00</rest>
      <reserved>0</reserved>
      <price>260.00</price>
      <discount>0.00</discount>
      <tax>0.00</tax>
      <price_tax>260.00</price_tax>
      <currency>руб.</currency>
      <shop_measure id="29">
         <name>г</name>
         <description>грамм</description>
         <okei>0</okei>
         <user_id>19</user_id>
      </shop_measure>
      <property_value id="170">
         <property_id>61</property_id>
         <entity_id>166</entity_id>
         <value>1</value>
         <property_dir_id>0</property_dir_id>
         <tag_name>dish_of_day</tag_name>
      </property_value>
   </shop_item>
   <shop_currency id="1">
      <name>руб.</name>
      <code>RUR</code>
      <exchange_rate>1.000000</exchange_rate>
      <date>0000-00-00</date>
      <default>1</default>
      <sorting>10</sorting>
      <user_id>19</user_id>
   </shop_currency>
   <shop_measure id="29">
      <name>г</name>
      <description>грамм</description>
      <okei>0</okei>
      <user_id>19</user_id>
   </shop_measure>
   <shop_company id="1">
      <name>ООО &quot;Инфинити&quot;</name>
      <description></description>
      <tin>1234567897</tin>
      <kpp>123456789</kpp>
      <psrn>12345678901</psrn>
      <okpo>1234567</okpo>
      <okved>68.01</okved>
      <bic>024040</bic>
      <current_account>40500000000000001</current_account>
      <correspondent_account>30700000000000001</correspondent_account>
      <bank_name>Сбербанк России ОАО</bank_name>
      <bank_address>г. Москва</bank_address>
      <legal_name>Иванов И. А.</legal_name>
      <accountant_legal_name>Пупкин В. В.</accountant_legal_name>
      <address>101000, г. Москва, ул. Тверская, д. 11/7</address>
      <phone>(495) 123-45-67</phone>
      <fax>(495) 987-65-43</fax>
      <site>http://www.hostcms.ru</site>
      <email>admin@localhost.ru</email>
      <user_id>0</user_id>
      <guid></guid>
   </shop_company>
   <size_measure>
      <name>мм</name>
   </size_measure>
   <shop_warehouse id="1">
      <shop_id>1</shop_id>
      <name>Основной</name>
      <sorting>0</sorting>
      <active>1</active>
      <default>0</default>
      <shop_country_id>0</shop_country_id>
      <shop_country_location_id>0</shop_country_location_id>
      <shop_country_location_city_id>0</shop_country_location_city_id>
      <shop_country_location_city_area_id>0</shop_country_location_city_area_id>
      <address></address>
      <user_id>0</user_id>
      <guid></guid>
   </shop_warehouse>
</shop>

<?php
               $Shop_Controller_Show = new Shop_Controller_Show(
    Core_Entity::factory('Shop', 1)
);
$Shop_Controller_Show
    ->xsl(
       Core_Entity::factory('Xsl')->getByName('БлюдоДня')
    )
    ->groupsMode('none')
    ->itemsForbiddenTags(array('text'))
    ->group(FALSE)
    ->limit(3)
    ->itemsProperties  (TRUE)
    //->show()
    ;
// Объединение с нужной таблицей свойств
$Shop_Controller_Show
    ->shopItems()
    ->queryBuilder()
    ->leftJoin('shop_item_properties', 'shop_items.Shop_id', '=', 'shop_item_properties.Shop_id')
    ->leftJoin('property_value_ints', 'shop_items.id', '=', 'property_value_ints.entity_id',
  array(
          array('AND' => array('shop_item_properties.property_id', '=', Core_QueryBuilder::expression('`property_value_ints`.`property_id`')))
  )
    )
    // Идентификатор дополнительного свойства
    ->where('shop_item_properties.property_id', '=', 61)
    // Значение дополнительного свойства
    ->where('property_value_ints.value', '=', '1')
    ->groupBy('shop_items.id')
    // Количество свойств, если 1, то можно не указывать
    ->having(Core_Querybuilder::expression('COUNT(DISTINCT `shop_item_properties`.`property_id`)'), '=', 1);
    $Shop_Controller_Show->show();
            ?>
theme.su - готовые сайты для HostCMS
Модератор
#
Re: не получается вывести товар по доп. свой-ву.
у вас выбрался 1 товар:
<shop_item id="166">
#
Re: не получается вывести товар по доп. свой-ву.
HostCMS писал(а):
<shop_item id="166">

Спасибо, Вывел.
theme.su - готовые сайты для HostCMS
Авторизация