Так все таки не т нормального варианта чтобы это сделать?
Попробовал для каждого свойства товара сделать свою ИС и связать через доп. свойства группы товаров ( тип ИС ). Получается так себе потому что куча не нужного создается.
После этого получаю в свойствах динамической страницы вот так:
$oShop_Information_Systems = Core_QueryBuilder::select('shop_item_properties.property_id',
array('informationsystems.name', 'infosystem_name'),
'informationsystem_items.name',
'informationsystem_items.image_small',
'property_value_ints.value')
->distinct()
->from('shop_items')
->leftJoin('shop_item_properties', 'shop_item_properties.shop_id', '=', 'shop_items.shop_id')
->leftJoin('properties', 'shop_item_properties.property_id', '=', 'properties.id')
->leftJoin('informationsystems', 'informationsystems.id', '=', 'properties.informationsystem_id')
->leftJoin('informationsystem_items', 'informationsystem_items.informationsystem_id', '=', 'informationsystems.id')
->leftJoin('informationsystem_item_properties','informationsystem_item_properties.informationsystem_id', '=', 'informationsystems.id')
->leftJoin(array('properties', 'infosys_prop'),'infosys_prop.id', '=', 'informationsystem_item_properties.property_id')
->leftJoin('property_value_ints','property_value_ints.property_id', '=','infosys_prop.id')
->where('infosys_prop.tag_name','=', 'increment')
->where('properties.informationsystem_id','!=', 0)
->where('shop_items.id', '=', $Shop_Controller_Show->item)
->where('shop_items.deleted', '=', 0)
->execute()
->asAssoc()
->result();
$groupedProperties = Core_Utils::array_group_by($oShop_Information_Systems, 'property_id');
foreach ($groupedProperties as $group)
{
$groupElement = array_shift(array_slice($group, 0, 1));
// XML-сущность, к которой будут добавляться производители
$oInfoSystemsXmlEntity = Core::factory('Core_Xml_Entity')->name('infosystems')
->addAttribute('id', $groupElement['property_id'])
->addAttribute('name', $groupElement['infosystem_name']);
// Добавляем XML-сущность контроллеру показа
foreach ($group as $property){
// Добавляем инфоэлементы в сущность
$oInfoSystemsXmlEntity->addEntity(
Core::factory('Core_Xml_Entity')
->name('info_element')
->addEntity(Core::factory('Core_Xml_Entity')->name('name')->value($property['name']))
->addEntity(Core::factory('Core_Xml_Entity')->name('image_small')->value($property['image_small']))
->addEntity(Core::factory('Core_Xml_Entity')->name('increment')->value($property['value']))
);
}
$Shop_Controller_Show->addEntity($oInfoSystemsXmlEntity);
}
В итоге формируется xml типа
<infosystems id="65" name="Цвет ДСП">
<info_element>
<name>Бежевый</name>
<image_small>small_information_items_178.jpg</image_small>
<increment>0</increment>
</info_element>
<info_element>
<name>Белый текстурированный</name>
<image_small>small_information_items_179.jpg</image_small>
<increment>0</increment>
</info_element>
</infosystems>
<infosystems id="76" name="Ширина">
<info_element>
<name>1520 мм</name>
<image_small></image_small>
<increment>0</increment>
</info_element>
<info_element>
<name>1800 мм</name>
<image_small></image_small>
<increment>0</increment>
</info_element>
</infosystems>
<infosystems id="77" name="Глубина">
<info_element>
<name>450 мм</name>
<image_small></image_small>
<increment>0</increment>
</info_element>
</infosystems>
А выводить тыпаюсь как то так:
<xsl:when test="$property/type = 5">
<xsl:variable name="properties"
select="/shop/infosystems[@id = $property/informationsystem_id]"/>
<xsl:choose>
<xsl:when test="contains($property/tag_name, '-selected')">
<select id='{$property/tag_name}' class="form-control margin-top-5 properties" name="param" onchange="$.changePrice(this)">
<xsl:for-each select="$properties">
<xsl:variable name="prop_value" select="name" />
<option value="{name}">
<xsl:attribute name="{concat('data-', $property/tag_name)}">
<xsl:value-of select="name"/>
</xsl:attribute>
<xsl:value-of disable-output-escaping="yes" select="name"/>
</option>
</xsl:for-each>
</select>
</xsl:when>
<xsl:when test="contains($property/tag_name, '-check')">
<form class="properties" name="param">
<div class="col-xs-6 col-sm-6 col-md-4 col-lg-4">
<xsl:variable name="prop_value" select="name"/>
<input type="checkbox" name="{tag_name}" value="{name}"
onclick = "$(this).val(this.checked ? 'Да' : 'Нет')"
onchange="$.changePrice(this)">
<xsl:attribute name="{concat('data-', tag_name)}">
</xsl:attribute>
</input>
</div>
</form>
</xsl:when>
</xsl:choose>
</xsl:when>
Но что то не работает. привязка к tagname нужна для разного форматирования относительно тех данных, что надо вывести ( группа чеоков, просто чек или комбобокс)
Подскажите пожалуйста, как это подправить, и если более простой и правильный путь? Еще и вопрос остается как это в корзину пробросить
