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

📄 attributes_preview.php

📁 Easy_Buy是一个在线销售系统
💻 PHP
📖 第 1 页 / 共 3 页
字号:
              // if an error, set to customer setting
              if ($_POST['id'] !='') {
                $selected_attribute= false;
                reset($_POST['id']);
                while(list($key,$value) = each($_POST['id'])) {
                  if (($key == $products_options_names->fields['products_options_id'] and $value == $products_options->fields['products_options_values_id'])) {
                  // zen_get_products_name($_POST['products_id']) .
                    $selected_attribute = true;
                    break;
                  }
                }
              } else {
                $selected_attribute = ($products_options->fields['attributes_default']=='1' ? true : false);
              }
            }

            switch ($products_options_names->fields['products_options_images_style']) {
              case '0':
              $tmp_radio .= zen_draw_radio_field('id[' . $products_options_names->fields['products_options_id'] . ']',
                            $products_options_value_id, $selected_attribute) . $products_options_details . '<br />';
              break;
              case '1':
              $tmp_radio .= zen_draw_radio_field('id[' . $products_options_names->fields['products_options_id'] . ']',
                            $products_options_value_id, $selected_attribute) . ($products_options->fields['attributes_image'] != '' ? zen_image(DIR_WS_CATALOG_IMAGES . $products_options->fields['attributes_image'], '', '', '', 'hspace="5" vspace="5"') . '&nbsp;' : '') . $products_options_details . '<br />';
              break;
              case '2':
              $tmp_radio .= zen_draw_radio_field('id[' . $products_options_names->fields['products_options_id'] . ']',
                            $products_options_value_id, $selected_attribute) . $products_options_details .
                            ($products_options->fields['attributes_image'] != '' ? '<br />' . zen_image(DIR_WS_CATALOG_IMAGES . $products_options->fields['attributes_image'], '', '', '', 'hspace="5" vspace="5"') : '') . '<br />';
              break;

              case '3':
                  $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;
                  }

                if ($products_options->fields['attributes_image'] != '') {
                  $tmp_attributes_image .= '<td class="smallText" align="center" valign="top">' . zen_draw_radio_field('id[' . $products_options_names->fields['products_options_id'] . ']',
                              $products_options_value_id, $selected_attribute) . zen_image(DIR_WS_CATALOG_IMAGES . $products_options->fields['attributes_image']) . (PRODUCT_IMAGES_ATTRIBUTES_NAMES == '1' ? '<br />' . $products_options->fields['products_options_values_name'] : '') . $products_options_details_noname . '</td>';
                } else {
                  $tmp_attributes_image .= '<td class="smallText" align="center" valign="top">' . zen_draw_radio_field('id[' . $products_options_names->fields['products_options_id'] . ']',
                              $products_options_value_id, $selected_attribute) . '<br />' . $products_options->fields['products_options_values_name'] . $products_options_details_noname . '</td>';
                }
              break;

              case '4':
                  $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;
                  }

                if ($products_options->fields['attributes_image'] != '') {
                  $tmp_attributes_image .= '<td class="smallText" align="center" valign="top">' . zen_image(DIR_WS_CATALOG_IMAGES . $products_options->fields['attributes_image']) . (PRODUCT_IMAGES_ATTRIBUTES_NAMES == '1' ? '<br />' . $products_options->fields['products_options_values_name'] : '') . ($products_options_details_noname != '' ? '<br />' . $products_options_details_noname : '') . '<br />' . zen_draw_radio_field('id[' . $products_options_names->fields['products_options_id'] . ']',
                                $products_options_value_id, $selected_attribute) . '</td>';
                } else {
                  $tmp_attributes_image .= '<td class="smallText" align="center" valign="top">' . $products_options->fields['products_options_values_name'] . ($products_options_details_noname != '' ? '<br />' . $products_options_details_noname : '') . '<br />' . zen_draw_radio_field('id[' . $products_options_names->fields['products_options_id'] . ']',
                                $products_options_value_id, $selected_attribute) . '</td>';
                }
              break;

              case '5':
                  $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;
                  }

                if ($products_options->fields['attributes_image'] != '') {
                  $tmp_attributes_image .= '<td class="smallText" align="center" valign="top">' . zen_draw_radio_field('id[' . $products_options_names->fields['products_options_id'] . ']',
                               $products_options_value_id, $selected_attribute) . '<br />' . zen_image(DIR_WS_CATALOG_IMAGES . $products_options->fields['attributes_image']) . (PRODUCT_IMAGES_ATTRIBUTES_NAMES == '1' ? '<br />' . $products_options->fields['products_options_values_name'] : '') . ($products_options_details_noname != '' ? '<br />' . $products_options_details_noname : '') . '</td>';
                } else {
                  $tmp_attributes_image .= '<td class="smallText" align="center" valign="top">' . zen_draw_radio_field('id[' . $products_options_names->fields['products_options_id'] . ']',
                               $products_options_value_id, $selected_attribute) . '<br />' . $products_options->fields['products_options_values_name'] . ($products_options_details_noname != '' ? '<br />' . $products_options_details_noname : '') . '</td>';
                }
              break;
            }
          }

// checkboxes
          if ($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_CHECKBOX) {
            $string = $products_options_names->fields['products_options_id'].'_chk'.$products_options->fields['products_options_values_id'];
            if (false) {
              if ($_SESSION['cart']->contents[$prod_id]['attributes'][$string] == $products_options->fields['products_options_values_id']) {
                $selected_attribute = true;
            } else {
                $selected_attribute = false;
              }
            } else {
//              $selected_attribute = ($products_options->fields['attributes_default']=='1' ? true : false);
              // if an error, set to customer setting
              if ($_POST['id'] !='') {
                $selected_attribute= false;
                reset($_POST['id']);
                while(list($key,$value) = each($_POST['id'])) {
                  if (is_array($value)) {
                    while(list($kkey,$vvalue) = each($value)) {
                      if (($key == $products_options_names->fields['products_options_id'] and $vvalue == $products_options->fields['products_options_values_id'])) {
                        $selected_attribute = true;
                        break;
                      }
                    }
                  } else {
                    if (($key == $products_options_names->fields['products_options_id'] and $value == $products_options->fields['products_options_values_id'])) {
                  // zen_get_products_name($_POST['products_id']) .
                      $selected_attribute = true;
                      break;
                    }
                  }
                }
              } else {
                $selected_attribute = ($products_options->fields['attributes_default']=='1' ? true : false);
              }
            }

/*
            $tmp_checkbox .= zen_draw_checkbox_field('id[' . $products_options_names->fields['products_options_id'] . ']['.$products_options_value_id.']',
                                $products_options_value_id, $selected_attribute) . $products_options_details .'<br />';
*/
            switch ($products_options_names->fields['products_options_images_style']) {
              case '0':
              $tmp_checkbox .= zen_draw_checkbox_field('id[' . $products_options_names->fields['products_options_id'] . ']['.$products_options_value_id.']',
                                $products_options_value_id, $selected_attribute) . $products_options_details .'<br />';
              break;
              case '1':
              $tmp_checkbox .= zen_draw_checkbox_field('id[' . $products_options_names->fields['products_options_id'] . ']['.$products_options_value_id.']',
                                $products_options_value_id, $selected_attribute) . ($products_options->fields['attributes_image'] != '' ? zen_image(DIR_WS_CATALOG_IMAGES . $products_options->fields['attributes_image'], '', '', '', 'hspace="5" vspace="5"') . '&nbsp;' : '') . $products_options_details . '<br />';
              break;
              case '2':
              $tmp_checkbox .= zen_draw_checkbox_field('id[' . $products_options_names->fields['products_options_id'] . ']['.$products_options_value_id.']',
                                $products_options_value_id, $selected_attribute) . $products_options_details .
                            ($products_options->fields['attributes_image'] != '' ? '<br />' . zen_image(DIR_WS_CATALOG_IMAGES . $products_options->fields['attributes_image'], '', '', '', 'hspace="5" vspace="5"') : '') . '<br />';
              break;

              case '3':
                  $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;
                  }

                if ($products_options->fields['attributes_image'] != '') {
                  $tmp_attributes_image .= '<td class="smallText" align="center" valign="top">' . zen_draw_checkbox_field('id[' . $products_options_names->fields['products_options_id'] . ']['.$products_options_value_id.']',
                                $products_options_value_id, $selected_attribute) . zen_image(DIR_WS_CATALOG_IMAGES . $products_options->fields['attributes_image']) . (PRODUCT_IMAGES_ATTRIBUTES_NAMES == '1' ? '<br />' . $products_options->fields['products_options_values_name'] : '') . $products_options_details_noname . '</td>';
                } else {
                  $tmp_attributes_image .= '<td class="smallText" align="center" valign="top">' . zen_draw_checkbox_field('id[' . $products_options_names->fields['products_options_id'] . ']['.$products_options_value_id.']',
                                $products_options_value_id, $selected_attribute) . '<br />' . $products_options->fields['products_options_values_name'] . $products_options_details_noname . '</td>';
                }
              break;

              case '4':
                  $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;
                  }

                if ($products_options->fields['attributes_image'] != '') {
                  $tmp_attributes_image .= '<td class="smallText" align="center" valign="top">' . zen_image(DIR_WS_CATALOG_IMAGES . $products_options->fields['attributes_image']) . (PRODUCT_IMAGES_ATTRIBUTES_NAMES == '1' ? '<br />' . $products_options->fields['products_options_values_name'] : '') . ($products_options_details_noname != '' ? '<br />' . $products_options_details_noname : '') . '<br />' . zen_draw_checkbox_field('id[' . $products_options_names->fields['products_options_id'] . ']['.$products_options_value_id.']',
                                $products_options_value_id, $selected_attribute) . '</td>';
                } else {
                  $tmp_attributes_image .= '<td class="smallText" align="center" valign="top">' . $products_options->fields['products_options_values_name'] . ($products_options_details_noname != '' ? '<br />' . $products_options_details_noname : '') . '<br />' . zen_draw_checkbox_field('id[' . $products_options_names->fields['products_options_id'] . ']['.$products_options_value_id.']',
                                $products_options_value_id, $selected_attribute) . '</td>';
                }
              break;

              case '5':
                  $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;
                  }

                if ($products_options->fields['attributes_image'] != '') {
                  $tmp_attributes_image .= '<td class="smallText" align="center" valign="top">' . zen_draw_checkbox_field('id[' . $products_options_names->fields['products_options_id'] . ']['.$products_options_value_id.']',
                                $products_options_value_id, $selected_attribute) . '<br />' . zen_image(DIR_WS_CATALOG_IMAGES . $products_options->fields['attributes_image']) . (PRODUCT_IMAGES_ATTRIBUTES_NAMES == '1' ? '<br />' . $products_options->fields['products_options_values_name'] : '') . ($products_options_details_noname != '' ? '<br />' . $products_options_details_noname : '') . '</td>';
                } else {
                  $tmp_attributes_image .= '<td class="smallText" align="center" valign="top">' . zen_draw_checkbox_field('id[' . $products_options_names->fields['products_options_id'] . ']['.$products_options_value_id.']',
                                $products_options_value_id, $selected_attribute) . '<br />' . $products_options->fields['products_options_values_name'] . ($products_options_details_noname != '' ? '<br />' . $products_options_details_noname : '') . '</td>';
                }
              break;
            }
          }


// text
          if (($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_TEXT)) {
            //CLR 030714 Add logic for text option
//            $products_attribs_query = zen_db_query("select distinct patrib.options_values_price, patrib.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$_GET['products_id'] . "' and patrib.options_id = '" . $products_options_name['products_options_id'] . "'");
//            $products_attribs_array = zen_db_fetch_array($products_attribs_query);
            if ($_POST['id']) {

⌨️ 快捷键说明

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