adding div to item options in display.php
-
I have tweaked the css to change the styling of the add to cart options, and this has worked fine for the products that are simple. But for products where there are various options, eg size or colour, the css changes are not working.
Therefore, I am wanting to add a div around the item option section of the code, but my php skills are basic and although I can add a div it is causing the product name to vanish! Below is the code from display.php from line 184 onwards …. including my attempt to add <div class=’item_options_box’>:
$output .= "<p id='cartname'>".$name . "</p>"; $output .= "<p id='cartcontent'>"; if (!empty ($item['options'])){ if ( $item['options_name'] != "" ) { $output .= $item['options_name'].": \n"; } $output .= "<input type='hidden' value='".$item['options_name']."' name='item_options_name' class ='item_options_name' />\n"; $options = explode(',',$item['options']); $output = "<div class='item_options_box'>\n"; $output .= "<select name='item_options' class = 'item_options' >\n"; foreach ($options as $option){ $info = explode(':',$option); if (count($info) == 1) { $output .= "<option value='".$info[0]."'>".$info[0]." (". $currency.number_format($item['price'],2) . ")</option>\n"; } else { $output .= "<option value='".$info[0].":" . $info[1]. "'>".$info[0]." (". $currency.number_format($info[1],2) . ")</option>\n"; } } $output .= "</select>\n"; $output .= "<br/>\n"; } else { $output .= __("Unit Price: ",'SCABN').trim($currency.number_format($item['price'],2)).__(" each",'SCABN')."<br/>"; } if(array_key_exists('qty_field',$item)) { $output .= __("Qty:",'SCABN'); $output .= "<input type='text' class='item_qty' value='1' size='2' name='item_qty'/>\n"; } else { $output .= "<input type='hidden' class='item_qty' value='1' size='2' name='item_qty'/>\n"; } if (array_key_exists('no_cart',$item)) { $output .= "<input type='hidden' value='true' name='no_cart'/>\n"; } if (array_key_exists('b_title',$item)) { $b_title=$item['b_title']; } else { $b_title=__('Add to Cart','SCABN'); } $output .= "<input type='submit' id='".$item_id."' ".$add_class." name='add' value='".$b_title."'/>\n"; $output .= "</div>\n"; $output .= "</form>\n"; $output .= "</p>\n"; $output .= "</div>\n";
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘adding div to item options in display.php’ is closed to new replies.