$defaults = getSystemDefaults(); $smarty->assign("defaults", $defaults); $products = new product(); $sth = $products->select_all('', $dir, $sort, $rp, $page); $sth_count_rows = $products->select_all('count', $dir, $sort, $rp, $page); $products_all = $sth->fetchAll(PDO::FETCH_ASSOC); $count = $sth_count_rows->rowCount(); //echo sql2xml($customers, $count); $xml .= "<rows>"; $xml .= "<page>{$page}</page>"; $xml .= "<total>{$count}</total>"; foreach ($products_all as $row) { $xml .= "<row id='" . $row['iso'] . "'>"; $xml .= "<cell><![CDATA[\r\n\t\t\t<a class='index_table' title='{$LANG['view']} " . $row['description'] . "' href='index.php?module=products&view=details&id=" . $row['id'] . "&action=view'><img src='images/common/view.png' height='16' border='-5px' padding='-4px' valign='bottom' /></a>\r\n\t\t\t<a class='index_table' title='{$LANG['edit']} " . $row['description'] . "' href='index.php?module=products&view=details&id=" . $row['id'] . "&action=edit'><img src='images/common/edit.png' height='16' border='-5px' padding='-4px' valign='bottom' /></a>\r\n\t\t]]></cell>"; $xml .= "<cell><![CDATA[" . $row['description'] . "]]></cell>"; $xml .= "<cell><![CDATA[" . siLocal::number_clean($row['unit_price']) . "]]></cell>"; if ($defaults['inventory'] == '1') { $xml .= "<cell><![CDATA[" . siLocal::number_trim($row['quantity']) . "]]></cell>"; } if ($row['enabled'] == $LANG['enabled']) { $xml .= "<cell><![CDATA[<img src='images/common/tick.png' alt='" . $row['enabled'] . "' title='" . $row['enabled'] . "' />]]></cell>"; } else { $xml .= "<cell><![CDATA[<img src='images/common/cross.png' alt='" . $row['enabled'] . "' title='" . $row['enabled'] . "' />]]></cell>"; } $xml .= "</row>"; } $xml .= "</rows>"; echo $xml; ?>
<?php if ($_GET['id']) { //sleep(2); $sql = sprintf('SELECT unit_price, default_tax_id, default_tax_id_2 FROM si_products WHERE id = %d LIMIT 1', $_GET['id']); $states = dbQuery($sql); // $output = ''; if ($states->rowCount() > 0) { $row = $states->fetch(); // print_r($row); // $output .= '<input id="state" class="field select two-third addr" value="'.$row['unit_price'].'"/>'; /*Format with decimal places with precision as defined in config.ini*/ $output['unit_price'] = siLocal::number_clean($row['unit_price']); $output['default_tax_id'] = $row['default_tax_id']; $output['default_tax_id_2'] = $row['default_tax_id_2']; // $output .= $_POST['id']; } else { $output .= ''; } echo json_encode($output); exit; } else { echo ""; } // Perform teh Queries! //$sql = 'SELECT * FROM si_products'; //$country = mysqlQuery($sql) or die('Query Failed:' . mysql_error());