Jump to content


  • Content count

  • Joined

  • Last visited

1 Follower

About plouka

  • Birthday 05/04/1983

Profile Information

  1. plouka

    XML Feed with Category Name

    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>
  2. I am getting a run time error when i go to admin/categories.php. It brings up "document.all[...]" is null or not an object line 153 The debugger brings up editor_basic.js. I was wondering what I could be missing that might be causing this error. Please help!!! Thanks, Patrick Louka
  3. Can someone link me to the master products contribution? I have been referred to it, but cannot find it on the contributions page. Thanks in advance for your help! Patrick
  4. where can I find this contribution?? Thanks, Patrick
  5. I need to make my store so that different sizes and attributes have differing part/model #"s. Is there a simple way to do this without having to have different product pages for large and small of the same product? Thanks in advance for any help! Patrick