Please help with PHP.
I will continue to work with Ivan.
Thank you for work.
Budget: 50 UAH Deadline: 1 day
Call me, I will do.
Budget: 20 USD Deadline: 1 day
Hi, I will quickly and quality fulfill your order, my email: [email protected]
Budget: 990 UAH Deadline: 1 day
You have a lot of categories. Make a var_dump massive, see which key in the required category and do unset
Budget: 50 USD Deadline: 1 day
I do it quickly!
C of UW. We go. Web development experience - over 7 years.
by: lovesexguns
после
foreach($this->categories as $k=>$category)
попробуйте поставить что-то типа
if ($category->id != укажите id нужной категории ) {
...остальной код
}
if ($category->category_id != 188 ) {
...остальной код
}Так я делал, категория скрывается, но ломается структура
Через unset попробуйте. Если не выйдет, то в скайп стучите alexxxx12345g5 , просто так помогу.
По ключу не вариант, если категорию снять с публикации ключи сместятся и все слетит
На крайняк можно переверстать
не делать через table, а например блочную верстку сделать
Снимать с публикации не желательно. Эта категория содержит один товар.
Через unset - как?
<?php $var = ['bar','foo']; print_r($var); unset($var[1]); print_r($var);
Больше кода можно? Как вариант то можно было бы запрос к БД отредачить..
<div class="jshop_list_category">
<?php
if (count($this->categories)){?>
<table class = "jshop">
<?php foreach($this->categories as $k=>$category){?>
<?php /* if ($category->category_id != 188 ) { */?>
<?php if ($k%$this->count_category_to_row==0) print "<tr>"; ?>
<td class="jshop_categ" width="<?php print (100/$this->count_category_to_row)?>%">
<a class="img" href="<?php print $category->category_link;?>"><img src="<?php print $this->image_category_path;?>/<?php if ($category->category_image) print $category->category_image; else print $this->noimage;?>" alt="<?php print htmlspecialchars($category->name);?>" title="<?php print htmlspecialchars($category->name);?>" /></a>
<a class="product_link" href="<?php print $category->category_link?>"><?php print $category->name?></a>
</td>
<?php if ($k%$this->count_category_to_row==$this->count_category_to_row-1) print '</tr>'; ?>
<?php } ?>
<?php/* } */ ?>
<?php if ($k%$this->count_category_to_row!=$this->count_category_to_row-1) print '</tr>'; ?>
</table>
<?php } ?>
</div>
условие
[php]
<?php /* if ($category->category_id != 188 ) { */?>
[/php]
закройте после
[php]
<?php if ($k%$this->count_category_to_row!=$this->count_category_to_row-1) print '</tr>'; ?>
[/php]а не перед
Здраствуйте!
Возможно попробуйте так?
<div class="jshop_list_category">
<?php
if (count($this->categories)){?>
<table class = "jshop">
<?php foreach($this->categories as $k=>$category){?>
<?php if ($category->category_id == 188 ) { continue; }/?>
<?php if ($k%$this->count_category_to_row==0) print "<tr>"; ?>
<td class="jshop_categ" width="<?php print (100/$this->count_category_to_row)?>%">
<a class="img" href="<?php print $category->category_link;?>"><img src="<?php print $this->image_category_path;?>/<?php if ($category->category_image) print $category->category_image; else print $this->noimage;?>" alt="<?php print htmlspecialchars($category->name);?>" title="<?php print htmlspecialchars($category->name);?>" /></a>
<a class="product_link" href="<?php print $category->category_link?>"><?php print $category->name?></a>
</td>
<?php if ($k%$this->count_category_to_row==$this->count_category_to_row-1) print '</tr>'; ?>
<?php } ?>
<?php if ($k%$this->count_category_to_row!=$this->count_category_to_row-1) print '</tr>'; ?>
</table>
<?php } ?>
</div>
а вывод в 3 колонки можно попробовать сделать так заменить
<?php if ($k%$this->count_category_to_row==0) print "<tr>"; ?>
на
<?php if ($k % 3 == 0) print "<tr>"; ?>
Правда закладываться на идентификатор категории не рекомендую, так как это явный костыль )), как вариант в категории добавить класс, либо какое то описание и по нему уже ориентироваться.
может так -
<div class="jshop_list_category">
<?php
if (count($this->categories)){?>
<table class = "jshop">
<?php foreach($this->categories as $k=>$category){?>
<?php if ($category->category_id != 188 ) continue; ?>
<?php if ($k%$this->count_category_to_row==0) print "<tr>"; ?>
<td class="jshop_categ" width="<?php print (100/$this->count_category_to_row)?>%">
<a class="img" href="<?php print $category->category_link;?>"><img src="<?php print $this->image_category_path;?>/<?php if ($category->category_image) print $category->category_image; else print $this->noimage;?>" alt="<?php print htmlspecialchars($category->name);?>" title="<?php print htmlspecialchars($category->name);?>" /></a>
<a class="product_link" href="<?php print $category->category_link?>"><?php print $category->name?></a>
</td>
<?php if ($k%$this->count_category_to_row==$this->count_category_to_row-1) print '</tr>'; ?>
<?php } ?>
<?php if ($k%$this->count_category_to_row!=$this->count_category_to_row-1) print '</tr>'; ?>
</table>
<?php } ?>
</div>
Дмитрий и Генадий, варианты не подошли.
Все так же товар только скрывается.
Как написать условия, что мол выводим все категории кроме "id188" ? Надо , наверное, где-то в helpere писать..
нет. не в контроллере, можно и в шаблоне.
Почему вы не хотите доверить дело специалисту и оплатить за его знания и труд ?
Тут фриланс, а не форум для обсуждения проблем на сайте.
У Вас вывод колонок формируется
в этой строке
<?php if ($k%$this->count_category_to_row==0) print "<tr>"; ?>
а вот таким образом вы можете управлять количеством колонок
<?php if ($k % 3 == 0) print "<tr>"; ?>
ну и ниже также нужно исправить, или найти где происходит инициализация переменной $this->count_category_to_row и исправить ее
Content Management Systems 31 proposals 2 August
Website Development 58 proposals 30 July
Desktop Apps 66 proposals 28 July
28 proposals 28 July
10 proposals 26 July