WebsiteBaker Support (2.8.x) > Bakery Shop
option values as checkbox in stead of selectbox
(1/1)
Bug:
is there a way to change the selectbox for the option values into a checkboxlist
something like
--- Code: ---// Show form to add new item attributes
echo "<tr height='50' class='mod_showroom_submit_row_b'>\n<td>\n";
// Get options and attributes
$query_options = $database->query("SELECT o.option_name, o.option_id, a.attribute_id, a.attribute_name FROM ".TABLE_PREFIX."mod_showroom_options o INNER JOIN ".TABLE_PREFIX."mod_showroom_attributes a ON o.option_id = a.option_id ORDER BY o.option_name, a.attribute_name ASC");
if ($query_options->numRows() > 0) {
// Generate option and attribute select
while($option = $query_options->fetchRow()) {
$option = array_map('stripslashes', $option);
// Only display if not listed in the item attributes table above
if (in_array($option['attribute_id'], $listed_attribute_ids))
continue;
echo "<input type='checkbox' value='{$option['attribute_id']}'";
echo $attribute_id == $option['attribute_id'] ? " selected='selected'" : "";
echo "/>{$option['option_name']}: {$option['attribute_name']}<br />";
}
} else {
echo "{$TEXT['NONE_FOUND']} <a href='".WB_URL."/modules/showroom/modify_options.php?page_id=$page_id&section_id=$section_id'>> {$TEXT['ADD']}/<span style='text-transform: lowercase;'>{$TEXT['MODIFY']}/{$TEXT['DELETE']}</span></a>";
}
?>
</td>
<td align="left"><?php echo $fetch_settings['shop_currency']; ?>
<select name="ia_operator">
<option value="+"<?php echo $ia_operator == "+" ? " selected='selected'" : ""; ?>> + </option>
<option value="-"<?php echo $ia_operator == "-" ? " selected='selected'" : ""; ?>> - </option>
<option value="="<?php echo $ia_operator == "=" ? " selected='selected'" : ""; ?>> = </option>
</select>
<input type="text" name="ia_price" style="width: 60px; text-align: right;" maxlength="150" value="<?php echo $ia_price; ?>" />
<input type="hidden" name="db_action" value="<?php echo $db_action; ?>" />
</td>
<td> </td>
<td colspan="2"><input type="submit" name="save_attribute" value=" <?php echo $TEXT['ADD']; ?> " />
</td>
</tr>
</table>
</form>
--- End code ---
where i replaced the selectbox for
--- Code: ---echo "<input type='checkbox' value='{$option['attribute_id']}'";
echo $attribute_id == $option['attribute_id'] ? " selected='selected'" : "";
echo "/>{$option['option_name']}: {$option['attribute_name']}<br />";
--- End code ---
the problems:
- it does not save
- i do not know hoe to display the pricebox for each separate value
DarkViper:
a group of radio-buttons or checkboxes works like a dropdownbox
--- Code: ---<?php
</td>
<td align="left"><?php echo $fetch_settings['shop_currency']; ?>
<input type="checkbox" name="ia_operator" value="+"<?php echo $ia_operator == "+" ? " selected='selected'" : ""; ?> /> +
<input type="checkbox" name="ia_operator" value="-"<?php echo $ia_operator == "-" ? " selected='selected'" : ""; ?> /> -
<input type="checkbox" name="ia_operator" value="="<?php echo $ia_operator == "=" ? " selected='selected'" : ""; ?> /> =
<input type="text" name="ia_price" style="width: 60px; text-align: right;" maxlength="150" value="<?php echo $ia_price; ?>" />
?>
--- End code ---
but if one option only should be selectable, it's better to use radio-buttons
Bug:
I guess you are talking about frontend....
I am talking about the backend...
So no, it is never that only one option should be selected with optionvalues, otherwise one wou
D not have to use optionvalues...
This item is only available in red,
That does not need optionvalue
That item is available in green blue and pink,
One cannot select those colors to be added to the optionfields
Bug:
Can someone take a look at this?
Maybe freesbee himself?
I would really like it if i can choose all needed option. Alues at once in stead of selecting the options one by one
If anyone still does not get it, I am talking about the backend, where you put the item info in
I am building a t shirtshop with quite some option fields (4 categories, each 4 to 8 options) and for 150 shirt designs...
I just want selectboxes in stead of a dropdown optionselector
Navigation
[0] Message Index
Go to full version