Jump to content
addax

[Решено] Сортировка товаров. Как сделать ссылки, вместо выпадающего списка?

Recommended Posts

Доброго времени суток!

Нуждаюсь в помощи, как реализовать соритровку подобно этой
 post-689488-0-86197700-1419452248_thumb.png

 

То есть вывести параметры поиска как ссылки?

Share this post


Link to post
Share on other sites

Что так все сложно с сортировкой.

Кстати заметил что для разных страниц (категории, новинки) разные сортировки. Не совсем удобно

Share this post


Link to post
Share on other sites

быстро, без рюшечек, тема default

category.tpl

      <select onchange="location = this.value;">
        <?php foreach ($sorts as $sorts) { ?>
        <?php if ($sorts['value'] == $sort . '-' . $order) { ?>
        <option value="<?php echo $sorts['href']; ?>" selected="selected"><?php echo $sorts['text']; ?></option>
        <?php } else { ?>
        <option value="<?php echo $sorts['href']; ?>"><?php echo $sorts['text']; ?></option>
        <?php } ?>
        <?php } ?>
      </select>
>>

По умолчанию, Цена (по возрастанию), Цена (по убыванию)

        <?php foreach ($sorts as $sorts) { ?>
        <?php if (in_array($sorts['value'], array('p.sort_order-ASC','p.price-ASC','p.price-DESC'))) { // sort links ?>
        <?php if ($sorts['value'] == $sort . '-' . $order) { ?>
        <span class="active-sort"><?php echo $sorts['text']; ?></span>
        <?php } else { ?>
        <a href="<?php echo $sorts['href']; ?>" class="inactive-sort"><?php echo $sorts['text']; ?></a>
        <?php } ?>
        <?php } // sort links ?>
        <?php } ?>

Share this post


Link to post
Share on other sites

Ура!

Спасибо большое, прям подарок на Новый год))

Edited by afwollis
overquote deleted

Share this post


Link to post
Share on other sites
Сортировка ссылками по цене и имени. Выводится по одному слову, когда нажимаешь, сортирует и меняется ссылка на другую сортировку. Пользуйтесь

<!-- Сортировка товаров-->

<ul onchange="location = this.value;">

 <span class="control-label" for="input-sort"><?php echo $text_sort; ?></span>

        <?php $k=0;foreach ($sorts as $sorts) { ?>

        <?php if (in_array($sorts['value'], array('p.price-ASC','p.price-DESC'))) { // sort links price ?>

        <?php if ($sorts['value'] != $sort . '-' . $order and $k==1) { 

if ($sort=='p.price'){echo "|";} ?>

        <span class="active-sort1"><a class="active-sort1" href="<?php echo $sorts['href']; ?>"> 

<?php if($order=='ASC' and $sort =='p.price' ) {echo '<span class="sr">▲</span>';} if($order=='DESC' and $sort =='p.price' ) {echo '<span class="sr">▼</span>';} echo $sorts['text']; ?></a></span>

<?php $k=0; }   ?>

        <?php } // sort links ?>

 

<?php if (in_array($sorts['value'], array('pd.name-ASC','pd.name-DESC'))) { // sort links name ?>

        <?php if ($sorts['value'] != $sort . '-' . $order and $k==0) {  ?>

        <span class="active-sort1"><a class="active-sort1" href="<?php echo $sorts['href']; ?>">

<?php if($order=='ASC' and $sort =='pd.name' ) {echo '<span class="sr">▲</span>';} if($order=='DESC' and $sort =='pd.name' ) {echo '<span class="sr">▼</span>';} echo $sorts['text']; ?></a></span>

<?php $k=1; if ($sort=='pd.name'){echo "|";}}   ?>

        <?php } // sort links ?>

 

        <?php } ?>

 

 

  </ul>

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.