24. februar 2009 - 16:23
Der er
13 kommentarer og 1 løsning
fortrykt antal i boks
Jeg skal i oscommerce have et fortrykt antal (1) i en input boks. Koden ser sådan ud: $products[$i]['quantity']=1; $info_box_contents[$cur_row][] = array('align' => 'center', 'params' => 'class="productListing-data" valign="top"', 'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id'])); Som det er nu kan man rette 1 tallet eller slette det. det skal være så man ikke kan fjerne det... Hvordan laver jeg det ??
Annonceindlæg tema
Forsvar & beredskab
Cybersikkerhed, realtidsdata og robuste it-systemer er blevet fundamentet for moderne forsvar.
24. februar 2009 - 17:41
#1
mener der er noget med at man kan "låse" tal fast i input bokse ....??
24. februar 2009 - 21:14
#2
Hvis du ændre 'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], TIL: 'text' => tep_hidden_input_field('cart_quantity[]', $products[$i]['quantity'], Så bliver det til et "usyneligt" felt
24. februar 2009 - 21:21
#3
straszek okay men hvad bliver værdien så af det ?? gør ikke noget at man kan se at antallet er lig 1..
24. februar 2009 - 21:27
#4
Værdien?
24. februar 2009 - 21:32
#5
24. februar 2009 - 21:41
#6
Ja, det er derfor du skal ændre det til et skjult felt med værdien 1, og så må du skrive 1 i teksten til feltet, lige foran eller bagefter det skjulte felt.
24. februar 2009 - 21:42
#7
okay på den måde. det vil jeg lige kigge på..
25. februar 2009 - 09:58
#8
jeg får denne meddelelse: Call to undefined function tep_hidden_input_field() ?? Det er vel en funktion som ikke er defineret....
25. februar 2009 - 10:04
#9
det er vel denne jeg skal have ændret i... // Output a form input field function tep_draw_input_field($name, $value = '', $parameters = '', $type = 'text', $reinsert_value = true) { $field = '<input type="' . tep_output_string($type) . '" name="' . tep_output_string($name) . '"'.($type = 'text' ? ' class=go' : ''); if ( (isset($GLOBALS[$name])) && ($reinsert_value == true) ) { $field .= ' value="' . tep_output_string(stripslashes($GLOBALS[$name])) . '"'; } elseif (tep_not_null($value)) { $field .= ' value="' . tep_output_string($value) . '"'; } if (tep_not_null($parameters)) $field .= ' ' . $parameters; $field .= '>'; return $field; }
25. februar 2009 - 10:25
#10
okay bruger nu: tep_draw_hidden_field og så er det skjult, men kan ikke rigtig få placeret 1 tallet på samme plads ? Her er koden hvis nogen kan hjælpe med hvor jeg skal skrive 1 tallet i stedet for den skjulte boks .. <tr> <td> <?php $info_box_contents = array(); $info_box_contents[0][] = array('align' => 'center', 'params' => 'class="productListing-heading"', 'text' => TABLE_HEADING_REMOVE); $info_box_contents[0][] = array('params' => 'class="productListing-heading"', 'text' => TABLE_HEADING_PRODUCTS); $info_box_contents[0][] = array('align' => 'center', 'params' => 'class="productListing-heading"', 'text' => TABLE_HEADING_QUANTITY); $info_box_contents[0][] = array('align' => 'right', 'params' => 'class="productListing-heading"', 'text' => TABLE_HEADING_TOTAL); $any_out_of_stock = 0; $products = $cart->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { // Push all attributes information in an array if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { while (list($option, $value) = each($products[$i]['attributes'])) { echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value); $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $products[$i]['id'] . "' and pa.options_id = '" . $option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'"); $attributes_values = tep_db_fetch_array($attributes); $products[$i][$option]['products_options_name'] = $attributes_values['products_options_name']; $products[$i][$option]['options_values_id'] = $value; $products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name']; $products[$i][$option]['options_values_price'] = $attributes_values['options_values_price']; $products[$i][$option]['price_prefix'] = $attributes_values['price_prefix']; } } } for ($i=0, $n=sizeof($products); $i<$n; $i++) { if (($i/2) == floor($i/2)) { $info_box_contents[] = array('params' => 'class="productListing-even"'); } else { $info_box_contents[] = array('params' => 'class="productListing-odd"'); } $cur_row = sizeof($info_box_contents) - 1; $info_box_contents[$cur_row][] = array('align' => 'center', 'params' => 'class="productListing-data" valign="top"', 'text' => tep_draw_checkbox_field('cart_delete[]', $products[$i]['id'])); $products_name = '<table border="0" cellspacing="2" cellpadding="2">' . ' <tr>' . ' <td class="productListing-data" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>' . ' <td class="productListing-data" valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b></a>'; if (STOCK_CHECK == 'true') { $stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']); if (tep_not_null($stock_check)) { $any_out_of_stock = 1; $products_name .= $stock_check; } } if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { reset($products[$i]['attributes']); while (list($option, $value) = each($products[$i]['attributes'])) { $products_name .= '<br><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>'; } } $products_name .= ' </td>' . ' </tr>' . '</table>'; $info_box_contents[$cur_row][] = array('params' => 'class="productListing-data"', 'text' => $products_name); $info_box_contents[$cur_row][] = array('align' => 'center', 'params' => 'class="productListing-data" valign="top"', 'text' => tep_draw_hidden_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id'])); $info_box_contents[$cur_row][] = array('align' => 'right', 'params' => 'class="productListing-data" valign="top"', 'text' => '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</b>'); } new productListingBox($info_box_contents); ?> </td> </tr>
25. februar 2009 - 14:30
#11
'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') rettes til: 'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4" disabled')
25. februar 2009 - 16:01
#12
splazz okay det vil jeg prøve. Bliver det så usynligt ?? Hvor kan jeg indsætte 1 tallet ??
25. februar 2009 - 16:22
#13
splazz fint så er det som det skal være.. Takker mange gange for hjælpen!
26. februar 2009 - 08:53
#14
selv tak, tak for point
Vi tilbyder markedets bedste kurser inden for webudvikling