fix
This commit is contained in:
@@ -8,69 +8,94 @@ $system = new System();
|
||||
$config = discountApp()->config();
|
||||
$data = [];
|
||||
$data['env'] = discountApp()->env();
|
||||
$data['ENABLE'] = $this->getCheckTemplate($config->get('ENABLE'));
|
||||
$data['UPDATE_ELEMENT_INDEX'] = $this->getCheckTemplate($config->get('UPDATE_ELEMENT_INDEX'));
|
||||
$data['DISCOUNT_TYPE_IBLOCK_ID'] = $discountTypeIBlockId = $config->get('DISCOUNT_TYPE_IBLOCK_ID');
|
||||
if($discountTypeIBlockId){
|
||||
$blockEntity = app()->factory()->main()->getIBlockFactory()->getEntityById($discountTypeIBlockId);
|
||||
if($blockEntity){
|
||||
$data['DISCOUNT_TYPE_IBLOCK_ID'] = "[$discountTypeIBlockId] {$blockEntity->getName()}";
|
||||
}
|
||||
}
|
||||
$data['CATALOG_IBLOCK_ID'] = $catalogIBlockId = $config->get('CATALOG_IBLOCK_ID');
|
||||
if($catalogIBlockId){
|
||||
$blockEntity = app()->factory()->main()->getIBlockFactory()->getEntityById($catalogIBlockId);
|
||||
if($blockEntity){
|
||||
$data['CATALOG_IBLOCK_ID'] = "[$catalogIBlockId] {$blockEntity->getName()}";
|
||||
}
|
||||
}
|
||||
$data['TICKET_PROP_ID'] = $ticketPropId = $config->get('TICKET_PROP_ID');
|
||||
$propertyEntity = null;
|
||||
if($ticketPropId){
|
||||
$blockAFactory = app()->factory()->iBlock()->getEntityById($catalogIBlockId);
|
||||
if($blockAFactory){
|
||||
$propertyEntity = $blockAFactory->getPropertyFactory()->getEntityById($ticketPropId);
|
||||
$linkTemplate = "<a href=\"/bitrix/admin/iblock_edit_property.php?ID=$ticketPropId&lang=ru&IBLOCK_ID=$catalogIBlockId\" target=\"_blank\">$ticketPropId</a>";
|
||||
$data['TICKET_PROP_ID'] = "[$linkTemplate] {$propertyEntity->getName()} ({$propertyEntity->getFullType()})";
|
||||
}
|
||||
}
|
||||
$data['CATALOG_GROUP_ID'] = $priceTypeId = $config->get('CATALOG_GROUP_ID');
|
||||
if($priceTypeId){
|
||||
$data['enable'] = $this->getCheckTemplate($config->get('enable'));
|
||||
$data['update_element_index'] = $this->getCheckTemplate($config->get('update_element_index'));
|
||||
|
||||
|
||||
$priceTypeIdList = $config->get('catalog_group_id_list', []);
|
||||
$data['catalog_group_id_list'] = $priceTypeIdList->join(', ');
|
||||
foreach ($priceTypeIdList as $priceTypeId){
|
||||
$priceTypeEntity = app()->factory()->shop()->getPriceTypeFactory()->getEntityById($priceTypeId);
|
||||
if($priceTypeEntity){
|
||||
$linkTemplate = "<a href=\"/bitrix/admin/cat_group_edit.php?ID=$priceTypeId\" target=\"_blank\">$priceTypeId</a>";
|
||||
$data['CATALOG_GROUP_ID'] = "[$linkTemplate] {$priceTypeEntity->getName()}";
|
||||
$linkTemplate = "<a href=\"{$priceTypeEntity->getUrl()}\" target=\"_blank\">$priceTypeId</a>";
|
||||
$data["catalog_group_id_list_$priceTypeId"] = "[$linkTemplate] {$priceTypeEntity->getName()}";
|
||||
}
|
||||
}
|
||||
$data['PAGE_SIZE'] = $config->get('PAGE_SIZE');
|
||||
$data['RENEWAL_PERIOD'] = $config->get('RENEWAL_PERIOD');
|
||||
$data['page_size'] = $config->get('page_size');
|
||||
|
||||
|
||||
?>
|
||||
<table cellpadding="5" border="1" style="border-collapse: collapse; width: 100%">
|
||||
<?php
|
||||
foreach ($data as $key => $value) {
|
||||
?><tr><td><?= $key ?></td><td><?= $value ?></td></tr><?php
|
||||
}
|
||||
?><tr><td>MAP</td><td><?php
|
||||
if($config->get('MAP', [])->count()){
|
||||
<table cellpadding="5" border="1" style="border-collapse: collapse; width: 100%">
|
||||
<?php
|
||||
foreach ($data as $key => $value) {
|
||||
?><tr><td><?= $key ?></td><td><?= $value ?></td></tr><?php
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<br>
|
||||
|
||||
?><table style="width: 100%;">
|
||||
<tr style="font-size: 0.8em; color: #6e6e6e"><td>type</td><td>ticket item</td></tr>
|
||||
<?php foreach ($config->get('MAP', []) as $type => $id){?>
|
||||
<tr><td><?= $type ?></td><td><?php
|
||||
if($propertyEntity){
|
||||
$valueFactory = $propertyEntity->getAdapter()->getValueFactory();
|
||||
$entity = $valueFactory->getEntityById($id);
|
||||
if($entity){
|
||||
echo "[{$entity->getId()}] {$entity->getName()}";
|
||||
}
|
||||
}
|
||||
?></td></tr>
|
||||
<?php }?>
|
||||
</table><?php
|
||||
} else {
|
||||
?><i>empty</i><?php
|
||||
<h3>Инфоблоки</h3>
|
||||
|
||||
<table cellpadding="5" border="1" style="border-collapse: collapse; width: 100%">
|
||||
<tr style="font-size: 0.9em; text-align: left;">
|
||||
<th>Config Name</th>
|
||||
<th>Title</th>
|
||||
<th>isSectionProperty</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<?php
|
||||
$catalogIBlockId = discountApp()->config('catalog_iblock_id', 0);
|
||||
$catalogTitle = "<span class='errortext'>".($catalogIBlockId?:'Undefined'). '</span>';
|
||||
$catalogEntity = app()->factory()->main()->getIBlockFactory()->getEntityById($catalogIBlockId);
|
||||
if($catalogEntity){
|
||||
$catalogTitle = "[{$catalogEntity->getId()}] {$catalogEntity->getName()}";
|
||||
$catalogTitle = "[<a href=\"{$catalogEntity->getAdminUrl()}\" target=\"_blank\">{$catalogEntity->getId()}</a>] {$catalogEntity->getName()}";
|
||||
}
|
||||
?></td></tr><?php
|
||||
?></table>
|
||||
?>
|
||||
<td><?='catalog_iblock_id'?></td><td><?=$catalogTitle?></td><td><?=$catalogEntity->isSectionProperty()?'Да':'Нет'?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
|
||||
<h3>Mapping</h3>
|
||||
<?php
|
||||
|
||||
|
||||
$af = app()->factory()->iBlock()->getEntityById($catalogIBlockId);
|
||||
$propertyFactory = $af->getPropertyFactory();
|
||||
$map = $config->get('MAP', [])->toArray();
|
||||
?>
|
||||
<table cellpadding="5" border="1" style="border-collapse: collapse; width: 100%">
|
||||
<tr style="font-size: 0.8em; color: #6e6e6e"><td>Type</td><td>Property</td><td>PropertyValue</td></tr>
|
||||
<?php
|
||||
foreach ($map as $type => $typeMap){
|
||||
foreach ($typeMap as $propertyCode => $propertyValue) {
|
||||
\Bx\Discount\Tools::prepareMapPropertyCodeAndValue($propertyCode, $propertyValue);
|
||||
|
||||
$propertyEntity = $propertyFactory->getEntityByCode($propertyCode);
|
||||
if($propertyEntity?->getBaseType() != 'L'){
|
||||
continue;
|
||||
}
|
||||
/**
|
||||
* @var \Wt\Core\Collection\IBlock\PropertyEnumCollection $valueCollection
|
||||
*/
|
||||
$valueCollection = $propertyEntity->getValueCollection();
|
||||
$valueEntity = $valueCollection->getByXmlId($propertyValue);
|
||||
?>
|
||||
<tr>
|
||||
<td><?= $type ?></td>
|
||||
<td><?php
|
||||
$propertyEntity->getUrl();
|
||||
$linkTemplate = "<a href=\"{$propertyEntity->getUrl()}\" target=\"_blank\">{$propertyEntity->getId()}</a>";
|
||||
echo "[$linkTemplate] {$propertyEntity->getName()}";
|
||||
?></td>
|
||||
<td><?php
|
||||
if($valueEntity){
|
||||
echo "[{$valueEntity->getId()}] {$valueEntity->getName()}";
|
||||
}
|
||||
?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}?>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user