allon925 Posted April 3, 2014 Report Share Posted April 3, 2014 На страницах каталога: http://choosemood.ru/products/ и на страницах лови момент: http://choosemood.ru/lovi-moment/ На всех кроме первой хочу вывести содержимое, а на остальных нет. {if $module== 'ProductsView' && $page->url== 'lovi-moment' && $current_page_num > 1} Содержимое {/if} Quote Link to post Share on other sites
Kosjak76 Posted April 3, 2014 Report Share Posted April 3, 2014 А в чем вопрос? Quote Link to post Share on other sites
allon925 Posted April 3, 2014 Author Report Share Posted April 3, 2014 {if $module== 'ProductsView' && $page->url== 'lovi-moment' && $current_page_num > 1} Содержимое {/if} Хочу вывести содержимое только на странице лови момент: http://choosemood.ru/lovi-moment/ на всех страницах кроме первой. В чем может быть ошибка? Заранее благодарен за ответ. Quote Link to post Share on other sites
dkoz Posted April 3, 2014 Report Share Posted April 3, 2014 {if ($module == 'ProductsView' && $current_page_num > 1) || $page->url == 'lovi-moment'} Quote Link to post Share on other sites
allon925 Posted April 3, 2014 Author Report Share Posted April 3, 2014 В этом случае у меня вывод будет на всех, не первых страницах категорий и на странице лови момент и на основной и на 2,3, и.т.д. Я хочу, чтобы вывод был только на странице лови момент но не первой а только второй третьей, и.т.д. Как это можно реализовать? Заранее благодарен за ответ. Quote Link to post Share on other sites
dkoz Posted April 3, 2014 Report Share Posted April 3, 2014 Так "Лови момент" это категория товаров? Если да, тогда нужно так: {if $module == 'ProductsView' && $category->url == 'lovi-moment' && $current_page_num > 1} или можно даже так: {if $category->url == 'lovi-moment' && $current_page_num > 1} Quote Link to post Share on other sites
dkoz Posted April 3, 2014 Report Share Posted April 3, 2014 Очень важно правильно сформулировать вопрос Quote Link to post Share on other sites
dkoz Posted April 3, 2014 Report Share Posted April 3, 2014 А вообще, лучше делать привязку не к url, а к id$category->id == 11 или $page->id == 4тогда при смене url не нужно лесть в исходники и править условие Quote Link to post Share on other sites
allon925 Posted April 3, 2014 Author Report Share Posted April 3, 2014 Не срабатывает. Для реализации пагинации в разделе лови момент добавлял в productsView.php if ($mode == 'products') { $filter = array(); $filter['visible'] = 1; $filter['featured'] = 1; } if ($mode == 'lovi-moment') { $filter = array(); $filter['visible'] = 1; $filter['discounted'] = 1; } затем в .htaccess: #Добавление RewriteRule ^products/?$ index.php?module=ProductsView&mode=products [L,QSA] RewriteRule ^lovi-moment/?$ index.php?module=ProductsView&mode=lovi-moment [L,QSA] После этого насколько я понял страница лови момент выводится с помощью products.tpl. В чем может быть причина не работы условий? Заранее благодарен за ответ. Quote Link to post Share on other sites
allon925 Posted April 3, 2014 Author Report Share Posted April 3, 2014 А вообще, лучше делать привязку не к url, а к id$category->id == 11 или $page->id == 4тогда при смене url не нужно лесть в исходники и править условиеПри указании url должна же тоже работать. Quote Link to post Share on other sites
dkoz Posted April 3, 2014 Report Share Posted April 3, 2014 В ProductsView делаем передачу в шаблон переменной mode $this->design->assign('mode', $this->request->get('mode', 'string')); В шаблоне {if $mode == 'lovi-moment' && $current_page_num > 1} Quote Link to post Share on other sites
allon925 Posted April 3, 2014 Author Report Share Posted April 3, 2014 Спасибо, заработало, но остался вопрос как сделать, чтобы в условие попадали не только все числовые страницы как сейчас, но также и содержимое при нажатии на кнопку все сразу: http://choosemood.ru/lovi-moment/?page=all Заранее благодарен за ответ. Quote Link to post Share on other sites
Solution dkoz Posted April 3, 2014 Solution Report Share Posted April 3, 2014 В ProductsView меняем // Показать все страницы сразу if($this->request->get('page') == 'all') $items_per_page = $products_count; на // Показать все страницы сразу if($this->request->get('page') == 'all'){ $items_per_page = $products_count; $this->design->assign('page_all', true); } в шаблоне {if $mode == 'lovi-moment' && ($current_page_num > 1 || $page_all == true)} Quote Link to post Share on other sites
allon925 Posted April 4, 2014 Author Report Share Posted April 4, 2014 Спасибо все заработало. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.