Skip to content

Instantly share code, notes, and snippets.

@taleeb35
Created January 5, 2015 09:04
Show Gist options
  • Save taleeb35/b54cef737f92013040aa to your computer and use it in GitHub Desktop.
Save taleeb35/b54cef737f92013040aa to your computer and use it in GitHub Desktop.
XML
<style>
.tablemain{
font-family: Helvetica, Arial, sans-serif;
font-size:14px;
width:100%
}
.tablemain td{
padding:10px 5px;
}
.leftPanel{
float:left;
width:200px;
background:#F8F8F8;
}
.rightPanel{
float:left;
width:800px;
}
</style>
<?php
$params = array (
'IWSLogin' => 'inxsql',
'IWSPassword' => 'inxsql4u',
'customer' => 324968,
'resultsPerPage' => 10,
'pageNumber' => 1,
'listOrder' => '',
'listOrderKey' => ''
);
$response = new SoapClient('http://shop.imperialpaper.com/webservice/inxsqlwebdata.asmx?wsdl',array('trace' => 1));
$data = $response->GetPSListing($params);
$xmlStr = $data->GetPSListingResult->any;
$myfile = fopen("test.txt", "w") or die("Unable to open file!");
fwrite($myfile, $xmlStr);
fclose($myfile);
?>
<html>
<body>
<h3 align="center">Previously Purchased Items:</h3>
<div class="leftPanel">
<ul>
<li><a href="http://localhost/webservice.php">Previous Sales</a></li>
<li><a href="http://localhost/listing.php" id="cart">Shopping Cart</a></li>
</ul>
</div>
<div class="rightPanel">
<table border="1" class="tablemain">
<tr>
<th>Part#</th>
<th>Date</th>
<th>Unit$</th>
<th>Current$</th>
<th>Qty</th>
<th>Reorder?</th>
</tr>
<?php //foreach($data as $obj){
$xml = simplexml_load_string($xmlStr);
foreach($xml as $datarow) { ?>
<tr>
<td> <?php echo $datarow->cihs_item ."<br><br>"; ?>
<?php echo $datarow->cihs_description ; ?>
</td>
<td> <?php echo Date("Y-m-d",strtotime($datarow->cihs_date )); ?> </td>
<td> <?php echo $datarow->cihs_unitcost; ?> </td>
<td> <?php echo $datarow->cihs_price; ?> </td>
<td> <?php echo $datarow->cihs_quantity ; ?> </td>
<td><input type="checkbox" name="reorder" id="reorder" class="checkbox"> </td>
</tr>
<?php } ?>
</table>
</div>
<?php //} ?>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
var count = 0;
var value = $('#cart').text();
//console.log(value);
$(".checkbox").click(function(){
var counts = $("[type='checkbox']:checked").length;
if(counts > 0){
$('#cart').html(value + '(' + counts +')');
var arr = $('input:checkbox.checkbox').filter(':checked').map(function () {
return this.name;
}).get();
} else {
$('#cart').html(value);
}
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment