Code: Select all
if ($frameoptions == 1) {
$frames = $ov_data;
$frameoptions = 2;
}Does anyone know what might be causing this. Thanks in advance.
Moderator: General Moderators
Code: Select all
if ($frameoptions == 1) {
$frames = $ov_data;
$frameoptions = 2;
}Code: Select all
<?php
// Store the information from the tables in arrays for easy of processing
$options = array();
$options_values = array();
while ($po = tep_db_fetch_array($products_options_query)) {
// we need to find the values name
if ( $po['options_type'] != 1 && $po['options_type'] != 4 ) {
$options_values_query = tep_db_query("select products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id ='". $po['options_values_id'] . "' and language_id = '" . (int)$languages_id . "'");
$ov = tep_db_fetch_array($options_values_query);
} else {
$ov['products_options_values_name'] = '';
}
$options[$po['options_id']] = array('name' => $po['products_options_name'], 'type' => $po['options_type'], 'length' => $po['options_length'], 'instructions' => $po['products_options_instruct']);
$options_values[$po['options_id']][$po['options_values_id']] = array('name' => stripslashes($ov['products_options_values_name']), 'price' => $po['options_values_price'], 'prefix' => $po['price_prefix']);
}
foreach ($options as $oID => $op_data) {
//frame options begin
//If frame accessories are available it will set frameoptions to 1 which will display the options.
if ($op_data['name'] == 'Frame') {
$frameoptions = "1";
}
//frame options end
switch ($op_data['type']) {
case 0:
$tmp_html = '<select name="id[' . $oID . ']">';
//to include only specific frames
if ($frameoptions == 1) {
$frames = $ov_data;
$frameoptions = 2;
}
foreach ( $options_values[$oID] as $vID => $ov_data ) {
if ( (float)$ov_data['price'] == 0 ) {
$price = ' ';
} else {
$price = '( '.$ov_data['prefix'] . ' ' . $currencies->display_price($ov_data['price'], $tax_rate).' )';
}
$tmp_html .= '<option value="' . $vID . '">' . $ov_data['name'] . ' ' . $price .'</option>';
} // End of the for loop on the option values
$tmp_html .= '</select>';
?>
<tr>
<td class="main"><?php echo $op_data['name'] . ':' . ($op_data['instructions'] != '' ? '<br /><span class="smallText">' . $op_data['instructions'] . '</span>' : '' ); ?></td>
<td class="main"><?php echo $tmp_html; ?></td>
</tr>
<?php
break;
} //end of switch
} //end of while
?>I thought about that and printed $frameoptions and $op_data['name'] through another loop. My test code looks like this:Burrito wrote:try echoing $op_data['type'] and $frameoptions inside your loop to make sure that they never reach the conditions that would reset the frames array. You are *potentially* resetting $frameoptions back to 1 with each iteration of the loop....don't know about $op_data['type'] though.
Code: Select all
//to include only specific frames
if ($frameoptions == 1) {
echo $frameoptions . '<br>';
$frames = $ov_data;
$frameoptions = 2;
foreach ( $options_values[$oID] as $vID => $ov_data ) {
echo $ov_data['name'] . '<br>';
}
}Code: Select all
foreach ($options as $oID => $op_data) {
//frame options begin
//If frame accessories are available it will set frameoptions to 1 which will display the options.
if ($op_data['name'] == 'Frame') {
$frameoptions = "1";d11wtq wrote:You potentially reset it here:
Echo something in that condition...Code: Select all
foreach ($options as $oID => $op_data) { //frame options begin //If frame accessories are available it will set frameoptions to 1 which will display the options. if ($op_data['name'] == 'Frame') { $frameoptions = "1";
Code: Select all
//If frame accessories are available it will set frameoptions to 1 which will display the options.
if ($op_data['name'] == 'Frame') {
echo 'first condition ' . $op_data['name'] . '<br>';
$frameoptions = "1";
}
//frame options endCode: Select all
//framing begin: to include only specific frames
if ($op_data['name'] == 'Frame') {
$frames = $ov_data;
$frameoptions = 2;
foreach ( $options_values[$oID] as $vID => $ov_data ) {
echo $ov_data['name'] . '<br>';
}
}
//framing end