Beispiel #1
0
 public static function taxDataHtml($field)
 {
     $listOfDest = array();
     if (!is_array($field->value)) {
         if (empty($field->value)) {
             $field->value = array();
         } else {
             $field->value = (array) json_decode($field->value, true);
         }
     }
     foreach (self::$userfieldDest as $d) {
         $listOfDest[] = array('id' => $d, 'text' => $d, 'checked' => is_array($field->value['dest']) && in_array($d, $field->value['dest']));
     }
     $categories = frameGmp::_()->getModule('products')->getCategories();
     $brands = frameGmp::_()->getModule('products')->getBrands();
     $cOptions = array();
     $bOptions = array();
     if (!empty($categories)) {
         if (!is_array($field->value['categories'])) {
             $field->value['categories'] = array();
         }
         foreach ($categories as $c) {
             $cOptions[] = array('id' => $c->term_taxonomy_id, 'text' => $c->cat_name, 'checked' => in_array($c->term_taxonomy_id, $field->value['categories']));
         }
     }
     if (!empty($brands)) {
         if (!is_array($field->value['brands'])) {
             $field->value['brands'] = array();
         }
         foreach ($brands as $b) {
             $bOptions[] = array('id' => $b->term_taxonomy_id, 'text' => $b->cat_name, 'checked' => in_array($b->term_taxonomy_id, $field->value['brands']));
         }
     }
     return '<div>' . __('Apply To', GMP_LANG_CODE) . '
         <div id="tax_address">
             <b>' . __('Address', GMP_LANG_CODE) . '</b><br />
             ' . __('Destination', GMP_LANG_CODE) . ':' . htmlGmp::checkboxlist('params[dest]', array('optionsGmp' => $listOfDest)) . '<br />
             ' . __('Country', GMP_LANG_CODE) . ':' . htmlGmp::countryList('params[country]', array('notSelected' => true, 'value' => $field->value['country'])) . '<br />
         </div>
         <div id="tax_category">
             <b>' . __('Categories', GMP_LANG_CODE) . '</b><br />
             ' . (empty($cOptions) ? __('You have no categories', GMP_LANG_CODE) : htmlGmp::checkboxlist('params[categories][]', array('optionsGmp' => $cOptions))) . '<br />
                 <b>' . __('Brands', GMP_LANG_CODE) . '</b><br />
             ' . (empty($bOptions) ? __('You have no brands', GMP_LANG_CODE) : htmlGmp::checkboxlist('params[brands][]', array('optionsGmp' => $bOptions))) . '<br />
         </div>
         <div>' . __('Tax Rate', GMP_LANG_CODE) . ': ' . htmlGmp::text('params[rate]', array('value' => $field->value['rate'])) . '</div>
         <div>' . __('Absolute', GMP_LANG_CODE) . ': ' . htmlGmp::checkbox('params[absolute]', array('checked' => $field->value['absolute'])) . '</div>
     </div>';
 }