Sorry for long post!
Help needed to integrate a working php / html page into a fragemnt.
Actinic Support have failed so far!!
I have a client who has 1100 small products with very similar part numbers.
To help the end user I have created a MySql database and was planning to use this to build a part number and Qty to insert into the cart using for example - http://eogb.co.uk/cgi-bin/ca000001.p...Da-1.1-80-H=10
Once my client has added all 1100 products I propose to hide the section containing the products then use the code running in the fragment to generate the part number and quantity which will be then be inserted into the cart via a string generated as above.
The Section ID and part number I will extract from the Actinic db and import into the product selector php/MySqL database.
Here is the code I am trying to insert into a fragment as either code enclosed within !!< >!! or a variable.
I have tried code within !!< >!!, also !!<[variable name ]>!! in the text box, also inserting the variable into the fragment layout.
I have also tried <actinic:block> include <filename> etc.
All have not worked.
Tested and working page as standalone php - http://www.neobium.net/testing/EOGB/results_EOGB4.php
make selections and add quantity and press +
This gives this page - http://www.neobium.net/testing/EOGB/proof.php
Code
<?php
session_start ();
//connect to server and select database
$db_name ="neobium_net";
$table_name ="EOGB";
$connection =@mysql_connect("localhost","neobium_net","b1u3t4c") or die(mysql_error());
$db =@mysql_select_db($db_name,$connection) or die(mysql_error());
// count rows
// get rows results
$result = mysql_query("SELECT * from $table_name")
or die(mysql_error());
$dbrows= mysql_num_rows($result);
// check if qty posted or reset pushed , clear all sessions for another search
if (isset($_POST['Qty'])||isset($_POST['reset']) ) {
//clear all sessions
$_SESSION['mk'] = "";
$_SESSION['pat'] = "";
$_SESSION['ds'] = "";
$_SESSION['cs'] = "";
}
// get form results
$Make = $_POST['Make'];
$Pattern = $_POST['Pattern'];
//set sessions
if($Make !=''){
$_SESSION['mk'] = "$Make";
//clear pat sessions
$_SESSION['pat'] = "";
}
// set pat session
if($Pattern !=''){
$_SESSION['pat'] = "$Pattern";
}
?>
<HTML>
<HEAD>
<TITLE>EOGB Nozzles Data Demo</TITLE>
</head>
<body>
<style type="text/css">
<!--
body {background-color: #ffffff;}
.red {background-color: #ff0000;}
.green{background-color: #339933;}
-->
</style>
<h3>EOGB Nozzles Search<br></h3>
<hr size="3" width="100%">
<h3><p>Searching <? echo $table_name; ?> Database</p></h3>
<p>The database contains <? echo $dbrows; ?> nozzles</p>
<div align="right">
<div id="show" align="right"></div>
</div>
<h4>Please Select an item from each box</h4>
<form name='form1' method='post' action=''>
Maker: <select name='Make' onChange='document.form1.submit()'>
<option value="">Maker</option>
<option <? if($_SESSION[mk]=="Danfoss"){echo"selected";} ?> value="Danfoss">Danfoss</option>
<option <? if($_SESSION[mk]=="Delevan"){echo"selected";} ?> value="Delevan">Delevan</option>
</select>
</form>
<form name='form4' method='post' action=''>
Spray Pattern: <select name='Pattern' onChange='document.form4.submit()'>
<option value="">Spray Pattern</option>
<?
if($_SESSION['mk']!=''){
//run query to get next box here.
$Extract3 = mysql_query("SELECT DISTINCT Pattern FROM $table_name WHERE Make = '$_SESSION[mk]' ORDER BY Pattern ASC")
or die(mysql_error());
while ($row = mysql_fetch_array($Extract3)){
$Items3 = $row['Pattern'];
if($_SESSION[pat]!="$Items3"){$t3="";}else{$t3="selected";}
echo"<option $t3 value=\"$Items3\">$Items3</option>";
}
}
?>
</select>
</form>
If you make no selection on any displayed table, press reset to make another choice.<br>
<form action="" method="post" name="reset">
<input type="hidden" name="reset" id="reset" value="1">
<input name="Reset " type="submit" Value = "Reset">
</form>
<?
//Diagnostic echo
//echo "<strong>Diagnostic Output</strong> <br>";
//echo "<strong>Posted Vars</strong> <br>";
//echo "Posted Make = ".$Make ."<br>";
//echo "Posted Pattern = ".$Pattern ."<br>";
//echo "<strong>Sessions Vars</strong> <br>";
//echo " Make Session = ".$_SESSION['mk']. "<br>";
//echo " Pattern Session = ".$_SESSION['pat']. "<br><br>";
// start table
?>
<table cellspacing="0" width="400" cellpadding="0" border="1">
<tr>
<td class="" width="60">USgal/hr</td>
<?
// get angles for column headers based on make
$n=0;
$Extract4 = mysql_query("SELECT DISTINCT Angle FROM $table_name WHERE Make = '$_SESSION[mk]' AND Pattern = '$_SESSION[pat]' ORDER by ANGLE ASC")
or die(mysql_error());
while ($row = mysql_fetch_array($Extract4)){
echo "<td width='50' align='center'>" .$row['Angle']. "</td>";
$n = $n+1;
$ang[$n] = $row['Angle'];
}
?>
</tr>
<!-- start new fetched rows -- >
<tr>
<?
$Extract5 = mysql_query("SELECT DISTINCT GPH FROM $table_name WHERE Make = '$_SESSION[mk]' AND Pattern = '$_SESSION[pat]'")
or die(mysql_error());
$row = mysql_fetch_array($Extract5);
$count = 1;
do{
echo "<td width='50' align='center' valign='middle'>" .$row['GPH']. "</td>";
// each angle query
for ( $counter = 1; $counter <= $n; $counter += 1) {
$Extract6 = mysql_query("SELECT * FROM $table_name WHERE Make = '$_SESSION[mk]' AND Pattern = '$_SESSION[pat]' AND GPH = '$row[GPH]' AND Angle='$ang[$counter]' ")
or die(mysql_error());
$row1 = mysql_fetch_array($Extract6);
// assemble part strings
$actcart1 = "http://eogb.co.uk/cgi-bin/ca000001.pl?SID=";
$actcart2 = "&PAGE=PRODUCT&Q_";
$partdesc = $_SESSION[mk]."-".$_SESSION[pat]."-".$row['GPH']."-".$ang[$counter];
$partnum = $row1['Part_num'];
$SID = $row1['SID'];
$cartstring = $actcart1.$SID.$actcart2.$partnum."=";
$cartstring = urlencode($cartstring);
// set strings as sessions
$_SESSION['ds'] = "$partdesc";
$_SESSION['cs'] = "$cartstring";
//echo " Diags <br>";
//echo " gph= ".$row['GPH']."<br>";
//echo "angle=".$ang[$counter]."<br>";
//echo "partdesc=".$_SESSION[ds]."<br>";
//echo "partnum=".$partnum."<br>";
//echo "SID=".$SID."<br>";
//echo "cartstring=".$_SESSION[cs]."<br>";
//echo "cart2=".$actcart2."<br>";
// start rows
if(!empty($row1))
{
echo "<td class='green' align='center' valign='middle'>";
echo "<form name=\"form$count\" method=\"post\" action=\"basket.php\">";
echo "<input type=\"text\" size=\"3\" maxlength=\"3\" name=\"Qty\" >";
echo" <input type=\"image\" src=\"plus.gif\" alt=\"Submit button\" width=\"20\" height=\"20\" border=\"0\" >";
echo "</form>";
echo "</td>";
}else{
echo "<td class='red' align='center' valign='middle'> </td>";
}
} //end counter for
echo "</tr>"; // end row
$count++;
}while($row = mysql_fetch_array($Extract5));
?>
</table>
<hr>
</body>
</HTML>
Help needed to integrate a working php / html page into a fragemnt.
Actinic Support have failed so far!!
I have a client who has 1100 small products with very similar part numbers.
To help the end user I have created a MySql database and was planning to use this to build a part number and Qty to insert into the cart using for example - http://eogb.co.uk/cgi-bin/ca000001.p...Da-1.1-80-H=10
Once my client has added all 1100 products I propose to hide the section containing the products then use the code running in the fragment to generate the part number and quantity which will be then be inserted into the cart via a string generated as above.
The Section ID and part number I will extract from the Actinic db and import into the product selector php/MySqL database.
Here is the code I am trying to insert into a fragment as either code enclosed within !!< >!! or a variable.
I have tried code within !!< >!!, also !!<[variable name ]>!! in the text box, also inserting the variable into the fragment layout.
I have also tried <actinic:block> include <filename> etc.
All have not worked.
Tested and working page as standalone php - http://www.neobium.net/testing/EOGB/results_EOGB4.php
make selections and add quantity and press +
This gives this page - http://www.neobium.net/testing/EOGB/proof.php
Code
<?php
session_start ();
//connect to server and select database
$db_name ="neobium_net";
$table_name ="EOGB";
$connection =@mysql_connect("localhost","neobium_net","b1u3t4c") or die(mysql_error());
$db =@mysql_select_db($db_name,$connection) or die(mysql_error());
// count rows
// get rows results
$result = mysql_query("SELECT * from $table_name")
or die(mysql_error());
$dbrows= mysql_num_rows($result);
// check if qty posted or reset pushed , clear all sessions for another search
if (isset($_POST['Qty'])||isset($_POST['reset']) ) {
//clear all sessions
$_SESSION['mk'] = "";
$_SESSION['pat'] = "";
$_SESSION['ds'] = "";
$_SESSION['cs'] = "";
}
// get form results
$Make = $_POST['Make'];
$Pattern = $_POST['Pattern'];
//set sessions
if($Make !=''){
$_SESSION['mk'] = "$Make";
//clear pat sessions
$_SESSION['pat'] = "";
}
// set pat session
if($Pattern !=''){
$_SESSION['pat'] = "$Pattern";
}
?>
<HTML>
<HEAD>
<TITLE>EOGB Nozzles Data Demo</TITLE>
</head>
<body>
<style type="text/css">
<!--
body {background-color: #ffffff;}
.red {background-color: #ff0000;}
.green{background-color: #339933;}
-->
</style>
<h3>EOGB Nozzles Search<br></h3>
<hr size="3" width="100%">
<h3><p>Searching <? echo $table_name; ?> Database</p></h3>
<p>The database contains <? echo $dbrows; ?> nozzles</p>
<div align="right">
<div id="show" align="right"></div>
</div>
<h4>Please Select an item from each box</h4>
<form name='form1' method='post' action=''>
Maker: <select name='Make' onChange='document.form1.submit()'>
<option value="">Maker</option>
<option <? if($_SESSION[mk]=="Danfoss"){echo"selected";} ?> value="Danfoss">Danfoss</option>
<option <? if($_SESSION[mk]=="Delevan"){echo"selected";} ?> value="Delevan">Delevan</option>
</select>
</form>
<form name='form4' method='post' action=''>
Spray Pattern: <select name='Pattern' onChange='document.form4.submit()'>
<option value="">Spray Pattern</option>
<?
if($_SESSION['mk']!=''){
//run query to get next box here.
$Extract3 = mysql_query("SELECT DISTINCT Pattern FROM $table_name WHERE Make = '$_SESSION[mk]' ORDER BY Pattern ASC")
or die(mysql_error());
while ($row = mysql_fetch_array($Extract3)){
$Items3 = $row['Pattern'];
if($_SESSION[pat]!="$Items3"){$t3="";}else{$t3="selected";}
echo"<option $t3 value=\"$Items3\">$Items3</option>";
}
}
?>
</select>
</form>
If you make no selection on any displayed table, press reset to make another choice.<br>
<form action="" method="post" name="reset">
<input type="hidden" name="reset" id="reset" value="1">
<input name="Reset " type="submit" Value = "Reset">
</form>
<?
//Diagnostic echo
//echo "<strong>Diagnostic Output</strong> <br>";
//echo "<strong>Posted Vars</strong> <br>";
//echo "Posted Make = ".$Make ."<br>";
//echo "Posted Pattern = ".$Pattern ."<br>";
//echo "<strong>Sessions Vars</strong> <br>";
//echo " Make Session = ".$_SESSION['mk']. "<br>";
//echo " Pattern Session = ".$_SESSION['pat']. "<br><br>";
// start table
?>
<table cellspacing="0" width="400" cellpadding="0" border="1">
<tr>
<td class="" width="60">USgal/hr</td>
<?
// get angles for column headers based on make
$n=0;
$Extract4 = mysql_query("SELECT DISTINCT Angle FROM $table_name WHERE Make = '$_SESSION[mk]' AND Pattern = '$_SESSION[pat]' ORDER by ANGLE ASC")
or die(mysql_error());
while ($row = mysql_fetch_array($Extract4)){
echo "<td width='50' align='center'>" .$row['Angle']. "</td>";
$n = $n+1;
$ang[$n] = $row['Angle'];
}
?>
</tr>
<!-- start new fetched rows -- >
<tr>
<?
$Extract5 = mysql_query("SELECT DISTINCT GPH FROM $table_name WHERE Make = '$_SESSION[mk]' AND Pattern = '$_SESSION[pat]'")
or die(mysql_error());
$row = mysql_fetch_array($Extract5);
$count = 1;
do{
echo "<td width='50' align='center' valign='middle'>" .$row['GPH']. "</td>";
// each angle query
for ( $counter = 1; $counter <= $n; $counter += 1) {
$Extract6 = mysql_query("SELECT * FROM $table_name WHERE Make = '$_SESSION[mk]' AND Pattern = '$_SESSION[pat]' AND GPH = '$row[GPH]' AND Angle='$ang[$counter]' ")
or die(mysql_error());
$row1 = mysql_fetch_array($Extract6);
// assemble part strings
$actcart1 = "http://eogb.co.uk/cgi-bin/ca000001.pl?SID=";
$actcart2 = "&PAGE=PRODUCT&Q_";
$partdesc = $_SESSION[mk]."-".$_SESSION[pat]."-".$row['GPH']."-".$ang[$counter];
$partnum = $row1['Part_num'];
$SID = $row1['SID'];
$cartstring = $actcart1.$SID.$actcart2.$partnum."=";
$cartstring = urlencode($cartstring);
// set strings as sessions
$_SESSION['ds'] = "$partdesc";
$_SESSION['cs'] = "$cartstring";
//echo " Diags <br>";
//echo " gph= ".$row['GPH']."<br>";
//echo "angle=".$ang[$counter]."<br>";
//echo "partdesc=".$_SESSION[ds]."<br>";
//echo "partnum=".$partnum."<br>";
//echo "SID=".$SID."<br>";
//echo "cartstring=".$_SESSION[cs]."<br>";
//echo "cart2=".$actcart2."<br>";
// start rows
if(!empty($row1))
{
echo "<td class='green' align='center' valign='middle'>";
echo "<form name=\"form$count\" method=\"post\" action=\"basket.php\">";
echo "<input type=\"text\" size=\"3\" maxlength=\"3\" name=\"Qty\" >";
echo" <input type=\"image\" src=\"plus.gif\" alt=\"Submit button\" width=\"20\" height=\"20\" border=\"0\" >";
echo "</form>";
echo "</td>";
}else{
echo "<td class='red' align='center' valign='middle'> </td>";
}
} //end counter for
echo "</tr>"; // end row
$count++;
}while($row = mysql_fetch_array($Extract5));
?>
</table>
<hr>
</body>
</HTML>
Comment