Neuigkeiten
  • Die modified eCommerce Shopsoftware ist kostenlos, aber nicht umsonst.
    Spenden
  • Damit wir die modified eCommerce Shopsoftware auch zukünftig kostenlos anbieten können:
    Spenden
  • Thema: Attribute im Admin erweitern

    webald

    • modified Team
    • Beiträge: 2.795
    Attribute im Admin erweitern
    am: 03. März 2021, 10:38:17
    Ich bin heute wohl zu doof. Ich will die Artikel-Attribute im Admin erweitern. Das geht einfach, da es hierfür in admin/includes/extra/modules/new_attributes/ verschiedene Möglichkeiten zum Einbinden gibt.

    In admin/includes/extra/modules/new_attributes/new_attribute_include_td/ folgenden Code:

    Code: PHP  [Auswählen]
    $output .= '<td class="main nobr">'. PHP_EOL;
    $output .= xtc_draw_checkbox_field($current_value_id.'_is_dings','1', isset($attr_array['is_dings'])?$attr_array['is_dings']:'', '', '').''. PHP_EOL;
    $output .= '</td>'. PHP_EOL;

    $output .= '<td class="main nobr">'. PHP_EOL;
    $output .= xtc_draw_checkbox_field($current_value_id.'_is_nix', '1', isset($attr_array['is_nix'])?$attr_array['is_nix']:'', '', 'class="cbx_optval cb check_'.$current_product_option_id.$noStyling.'"').''. PHP_EOL;
    $output .= '</td>'. PHP_EOL;

    Der eine Teil führt dazu, dass keine Checkbox angezeigt wird. Der zweite Teil fürht dazu, dass beim Click auf die Checkbox die Zeile aktiviert/deaktiviert wird.

    Kann mir da mal jemand auf die Sprünge helfen?

    Linkback: https://www.modified-shop.org/forum/index.php?topic=41709.0
    Modulshop - Eine große Auswahl an neuen und hilfreichen Modulen für die modified eCommerce Shopsoftware

    hpzeller

    • Experte
    • Beiträge: 4.130
    • Geschlecht:
    Re: Attribute im Admin erweitern
    Antwort #1 am: 03. März 2021, 16:38:28
    Füge testweise folgenden Code in die Datei welche du im Ordner admin/includes/extra/modules/new_attributes/new_attribute_include_td/ erstellt hast ein.

    Code: PHP  [Auswählen]
    <?php

    $output .= '<td class="main nobr">'. PHP_EOL;
    $output .= xtc_draw_checkbox_field($current_value_id.'_is_nix', '1', isset($attr_array['is_nix'])?$attr_array['is_nix']:'', '', 'class="remove_attr_disabled cb check_'.$current_product_option_id.'"').''. PHP_EOL;
    $output .= '</td>'. PHP_EOL;

    if (!function_exists('dummy')) {
      function dummy() {}
      $output .= '<script> $(function($) { $(".remove_attr_disabled").removeAttr("disabled"); });</script>'. PHP_EOL;
    }

    Gruss
    Hanspeter

    hpzeller

    • Experte
    • Beiträge: 4.130
    • Geschlecht:
    Re: Attribute im Admin erweitern
    Antwort #2 am: 04. März 2021, 12:43:25
    Also ich persönlich würde das mit einem Pull-down-Menü machen, dann funktioniert auch das sperren der ganzen Zeile korrekt.

    Code: PHP  [Auswählen]
    <?php

    switch ($_SESSION['language_code']) {
        case 'de':
            define('EXTRA_PULL_DOWN_TEXT_YES','Ja');
            define('EXTRA_PULL_DOWN_TEXT_NO','Nein');
            break;
        default:
            define('EXTRA_PULL_DOWN_TEXT_YES','Yes');
            define('EXTRA_PULL_DOWN_TEXT_NO','No');
            break;
    }

    $extra_pull_down = array(
      array('id' => '0', 'text' => EXTRA_PULL_DOWN_TEXT_NO),
      array('id' => '1', 'text' => EXTRA_PULL_DOWN_TEXT_YES )
    );

    $output .= '<td class="main nobr">'. PHP_EOL;
    $output .= xtc_draw_pull_down_menu($current_value_id . '_is_nix', $extra_pull_down, (isset($attr_array['is_nix'])?$attr_array['is_nix']:''), $noStylingClass . $disable). PHP_EOL;
    $output .= '</td>'. PHP_EOL;

    if (!function_exists('dummy')) {
      function dummy() {}
      $output .= '<style>.SumoSelect.disabled p{background:#D4D0C8;}.SumoSelect.disabled > .CaptionCont > label{background-color:transparent;}.SumoSelect.disabled{opacity:1;}</style>'. PHP_EOL;
    }

    [ Für Gäste sind keine Dateianhänge sichtbar ]

    Gruss
    Hanspeter

    webald

    • modified Team
    • Beiträge: 2.795
    Re: Attribute im Admin erweitern
    Antwort #3 am: 04. März 2021, 12:50:09
    Ich habe da mal ein Ticket draus gemacht, Checkbox oder Dropdown macht schon einen Unterschied, denn die Zahl der Clicks steigt erheblich.

    hpzeller

    • Experte
    • Beiträge: 4.130
    • Geschlecht:
    Re: Attribute im Admin erweitern
    Antwort #4 am: 05. März 2021, 00:52:03
    Ja es ist mir schon auch klar, dass es mit Checkboxen schneller geht als mit Dropdowns, aber die Datei includes/javascript/jquery.new_attributes.js benutzt halt die Checkbox in spezieller weise für die Zeilenselektion, deshalb muss man einen ziemlichen Aufwand betreiben um sie auch in den Zeilen zu nutzen, ohne die Coredatei includes/javascript/jquery.new_attributes.js verändern zu müssen, also updatesicher zu programmieren und trotzdem nicht auf das Sperren der Checkbox in gesperrten Zeilen zu verzichten. Nichtsdestotrotz habe ich jetzt aber, mit nachfolgendem Ergebnis, diesen Aufwand betrieben.

    Code: PHP  [Auswählen]
    <?php
     
    $output .= '<td class="main nobr">'. PHP_EOL;
    $output .= xtc_draw_checkbox_field($current_value_id.'_is_nix', '1', isset($attr_array['is_nix'])?$attr_array['is_nix']:'', '', 'class="rad_'.$current_value_id.' cb check_'.$current_product_option_id.'"').''. PHP_EOL;
    $output .= '    <script>
        $(function($) {
          if ($("[class*=cbx_optval][value='
    .$current_value_id.']").is(":checked")) {
            $(".rad_'
    .$current_value_id.'").removeAttr("disabled");
          }
          $("[class*=cbx_optval][value='
    .$current_value_id.']").change(function() {
            if ($(this).is(":checked")) {
              $(".rad_'
    .$current_value_id.'").removeAttr("disabled");
            } else {
              $(".rad_'
    .$current_value_id.'").attr("disabled", true);
            }
          });
        });
        </script>'
    . PHP_EOL;
      if (!function_exists('dummy')) {
        function dummy() {}
        $output .= '    <script>
        $(function($) {
          $("[class*=select_all]").change(function() {
            if ($(this).is(":checked")) {
              $("[class*=rad_]").removeAttr("disabled");
            } else {
              $("[class*=rad_]").attr("disabled", true);
            }
          });
        });
        </script>'
    . PHP_EOL;      
        $output .= "    <style>
        input[type=checkbox].ChkBox:not(old) + em,
        input[type=radio].ChkBox:not(old) + em
        {
          display:inline-block;
          margin-left:-28px;
          padding-left:28px;
          background:url('includes/css/images/checks.png') no-repeat 0 0;
          line-height:24px;
          margin-right:-10px;
        }
       
        input[type=checkbox][disabled].ChkBox:not(old) + em,
        input[type=radio][disabled].ChkBox:not(old) + em
        {
          opacity: 0.5;
        }
       
        input[type=checkbox][class*=select_all][disabled].ChkBox:not(old) + em
        {
          opacity: 0.0;
        }        
        </style>"
    . PHP_EOL;  
      }  
    $output .= '</td>'. PHP_EOL;

    Gruss
    Hanspeter
    0 Antworten
    828 Aufrufe
    18. März 2020, 11:03:51 von Lottemann
    18 Antworten
    7100 Aufrufe
    01. Dezember 2010, 18:55:33 von Lewdness
    1 Antworten
    2937 Aufrufe
    20. Januar 2012, 10:23:14 von Tomcraft
    2 Antworten
    2598 Aufrufe
    10. April 2010, 16:06:17 von Tomcraft