- Автор темы
- #1
Приветствую всех! Прошу помощи в реализации.
Нужно выделить цветом строку и поменять иконку при значении поля DAY=0 в базе.
В php не силен.
В css создал класс
Нужно выделить цветом строку и поменять иконку при значении поля DAY=0 в базе.
В php не силен.
В css создал класс
Код:
.sklad{
width: 30px;
}
.nalichie{background-color: #dcffdc;}
PHP:
<?if(!defined("TDM_PROLOG_INCLUDED") || TDM_PROLOG_INCLUDED!==true)die();
?>
<table class="tdlist">
<tr class="head"><td><?=Lng('Brand',1,0);?></td><?/*<td><?=Lng('Number',1,0);?></td>*/?><td></td><td><?=Lng('Name',1,0);?></td><td></td><td></td>
<td style="padding:0px; text-align:right;">
<table class="listprice"><tr class="thead">
<td class="avail"><?=Lng('Avail.',1,1)?></td>
<td class="day ttip" title="<?=Lng('Dtime_delivery',1,0)?>"><?=Lng('Dtime',1,1)?></td>
<td class="cost ttip" title="<?=TDM_CUR?>"><?=Lng('Price',1,1)?></td>
<td class="tocart"></td></tr>
</table>
</td>
</tr>
<?
foreach($arResult['PARTS'] as $NumKey=>$arPart){
if($arPart['PKEY']==''){continue;} //ERROR key
$Cnt++; $PCnt=0; $OpCnt=0; $cm=''; $AddF=0;
//Criteria display method
if($arPart['CRITERIAS_COUNT']>0){
foreach($arPart['CRITERIAS'] as $Criteria=>$Value){
if($Criteria!=''){$arPart['CRITERIA'].=$cm.$Criteria.' - '.$Value;}else{$arPart['CRITERIA'].=$cm.UWord($Value);} $cm='; ';
}
}
//Pictures display method
if($arPart['IMG_ZOOM']=='Y'){
$Zoom=$arPart['IMG_SRC']; $ZClass='cbx_imgs';
$PicText=''; $Target='';
}else{
$Zoom='https://www.google.com/search?q='.$arPart['BRAND'].'+'.$arPart['ARTICLE'].'&tbm=isch'; $ZClass='';
$PicText=Lng('Search_photo_in_google',1,0); $Target='target="_blank"';
}
if(TDM_ISADMIN AND $arPart['LINK_CODE']!=''){$BrandClass='linked';
$BrLink = '<a href="/'.TDM_ROOT_DIR.'/admin/dbedit.php?selecttable=Y&table=TDM_LINKS&LINK='.$arPart['LINK_LEFT_AKEY'].'" target="_blank" class="ttip link" title="'.$arPart['LINK_INFO'].'<br>'.$arPart['LINK_CODE'].'"></a>';
}else{$BrandClass=''; $BrLink='';}
?>
<tr class="cols">
<td class="tdbrand">
<a href="javascript:void(0)" class="<?=$BrandClass?>" title="<?echo Lng('Information_about_brand',0,0);?>"><?=$arPart['BRAND']?></a>
<?=$BrLink?><br>
<div class="ttip" <?if(TDM_ISADMIN){?>ttip" title="BKEY: <?=$arPart['BKEY']?><br>AKEY: <?=$arPart['AKEY']?><br>ID:<?=$arPart['AID']?><?}?>"><?=$arPart['ARTICLE']?></div>
<?if($arPart['KIND']>0){?><span style="font-size:11px;"><?=TDMPrintArtKinde($arPart['KIND']);?></span><?}?>
</td>
<?/*
<td class="article <?if(TDM_ISADMIN){?>ttip" title="BKEY: <?=$arPart['BKEY']?><br>AKEY: <?=$arPart['AKEY']?><br>ID:<?=$arPart['AID']?><?}?>">
<?=$arPart['ARTICLE']?>
</td>*/?>
<td>
<div class="tditem" id="item<?=$arPart['PKEY']?>">
<?// Preview images: ?>
<a href="<?=$Zoom?>" class="image <?=$ZClass?>" rel="img<?=$arPart['PKEY']?>" <?=$Target?> title="<?=Lng('Buy_cheap',1,0);?> <?=$arPart['TD_NAME']?> <?=$arPart['BRAND']?> <?=$arPart['ARTICLE']?>">
<?if($arResult['ART_LOGOS'][$arPart['AID']]!=''){?>
<div style="background-image:url('<?=$arResult['ART_LOGOS'][$arPart['AID']]?>');" class="logobox"></div>
<?}?>
<?if($PicText!=''){?>
<div class="gosrch"><?=$PicText?></div>
<?}else{?>
<div style="background-image:url('<?=$arPart['IMG_SRC']?>');" class="photobox"></div>
<?}?>
</a>
<?if($AddF>0){?><div class="addphoto" title="<?=Lng('Photo_count',1,0);?>">x<?=($AddF+1)?></div><?}?>
<?if(is_array($arPart["IMG_ADDITIONAL"])){
foreach($arPart["IMG_ADDITIONAL"] as $AddImgSrc){ $AddF++;?><a href="<?=$AddImgSrc?>" class="cbx_imgs" rel="img<?=$arPart['PKEY']?>" title="<?=Lng('Buy_cheap',1,0);?> <?=$arPart['TD_NAME']?> <?=$arPart['BRAND']?> <?=$arPart['ARTICLE']?>"></a><?}
}?>
</td>
<td width="40%">
<b class="name" title="<?=Lng('Buy_cheap',1,0);?> <?=$arPart['TD_NAME']?> <?=$arPart['BRAND']?> <?=$arPart['ARTICLE']?>"><?=$arPart['NAME']?> <div class="Title_parts"><?=$arPart['BRAND']?> <?=$arPart['ARTICLE']?></div></b><br>
<div class="criteria"><?=$arPart['CRITERIA']?></div>
<div class="itemprops" id="props<?=$arPart['PKEY']?>">
<?if($arPart["PROPS_COUNT"]>0){
foreach($arPart['PROPS'] as $PName=>$PValue){?>
<span class="criteria"><?=$PName?><?if($PValue!=''){?>: <?=$PValue?><?}else{?>.<?}?></span><br>
<?}
}?>
</div>
<?if($arPart["PROPS_COUNT"]>3){?>
<a class="moreprops" href="javascript:void(0)" onClick="ShowMoreProps(this,'props<?=$arPart['PKEY']?>')">▼ <?=Lng('Show_more_properties',1,false)?> (<?=($arPart["PROPS_COUNT"]-3)?>)</a>
<?}?>
<?if((!isset($_GET['brand'])) OR (TDMSingleKey($_GET['article'])!=TDMSingleKey($arPart['AKEY']) AND TDMSingleKey($_GET['brand'],true)!=TDMSingleKey($arPart['BRAND'],true)) ){?>
<a href="/<?=TDM_ROOT_DIR?>/search/<?=$arPart['AKEY']?>/<?=BrandNameEncode($arPart['BRAND'])?>/" class="lookup_analogues"><?=Lng('Lookup_analogues',1,0)?></a>
<?}?>
</td>
<td style="width:40px; white-space:nowrap;" class="rigbord">
<?if($arPart["AID"]>0){?><table class="propstb"><tr><td>
<a href="/<?=TDM_ROOT_DIR?>/props.php?of=<?=$arPart["AID"]?>" class="dopinfo popup" title="<?=Lng('Additional_Information',1,0)?>"></a></td><td>
<a href="javascript:void(0)" OnClick="AppWin('<?=TDM_ROOT_DIR?>',<?=$arPart["AID"]?>,980)" class="carsapp" target="_blank" title="<?=Lng('Applicability_to_model_cars',1,0)?>"></a></table>
<?}?>
</td>
<td class="options">
<?if($arPart["PRICES_COUNT"]>0){?>
<table class="optionstab">
<?foreach($arResult['PRICES'][$arPart['PKEY']] as $arPrice){ $OpCnt++;
if($OpCnt>$arResult['LIST_PRICES_LIMIT']){$OpClass='op'.$arPart['PKEY']; $OpStyle='style="display:none;"'; }else{$OpClass=''; $OpStyle='';}?>
<tr class="<?=$OpClass?>" <?=$OpStyle?> ><td><?=$arPrice['OPTIONS']['VIEW_INTAB']?></td></tr>
<?}?>
</table>
<?}?>
</td>
<td style="padding:0px;">
<?if($arPart["PRICES_COUNT"]>0){?>
<table class="listprice">
<?foreach($arResult['PRICES'][$arPart['PKEY']] as $arPrice){
$PCnt++;
if($PCnt>1){$TopBord='topbord';}else{$TopBord='';}
if($PCnt>$arResult['LIST_PRICES_LIMIT']){$HClass='pr'.$arPart['PKEY']; $HStyle='style="display:none;"'; }else{$HStyle=''; $HClass='';}?>
<tr class="trow <?=$HClass?> <?=$TopBord?>" <?=$HStyle?> >
<td class="avail"><?=$arPrice['AVAILABLE']?> шт.</td>
<td class="day ttip" <?if(TDM_ISADMIN){?>title="<?=$arPrice['INFO']?>"<?}?> >
<div class="pict_sup"><img src="http://usveruub.bget.ru/autoparts/templates/partslist/default/images/sclock.png"></div><?=$arPrice['DAY']?>
<td class="cost ttip">
<?if($arPrice['EDIT_LINK']!=''){?><a class="pad" href="<?=$arPrice['EDIT_LINK']?>" class="popup editprice" title="<?=Lng('Price',1,0)?>: <?=Lng('Edit',2,0)?>"><?}?>
<?=$arPrice['PRICE_FORMATED']?></a>
</td>
<td class="tocart">
<?if($arResult['ADDED_PHID']==$arPrice['PHID']){?>
<div class="tdcartadded" title="<?=Lng('Added_to_cart',1,0)?>"><div class="text_cart_added">В корзине</div></div>
<?}else{
/*?>
<table><tr><td>
<input type="number" style="width:35px;" value="1" id="Qt_<?=$arPrice['PHID']?>" min="1" <?if($arPrice['AVAILABLE']>0){?>max="<?=$arPrice['AVAILABLE']?>"<?}?> />
</td><td>
<a href="javascript:void(0)" class="tdcartadd" OnClick="TDMAddToCart('<?=$arPrice['PHID']?>')" title="<?=Lng('Add_to_cart',1,0)?>"></a>
</table>
*/?>
<!--input type="number" class="number numb_dav" id="Qt_<?=$arPrice['PHID']?>" name="Qt_<?=$arPrice['PHID']?>" value="1" min="1" max="<?=$arPrice['AVAILABLE']?>" -->
<button class="but_cart" title="Купить" OnClick="TDMAddToCart('<?=$arPrice['PHID']?>')" type="button" title="<?=Lng('Add_to_cart',1,0)?>"><i class="fa fa-shopping-cart"> <div class="text_cart_add">Купить</div></i><!--<div class="text_cart_add">Купить</div>-->
<!--<a href="javascript:void(0)" class="tdcartadd" OnClick="TDMAddToCart('<?=$arPrice['PHID']?>')" title="<?=Lng('Add_to_cart',1,0)?>"><div class="text_cart_add">Купить</div></a>-->
<?}?>
</td>
</tr>
<?}?>
</table>
<?
if($arPart["PRICES_COUNT"]>$arResult['LIST_PRICES_LIMIT']){?>
<a href="javascript:void(0)" OnClick="ShowMoreListPrices('<?=$arPart['PKEY']?>')" class="sbut sb<?=$arPart['PKEY']?>">▼ <b><u><?=Lng('Show_more_prices',1,0)?></u></b> (<?=($arPart["PRICES_COUNT"]-$arResult['LIST_PRICES_LIMIT'])?>)</a><?
}
}elseif($arResult['ALLOW_ORDER']==1){?>
<a href="javascript:void(0)" class="tdorder order_tdm" OnClick="TDMOrder('<?=$arPart['PKEY']?>')"><div class="text_cart_ord"><i class="glyphicon glyphicon-send"></i> Узнать ниличие и стоимость</div></a>
<?}?>
<?if(TDM_ISADMIN){?>
<?if($arPart["PRICES_COUNT"]<=0){?><br><?}?>
<a href="/<?=TDM_ROOT_DIR?>/admin/dbedit_price.php?ID=NEW&ARTICLE=<?=urlencode($arPart['ARTICLE'])?>&BRAND=<?=urlencode($arPart['BRAND'])?>" class="popup addprice" title="Add price record">+$</a>
<a href="/<?=TDM_ROOT_DIR?>/admin/dbedit_link.php?ID=NEW&BKEY=<?=$arPart['BKEY']?>&AKEY=<?=$arPart['AKEY']?>" class="popup addprice" title="Add cross record">+X</a>
<?}?>
</td>
</tr><?
}?>
</table>
Заранее благодарен!