|
ZenCart_Documentation
1.5.0
http://www.collinsharper.com
|
00001 <?php 00009 if (!defined('IS_ADMIN_FLAG')) { 00010 die('Illegal Access'); 00011 } 00015 // limit to 1 for larger tables 00016 00017 $_GET['products_id'] = $pInfo->products_id; 00018 $prod_id = $pInfo->products_id; 00019 00020 $sql = "select count(*) as total 00021 from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib 00022 where patrib.products_id='" . (int)$_GET['products_id'] . "' 00023 and patrib.options_id = popt.products_options_id 00024 and popt.language_id = '" . (int)$_SESSION['languages_id'] . "'" . 00025 " limit 1"; 00026 00027 $pr_attr = $db->Execute($sql); 00028 00029 if ($pr_attr->fields['total'] > 0) { 00030 if (PRODUCTS_OPTIONS_SORT_ORDER=='0') { 00031 $options_order_by= ' order by LPAD(popt.products_options_sort_order,11,"0")'; 00032 } else { 00033 $options_order_by= ' order by popt.products_options_name'; 00034 } 00035 00036 $sql = "select distinct popt.products_options_id, popt.products_options_name, popt.products_options_sort_order, 00037 popt.products_options_type, popt.products_options_length, popt.products_options_comment, popt.products_options_size, 00038 popt.products_options_images_per_row, 00039 popt.products_options_images_style 00040 from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib 00041 where patrib.products_id='" . (int)$_GET['products_id'] . "' 00042 and patrib.options_id = popt.products_options_id 00043 and popt.language_id = '" . (int)$_SESSION['languages_id'] . "' " . 00044 $options_order_by; 00045 00046 $products_options_names = $db->Execute($sql); 00047 00048 // iii 030813 added: initialize $number_of_uploads 00049 $number_of_uploads = 0; 00050 00051 if ( PRODUCTS_OPTIONS_SORT_BY_PRICE =='1' ) { 00052 $order_by= ' order by LPAD(pa.products_options_sort_order,11,"0"), pov.products_options_values_name'; 00053 } else { 00054 $order_by= ' order by LPAD(pa.products_options_sort_order,11,"0"), pa.options_values_price'; 00055 } 00056 00057 $discount_type = zen_get_products_sale_discount_type((int)$_GET['products_id']); 00058 $discount_amount = zen_get_discount_calc((int)$_GET['products_id']); 00059 $show_onetime_charges_description = 'false'; 00060 $show_attributes_qty_prices_description = 'false'; 00061 00062 while (!$products_options_names->EOF) { 00063 $products_options_array = array(); 00064 00065 /* 00066 pa.options_values_price, pa.price_prefix, 00067 pa.products_options_sort_order, pa.product_attribute_is_free, pa.products_attributes_weight, pa.products_attributes_weight_prefix, 00068 pa.attributes_default, pa.attributes_discounted, pa.attributes_image 00069 */ 00070 00071 $sql = "select pov.products_options_values_id, 00072 pov.products_options_values_name, 00073 pa.* 00074 from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov 00075 where pa.products_id = '" . (int)$_GET['products_id'] . "' 00076 and pa.options_id = '" . (int)$products_options_names->fields['products_options_id'] . "' 00077 and pa.options_values_id = pov.products_options_values_id 00078 and pov.language_id = '" . (int)$_SESSION['languages_id'] . "' " . 00079 $order_by; 00080 00081 $products_options = $db->Execute($sql); 00082 00083 $products_options_value_id = ''; 00084 $products_options_details = ''; 00085 $products_options_details_noname = ''; 00086 $tmp_radio = ''; 00087 $tmp_checkbox = ''; 00088 $tmp_html = ''; 00089 $selected_attribute = false; 00090 00091 $tmp_attributes_image = ''; 00092 $tmp_attributes_image_row = 0; 00093 $show_attributes_qty_prices_icon = 'false'; 00094 while (!$products_options->EOF) { 00095 // reset 00096 $products_options_display_price=''; 00097 $new_attributes_price= ''; 00098 $price_onetime = ''; 00099 00100 $products_options_array[] = array('id' => $products_options->fields['products_options_values_id'], 00101 'text' => $products_options->fields['products_options_values_name']); 00102 00103 if (((CUSTOMERS_APPROVAL == '2' and $_SESSION['customer_id'] == '') or (STORE_STATUS == '1')) or (CUSTOMERS_APPROVAL_AUTHORIZATION == 2 and $_SESSION['customers_authorization'] != 0)) { 00104 $new_attributes_price = ''; 00105 $new_options_values_price = 0; 00106 $products_options_display_price = ''; 00107 $price_onetime = ''; 00108 } else { 00109 // collect price information if it exists 00110 if ($products_options->fields['attributes_discounted'] == 1) { 00111 // apply product discount to attributes if discount is on 00112 // $new_attributes_price = $products_options->fields['options_values_price']; 00113 $new_attributes_price = zen_get_attributes_price_final($products_options->fields["products_attributes_id"], 1, '', 'false'); 00114 $new_attributes_price = zen_get_discount_calc((int)$_GET['products_id'], true, $new_attributes_price); 00115 } else { 00116 // discount is off do not apply 00117 $new_attributes_price = $products_options->fields['options_values_price']; 00118 } 00119 00120 if ($products_options->fields['attributes_price_onetime'] != 0 or $products_options->fields['attributes_price_factor_onetime'] != 0) { 00121 $show_onetime_charges_description = 'true'; 00122 $new_onetime_charges = zen_get_attributes_price_final_onetime($products_options->fields["products_attributes_id"], 1, ''); 00123 $price_onetime = TEXT_ONETIME_CHARGE_SYMBOL . $currencies->display_price($new_onetime_charges, 00124 zen_get_tax_rate($product_info->fields['products_tax_class_id'])); 00125 } else { 00126 $price_onetime = ''; 00127 } 00128 00129 if ($products_options->fields['attributes_qty_prices'] != '' or $products_options->fields['attributes_qty_prices_onetime'] != '') { 00130 $show_attributes_qty_prices_description = 'true'; 00131 $show_attributes_qty_prices_icon = 'true'; 00132 } 00133 00134 if ($products_options->fields['options_values_price'] != '0' and ($products_options->fields['product_attribute_is_free'] != '1' and $product_info->fields['product_is_free'] != '1')) { 00135 // show sale maker discount if a percentage 00136 $products_options_display_price= ' (' . $products_options->fields['price_prefix'] . 00137 $currencies->display_price($new_attributes_price, 00138 zen_get_tax_rate($product_info->fields['products_tax_class_id'])) . ') '; 00139 } else { 00140 // if product_is_free and product_attribute_is_free 00141 if ($products_options->fields['product_attribute_is_free'] == '1' and $product_info->fields['product_is_free'] == '1') { 00142 $products_options_display_price= TEXT_ATTRIBUTES_PRICE_WAS . $products_options->fields['price_prefix'] . 00143 $currencies->display_price($new_attributes_price, 00144 zen_get_tax_rate($product_info->fields['products_tax_class_id'])) . TEXT_ATTRIBUTE_IS_FREE; 00145 } else { 00146 // normal price 00147 if ($new_attributes_price == 0) { 00148 $products_options_display_price= ''; 00149 } else { 00150 $products_options_display_price= ' (' . $products_options->fields['price_prefix'] . 00151 $currencies->display_price($new_attributes_price, 00152 zen_get_tax_rate($product_info->fields['products_tax_class_id'])) . ') '; 00153 } 00154 } 00155 } 00156 00157 $products_options_display_price .= $price_onetime; 00158 00159 } // approve 00160 $products_options_array[sizeof($products_options_array)-1]['text'] .= $products_options_display_price; 00161 00162 // collect weight information if it exists zen_get_show_product_switch($prod_id, 'WEIGHT_ATTRIBUTES') 00163 if ((zen_get_show_product_switch($prod_id, 'WEIGHT_ATTRIBUTES') =='1' and $products_options->fields['products_attributes_weight'] != '0')) { 00164 $products_options_display_weight = ' (' . $products_options->fields['products_attributes_weight_prefix'] . round($products_options->fields['products_attributes_weight'],2) . TEXT_PRODUCT_WEIGHT_UNIT . ')'; 00165 $products_options_array[sizeof($products_options_array)-1]['text'] .= $products_options_display_weight; 00166 } else { 00167 // reset 00168 $products_options_display_weight=''; 00169 } 00170 00171 // prepare product options details 00172 $prod_id = $_GET['products_id']; 00173 //die($prod_id); 00174 if ($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'] == PRODUCTS_OPTIONS_TYPE_CHECKBOX or $products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_RADIO or $products_options->RecordCount() == 1 or $products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_READONLY) { 00175 $products_options_value_id = $products_options->fields['products_options_values_id']; 00176 if ($products_options_names->fields['products_options_type'] != PRODUCTS_OPTIONS_TYPE_TEXT and $products_options_names->fields['products_options_type'] != PRODUCTS_OPTIONS_TYPE_FILE) { 00177 $products_options_details = $products_options->fields['products_options_values_name']; 00178 } else { 00179 // don't show option value name on TEXT or filename 00180 $products_options_details = ''; 00181 } 00182 if ($products_options_names->fields['products_options_images_style'] >= 3) { 00183 $products_options_details .= $products_options_display_price . ($products_options->fields['options_values_price'] != 0 ? '<br />' . $products_options_display_weight : ''); 00184 $products_options_details_noname = $products_options_display_price . ($products_options->fields['options_values_price'] != 0 ? '<br />' . $products_options_display_weight : ''); 00185 } else { 00186 $products_options_details .= $products_options_display_price . ($products_options->fields['options_values_price'] != 0 ? ' ' . $products_options_display_weight : ''); 00187 $products_options_details_noname = $products_options_display_price . ($products_options->fields['options_values_price'] != 0 ? ' ' . $products_options_display_weight : ''); 00188 } 00189 } 00190 00191 // radio buttons 00192 //echo $prod_id; 00193 //echo $_SESSION['cart']->in_cart($prod_id); 00194 00195 00196 00197 if ($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_RADIO) { 00198 if (false) { 00199 if ($_SESSION['cart']->contents[$prod_id]['attributes'][$products_options_names->fields['products_options_id']] == $products_options->fields['products_options_values_id']) { 00200 $selected_attribute = $_SESSION['cart']->contents[$prod_id]['attributes'][$products_options_names->fields['products_options_id']]; 00201 } else { 00202 $selected_attribute = false; 00203 } 00204 } else { 00205 // $selected_attribute = ($products_options->fields['attributes_default']=='1' ? true : false); 00206 // if an error, set to customer setting 00207 if ($_POST['id'] !='') { 00208 $selected_attribute= false; 00209 reset($_POST['id']); 00210 while(list($key,$value) = each($_POST['id'])) { 00211 if (($key == $products_options_names->fields['products_options_id'] and $value == $products_options->fields['products_options_values_id'])) { 00212 // zen_get_products_name($_POST['products_id']) . 00213 $selected_attribute = true; 00214 break; 00215 } 00216 } 00217 } else { 00218 $selected_attribute = ($products_options->fields['attributes_default']=='1' ? true : false); 00219 } 00220 } 00221 00222 switch ($products_options_names->fields['products_options_images_style']) { 00223 case '0': 00224 $tmp_radio .= zen_draw_radio_field('id[' . $products_options_names->fields['products_options_id'] . ']', 00225 $products_options_value_id, $selected_attribute) . $products_options_details . '<br />'; 00226 break; 00227 case '1': 00228 $tmp_radio .= zen_draw_radio_field('id[' . $products_options_names->fields['products_options_id'] . ']', 00229 $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"') . ' ' : '') . $products_options_details . '<br />'; 00230 break; 00231 case '2': 00232 $tmp_radio .= zen_draw_radio_field('id[' . $products_options_names->fields['products_options_id'] . ']', 00233 $products_options_value_id, $selected_attribute) . $products_options_details . 00234 ($products_options->fields['attributes_image'] != '' ? '<br />' . zen_image(DIR_WS_CATALOG_IMAGES . $products_options->fields['attributes_image'], '', '', '', 'hspace="5" vspace="5"') : '') . '<br />'; 00235 break; 00236 00237 case '3': 00238 $tmp_attributes_image_row++; 00239 00240 // if ($tmp_attributes_image_row > PRODUCTS_IMAGES_ATTRIBUTES_PER_ROW) { 00241 if ($tmp_attributes_image_row > $products_options_names->fields['products_options_images_per_row']) { 00242 $tmp_attributes_image .= '</tr><tr>'; 00243 $tmp_attributes_image_row = 1; 00244 } 00245 00246 if ($products_options->fields['attributes_image'] != '') { 00247 $tmp_attributes_image .= '<td class="smallText" align="center" valign="top">' . zen_draw_radio_field('id[' . $products_options_names->fields['products_options_id'] . ']', 00248 $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>'; 00249 } else { 00250 $tmp_attributes_image .= '<td class="smallText" align="center" valign="top">' . zen_draw_radio_field('id[' . $products_options_names->fields['products_options_id'] . ']', 00251 $products_options_value_id, $selected_attribute) . '<br />' . $products_options->fields['products_options_values_name'] . $products_options_details_noname . '</td>'; 00252 } 00253 break; 00254 00255 case '4': 00256 $tmp_attributes_image_row++; 00257 00258 // if ($tmp_attributes_image_row > PRODUCTS_IMAGES_ATTRIBUTES_PER_ROW) { 00259 if ($tmp_attributes_image_row > $products_options_names->fields['products_options_images_per_row']) { 00260 $tmp_attributes_image .= '</tr><tr>'; 00261 $tmp_attributes_image_row = 1; 00262 } 00263 00264 if ($products_options->fields['attributes_image'] != '') { 00265 $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'] . ']', 00266 $products_options_value_id, $selected_attribute) . '</td>'; 00267 } else { 00268 $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'] . ']', 00269 $products_options_value_id, $selected_attribute) . '</td>'; 00270 } 00271 break; 00272 00273 case '5': 00274 $tmp_attributes_image_row++; 00275 00276 // if ($tmp_attributes_image_row > PRODUCTS_IMAGES_ATTRIBUTES_PER_ROW) { 00277 if ($tmp_attributes_image_row > $products_options_names->fields['products_options_images_per_row']) { 00278 $tmp_attributes_image .= '</tr><tr>'; 00279 $tmp_attributes_image_row = 1; 00280 } 00281 00282 if ($products_options->fields['attributes_image'] != '') { 00283 $tmp_attributes_image .= '<td class="smallText" align="center" valign="top">' . zen_draw_radio_field('id[' . $products_options_names->fields['products_options_id'] . ']', 00284 $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>'; 00285 } else { 00286 $tmp_attributes_image .= '<td class="smallText" align="center" valign="top">' . zen_draw_radio_field('id[' . $products_options_names->fields['products_options_id'] . ']', 00287 $products_options_value_id, $selected_attribute) . '<br />' . $products_options->fields['products_options_values_name'] . ($products_options_details_noname != '' ? '<br />' . $products_options_details_noname : '') . '</td>'; 00288 } 00289 break; 00290 } 00291 } 00292 00293 // checkboxes 00294 if ($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_CHECKBOX) { 00295 $string = $products_options_names->fields['products_options_id'].'_chk'.$products_options->fields['products_options_values_id']; 00296 if (false) { 00297 if ($_SESSION['cart']->contents[$prod_id]['attributes'][$string] == $products_options->fields['products_options_values_id']) { 00298 $selected_attribute = true; 00299 } else { 00300 $selected_attribute = false; 00301 } 00302 } else { 00303 // $selected_attribute = ($products_options->fields['attributes_default']=='1' ? true : false); 00304 // if an error, set to customer setting 00305 if ($_POST['id'] !='') { 00306 $selected_attribute= false; 00307 reset($_POST['id']); 00308 while(list($key,$value) = each($_POST['id'])) { 00309 if (is_array($value)) { 00310 while(list($kkey,$vvalue) = each($value)) { 00311 if (($key == $products_options_names->fields['products_options_id'] and $vvalue == $products_options->fields['products_options_values_id'])) { 00312 $selected_attribute = true; 00313 break; 00314 } 00315 } 00316 } else { 00317 if (($key == $products_options_names->fields['products_options_id'] and $value == $products_options->fields['products_options_values_id'])) { 00318 // zen_get_products_name($_POST['products_id']) . 00319 $selected_attribute = true; 00320 break; 00321 } 00322 } 00323 } 00324 } else { 00325 $selected_attribute = ($products_options->fields['attributes_default']=='1' ? true : false); 00326 } 00327 } 00328 00329 /* 00330 $tmp_checkbox .= zen_draw_checkbox_field('id[' . $products_options_names->fields['products_options_id'] . ']['.$products_options_value_id.']', 00331 $products_options_value_id, $selected_attribute) . $products_options_details .'<br />'; 00332 */ 00333 switch ($products_options_names->fields['products_options_images_style']) { 00334 case '0': 00335 $tmp_checkbox .= zen_draw_checkbox_field('id[' . $products_options_names->fields['products_options_id'] . ']['.$products_options_value_id.']', 00336 $products_options_value_id, $selected_attribute) . $products_options_details .'<br />'; 00337 break; 00338 case '1': 00339 $tmp_checkbox .= zen_draw_checkbox_field('id[' . $products_options_names->fields['products_options_id'] . ']['.$products_options_value_id.']', 00340 $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"') . ' ' : '') . $products_options_details . '<br />'; 00341 break; 00342 case '2': 00343 $tmp_checkbox .= zen_draw_checkbox_field('id[' . $products_options_names->fields['products_options_id'] . ']['.$products_options_value_id.']', 00344 $products_options_value_id, $selected_attribute) . $products_options_details . 00345 ($products_options->fields['attributes_image'] != '' ? '<br />' . zen_image(DIR_WS_CATALOG_IMAGES . $products_options->fields['attributes_image'], '', '', '', 'hspace="5" vspace="5"') : '') . '<br />'; 00346 break; 00347 00348 case '3': 00349 $tmp_attributes_image_row++; 00350 00351 // if ($tmp_attributes_image_row > PRODUCTS_IMAGES_ATTRIBUTES_PER_ROW) { 00352 if ($tmp_attributes_image_row > $products_options_names->fields['products_options_images_per_row']) { 00353 $tmp_attributes_image .= '</tr><tr>'; 00354 $tmp_attributes_image_row = 1; 00355 } 00356 00357 if ($products_options->fields['attributes_image'] != '') { 00358 $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.']', 00359 $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>'; 00360 } else { 00361 $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.']', 00362 $products_options_value_id, $selected_attribute) . '<br />' . $products_options->fields['products_options_values_name'] . $products_options_details_noname . '</td>'; 00363 } 00364 break; 00365 00366 case '4': 00367 $tmp_attributes_image_row++; 00368 00369 // if ($tmp_attributes_image_row > PRODUCTS_IMAGES_ATTRIBUTES_PER_ROW) { 00370 if ($tmp_attributes_image_row > $products_options_names->fields['products_options_images_per_row']) { 00371 $tmp_attributes_image .= '</tr><tr>'; 00372 $tmp_attributes_image_row = 1; 00373 } 00374 00375 if ($products_options->fields['attributes_image'] != '') { 00376 $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.']', 00377 $products_options_value_id, $selected_attribute) . '</td>'; 00378 } else { 00379 $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.']', 00380 $products_options_value_id, $selected_attribute) . '</td>'; 00381 } 00382 break; 00383 00384 case '5': 00385 $tmp_attributes_image_row++; 00386 00387 // if ($tmp_attributes_image_row > PRODUCTS_IMAGES_ATTRIBUTES_PER_ROW) { 00388 if ($tmp_attributes_image_row > $products_options_names->fields['products_options_images_per_row']) { 00389 $tmp_attributes_image .= '</tr><tr>'; 00390 $tmp_attributes_image_row = 1; 00391 } 00392 00393 if ($products_options->fields['attributes_image'] != '') { 00394 $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.']', 00395 $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>'; 00396 } else { 00397 $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.']', 00398 $products_options_value_id, $selected_attribute) . '<br />' . $products_options->fields['products_options_values_name'] . ($products_options_details_noname != '' ? '<br />' . $products_options_details_noname : '') . '</td>'; 00399 } 00400 break; 00401 } 00402 } 00403 00404 00405 // text 00406 if (($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_TEXT)) { 00407 //CLR 030714 Add logic for text option 00408 // $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'] . "'"); 00409 // $products_attribs_array = zen_db_fetch_array($products_attribs_query); 00410 if ($_POST['id']) { 00411 reset($_POST['id']); 00412 while(list($key,$value) = each($_POST['id'])) { 00413 if ((preg_replace('/txt_/', '', $key) == $products_options_names->fields['products_options_id'])) { 00414 $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) .'" /> '; 00415 $tmp_html .= $products_options_details; 00416 break; 00417 } 00418 } 00419 00420 } else { 00421 $tmp_value = $_SESSION['cart']->contents[$_GET['products_id']]['attributes_values'][$products_options_names->fields['products_options_id']]; 00422 $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) .'" /> '; 00423 $tmp_html .= $products_options_details; 00424 $tmp_word_cnt_string = ''; 00425 // calculate word charges 00426 $tmp_word_cnt =0; 00427 $tmp_word_cnt_string = $_SESSION['cart']->contents[$_GET['products_id']]['attributes_values'][$products_options_names->fields['products_options_id']]; 00428 $tmp_word_cnt = zen_get_word_count($tmp_word_cnt_string, $products_options->fields['attributes_price_words_free']); 00429 $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']); 00430 00431 if ($products_options->fields['attributes_price_words'] != 0) { 00432 $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'] : ''); 00433 } 00434 if ($tmp_word_cnt != 0 and $tmp_word_price != 0) { 00435 $tmp_word_price = $currencies->display_price($tmp_word_price, zen_get_tax_rate($product_info->fields['products_tax_class_id'])); 00436 $tmp_html = $tmp_html . '<br />' . TEXT_CHARGES_WORD . ' ' . $tmp_word_cnt . ' = ' . $tmp_word_price; 00437 } 00438 // calculate letter charges 00439 $tmp_letters_cnt =0; 00440 $tmp_letters_cnt_string = $_SESSION['cart']->contents[$_GET['products_id']]['attributes_values'][$products_options_names->fields['products_options_id']]; 00441 $tmp_letters_cnt = zen_get_letters_count($tmp_letters_cnt_string, $products_options->fields['attributes_price_letters_free']); 00442 $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']); 00443 00444 if ($products_options->fields['attributes_price_letters'] != 0) { 00445 $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'] : ''); 00446 } 00447 if ($tmp_letters_cnt != 0 and $tmp_letters_price != 0) { 00448 $tmp_letters_price = $currencies->display_price($tmp_letters_price, zen_get_tax_rate($product_info->fields['products_tax_class_id'])); 00449 $tmp_html = $tmp_html . '<br />' . TEXT_CHARGES_LETTERS . ' ' . $tmp_letters_cnt . ' = ' . $tmp_letters_price; 00450 } 00451 00452 } 00453 } 00454 00455 // file uploads 00456 00457 // iii 030813 added: support for file fields 00458 if ($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_FILE) { 00459 $number_of_uploads++; 00460 // $cart->contents[$_GET['products_id']]['attributes_values'][$products_options_name['products_options_id']] 00461 $tmp_html = '<input type="file" name="id[' . TEXT_PREFIX . $products_options_names->fields['products_options_id'] . ']" /><br />' . 00462 $_SESSION['cart']->contents[$prod_id]['attributes_values'][$products_options_names->fields['products_options_id']] . 00463 zen_draw_hidden_field(UPLOAD_PREFIX . $number_of_uploads, $products_options_names->fields['products_options_id']) . 00464 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']]); 00465 $tmp_html .= $products_options_details; 00466 } 00467 00468 00469 // collect attribute image if it exists and to draw in table below 00470 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') ) { 00471 if ($products_options->fields['attributes_image'] != '') { 00472 $tmp_attributes_image_row++; 00473 00474 // if ($tmp_attributes_image_row > PRODUCTS_IMAGES_ATTRIBUTES_PER_ROW) { 00475 if ($tmp_attributes_image_row > $products_options_names->fields['products_options_images_per_row']) { 00476 $tmp_attributes_image .= '</tr><tr>'; 00477 $tmp_attributes_image_row = 1; 00478 } 00479 00480 $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>'; 00481 } 00482 } 00483 00484 // Read Only - just for display purposes 00485 if ($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_READONLY) { 00486 // $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']; 00487 $tmp_html .= $products_options_details . '<br />'; 00488 } else { 00489 $zv_display_select_option ++; 00490 } 00491 00492 00493 // default 00494 // find default attribute if set to for default dropdown 00495 if ($products_options->fields['attributes_default']=='1') { 00496 $selected_attribute = $products_options->fields['products_options_values_id']; 00497 } 00498 00499 $products_options->MoveNext(); 00500 00501 } 00502 00503 //echo 'TEST I AM ' . $products_options_names->fields['products_options_name'] . ' Type - ' . $products_options_names->fields['products_options_type'] . '<br />'; 00504 // Option Name Type Display 00505 switch (true) { 00506 // text 00507 case ($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_TEXT): 00508 if ($show_attributes_qty_prices_icon == 'true') { 00509 $options_name[] = ATTRIBUTES_QTY_PRICE_SYMBOL . $products_options_names->fields['products_options_name']; 00510 } else { 00511 $options_name[] = $products_options_names->fields['products_options_name']; 00512 } 00513 $options_menu[] = $tmp_html; 00514 $options_comment[] = $products_options_names->fields['products_options_comment']; 00515 $options_comment_position[] = ($products_options_names->fields['products_options_comment_position'] == '1' ? '1' : '0'); 00516 break; 00517 // checkbox 00518 case ($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_CHECKBOX): 00519 if ($show_attributes_qty_prices_icon == 'true') { 00520 $options_name[] = ATTRIBUTES_QTY_PRICE_SYMBOL . $products_options_names->fields['products_options_name']; 00521 } else { 00522 $options_name[] = $products_options_names->fields['products_options_name']; 00523 } 00524 $options_menu[] = $tmp_checkbox; 00525 $options_comment[] = $products_options_names->fields['products_options_comment']; 00526 $options_comment_position[] = ($products_options_names->fields['products_options_comment_position'] == '1' ? '1' : '0'); 00527 break; 00528 // radio buttons 00529 case ($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_RADIO): 00530 if ($show_attributes_qty_prices_icon == 'true') { 00531 $options_name[] = ATTRIBUTES_QTY_PRICE_SYMBOL . $products_options_names->fields['products_options_name']; 00532 } else { 00533 $options_name[] = $products_options_names->fields['products_options_name']; 00534 } 00535 $options_menu[] = $tmp_radio; 00536 $options_comment[] = $products_options_names->fields['products_options_comment']; 00537 $options_comment_position[] = ($products_options_names->fields['products_options_comment_position'] == '1' ? '1' : '0'); 00538 break; 00539 // file upload 00540 case ($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_FILE): 00541 if ($show_attributes_qty_prices_icon == 'true') { 00542 $options_name[] = ATTRIBUTES_QTY_PRICE_SYMBOL . $products_options_names->fields['products_options_name']; 00543 } else { 00544 $options_name[] = $products_options_names->fields['products_options_name']; 00545 } 00546 $options_menu[] = $tmp_html; 00547 $options_comment[] = $products_options_names->fields['products_options_comment']; 00548 $options_comment_position[] = ($products_options_names->fields['products_options_comment_position'] == '1' ? '1' : '0'); 00549 break; 00550 // READONLY 00551 case ($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_READONLY): 00552 $options_name[] = $products_options_names->fields['products_options_name']; 00553 $options_menu[] = $tmp_html; 00554 $options_comment[] = $products_options_names->fields['products_options_comment']; 00555 $options_comment_position[] = ($products_options_names->fields['products_options_comment_position'] == '1' ? '1' : '0'); 00556 break; 00557 // dropdownmenu auto switch to selected radio button display 00558 case ($products_options->RecordCount() == 1): 00559 if ($show_attributes_qty_prices_icon == 'true') { 00560 $options_name[] = ATTRIBUTES_QTY_PRICE_SYMBOL . $products_options_names->fields['products_options_name']; 00561 } else { 00562 $options_name[] = $products_options_names->fields['products_options_name']; 00563 } 00564 $options_menu[] = zen_draw_radio_field('id[' . $products_options_names->fields['products_options_id'] . ']', 00565 $products_options_value_id, 'selected') . $products_options_details; 00566 $options_comment[] = $products_options_names->fields['products_options_comment']; 00567 $options_comment_position[] = ($products_options_names->fields['products_options_comment_position'] == '1' ? '1' : '0'); 00568 break; 00569 default: 00570 // normal dropdown menu display 00571 if (isset($_SESSION['cart']->contents[$prod_id]['attributes'][$products_options_names->fields['products_options_id']])) { 00572 $selected_attribute = $_SESSION['cart']->contents[$prod_id]['attributes'][$products_options_names->fields['products_options_id']]; 00573 } else { 00574 // selected set above 00575 // echo 'Type ' . $products_options_names->fields['products_options_type'] . '<br />'; 00576 } 00577 00578 if ($show_attributes_qty_prices_icon == 'true') { 00579 $options_name[] = ATTRIBUTES_QTY_PRICE_SYMBOL . $products_options_names->fields['products_options_name']; 00580 } else { 00581 $options_name[] = $products_options_names->fields['products_options_name']; 00582 } 00583 00584 00585 $options_menu[] = zen_draw_pull_down_menu('id[' . $products_options_names->fields['products_options_id'] . ']', 00586 $products_options_array, $selected_attribute); 00587 $options_comment[] = $products_options_names->fields['products_options_comment']; 00588 $options_comment_position[] = ($products_options_names->fields['products_options_comment_position'] == '1' ? '1' : '0'); 00589 break; 00590 } 00591 00592 // attributes images table 00593 $options_attributes_image[] = $tmp_attributes_image; 00594 $products_options_names->MoveNext(); 00595 } 00596 // manage filename uploads 00597 $_GET['number_of_uploads'] = $number_of_uploads; 00598 // zen_draw_hidden_field('number_of_uploads', $_GET['number_of_uploads']); 00599 zen_draw_hidden_field('number_of_uploads', $number_of_uploads); 00600 } 00601 00605 00606 ?>