PHP для идиотов
→ Что не так • 28 июля 2011 г. 16:58
PHP для идиотов
→ Что не так • 28 июля 2011 г. 15:59
PHP для идиотов
→ Что не так • 28 июля 2011 г. 15:54
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?><div class="catalog-section"><?if($arParams["DISPLAY_TOP_PAGER"]):?> <p><?=$arResult["NAV_STRING"]?></p><?endif?><!—ИСПОЛНЯЮЩИЙ СКРИПТ&...
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>
<div class="catalog-section">
<?if($arParams["DISPLAY_TOP_PAGER"]):?>
<p><?=$arResult["NAV_STRING"]?></p>
<?endif?>
<!—ИСПОЛНЯЮЩИЙ СКРИПТ—–>
<script>
function cost(){
var cost_p=document.getElementById('cost_p').innerHTML;
var amount_p=document.getElementById('amount_p').value;
document.getElementById('cost_out').innerHTML=cost_p*amount_p;
}
</script>
<!————————–>
<hr noshade color="indigo"></hr>
<table class="data-table" cellspacing="0" cellpadding="0" border="0" width="100%">
<thead>
<tr>
<td><b><?=GetMessage("CATALOG_TITLE")?></b></td>
<?if(count($arResult["ITEMS"]) > 0):
foreach($arResult["ITEMS"][0]["DISPLAY_PROPERTIES"] as $arProperty):?>
<td><?=$arProperty["NAME"]?></td>
<?endforeach;
endif;?>
<?foreach($arResult["PRICES"] as $code=>$arPrice):?>
<td><b><?=$arPrice["TITLE"]?></b></td>
<?endforeach?>
<?if(count($arResult["PRICES"]) > 0):?>
<?endif?>
<td><b>Количество</b></td>
<td><b>Сумма</b></td>
</tr>
</thead>
<?foreach($arResult["ITEMS"] as $arElement):?>
<?
$this->AddEditAction($arElement['ID'], $arElement['EDIT_LINK'], CIBlock::GetArrayByID($arParams["IBLOCK_ID"], "ELEMENT_EDIT"));
$this->AddDeleteAction($arElement['ID'], $arElement['DELETE_LINK'], CIBlock::GetArrayByID($arParams["IBLOCK_ID"], "ELEMENT_DELETE"), array("CONFIRM" => GetMessage('CT_BCS_ELEMENT_DELETE_CONFIRM')));
?>
<tr id="<?=$this->GetEditAreaId($arElement['ID']);?>">
<td>
<a href="<?=$arElement["DETAIL_PAGE_URL"]?>"><?=$arElement["NAME"]?></a>
<?if(count($arElement["SECTION"]["PATH"])>0):?>
<?foreach($arElement["SECTION"]["PATH"] as $arPath):?>
/<a href="<?=$arPath["SECTION_PAGE_URL"]?>"><?=$arPath["NAME"]?></a>
<?endforeach?>
<?endif?>
</td>
<?foreach($arElement["DISPLAY_PROPERTIES"] as $pid=>$arProperty):?>
<td>
<?if(is_array($arProperty["DISPLAY_VALUE"]))
echo implode(" / ", $arProperty["DISPLAY_VALUE"]);
elseif($arProperty["DISPLAY_VALUE"] === false)
echo " ";
else
echo $arProperty["DISPLAY_VALUE"];?>
</td>
<?endforeach?>
<?foreach($arResult["PRICES"] as $code=>$arPrice):?>
<td>
<?if($arPrice = $arElement["PRICES"][$code]):?>
<?if($arPrice["DISCOUNT_VALUE"] < $arPrice["VALUE"]):?>
<s><?=$arPrice["PRINT_VALUE"]?></s><br /><span class="catalog-price"><?=$arPrice["PRINT_DISCOUNT_VALUE"]?></span>
<?else:?>
<!———ОПРЕДЕЛЯЕМ ПЕРЕМЕННУЮ ЦЕНЫ———->
<div id=cost_p><span class="catalog-price"><?=$arPrice["PRINT_DISCOUNT_VALUE"]?></span></div>
<!———————————————->
<?endif?>
<?else:?>
<?endif;?>
</td>
<?endforeach;?>
<?if(count($arResult["PRICES"]) > 0):?>
<td>
<!—————ПОЛЕ ДЛЯ ВВОДА КОЛИЧЕСТВА————>
<form>
<input onkeyup=cost(); id=amount_p style='text-align:right;border:1px solid #999999' type="text" name="kolvo" value="0" size="1">
</form>
<!—————————————————->
</td>
<td>
<!—————–ЗДЕСЬ ВЫВОДИМ СУММУ—————->
<div id=cost_out>0</div>
<!—————————————————->
</td>
<td>
<?if($arElement["CAN_BUY"]):?>
<?elseif((count($arResult["PRICES"]) > 0) || is_array($arElement["PRICE_MATRIX"])):?>
<?=GetMessage("CATALOG_NOT_AVAILABLE")?>
<?endif?>
</td>
<?endif;?>
</tr>
<?endforeach;?>
</table>
<hr noshade color="indigo"></hr>
<noindex>
<form action="<?echo $arElement["ADD_URL"]?>" method="post" enctype="multipart/form-data">
<p align="right"><input type="submit" name="<?echo $arParams["ACTION_VARIABLE"]."ADD2BASKET"?>" value="Оформить заказ"></p>
</form>
</noindex>
<?if($arParams["DISPLAY_BOTTOM_PAGER"]):?>
<p><?=$arResult["NAV_STRING"]?></p>
<?endif?>
</div>