Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2014
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.70 KB | None | 0 0
  1. js/js.js
  2. <script>
  3.  jQuery(document).ready(function($){
  4.                   var count = $("#jform_params_foreignmanuf :selected").length;
  5.                   return count;
  6.               });
  7. </script>
  8.  
  9. manulist.php (dropdownlist)
  10.  
  11. <?php
  12.  
  13. defined('JPATH_PLATFORM') or die;
  14. JFormHelper::loadFieldClass('list');
  15. class JFormFieldManulist extends JFormFieldList
  16. {
  17.  
  18.     protected $type = 'Manulist';
  19.  
  20.    
  21.     protected function getOptions()
  22.     {
  23.    
  24.      $db= JFactory::getDbo();
  25.      $query = $db->getQuery(true);
  26.         $query->select('*');
  27.         $query->from('#__virtuemart_manufacturers_en_gb');
  28.         $db->setQuery($query);
  29.      $items = $db->loadObjectList();
  30.          $options = array();
  31.          if ($items)
  32.          {
  33.           foreach($items as $item)
  34.           {
  35.             $options[] = JHtml::_('select.option', $item->virtuemart_manufacturer_id , $item->mf_name,$item->slug);
  36.           }
  37.          }
  38.          $options = array_merge(parent::getOptions(), $options);
  39.          JHtml::_('script', JUri::root() . 'modules/mod_mymodule/js/js.js');
  40.          return $options;
  41.    
  42.     }
  43.  
  44.  
  45. }
  46.  
  47. countermanu.php (text field of counter)
  48.  
  49.  
  50. <?php
  51.  
  52. defined('JPATH_PLATFORM') or die;
  53. JFormHelper::loadFieldClass('Text');
  54. class JFormFieldManulist extends JFormFieldText
  55. {
  56.  
  57.     protected $type = 'Countermanu';
  58.  
  59.    
  60.     protected function getOptions()
  61.     {
  62.    
  63.     $doc = JDocument::getDocument();
  64.        $js = '
  65.              jQuery(document).ready(function($){
  66.                  var count = $("#jform_params_foreignmanuf :selected").length;
  67.                  return count;
  68.              });
  69.       ';
  70.        $doc->addScriptDeclaration($js);
  71.     JHtml::_('script', JUri::root() . 'modules/mod_mymodule/js/js.js');
  72.    
  73.     }
  74.  
  75.  
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement