Jump to content
Sign in to follow this  
Johno

XML Feed with Category Name

Recommended Posts

Greetings All,

 

I'm Trying to tweak the XML Feed contribution

 

http://www.oscommerce.com/community/contributions,905

 

 

I want the XML produced to also include the Category. I've changed the original to that below - but I get an error - " Couldn't execute query 3 "

 

Any help would be gratefully recieved

 

Johno

 

 

<?php

Header( 'Content-Type: text/xml' ); 

echo '<?xml version="1.0" ?>'; 

echo "<Disking_Products>";

/*

 OSCommerce Product XML Feed

 by Kenny Boyd (kenny@theinternetfoundry.com)

 http://www.theinternetfoundry.com



 This hack will provide a basic xml feed which can be polled by

 applications, affiliate websites or systems using other languages

 such as C++, Perl, .NET etc to display your product line in xml

 readable format.

 

 It is rehash of the excellent Catalog Anywhere addon programmed by:

 Patrick Veverka (patrick@veverka.net) available at: 

 http://www.oscommerce.com/community/contributions,294



 This is a real quick and dirty xml implementation so bugs may exist 

 

 Please see the README.TXT before you use this



*/

////////////////////////////////////////////

// THE FOLLOWING OPTIONS MUST BE CONFIGURED!



// 1. Configure DB Connection

$db_server = "*****"; //database server

$db_user = "*****"; //database user

$db_pass = "*****"; //database password

$db_name = "*****"; //database name



// 2. Configure Site Info

//Enter the url to your website

//don't use any slashes or http eg: www.mysite.com

$domain_name = "www.diskingcomputers.co.uk";



//Enter the directory name of your catalog

//don't use any slashes  eg: catalog 

$catalog_folder_name = ""; //no slashes



// 3. Configure XML Data to be included



// 3A: Include product prices? (1 is on, 0 is off)

$product_price = "1"; 



// 3B: include link to product_info.php at your website? (1 is on, 0 is off)

$product_info_link = "1"; 



// END CONFIGURATION

////////////////////////////////////////////



// create connection

$connection = mysql_connect("$db_server","$db_user","$db_pass")    or die("Couldn't make connection.");

// select database

$db = mysql_select_db("$db_name", $connection) or die("Couldn't select database.");

// create SQL statement

$sqlcount = "SELECT * FROM `products` ORDER BY 'products_model'";

$sql = "SELECT * FROM `products` ORDER BY 'products_model'";

// execute SQL query and get result

$sql_result = mysql_query($sql,$connection) or die("Couldn't execute query.");

$sqlcount_result = mysql_query($sqlcount,$connection) or die("Couldn't execute query.");

$num = mysql_numrows($sqlcount_result);

mysql_free_result($sqlcount_result);



// format results by row

while ($row = mysql_fetch_array($sql_result)) {

   $id = $row["products_id"];

   $model = $row["products_model"];

   $image = $row["products_image"];

   $price = $row["products_price"];

   $sql2 = "SELECT `products_name` FROM `products_description` WHERE products_id = '$id' LIMIT 1";

   $sql2_result = mysql_query($sql2,$connection) or die("Couldn't execute query.");

   $row2 = mysql_fetch_array($sql2_result);

   $name = $row2["0"];











// Added By Johno - Category



   $sql3 = "SELECT 'categories_id' FROM 'products_to_categories' WHERE products_id = '$id'; LIMIT 1";

   $sql3_result = mysql_query($sql3,$connection) or die("Couldn't execute query 3.");



   $sql4 = "SELECT 'categories_name' FROM 'categories_description' WHERE categories_id = '$sql3_result'; LIMIT 1";

   $sql4_result = mysql_query($sql4,$connection) or die("Couldn't execute query 4.");



// End of Added By Johno - Category









// add extra data here then add the xml tag below

  $products_url =  $row2["4"];

  $products_description =  $row2["5"];

// add extra data here



?>

<PRODUCT ITEM='<?php echo $id; ?>'>

<NAME><?php echo $name;?></NAME>

<MODEL><?php echo $model; ?></MODEL>





<?php  

// Added By Johno - Category

?>

<CATEGORY><?php echo $sql4_result; ?></CATEGORY>

<?php  

// End of Added By Johno - Category

?>







<?php

if ($product_price == 1) {

?>

<PRICE><?php printf("%.2f", $price);  ?></PRICE>

<?php

}

if ($product_info_link == 1) {

?>

<URL value="http://<?php echo $domain_name; ?>/<?php echo $catalog_folder_name; ?>product_info.php?products_id=<?php echo $id; ?>"></URL>

<?php

}

?>

</PRODUCT>

<?php

}

// free resources and close connection

mysql_free_result($sql_result);

mysql_close($connection);

?>

</Disking_Products>

Share this post


Link to post
Share on other sites

Done It !

 

<?php

Header( 'Content-Type: text/xml' ); 

echo '<?xml version="1.0" ?>'; 

echo "<Disking>";

/*

 OSCommerce Product XML Feed

 by Kenny Boyd (kenny@theinternetfoundry.com)

 http://www.theinternetfoundry.com



 This hack will provide a basic xml feed which can be polled by

 applications, affiliate websites or systems using other languages

 such as C++, Perl, .NET etc to display your product line in xml

 readable format.

 

 It is rehash of the excellent Catalog Anywhere addon programmed by:

 Patrick Veverka (patrick@veverka.net) available at: 

 http://www.oscommerce.com/community/contributions,294



 This is a real quick and dirty xml implementation so bugs may exist 

 

 Please see the README.TXT before you use this



*/

////////////////////////////////////////////

// THE FOLLOWING OPTIONS MUST BE CONFIGURED!



// 1. Configure DB Connection

$db_server = "*****"; //database server

$db_user = "*****"; //database user

$db_pass = "*****"; //database password

$db_name = "*****"; //database name



// 2. Configure Site Info

//Enter the url to your website

//don't use any slashes or http eg: www.mysite.com

$domain_name = "www.diskingcomputers.co.uk";



//Enter the directory name of your catalog

//don't use any slashes  eg: catalog 

$catalog_folder_name = ""; //no slashes



// 3. Configure XML Data to be included



// 3A: Include product prices? (1 is on, 0 is off)

$product_price = "1"; 



// 3B: include link to product_info.php at your website? (1 is on, 0 is off)

$product_info_link = "1"; 



// END CONFIGURATION

////////////////////////////////////////////



// create connection

$connection = mysql_connect("$db_server","$db_user","$db_pass")    or die("Couldn't make connection.");

// select database

$db = mysql_select_db("$db_name", $connection) or die("Couldn't select database.");

// create SQL statement

$sqlcount = "SELECT * FROM `products` ORDER BY 'products_id'";

$sql = "SELECT * FROM `products` ORDER BY 'products_id'";

// execute SQL query and get result

$sql_result = mysql_query($sql,$connection) or die("Couldn't execute query.");

$sqlcount_result = mysql_query($sqlcount,$connection) or die("Couldn't execute query.");

$num = mysql_numrows($sqlcount_result);

mysql_free_result($sqlcount_result);



// format results by row

while ($row = mysql_fetch_array($sql_result)) {

   $id = $row["products_id"];

   $model = $row["products_model"];

   $image = $row["products_image"];

   $price = $row["products_price"];

   $sql2 = "SELECT `products_name` FROM `products_description` WHERE products_id = '$id' LIMIT 1";    $sql2_result = mysql_query($sql2,$connection) or die("Couldn't execute query.");

   $sql2_result = mysql_query($sql2,$connection) or die("Couldn't execute query.");

   $row2 = mysql_fetch_array($sql2_result);

   $name = $row2["0"];

// add extra data here then add the xml tag below



   $sql3 = "SELECT `categories_id` FROM `products_to_categories` WHERE products_id = '$id' LIMIT 1";

   $sql3_result = mysql_query($sql3,$connection) or die("Couldn't execute query 3.");

   $row3 = mysql_fetch_array($sql3_result);

   $catid = $row3["0"];

   $sql4 = "SELECT `categories_name` FROM `categories_description` WHERE categories_id = '$catid' LIMIT 1";

   $sql4_result = mysql_query($sql4,$connection) or die("Couldn't execute query 4.");

   $row4 = mysql_fetch_array($sql4_result);



   $catname = $row4["0"];

   $products_url =  $row2["4"];

   $products_description =  $row2["5"];

// add extra data here



?>

<PRODUCT ITEM='<?php echo $id; ?>'>

<NAME><?php echo $name;?></NAME>

<MODEL><?php echo $model; ?></MODEL>

<CATEGORY><?php echo $catname; ?></CATEGORY>

<?php

if ($product_price == 1) {

?>

<PRICE><?php printf("%.2f", $price);  ?></PRICE>

<?php

}

if ($product_info_link == 1) {

?>

<URL value="http://<?php echo $domain_name; ?>/<?php echo $catalog_folder_name; ?>product_info.php?products_id=<?php echo $id; ?>"></URL>

<?php

}

?>

</PRODUCT>

<?php

}

// free resources and close connection

mysql_free_result($sql_result);

mysql_close($connection);

?>

</Disking>

Share this post


Link to post
Share on other sites

Good contribuition! I'm working on a xsl file capable to sort the xml result by category and split results for page. Anyone can help me? :roll:


They killed Kenny! Bastards!

Share this post


Link to post
Share on other sites

Hi, this is an Xsl file for this contribution including images!

 

See a working example here:

http://www.nagrit.com/public/catalogoprezzi.php

 

Here the script:

 

First of all you can edit your php file to show the image file name in the xml result:

 

FIND:

 

<PRODUCT ITEM='<?php echo $id; ?>'> 

<NAME><?php echo $name;?></NAME> 

<MODEL><?php echo $model; ?></MODEL> 

<CATEGORY><?php echo $catname; ?></CATEGORY> 

<?php 

if ($product_price == 1) { 

?>

 

and after this PLACE:

 

<IMAGE><?php echo $image; ?></IMAGE>

 

Here the xsl file: style.xsl

 

<?xml version="1.0" encoding="ISO-8859-1" ?>

<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/TR/xhtml1/strict">

  <body style="font-family:Arial,helvetica,sans-serif;font-size:12pt; background-color:#EEEEEE">

     <xsl:for-each select="Disking/PRODUCT">

        <div style="background-color:teal;color:white;padding:4px">

           <span style="font-weight:bold;color:white;">

              <xsl:value-of select="NAME" />

           </span>

        </div>



        <div align="right" style="background-color:teal;color:white;padding:4px">

           <b>Model:</b>



           <xsl:value-of select="MODEL" />

   

        </div>



        <div align="left" style="margin-left:20px;margin-bottom:1em;font-size:10pt">

           <span style="font-style:italic">

              <b>( 

              <xsl:value-of select="PRICE" />



              Euro)</b>



              <span>

                 <A>

                    <xsl:attribute name="HREF">

                       <xsl:value-of select="URL/@value" />

                    </xsl:attribute>

                 </A>

              </span>



              <div align="right">

                  

                  <xsl:value-of select="CATEGORY" />

 <img width="75" height="50">

                    <xsl:attribute name="src">http://www.nagrit.com/public/<xsl:value-of select="IMAGE" />

                    </xsl:attribute>

                  

                 </img>

              </div>

           </span>

        </div>

     </xsl:for-each>

  </body>

</html>

 

REMEMBER!!! In your php file after THIS LINE

 

echo '<?xml version="1.0" encoding="ISO-8859-1" ?>';

 

Insert:

 

echo '<?xml-stylesheet type="text/xsl" href="stile.xsl"?>';

 

Feedback will be appreciated :P


They killed Kenny! Bastards!

Share this post


Link to post
Share on other sites

I am having trouble getting the stylesheet to work correctly. My stylesheet is set up as follows:

 

The output of these can be found at XML address

 

I am new to XML, but I am beginning to learn some of the basics. Could you please help me figure out what I could be doing wrong? Also I am interested in helping to try and make the pages for this contribution split into categories and more appealing. Have you had any luck with this yet?

 

<?xml version="1.0" encoding="ISO-8859-1" ?>
<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/TR/xhtml1/strict">
<body style="font-family:Arial,helvetica,sans-serif;font-size:12pt; background-color:#EEEEEE">


<xsl:for-each select="DISKING/PRODUCT">
<div style="background-color:teal;color:white;padding:4px">
<span  style="font-weight:bold;color:white;" >

 <xsl:value-of select="NAME" />

 </span>
 </div>
<div align="right" style="background-color:teal;color:white;padding:4px">
 <b>Model:</b> <xsl:value-of select="MODEL" />
 </div>
<div align="right" style="margin-left:20px;margin-bottom:1em;font-size:10pt">
 <A>www.colonialscientific.com/OScatalog/images<xsl:value-of select="IMAGE"/></A>
</div>
<div align="left" style="margin-left:20px;margin-bottom:1em;font-size:10pt">
<span  style="font-style:italic">
 <b>(
 <xsl:value-of select="PRICE" />
 Euro)</b>
<span>
<A>
<xsl:attribute name="HREF">
<xsl:value-of select="URL/@value" />
</xsl:attribute >
</A>
</span>
<div align="right">
 <img width="75" height="50" src = "images/ColonialScientificLogo.JPG">
<xsl:attribute name="src">
http://www.colonialscientific.com/OScatalog/images/<xsl:value-of select="IMAGE" />
</xsl:attribute >
</img>
</div>

</span>
 </div>
 </xsl:for-each>
 
 </body>
 </html>

 

my xml.php has a slight variation to eliminate the problem with ampersands and quotes.

 

<title> XML file for punchout implementation </title>

<?php

//Header( 'Content-Type: text/xml' ); 

echo '<?xml version="1.0" ?>'; 
echo '<?xml-stylesheet type="text/xsl" href="stile.xsl"?>'; 
echo '<Disking>';

/*

OSCommerce Product XML Feed

by Kenny Boyd (kenny@theinternetfoundry.com)

http://www.theinternetfoundry.com



This hack will provide a basic xml feed which can be polled by

applications, affiliate websites or systems using other languages

such as C++, Perl, .NET etc to display your product line in xml

readable format.



It is rehash of the excellent Catalog Anywhere addon programmed by:

Patrick Veverka (patrick@veverka.net) available at: 

http://www.oscommerce.com/community/contributions,294



This is a real quick and dirty xml implementation so bugs may exist 



Please see the README.TXT before you use this



*/

////////////////////////////////////////////

// THE FOLLOWING OPTIONS MUST BE CONFIGURED!
// 1. Configure DB Connection
$db_server = "****"; //database server
$db_user = "****"; //database user
$db_pass = "****"; //database password
$db_name = "****"; //database name

// 2. Configure Site Info
//Enter the url to your website
//don't use any slashes or http eg: www.mysite.com
$domain_name = "www.colonialscientific.com"; 

//Enter the directory name of your catalog
//don't use any slashes  eg: catalog 
$catalog_folder_name = "OScatalog"; //no slashes

// 3. Configure XML Data to be included

// 3A: Include product prices? (1 is on, 0 is off)
$product_price = "1"; 

// 3B: include link to product_info.php at your website? (1 is on, 0 is off)
$product_info_link = "1"; 

// END CONFIGURATION
////////////////////////////////////////////

// create connection

$connection = mysql_connect("$db_server","$db_user","$db_pass")    or die("Couldn't make connection.");

// select database

$db = mysql_select_db("$db_name", $connection) or die("Couldn't select database.");

// create SQL statement

$sqlcount = "SELECT * FROM `products` ORDER BY 'products_id'";

$sql = "SELECT * FROM `products` ORDER BY 'products_id'";

// execute SQL query and get result

$sql_result = mysql_query($sql,$connection) or die("Couldn't execute query.");

$sqlcount_result = mysql_query($sqlcount,$connection) or die("Couldn't execute query.");

$num = mysql_numrows($sqlcount_result);

mysql_free_result($sqlcount_result);



// format results by row

while ($row = mysql_fetch_array($sql_result)) {

  $id = $row["products_id"];

  $model = $row["products_model"];

  $image = $row["products_image"];

  $price = $row["products_price"];

  $sql2 = "SELECT `products_name` FROM `products_description` WHERE products_id = '$id' LIMIT 1";    $sql2_result = mysql_query($sql2,$connection) or die("Couldn't execute query.");

  $sql2_result = mysql_query($sql2,$connection) or die("Couldn't execute query.");

  $row2 = mysql_fetch_array($sql2_result);

  $name = $row2["0"];

// add extra data here then add the xml tag below



  $sql3 = "SELECT `categories_id` FROM `products_to_categories` WHERE products_id = '$id' LIMIT 1";

  $sql3_result = mysql_query($sql3,$connection) or die("Couldn't execute query 3.");

  $row3 = mysql_fetch_array($sql3_result);

  $catid = $row3["0"];

  $sql4 = "SELECT `categories_name` FROM `categories_description` WHERE categories_id = '$catid' LIMIT 1";

  $sql4_result = mysql_query($sql4,$connection) or die("Couldn't execute query 4.");

  $row4 = mysql_fetch_array($sql4_result);



  $catname = $row4["0"];

  $products_url =  $row2["4"];

  $products_description =  $row2["5"];

// add extra data here

//Fix ampersand error and quotation error- by Patrick Louka plouka@vt.edu
//$ampersand_location= strchr($name,'&');
//$quote_location = strchr($name, '/"');
str_replace('&','and', $name);
str_replace('/"', ' in.', $name);
?>

<PRODUCT ITEM='<?php echo $id; ?>'>

<NAME><?php echo $name;?></NAME>

<MODEL><?php echo $model; ?></MODEL>

<CATEGORY><?php echo $catname; ?></CATEGORY>

<?php

if ($product_price == 1) {

?>

<IMAGE><?php echo $image; ?></IMAGE> 


<PRICE><?php printf("%.2f", $price);  ?></PRICE>

<?php

}

if ($product_info_link == 1) {

?>

<URL value="http://<?php echo $domain_name; ?>/<?php echo $catalog_folder_name; ?>product_info.php?products_id=<?php echo $id; ?>"></URL>

<?php

}

?>
<br>
</PRODUCT>

<?php

}

// free resources and close connection

mysql_free_result($sql_result);

mysql_close($connection);

?>

</Disking>


Patrick Louka

 

 

"Life greatest art learned through its hardest knocks is to make stepping stones of stumbling blocks."

Share this post


Link to post
Share on other sites

After a year i can't split this page result!!!! Thats incredible!!!!!

 

:P

 

Here is my code and i use the same xsl file listed in mine and your post.

 

<?php
Header( 'Content-Type: text/xml' );
echo '<?xml version="1.0" ?>';
echo '<?xml-stylesheet type="text/xsl" href="stile.xsl"?>';
echo "<STOREITEMS>";
/*
 OSCommerce Product XML Feed
 by Kenny Boyd (kenny@theinternetfoundry.com)
 http://www.theinternetfoundry.com

 This hack will provide a basic xml feed which can be polled by
 applications, affiliate websites or systems using other languages
 such as C++, Perl, .NET etc to display your product line in xml
 readable format.

 It is rehash of the excellent Catalog Anywhere addon programmed by:
 Patrick Veverka (patrick@veverka.net) available at:
 http://www.oscommerce.com/community/contributions,294

 This is a real quick and dirty xml implementation so bugs may exist

 Please see the README.TXT before you use this

*/
////////////////////////////////////////////
// THE FOLLOWING OPTIONS MUST BE CONFIGURED!

// 1. Configure DB Connection
$db_server = "******"; //database server
$db_user = "********"; //database user
$db_pass = "********"; //database password
$db_name = "********"; //database name

// 2. Configure Site Info
//Enter the url to your website
//don't use any slashes or http eg: www.mysite.com
$domain_name = "www.yoursite.com";

//Enter the directory name of your catalog
//don't use any slashes  eg: catalog
$catalog_folder_name = "********/******"; //no slashes

// 3. Configure XML Data to be included

// 3A: Include product prices? (1 is on, 0 is off)
$product_price = "1";

// 3B: include link to product_info.php at your website? (1 is on, 0 is off)
$product_info_link = "1";

// END CONFIGURATION
////////////////////////////////////////////

// create connection
$connection = mysql_connect("$db_server","$db_user","$db_pass")        or die("Couldn't make connection.");
// select database
$db = mysql_select_db("$db_name", $connection) or die("Couldn't select database.");
// create SQL statement
$sqlcount = "SELECT * FROM `products` ORDER BY 'products_model'";
$sql = "SELECT * FROM `products` ORDER BY 'products_model'";
// execute SQL query and get result
$sql_result = mysql_query($sql,$connection) or die("Couldn't execute query.");
$sqlcount_result = mysql_query($sqlcount,$connection) or die("Couldn't execute query.");
$num = mysql_numrows($sqlcount_result);
mysql_free_result($sqlcount_result);

// format results by row
while ($row = mysql_fetch_array($sql_result)) {
       $id = $row["products_id"];
       $model = $row["products_model"];
       $image = $row["products_image"];
       $price = $row["products_price"];
   $sql2 = "SELECT `products_name` FROM `products_description` WHERE products_id = '$id' LIMIT 1";
       $sql2_result = mysql_query($sql2,$connection) or die("Couldn't execute query.");
       $row2 = mysql_fetch_array($sql2_result);
   $name = $row2["0"];
// add extra data here then add the xml tag below
  $products_url =  $row2["4"];
  $products_description =  $row2["5"];
// add extra data here

?>
<PRODUCT ITEM='<?php echo $id; ?>'>
<NAME><?php echo $name;?></NAME>
<MODEL><?php echo $model; ?></MODEL>
<?php
if ($product_price == 1) {
?>
<IMAGE><?php echo $image; ?></IMAGE>
<PRICE><?php printf("%.2f", $price);  ?></PRICE>
<?php
}
if ($product_info_link == 1) {
?>
<URL value="http://<?php echo $domain_name; ?>/<?php echo $catalog_folder_name; ?>/product_info.php?products_id=<?php echo $id; ?>"></URL>
<?php
}
?>
</PRODUCT>
<?php
}
// free resources and close connection
mysql_free_result($sql_result);
mysql_close($connection);
?>
</STOREITEMS>

 

You can see the result here CLICK HERE

 

Regards!

 

p.s. I have serious problems in split the result of this page. I want to split the results because the page is too long! I also tried with the pricelist HTML) contribution, but i can't split the results. TO SPLIT OR NOT TO SPLIT.... THAT'S THE PROBLEM :rolleyes:

 

Any help would be appreciated :lol:

 

BY!

Share this post


Link to post
Share on other sites

After a year i can't split this page result!!!! Thats incredible!!!!!

 

:P

 

Here is my code and i use the same xsl file listed in mine and your post.

 

<?php
Header( 'Content-Type: text/xml' );
echo '<?xml version="1.0" ?>';
echo '<?xml-stylesheet type="text/xsl" href="stile.xsl"?>';
echo "<STOREITEMS>";
/*
 OSCommerce Product XML Feed
 by Kenny Boyd (kenny@theinternetfoundry.com)
 http://www.theinternetfoundry.com

 This hack will provide a basic xml feed which can be polled by
 applications, affiliate websites or systems using other languages
 such as C++, Perl, .NET etc to display your product line in xml
 readable format.

 It is rehash of the excellent Catalog Anywhere addon programmed by:
 Patrick Veverka (patrick@veverka.net) available at:
 http://www.oscommerce.com/community/contributions,294

 This is a real quick and dirty xml implementation so bugs may exist

 Please see the README.TXT before you use this

*/
////////////////////////////////////////////
// THE FOLLOWING OPTIONS MUST BE CONFIGURED!

// 1. Configure DB Connection
$db_server = "******"; //database server
$db_user = "********"; //database user
$db_pass = "********"; //database password
$db_name = "********"; //database name

// 2. Configure Site Info
//Enter the url to your website
//don't use any slashes or http eg: www.mysite.com
$domain_name = "www.yoursite.com";

//Enter the directory name of your catalog
//don't use any slashes  eg: catalog
$catalog_folder_name = "********/******"; //no slashes

// 3. Configure XML Data to be included

// 3A: Include product prices? (1 is on, 0 is off)
$product_price = "1";

// 3B: include link to product_info.php at your website? (1 is on, 0 is off)
$product_info_link = "1";

// END CONFIGURATION
////////////////////////////////////////////

// create connection
$connection = mysql_connect("$db_server","$db_user","$db_pass")        or die("Couldn't make connection.");
// select database
$db = mysql_select_db("$db_name", $connection) or die("Couldn't select database.");
// create SQL statement
$sqlcount = "SELECT * FROM `products` ORDER BY 'products_model'";
$sql = "SELECT * FROM `products` ORDER BY 'products_model'";
// execute SQL query and get result
$sql_result = mysql_query($sql,$connection) or die("Couldn't execute query.");
$sqlcount_result = mysql_query($sqlcount,$connection) or die("Couldn't execute query.");
$num = mysql_numrows($sqlcount_result);
mysql_free_result($sqlcount_result);

// format results by row
while ($row = mysql_fetch_array($sql_result)) {
       $id = $row["products_id"];
       $model = $row["products_model"];
       $image = $row["products_image"];
       $price = $row["products_price"];
   $sql2 = "SELECT `products_name` FROM `products_description` WHERE products_id = '$id' LIMIT 1";
       $sql2_result = mysql_query($sql2,$connection) or die("Couldn't execute query.");
       $row2 = mysql_fetch_array($sql2_result);
   $name = $row2["0"];
// add extra data here then add the xml tag below
  $products_url =  $row2["4"];
  $products_description =  $row2["5"];
// add extra data here

?>
<PRODUCT ITEM='<?php echo $id; ?>'>
<NAME><?php echo $name;?></NAME>
<MODEL><?php echo $model; ?></MODEL>
<?php
if ($product_price == 1) {
?>
<IMAGE><?php echo $image; ?></IMAGE>
<PRICE><?php printf("%.2f", $price);  ?></PRICE>
<?php
}
if ($product_info_link == 1) {
?>
<URL value="http://<?php echo $domain_name; ?>/<?php echo $catalog_folder_name; ?>/product_info.php?products_id=<?php echo $id; ?>"></URL>
<?php
}
?>
</PRODUCT>
<?php
}
// free resources and close connection
mysql_free_result($sql_result);
mysql_close($connection);
?>
</STOREITEMS>

 

You can see the result here CLICK HERE

 

Regards!

 

p.s. I have serious problems in split the result of this page. I want to split the results because the page is too long! I also tried with the pricelist HTML) contribution, but i can't split the results. TO SPLIT OR NOT TO SPLIT.... THAT'S THE PROBLEM :rolleyes:

 

Any help would be appreciated :lol:

 

BY!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×