Вход • Регистрация

Дополнительные параметры на сайте!

  • 15 декабря 2015 г.
  • Добрый день. Возникла следующая ситуация.
    В админке мы выставили сортировку дополнительных параметров по очереди начиная с наименьшего размера и заканчивая максимальными размерами. Но на сайте все отображается вразброс. Как это поправить??
  • 15 декабря 2015 г.
  • У вас выборка по цене идет. Копайте в этом направлении.
    Точнее ничего сказать нельзя, ибо в коробочном варианте такого не видела. Видимо, чья-то доработка?
    • 15 декабря 2015 г.
    • Я это понимаю. Как мне исправить сортировку??
      • 15 декабря 2015 г.
      • Покажите хотя бы код, который делает выборку. У меня такого нет.
  • 16 декабря 2015 г.
  • Код


    echo "<!-- ";
    print_r($result["row"]["price_arr"]);
    echo " -->";

    $i0=1;

    foreach($result["row"]["price_arr"] as $row){
    //print_r($row);
    if($i0==1){
    echo '<div class="allProd g" id="'.$row['id'].'">';
    $i0++;
    }
    elseif($i0==2){
    echo '<div class="allProd w" id="'.$row['id'].'">';
    $i0--;
    }
    else{}

    foreach($result["result"]["depends_param"][0]['values'] as $a) {
    if ($a['id'] == $row["param"][0]['value']) {
    //echo $a['name']."<BR/>";
    //echo $a['id'];
    //print_r($a);
    echo '<div class="prodColRazm">'.$a['name'].'</div>';
    echo '<input type="hidden" id="one" name="param'.$row["param"][0]['id'].'" value="'.$row["param"][0]['value'].'" />';
    break;
    }
    }
    foreach($result["result"]["depends_param"][1]['values'] as $b){
    if($b['id'] == $row["param"][1]['value']){
    //echo $b['name']."<BR/>";
    //echo $b['id'];
    //print_r($b);

    echo '<div class="prodColVes">'.$b['name'].'</div>';
    echo '<input type="hidden" id="two" name="param'.$row["param"][1]['id'].'" value="'.$row["param"][1]['value'].'" />';
    break;
    }
    }

    echo "
    <div class=\"prodColPrice\">".$row["price"]."</div>
    <div class=\"prodColBuy\">
    <a onClick=\"addBsket($(this).parent().parent().attr('id'))\">Купить</a>
    </div>
    </div>
    ";
    $price = $this->diafan->_shop->price_get($row["good_id"], array($row["param"][0]["id"]=>$row["param"][0]["value"]));

    }
    echo '</div></div>';

  • 16 декабря 2015 г.
  • И возможно ли обойтись малой кровью???
    Вот аутпут
    Код


    <!-- Array
    (
    [0] => Array
    (
    [id] => 922
    [good_id] => 21
    [price] => 4&nbsp;200
    [old_price] => 0
    [count_goods] => 0
    [price_id] => 922
    [date_start] => 0
    [date_finish] => 0
    [discount] => 0
    [discount_id] => 0
    [person] => 0
    [role_id] => 0
    [currency_id] => 0
    [import_id] =>
    [trash] => 0
    [param] => Array
    (
    [0] => Array
    (
    [id] => 1
    [value] => 1
    )

    [1] => Array
    (
    [id] => 2
    [value] => 59
    )

    )

    [count] => 1
    [image_rel] =>
    [price_no_format] => 4200
    [count_in_cart] =>
    )

    [1] => Array
    (
    [id] => 923
    [good_id] => 21
    [price] => 4&nbsp;300
    [old_price] => 0
    [count_goods] => 0
    [price_id] => 923
    [date_start] => 0
    [date_finish] => 0
    [discount] => 0
    [discount_id] => 0
    [person] => 0
    [role_id] => 0
    [currency_id] => 0
    [import_id] =>
    [trash] => 0
    [param] => Array
    (
    [0] => Array
    (
    [id] => 1
    [value] => 2
    )

    [1] => Array
    (
    [id] => 2
    [value] => 60
    )

    )

    [count] => 1
    [image_rel] =>
    [price_no_format] => 4300
    [count_in_cart] =>
    )

    [2] => Array
    (
    [id] => 927
    [good_id] => 21
    [price] => 4&nbsp;600
    [old_price] => 0
    [count_goods] => 0
    [price_id] => 927
    [date_start] => 0
    [date_finish] => 0
    [discount] => 0
    [discount_id] => 0
    [person] => 0
    [role_id] => 0
    [currency_id] => 0
    [import_id] =>
    [trash] => 0
    [param] => Array
    (
    [0] => Array
    (
    [id] => 1
    [value] => 109
    )

    [1] => Array
    (
    [id] => 2
    [value] => 61
    )

    )

    [count] => 1
    [image_rel] =>
    [price_no_format] => 4600
    [count_in_cart] =>
    )

    [3] => Array
    (
    [id] => 926
    [good_id] => 21
    [price] => 4&nbsp;600
    [old_price] => 0
    [count_goods] => 0
    [price_id] => 926
    [date_start] => 0
    [date_finish] => 0
    [discount] => 0
    [discount_id] => 0
    [person] => 0
    [role_id] => 0
    [currency_id] => 0
    [import_id] =>
    [trash] => 0
    [param] => Array
    (
    [0] => Array
    (
    [id] => 1
    [value] => 2
    )

    [1] => Array
    (
    [id] => 2
    [value] => 61
    )

    )

    [count] => 1
    [image_rel] =>
    [price_no_format] => 4600
    [count_in_cart] =>
    )

    [4] => Array
    (
    [id] => 925
    [good_id] => 21
    [price] => 4&nbsp;600
    [old_price] => 0
    [count_goods] => 0
    [price_id] => 925
    [date_start] => 0
    [date_finish] => 0
    [discount] => 0
    [discount_id] => 0
    [person] => 0
    [role_id] => 0
    [currency_id] => 0
    [import_id] =>
    [trash] => 0
    [param] => Array
    (
    [0] => Array
    (
    [id] => 1
    [value] => 106
    )

    [1] => Array
    (
    [id] => 2
    [value] => 61
    )

    )

    [count] => 1
    [image_rel] =>
    [price_no_format] => 4600
    [count_in_cart] =>
    )

    [5] => Array
    (
    [id] => 924
    [good_id] => 21
    [price] => 4&nbsp;600
    [old_price] => 0
    [count_goods] => 0
    [price_id] => 924
    [date_start] => 0
    [date_finish] => 0
    [discount] => 0
    [discount_id] => 0
    [person] => 0
    [role_id] => 0
    [currency_id] => 0
    [import_id] =>
    [trash] => 0
    [param] => Array
    (
    [0] => Array
    (
    [id] => 1
    [value] => 104
    )

    [1] => Array
    (
    [id] => 2
    [value] => 61
    )

    )

    [count] => 1
    [image_rel] =>
    [price_no_format] => 4600
    [count_in_cart] =>
    )

    [6] => Array
    (
    [id] => 928
    [good_id] => 21
    [price] => 4&nbsp;900
    [old_price] => 0
    [count_goods] => 0
    [price_id] => 928
    [date_start] => 0
    [date_finish] => 0
    [discount] => 0
    [discount_id] => 0
    [person] => 0
    [role_id] => 0
    [currency_id] => 0
    [import_id] =>
    [trash] => 0
    [param] => Array
    (
    [0] => Array
    (
    [id] => 1
    [value] => 105
    )

    [1] => Array
    (
    [id] => 2
    [value] => 61
    )

    )

    [count] => 1
    [image_rel] =>
    [price_no_format] => 4900
    [count_in_cart] =>
    )

    [7] => Array
    (
    [id] => 929
    [good_id] => 21
    [price] => 4&nbsp;900
    [old_price] => 0
    [count_goods] => 0
    [price_id] => 929
    [date_start] => 0
    [date_finish] => 0
    [discount] => 0
    [discount_id] => 0
    [person] => 0
    [role_id] => 0
    [currency_id] => 0
    [import_id] =>
    [trash] => 0
    [param] => Array
    (
    [0] => Array
    (
    [id] => 1
    [value] => 110
    )

    [1] => Array
    (
    [id] => 2
    [value] => 61
    )

    )

    [count] => 1
    [image_rel] =>
    [price_no_format] => 4900
    [count_in_cart] =>
    )

    [8] => Array
    (
    [id] => 930
    [good_id] => 21
    [price] => 5&nbsp;300
    [old_price] => 0
    [count_goods] => 0
    [price_id] => 930
    [date_start] => 0
    [date_finish] => 0
    [discount] => 0
    [discount_id] => 0
    [person] => 0
    [role_id] => 0
    [currency_id] => 0
    [import_id] =>
    [trash] => 0
    [param] => Array
    (
    [0] => Array
    (
    [id] => 1
    [value] => 111
    )

    [1] => Array
    (
    [id] => 2
    [value] => 62
    )

    )

    [count] => 1
    [image_rel] =>
    [price_no_format] => 5300
    [count_in_cart] =>
    )

    [9] => Array
    (
    [id] => 931
    [good_id] => 21
    [price] => 5&nbsp;700
    [old_price] => 0
    [count_goods] => 0
    [price_id] => 931
    [date_start] => 0
    [date_finish] => 0
    [discount] => 0
    [discount_id] => 0
    [person] => 0
    [role_id] => 0
    [currency_id] => 0
    [import_id] =>
    [trash] => 0
    [param] => Array
    (
    [0] => Array
    (
    [id] => 1
    [value] => 112
    )

    [1] => Array
    (
    [id] => 2
    [value] => 63
    )

    )

    [count] => 1
    [image_rel] =>
    [price_no_format] => 5700
    [count_in_cart] =>
    )

    [10] => Array
    (
    [id] => 932
    [good_id] => 21
    [price] => 5&nbsp;900
    [old_price] => 0
    [count_goods] => 0
    [price_id] => 932
    [date_start] => 0
    [date_finish] => 0
    [discount] => 0
    [discount_id] => 0
    [person] => 0
    [role_id] => 0
    [currency_id] => 0
    [import_id] =>
    [trash] => 0
    [param] => Array
    (
    [0] => Array
    (
    [id] => 1
    [value] => 113
    )

    [1] => Array
    (
    [id] => 2
    [value] => 64
    )

    )

    [count] => 1
    [image_rel] =>
    [price_no_format] => 5900
    [count_in_cart] =>
    )

    )

    • 16 декабря 2015 г.
    • Тут описано как можно сортировать массивы
      http://www.softtime.ru/bookphp/gl4_4.php
    • 16 декабря 2015 г.
    • А тут уже как на этапе запроса к БД сортировать
      http://www.phptown.ru/php/sql_select_sort.php

Новости

  • 18 июня
  • В сборке большое обновление demo-шаблона, дополнительная защита от спама, улучшение YML-импорта и еще много важного и интересного.
  • 24 апреля
  • В новой сборке совершили революцию в структурировании кастомизированной информации в шаблонах, добавили авторегистрацию пользователей, усовершенствовали защиту от спама, актуализировали накопительную скидку, а также улучшили производительность и стабильность работы системы.
  • 12 января
  • После выхода сборки 7.1 мы выпустили уже три патча, в каждом из которых улучшаем административную часть сайта. Сборка DIAFAN.CMS 7.1.3 уже доступна к установке. 

Форум