Beispiel #1
0
function qtpro_doctor_formulate_product_investigation($facts_array, $formulate_style)
{
    $str_ret = '';
    switch ($formulate_style) {
        case 'short_suggestion':
            if ($facts_array['any_problems']) {
                if ($facts_array['summary_and_calc_stock_match'] != true && $facts_array['stock_entries_healthy'] != true) {
                    $str_ret = 'The database entries for this products stock is messy and the summary stock calculation is wrong. Please take a look at this <a href="' . tep_href_link("stock.php", 'product_id=' . $facts_array['id']) . '"><b>products stock</b></a>.';
                } elseif (!$facts_array['summary_and_calc_stock_match']) {
                    $str_ret = 'The summary stock calculation is wrong. Please take a look at this <a href="' . tep_href_link("stock.php", 'product_id=' . $facts_array['id']) . ' "><b>products stock</b></a>.';
                } elseif (!$facts_array['stock_entries_healthy']) {
                    $str_ret = 'The database entries for this products stock is messy. Please take a look at this <a href="' . tep_href_link("stock.php", 'product_id=' . $facts_array['id']) . ' "><b>products stock</b></a>.';
                } else {
                    $str_ret = "Errorcatsh 754780+94322354678";
                }
            } else {
                $str_ret = "This product is all ok.";
            }
            break;
        case 'detailed':
            //Create Header
            /*if($facts_array['any_problems']){
            			$str_ret ='<span style="color:red; font-weight: bold; font-size:1.2em;">This product needs attention!</span><br /><br />';
            		}else{
            			$str_ret ='<span style="color:green; font-weight: bold;">This product is all ok.</span><br /><br />';
            		}*/
            //Talk about summary and calc stock
            if ($facts_array['summary_and_calc_stock_match']) {
                $str_ret .= '<span style="color:green; font-weight: bold; font-size:1.2em;">The stock quantity summary is ok</span><br />
				This means that the current summary of this products quantity, which is in the database, is the value we get if we calculate it from scratch right now.<br />
				<b>The Summary stock is: ' . $facts_array['summary_stock'] . '</b><br /><br />';
            } else {
                $str_ret .= '<span style="color:red; font-weight: bold; font-size:1.2em;">The stock quantity summary is NOT ok</span><br />
				This means that the current summary of this products quantity, which is in the database, isn\'t the value we get if we calculate it from scratch right now.<br />
				<b>The current summary stock is: ' . $facts_array['summary_stock'] . '</b><br />
				<b>If we calculate it we get: ' . $facts_array['calc_stock'] . '</b><br /><br />';
            }
            //Talk about the health of the stock entries
            if ($facts_array['stock_entries_healthy']) {
                $str_ret .= '<span style="color:green; font-weight: bold; font-size:1.2em;">The options stock is ok</span><br />
				This means that the database entries for this product looks the way they should. No options are missing in any row. No option exist in any row where it should not.<br />
				<b>Total number of stock entries this product has: ' . $facts_array['stock_entries_count'] . '</b><br />
				<b>Number of messy entries: ' . $facts_array['sick_stock_entries_count'] . '</b><br />';
            } else {
                $str_ret .= '<span style="color:red; font-weight: bold; font-size:1.2em;">The options stock is NOT ok</span><br />
				This means that at least one of the database entries for this product is messed up. Either options are missing in rows or options exist in rows they should not.<br />
				<b>Total number of stock entries this product has: ' . $facts_array['stock_entries_count'] . '</b><br />
				<b>Number of messy entries: ' . $facts_array['sick_stock_entries_count'] . '</b><br /><br />';
                if (sizeof($facts_array['lacks_id_array']) > 0) {
                    $str_ret .= '<b>These options were missing in row(s):</b><br />';
                    foreach ($facts_array['lacks_id_array'] as $lack_id) {
                        $str_ret .= '<span style="color:red;"><b>' . tep_options_name($lack_id) . '</b></span><br />';
                    }
                    $str_ret .= '<span style="color:blue; font-weight: bold;">Possible solutions: </span>Delete the corresponding row(s) from the database or stop tracking the stock for that option.<br /><br />';
                }
                if (sizeof($facts_array['intruders_id_array']) > 0) {
                    $str_ret .= '<br /><b>These options exists in row(s) although they should not:</b><br />';
                    foreach ($facts_array['intruders_id_array'] as $intruder_id) {
                        $str_ret .= '<span style="color:red;"><b>' . tep_options_name($intruder_id) . '</b></span><br />';
                    }
                    $str_ret .= '<span style="color:blue; font-weight: bold;">Possible solutions: </span>Delete the corresponding row(s) from the database or start tracking the stock for that option.<br /><br />';
                }
            }
            //Talk about automatic solutions
            if ($facts_array['any_problems']) {
                $str_ret .= '<p><span style="color:blue; font-weight: bold; font-size:1.2em;">Automatic Solutions Avaliable:</span><br />';
                if (!$facts_array['stock_entries_healthy']) {
                    $str_ret .= '<p><a href="' . tep_href_link(FILENAME_QTPRODOCTOR, 'action=amputate&pID=' . $facts_array['id'], 'NONSSL') . '" class="menuBoxContentLink" target="_blank">Amputation (Deletes all messy rows)</a></p>';
                }
                if (!$facts_array['summary_and_calc_stock_match']) {
                    $str_ret .= '<p><a href="' . tep_href_link(FILENAME_QTPRODOCTOR, 'action=update_summary&pID=' . $facts_array['id'], 'NONSSL') . '" class="menuBoxContentLink" target="_blank">Set the summary stock to: ' . $facts_array['calc_stock'] . '</a></p>';
                }
                $str_ret .= '</p>';
            }
            break;
    }
    return $str_ret;
}
echo TABLE_HEADING_ACTION;
?>
&nbsp;</td>
          </tr>
          <tr>
            <td colspan="7"><?php 
echo tep_black_line();
?>
</td>
          </tr>
<?php 
$next_id = 1;
$attributes = tep_db_query($attributes);
while ($attributes_values = tep_db_fetch_array($attributes)) {
    $products_name_only = tep_get_products_name($attributes_values['products_id']);
    $options_name = tep_options_name($attributes_values['options_id']);
    $values_name = tep_values_name($attributes_values['options_values_id']);
    $rows++;
    ?>
          <tr class="<?php 
    echo floor($rows / 2) == $rows / 2 ? 'attributes-even' : 'attributes-odd';
    ?>
">
<?php 
    if ($action == 'update_attribute' && $HTTP_GET_VARS['attribute_id'] == $attributes_values['products_attributes_id']) {
        ?>
            <td class="smallText">&nbsp;<?php 
        echo $attributes_values['products_attributes_id'];
        ?>
<input type="hidden" name="attribute_id" value="<?php 
        echo $attributes_values['products_attributes_id'];
</th><th><?php 
        echo AAS_TEXT_AM_OPTION_NAME;
        ?>
</th><th><?php 
        echo AAS_TEXT_AM_OPTION_VALUE;
        ?>
</th><th style="width:150px;"><?php 
        echo AAS_TEXT_AM_ACTION;
        ?>
</th></tr>
				  </thead>
				  <tbody>
				
				  <?php 
        while ($values_values = tep_db_fetch_array($values)) {
            $options_name = tep_options_name($values_values['products_options_id']);
            $values_name = $values_values['products_options_values_name'];
            ?>
				  <tr id="tr_povid_<?php 
            echo $values_values['products_options_values_id'];
            ?>
">
					  <td><?php 
            echo $values_values['products_options_values_id'];
            ?>
</td>
					  <td class="v_poid" data-id="v_poid_<?php 
            echo $values_values['products_options_id'];
            ?>
"><?php 
            echo $options_name;