Уважаемые Знатоки, Подскажите пожалуйста. Есть код: Код (Text): <?php if ($product->image){?> <div style="width:150px; height:150px; margin-left: 60px; margin-top: 10px;"> <a href="<?php print $product->product_link?>"> <div style=" padding-top:37px; position: absolute; margin-top: 60px;"><img style="height:150px; width:150px;" src="<?php print $product->image?>" alt="<?php print htmlspecialchars($product->name);?> " /> </div> </a> <?php print $product_thumb_image ?> </div> <?php }?> Как сделать чтобы при условии: Код (Text): <?php $varmactak1 = $product->_label_name; $varmactak2 = "Скоро в продаже"; if (strcasecmp($varmactak1, $varmactak2) == 0) {?> <?php }?> Размер картинки и дива увеличился?! Заранее благодарю!
PHP: <?php $varmactak1 = $product->_label_name; $varmactak2 = "Скоро в продаже"; if (strcasecmp($varmactak1, $varmactak2) == 0) {?> <div style="width:800px; height:150px; margin-left: 60px; margin-top: 10px;"> <?php } else { ?> <div style="width:150px; height:150px; margin-left: 60px; margin-top: 10px;"> <?php } ?> Размер картинки можешь задать в 100%, чтобы она по размеру div была. Примерно так.
Код (Text): <?php if ($product->image){?> <?php $varmactak1 = $product->_label_name; $varmactak2 = "Скоро в продаже"; if (strcasecmp($varmactak1, $varmactak2) == 0) {?> <div style="width:170px; height:170px; margin-left: 60px; margin-top: 10px;"> <?php } else { ?> <div style="width:150px; height:150px; margin-left: 60px; margin-top: 10px;"> <?php } ?> <a href="<?php print $product->product_link?>"> <div style=" padding-top:37px; position: absolute; margin-top: 60px;"><img style="height:100%; width:100%;" src="<?php print $product->image?>" alt="<?php print htmlspecialchars($product->name);?> " /> </div> </a> <?php print $product_thumb_image ?> </div> <?php }?> Сделал. По идее все должно работать. Но вся страница летит к чертям. Видимо где-то в другом месте кода не состыковка. (
Вроде всё нормально, попробуй в браузере посмотреть исходный код страницы который приходит, может там будет видна проблема
Сайт писал не я. Сайт старый, код наикривейший. Задачу поставили. Пытаюсь решить. --- Добавлено --- Могу скинуть весь код этого файла. Может опытным глазом взгляните. И увидите корень ошибки?! --- Добавлено --- Страшный код... Код (Text): <?php print $product->_tmp_var_start?> <div style=" background-image: url('../images/ramka.png'); height: 307px; width: 275px; margin-left: 30px; " > <div style="margin-top: 0px; padding-top: 5px; position: absolute;"> <?php if ($product->_label_image){?> <img src="<?php print $product->_label_image?>" alt="<?php print htmlspecialchars($product->_label_name)?>" /> <?php }else{?> <span class="label_name"><?php print $product->_label_name;?></span> <?php }?> </div> <div style="font-size:10px;color:#787878; float: right;margin-right: 10px; margin-top: 5px;"> <?php if ($this->config->product_list_show_product_code){?> <?php /*?><span class="jshop_code_prod"><?php */?>(<?php print _JSHOP_EAN?>: <?php print $product->product_ean;?>)</span><?php }?> <div> <?php print $product->manufacturer->name?></div> </div> <?php if ($product->image){?> <?php $varmactak1 = $product->_label_name; $varmactak2 = "Скоро в продаже"; if (strcasecmp($varmactak1, $varmactak2) == 0) {?> <div style="width:170px; height:170px; margin-left: 60px; margin-top: 10px;"> <?php } else { ?> <div style="width:150px; height:150px; margin-left: 60px; margin-top: 10px;"> <?php } ?> <a href="<?php print $product->product_link?>"> <div style=" padding-top:37px; position: absolute; margin-top: 60px;"><img style="height:100%; width:100%;" src="<?php print $product->image?>" alt="<?php print htmlspecialchars($product->name);?> " /> </div> </a> <?php print $product_thumb_image ?> </div> <?php }?> <?php if ($this->allow_review){?> <?php /*?><table class="review_mark"><tr><td><?php print showMarkStar($product->average_rating);?></td></tr></table><?php */?> <?php /*?>отзывы<?php */?> <?php /*?><div class="count_commentar"><?php */?> <?php /*?> <div style="font-size:10px; font-family:Arial, Helvetica, sans-serif; color:#787878; margin-left: 20px; "> <?php print sprintf(_JSHOP_X_COMENTAR, $product->reviews_count);?> </div><?php */?> <?php /*?>конец отзывов<?php */?> <?php }?> <?php print $product->_tmp_var_bottom_foto;?> <div style="text-align: height: 40px; margin-top: -110px; margin-left: 10px; margin-right: 10px; height: 215px;"> <a style="font-size:12x;" href="<?php print $product->product_link?>"><?php print $product->name?></a> </div> <?php /*?> <div class="description"> <?php print $product->short_description?> </div><?php */?> <?php if ($product->manufacturer->name){?> <?php /*?>вес<?php */?> <?php /*?> <div style="font-size:10px; font-family:Arial, Helvetica, sans-serif; color:#787878;"><?php print _JSHOP_WEIGHT?>: <?php print formatweight($product->product_weight)?></div><?php */?> <?php /*?>конец вес<?php */?> <?php }?> <table style="width: 274px; margin-left: 19px; margin-top: 17<ol></ol>0px;"> <tbody> <tr> <td> <div style="font-size: 12pt; color: rgb(255, 0, 0); text-decoration: line-through; margin-top: -20px; position: absolute; margin-left: 6px;"> <?php if ($product->product_old_price > 0){?> <?php if ($this->config->product_list_show_price_description) print _JSHOP_OLD_PRICE.": ";?><?php print formatprice($product->product_old_price)?> <?php }?> <?php /*?> <?php if ($product->product_price_default > 0 && $this->config->product_list_show_price_default){?> <?php print _JSHOP_DEFAULT_PRICE.": ";?><?php print formatprice($product->product_price_default)?> <?php }?><?php */?> <?php if ($product->_display_price){?> </div> </td> <td> <div style="font-size: 16pt; color:#2A3387; width: 130px;" > <?php /*?>цена начало<?php */?> <?php /*?><?php print("Стоимость:");?><?php */?> <?php if ($this->config->product_list_show_price_description) print _JSHOP_PRICE.": ";?> <?php if ($product->show_price_from) print _JSHOP_FROM." ";?> <?php /*?><?php print formatprice($product->product_price);?><?php */?> <?php $h125= formatprice($product->product_price);?> <?php if ($h125 > 0 ) { echo "$h125"; } ?> </div> </td> </tr> </tbody> </table> <?php if ($product->product_quantity <=0 && !$this->config->hide_text_product_not_available){?> <?php /*?>нет в наличии начало<?php */?> <div style="font-size: 11px; font-family: Arial,Helvetica,sans-serif; color: rgb(255, 0, 0); margin-top: -26px; padding-left: 30px; margin-left: 145px; width: 50px;"><?php print _JSHOP_PRODUCT_NOT_AVAILABLE;?></div> <?php /*?> нет в наличии конец <?php */?> <?php }?> <?php elseif (strcasecmp($varmactak1, $varmactak2) == 0){?> <?php }?> <?php /*?>цена конец<?php */?> <?php }?> <?php print $product->_tmp_var_bottom_price;?> <?php if ($this->config->show_tax_in_product && $product->tax > 0){?> <span class="taxinfo"><?php print productTaxInfo($product->tax);?></span> <?php }?> <?php if ($this->config->show_plus_shipping_in_product){?> <span class="plusshippinginfo"><?php print sprintf(_JSHOP_PLUS_SHIPPING, $this->shippinginfo);?></span> <?php }?> <?php if ($product->basic_price_info['price_show']){?> <div class="base_price"><?php print _JSHOP_BASIC_PRICE?>: <?php if ($product->show_price_from) print _JSHOP_FROM;?> <?php print formatprice($product->basic_price_info['basic_price'])?> / <?php print $product->basic_price_info['name'];?></div> <?php }?> <?php if ($this->config->product_list_show_weight && $product->product_weight > 0){?> <?php /*?><div class="productweight"><?php print _JSHOP_WEIGHT?>: <?php print formatweight($product->product_weight)?></div><?php */?> <?php }?> <?php if ($product->delivery_time != ''){?> <div class="deliverytime"><?php print _JSHOP_DELIVERY_TIME?>: <?php print $product->delivery_time?></div> <?php }?> <?php if (is_array($product->extra_field)){?> <?php foreach($product->extra_field as $extra_field){?> <?php /*?><div><?php print $extra_field['name']; ?>: <?php print $extra_field['value']; ?></div><?php */?> <?php }?> <?php }?> <?php if ($product->vendor){?> <div class="vendorinfo"><?php print _JSHOP_VENDOR;?>: <a href="<?php print $product->vendor->products;?>"><?php print $product->vendor->shop_name?></a></div> <?php }?> <?php if ($this->config->product_list_show_qty_stock){?> <div class="qty_in_stock"><?php print _JSHOP_QTY_IN_STOCK?>: <?php print sprintQtyInStock($product->qty_in_stock)?></div> <?php }?> <?php /*?> уведомить о наличии<?php */?> <?php /*?><?php print $product->_tmp_var_top_buttons;?><?php */?> <?php /*?>купить подробнее начало<?php */?> <div style="margin-left: 20px; font-size: 11pt;"> <?php if ($product->buy_link){?> <?php /*?><a style="font-size:11px; color:#666666; margin-left: 7px;" href="<?php print $product->product_link?>"><?php print _JSHOP_DETAIL?></a><?php */?> <?php /*?><a style="font-size:11px; color:#ff0000; margin-left: 20px;" href="<?php print $product->buy_link?>"><?php print _JSHOP_BUY?></a><?php */?> <div style="width: 110px; margin-left: 115px; margin-top: -30px;"> <a class="zoom31" style="font-size:11px; color:#ff0000; margin-left: 20px;" href="<?php print $product->buy_link?>"></a> </div> <?php }?> <?php /*?><div><?php print $product->_tmp_var_buttons;?> </div><?php */?> </div> <?php print $product->_tmp_var_bottom_buttons;?> </div> <?php print $product->_tmp_var_end?>