Domanda

Il mio elenco multi selezione è molto grande, è difficile scoprire quali opzioni sono selezionate, voglio cambiarlo in qualche cosa come seguendo, è possibile? Può essere qualsiasi dove, ma attualmente ho un tipo di attributo "customer_address" personalizzato "Multiselect", Inserisci la descrizione dell'immagine qui

Sto creando il mio attributo come questo il mio script SQL,

    <?php

$installer = $this;

$installer->startSetup();

$installer->addAttribute('customer_address', 'additional_managers', array(
    'label' => 'Additional Store/Site Managers',
    'visible' => true,
    'required' => false,
    'type' => 'varchar',
    'input' => 'multiselect',
    'source' => 'abc_districtmanager/address_attribute_source_districtmanager',
    'onclick' => 'getSelectValues(this)',
    'user_defined' => 1,
    'position' => 100
));

$used_in_forms = array(
     'adminhtml_customer_address',
     'customer_address_edit',
     'customer_register_address'
    );

$attribute = Mage::getSingleton('eav/config')->getAttribute('customer_address', 'additional_managers');
$attribute->setData('used_in_forms', $used_in_forms); 
$attribute->save();

$installer->endSetup();
.

È stato utile?

Soluzione 2

Ho ottenuto il mio scopo con una leggera interfaccia modificata utilizzando "Scelto" JQuery.

Scarica Scelto JQuery Chosen.jquery.js e Chosen.csss, posiziona questi file nel tuo design, aggiungili al tuo modulo nel file .xml rispettato, in testa come

     <reference name="head">
        <!--            Adding js and css to use "chosen" instead of "select" for "multiselect" input types-->
        <action method="addItem">
            <type>skin_js</type>
            <name>js/chosen.jquery.js</name>
        </action>
        <action method="addItem">
            <type>skin_css</type>
            <name>css/chosen.css</name>
        </action>
    </reference>
.

Fai attenzione a Percorso dei file , dopo questo, nella vostra vista rispettata ( .phtml ) Utilizzare scelti

<script type="text/javascript">

jQuery(document).ready(function ($) {
    $(".myClass").chosen();
});
.

. Ciò cambierà l'interfaccia degli elementi con classe "myclass", l'output potrebbe piacere a questo Inserisci la descrizione dell'immagine qui

Altri suggerimenti

È possibile ottenere questa funzionalità dal seguente codice

<select onchange="getSelectValues(this)"></select>



    function getSelectValues(select) {

          var options = select && select.options;
          var opt;

          for (var i=0, iLen=options.length; i<iLen; i++) {
            opt = options[i];

            if (opt.selected) {
               opttext +=opt.text+'<br />';
            }
          }
          document.getElementById('showdiv').innerHtml=opttext;
        }
.

facendo con prototipo

$("_itemNaNadditional_managers").invoke('observe', 'change', function() {

    var options = $("_itemNaNadditional_managers").options;
              var opt;

              for (var i=0, iLen=options.length; i<iLen; i++) {
                opt = options[i];

                if (opt.selected) {
                   opttext +=opt.text+'<br />';
                }
              }
              document.getElementById('showdiv').innerHtml=opttext;

});
.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a magento.stackexchange
scroll top