while ($products_stock_values = tep_db_fetch_array($products_stock_query)) { if ($products_stock_values['products_stock_quantity'] >= 0) { // Hide attribute row if stock level is negative - if you want to hide 0 values as well then remove the = from the line above. if ($products_stock_values['products_stock_quantity'] == 0) { $stockTableStyle = 'stockTableContentsZero'; } else { $stockTableStyle = 'stockTableContents'; } $html_ev_out .= ' <tr class="' . $stockTableStyle . '">'; $rowscounter += 1; $attributes = explode(",", $products_stock_values['products_stock_attributes']); //$total_price = $products_facts['products_price']; $total_price = $hi_product_price; foreach ($attributes as $attribute) { $attr = explode("-", $attribute); $html_ev_out .= ' <td class="' . $stockTableStyle . '" align="center">' . tep_values_name($attr[1]) . '</td>'; $total_price += $attributes_price[$attr[0]][$attr[1]]; } $total_price = $currencies->display_price($total_price, tep_get_tax_rate($products_facts['products_tax_class_id'])); $html_ev_out .= ' <td class="' . $stockTableStyle . '" align="center">' . $total_price . '</td>'; $html_ev_out .= ' <td class="' . $stockTableStyle . '" align="center">' . $products_stock_values['products_stock_quantity'] . '</td>'; $html_ev_out .= ' </tr>'; } } $html_ev_out .= '</table></td></tr></table>'; // Table is finished! $html_ev_out .= '</center></td></tr>'; // Close fallback table if ($rowscounter > 0) { echo $html_ev_out; }
?> </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"> <?php echo $attributes_values['products_attributes_id']; ?> <input type="hidden" name="attribute_id" value="<?php echo $attributes_values['products_attributes_id']; ?>
$html_ev_out .= '<td class="infoBoxHeading" align="center"><nobr>' . $products_options_name['products_options_name'] . '</nobr></td>'; } $html_ev_out .= '<td class="infoBoxHeading" align="center">' . STOCK_LIST_IN_PI_TEXT_PRICE . '</td>'; $html_ev_out .= '<td class="infoBoxHeading" align="center">' . STOCK_LIST_IN_PI_TEXT_STOCK . '</td>'; $html_ev_out .= '</tr>'; // now create the rows! Each row will display the quantity for one combination of attributes. while ($products_stock_values = tep_db_fetch_array($products_stock_query)) { if ($products_stock_values['products_stock_quantity'] > 0) { //We only want to display rows for combinations we have on stock... //For example the quantity can be 0 or even negative if oversold. $rowscounter += 1; $attributes = explode(",", $products_stock_values['products_stock_attributes']); $html_ev_out .= '<tr >'; $total_price = $products_facts['products_price']; foreach ($attributes as $attribute) { $attr = explode("-", $attribute); $html_ev_out .= '<td class="infoBoxContents" align="center">' . tep_values_name($attr[1]) . '</td>'; $total_price += $attributes_price[$attr[0]][$attr[1]]; } $total_price = $currencies->display_price($total_price, tep_get_tax_rate($products_facts['products_tax_class_id'])); //$total_price=$currencies->format($total_price); $html_ev_out .= '<td class="infoBoxContents" align="center">' . $total_price . '</td>'; $html_ev_out .= '<td class="infoBoxContents" align="center">' . $products_stock_values['products_stock_quantity'] . '</td>'; } } $html_ev_out .= '</tr></table></td></tr></table>'; //Table is finished! if ($rowscounter > 0) { //Only display the table if it contains anything =) echo $html_ev_out; }
} // now display the attribute value names, table the html for quantity & price to get everything // to line up right $quantity_html_table = " <table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"2\">\n"; $quantity_html_table .= " <tr class=\"dataTableRow\"><td class=\"main\" colspan=\"" . sizeof($products_options_array) . "\"> </td></tr>\n"; $price_html_table = " <table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"2\">\n"; $price_html_table .= " <tr class=\"dataTableRow\"><td class=\"main\" colspan=\"" . sizeof($products_options_array) . "\"> </td></tr>\n"; while ($products_stock_values = tep_db_fetch_array($products_stock_query)) { $attributes = explode(",", $products_stock_values['products_stock_attributes']); echo " <tr class=\"dataTableRowSelected\">\n"; $quantity_html_table .= " <tr class=\"dataTableRowSelected\">\n"; $price_html_table .= " <tr class=\"dataTableRowSelected\">\n"; $total_price = $products['products_price']; foreach ($attributes as $attribute) { $attr = explode("-", $attribute); echo " <td class=smalltext>" . tep_values_name($attr[1]) . "</td>\n"; $total_price += $attributes_price[$attr[0]][$attr[1]]; } echo " </tr>\n"; $quantity_html_table .= " <td class=smalltext>" . $products_stock_values['products_stock_quantity'] . "</td>\n"; $quantity_html_table .= " </tr>\n"; $price_html_table .= " <td align=\"right\" class=smalltext>" . $total_price . " </td>\n"; $price_html_table .= " </tr>\n"; } echo " </table>\n"; echo " </td>\n"; $quantity_html_table .= " </table>\n"; $price_html_table .= " </table>\n"; echo " <td class=smalltext>" . $quantity_html_table . "</td>\n"; echo " <td>" . $price_html_table . "</td>\n"; echo " </tr>\n";
<?php $title_num = 1; if ($flag) { while (list($k, $v) = each($options)) { echo "<td class=\"dataTableHeadingContent\"> {$option_names[$k]}</td>"; $title[$title_num] = $k; } echo "<td class=\"dataTableHeadingContent\"><span class=smalltext>Quantity</span></td><td width=\"100%\"> </td>"; echo "</tr>"; $q = tep_db_query("select * from " . TABLE_PRODUCTS_STOCK . " where products_id=" . $VARS['product_id'] . " order by products_stock_attributes"); while ($rec = tep_db_fetch_array($q)) { $val_array = explode(",", $rec[products_stock_attributes]); echo "<tr>"; foreach ($val_array as $val) { if (preg_match("/^(\\d+)-(\\d+)\$/", $val, $m1)) { echo "<td class=smalltext> " . tep_values_name($m1[2]) . "</td>"; } else { echo "<td> </td>"; } } for ($i = 0; $i < sizeof($options) - sizeof($val_array); $i++) { echo "<td> </td>"; } echo "<td class=smalltext> {$rec['products_stock_quantity']}</td><td> </td></tr>"; } echo "<tr>"; reset($options); $i = 0; while (list($k, $v) = each($options)) { echo "<td class=dataTableHeadingRow><select name=option{$k}>"; foreach ($v as $v1) {
<?php $title_num = 1; if ($flag) { while (list($k, $v) = each($options)) { echo "<td class=\"dataTableHeadingContent\" valign=\"middle\"> {$option_names[$k]}</td>"; $title[$title_num] = $k; } echo "<td class=\"dataTableHeadingContent\" valign=\"middle\"><span class=smallText>" . TABLE_HEADING_QTY . "</span></td><td width=\"100%\" colspan=\"2\"> </td>"; echo "</tr>"; $q = tep_db_query("select * from " . TABLE_PRODUCTS_STOCK . " where products_id=" . $VARS['product_id'] . " order by products_stock_attributes"); while ($rec = tep_db_fetch_array($q)) { $val_array = explode(",", $rec[products_stock_attributes]); echo "<tr><form action={$PHP_SELF} method=get><input type=hidden name=product_id value=" . $VARS['product_id'] . ">"; foreach ($val_array as $val) { if (preg_match("/^(\\d+)-(\\d+)\$/", $val, $m1)) { echo "<td class=smallText> " . tep_values_name($m1[2]) . "<input type=hidden name=option" . $m1[1] . " value=" . $m1[2] . "></td>"; } else { echo "<td> </td>"; } } for ($i = 0; $i < sizeof($options) - sizeof($val_array); $i++) { echo "<td> </td>"; } echo "<td class=smallText> <input style=\"margin-top: -8px;\" type=text name=quantity size=4 value={$rec['products_stock_quantity']}></td><td><input type=submit name=action value=" . TEXT_MODIFY . "><input type=submit name=action value=" . TEXT_REMOVE . "></td></form></tr>"; } echo "<tr><form action={$PHP_SELF} method=get>"; reset($options); $i = 0; while (list($k, $v) = each($options)) { echo "<td class=dataTableHeadingRow><select name=option{$k}>"; foreach ($v as $v1) {
?> <tr class="optionValue" id="trOptionsValues_9999" style="display:none" > <td align="center"> <?php echo $rec[products_stock_id]; ?> <img src="attributeManager/images/icon_arrow.gif" /> </td> <?php foreach ($val_array as $val) { if (preg_match("/^(\\d+)-(\\d+)\$/", $val, $m1)) { ?> <td> <?php echo tep_values_name($m1[2]); ?> </td> <?php } else { ?> <td> </td> <?php } } for ($i = 0; $i < sizeof($options) - sizeof($val_array); $i++) { ?> <td>