⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 attributes_preview.php

📁 Easy_Buy是一个在线销售系统
💻 PHP
📖 第 1 页 / 共 3 页
字号:
                reset($_POST['id']);
                while(list($key,$value) = each($_POST['id'])) {
//echo ereg_replace('txt_', '', $key) . '#';
//print_r($_POST['id']);
//echo $products_options_names->fields['products_options_id'].'|';
//echo $value.'|';
//echo $products_options->fields['products_options_values_id'].'#';
                  if ((ereg_replace('txt_', '', $key) == $products_options_names->fields['products_options_id'])) {
//                  if ((ereg_replace('txt_', '', $key) == $products_options_names->fields['products_options_id'] and $value == $products_options->fields['products_options_values_id'])) {
                    $tmp_html = '<input type="text" name ="id[' . TEXT_PREFIX . $products_options_names->fields['products_options_id'] . ']" size="' . $products_options_names->fields['products_options_size'] .'" maxlength="' . $products_options_names->fields['products_options_length'] . '" value="' . stripslashes($value) .'" />  ';
                    $tmp_html .= $products_options_details;
                    break;
                  }
                }

            } else {
              $tmp_value = $_SESSION['cart']->contents[$_GET['products_id']]['attributes_values'][$products_options_names->fields['products_options_id']];
              $tmp_html = '<input type="text" name ="id[' . TEXT_PREFIX . $products_options_names->fields['products_options_id'] . ']" size="' . $products_options_names->fields['products_options_size'] .'" maxlength="' . $products_options_names->fields['products_options_length'] . '" value="' . htmlspecialchars($tmp_value) .'" />  ';
              $tmp_html .= $products_options_details;
              $tmp_word_cnt_string = '';
// calculate word charges
              $tmp_word_cnt =0;
              $tmp_word_cnt_string = $_SESSION['cart']->contents[$_GET['products_id']]['attributes_values'][$products_options_names->fields['products_options_id']];
              $tmp_word_cnt = zen_get_word_count($tmp_word_cnt_string, $products_options->fields['attributes_price_words_free']);
              $tmp_word_price = zen_get_word_count_price($tmp_word_cnt_string, $products_options->fields['attributes_price_words_free'], $products_options->fields['attributes_price_words']);

              if ($products_options->fields['attributes_price_words'] != 0) {
                $tmp_html .= TEXT_PER_WORD . $currencies->display_price($products_options->fields['attributes_price_words'], zen_get_tax_rate($product_info->fields['products_tax_class_id'])) . ($products_options->fields['attributes_price_words_free'] !=0 ? TEXT_WORDS_FREE . $products_options->fields['attributes_price_words_free'] : '');
              }
              if ($tmp_word_cnt != 0 and $tmp_word_price != 0) {
                $tmp_word_price = $currencies->display_price($tmp_word_price, zen_get_tax_rate($product_info->fields['products_tax_class_id']));
                $tmp_html = $tmp_html . '<br />' . TEXT_CHARGES_WORD . ' ' . $tmp_word_cnt . ' = ' . $tmp_word_price;
              }
// calculate letter charges
              $tmp_letters_cnt =0;
              $tmp_letters_cnt_string = $_SESSION['cart']->contents[$_GET['products_id']]['attributes_values'][$products_options_names->fields['products_options_id']];
              $tmp_letters_cnt = zen_get_letters_count($tmp_letters_cnt_string, $products_options->fields['attributes_price_letters_free']);
              $tmp_letters_price = zen_get_letters_count_price($tmp_letters_cnt_string, $products_options->fields['attributes_price_letters_free'], $products_options->fields['attributes_price_letters']);

              if ($products_options->fields['attributes_price_letters'] != 0) {
                $tmp_html .= TEXT_PER_LETTER . $currencies->display_price($products_options->fields['attributes_price_letters'], zen_get_tax_rate($product_info->fields['products_tax_class_id'])) . ($products_options->fields['attributes_price_letters_free'] !=0 ? TEXT_LETTERS_FREE . $products_options->fields['attributes_price_letters_free'] : '');
              }
              if ($tmp_letters_cnt != 0 and $tmp_letters_price != 0) {
                $tmp_letters_price = $currencies->display_price($tmp_letters_price, zen_get_tax_rate($product_info->fields['products_tax_class_id']));
                $tmp_html = $tmp_html . '<br />' . TEXT_CHARGES_LETTERS . ' ' . $tmp_letters_cnt . ' = ' . $tmp_letters_price;
              }

            }
          }

// file uploads

// iii 030813 added: support for file fields
          if ($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_FILE) {
            $number_of_uploads++;
// $cart->contents[$_GET['products_id']]['attributes_values'][$products_options_name['products_options_id']]
            $tmp_html = '<input type="file" name="id[' . TEXT_PREFIX . $products_options_names->fields['products_options_id'] . ']" /><br />' .
                         $_SESSION['cart']->contents[$prod_id]['attributes_values'][$products_options_names->fields['products_options_id']] .
                         zen_draw_hidden_field(UPLOAD_PREFIX . $number_of_uploads, $products_options_names->fields['products_options_id']) .
                         zen_draw_hidden_field(TEXT_PREFIX . UPLOAD_PREFIX . $number_of_uploads, $_SESSION['cart']->contents[$prod_id]['attributes_values'][$products_options_names->fields['products_options_id']]);
            $tmp_html  .= $products_options_details;
          }


// collect attribute image if it exists and to draw in table below
          if ($products_options_names->fields['products_options_images_style'] == '0' or ($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_FILE or $products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_TEXT or $products_options_names->fields['products_options_type'] == '0') ) {
            if ($products_options->fields['attributes_image'] != '') {
              $tmp_attributes_image_row++;

//              if ($tmp_attributes_image_row > PRODUCTS_IMAGES_ATTRIBUTES_PER_ROW) {
              if ($tmp_attributes_image_row > $products_options_names->fields['products_options_images_per_row']) {
                $tmp_attributes_image .= '</tr><tr>';
                $tmp_attributes_image_row = 1;
              }

              $tmp_attributes_image .= '<td class="smallText" align="center">' . zen_image(DIR_WS_CATALOG_IMAGES . $products_options->fields['attributes_image']) . (PRODUCT_IMAGES_ATTRIBUTES_NAMES == '1' ? '<br />' . $products_options->fields['products_options_values_name'] : '') . '</td>';
            }
          }

// Read Only - just for display purposes
          if ($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_READONLY) {
//            $tmp_html .= '<input type="hidden" name ="id[' . $products_options_names->fields['products_options_id'] . ']"' . '" value="' . stripslashes($products_options->fields['products_options_values_name']) . ' SELECTED' . '" />  ' . $products_options->fields['products_options_values_name'];
            $tmp_html .= $products_options_details . '<br />';
          } else {
            $zv_display_select_option ++;
          }


// default
// find default attribute if set to for default dropdown
              if ($products_options->fields['attributes_default']=='1') {
                $selected_attribute = $products_options->fields['products_options_values_id'];
              }

          $products_options->MoveNext();

        }

//echo 'TEST I AM ' . $products_options_names->fields['products_options_name'] . ' Type - ' . $products_options_names->fields['products_options_type'] . '<br />';
// Option Name Type Display
        switch (true) {
          // text
          case ($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_TEXT):
            if ($show_attributes_qty_prices_icon == 'true') {
              $options_name[] = ATTRIBUTES_QTY_PRICE_SYMBOL . $products_options_names->fields['products_options_name'];
            } else {
              $options_name[] = $products_options_names->fields['products_options_name'];
            }
            $options_menu[] = $tmp_html;
            $options_comment[] = $products_options_names->fields['products_options_comment'];
            $options_comment_position[] = ($products_options_names->fields['products_options_comment_position'] == '1' ? '1' : '0');
          break;
          // checkbox
          case ($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_CHECKBOX):
            if ($show_attributes_qty_prices_icon == 'true') {
              $options_name[] = ATTRIBUTES_QTY_PRICE_SYMBOL . $products_options_names->fields['products_options_name'];
            } else {
              $options_name[] = $products_options_names->fields['products_options_name'];
            }
            $options_menu[] = $tmp_checkbox;
            $options_comment[] = $products_options_names->fields['products_options_comment'];
            $options_comment_position[] = ($products_options_names->fields['products_options_comment_position'] == '1' ? '1' : '0');
          break;
          // radio buttons
          case ($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_RADIO):
            if ($show_attributes_qty_prices_icon == 'true') {
              $options_name[] = ATTRIBUTES_QTY_PRICE_SYMBOL . $products_options_names->fields['products_options_name'];
            } else {
              $options_name[] = $products_options_names->fields['products_options_name'];
            }
            $options_menu[] = $tmp_radio;
            $options_comment[] = $products_options_names->fields['products_options_comment'];
            $options_comment_position[] = ($products_options_names->fields['products_options_comment_position'] == '1' ? '1' : '0');
          break;
          // file upload
          case ($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_FILE):
            if ($show_attributes_qty_prices_icon == 'true') {
              $options_name[] = ATTRIBUTES_QTY_PRICE_SYMBOL . $products_options_names->fields['products_options_name'];
            } else {
              $options_name[] = $products_options_names->fields['products_options_name'];
            }
            $options_menu[] = $tmp_html;
            $options_comment[] = $products_options_names->fields['products_options_comment'];
            $options_comment_position[] = ($products_options_names->fields['products_options_comment_position'] == '1' ? '1' : '0');
          break;
          // READONLY
          case ($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_READONLY):
            $options_name[] = $products_options_names->fields['products_options_name'];
            $options_menu[] = $tmp_html;
            $options_comment[] = $products_options_names->fields['products_options_comment'];
            $options_comment_position[] = ($products_options_names->fields['products_options_comment_position'] == '1' ? '1' : '0');
          break;
          // dropdownmenu auto switch to selected radio button display
          case ($products_options->RecordCount() == 1):
            if ($show_attributes_qty_prices_icon == 'true') {
              $options_name[] = ATTRIBUTES_QTY_PRICE_SYMBOL . $products_options_names->fields['products_options_name'];
            } else {
              $options_name[] = $products_options_names->fields['products_options_name'];
            }
            $options_menu[] = zen_draw_radio_field('id[' . $products_options_names->fields['products_options_id'] . ']',
                              $products_options_value_id, 'selected') . $products_options_details;
            $options_comment[] = $products_options_names->fields['products_options_comment'];
            $options_comment_position[] = ($products_options_names->fields['products_options_comment_position'] == '1' ? '1' : '0');
          break;
          default:
            // normal dropdown menu display
            if (isset($_SESSION['cart']->contents[$prod_id]['attributes'][$products_options_names->fields['products_options_id']])) {
              $selected_attribute = $_SESSION['cart']->contents[$prod_id]['attributes'][$products_options_names->fields['products_options_id']];
            } else {
              // selected set above
//                echo 'Type ' . $products_options_names->fields['products_options_type'] . '<br />';
            }

            if ($show_attributes_qty_prices_icon == 'true') {
              $options_name[] = ATTRIBUTES_QTY_PRICE_SYMBOL . $products_options_names->fields['products_options_name'];
            } else {
              $options_name[] = $products_options_names->fields['products_options_name'];
            }


            $options_menu[] = zen_draw_pull_down_menu('id[' . $products_options_names->fields['products_options_id'] . ']',
                                $products_options_array, $selected_attribute);
            $options_comment[] = $products_options_names->fields['products_options_comment'];
            $options_comment_position[] = ($products_options_names->fields['products_options_comment_position'] == '1' ? '1' : '0');
          break;
        }

        // attributes images table
        $options_attributes_image[] = $tmp_attributes_image;
        $products_options_names->MoveNext();
      }
      // manage filename uploads
      $_GET['number_of_uploads'] = $number_of_uploads;
//      zen_draw_hidden_field('number_of_uploads', $_GET['number_of_uploads']);
      zen_draw_hidden_field('number_of_uploads', $number_of_uploads);
    }

//////////////////////////////////////////////////
//// EOF: attributes
//////////////////////////////////////////////////

?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -