PHP and Picasa
Posted: Thu Feb 18, 2010 2:12 pm
Hi everyone! I am a seasoned HTML/css coder just starting to get into PHP coding. Currently, my client is a small business that needed an inventory they could update without my help for their website. I implemented a system with picasa that they could use to update their inventory, however once it was done they wanted more functionality from it. They would like to change one portion of the text description in Picasa to change to red because it's a warning for small children. Additionally, I am using the 'tag' system in picasa for the prices of each item. However they wanted to add more parameters to each item such as weight and item number, but I seem to have run out of variables to use with Picasa. Does anyone have any experience with this that will help me out? Below is the code of my phpfunctions file.
Code: Select all
<?php
//////////////FUNCTION FOR PULLING ALBUM (CATEGORY) ENTRIES///////////////
function getInventory($userID,$category){
$userid = $userID;
$album = $category;
$feedURL = "http://picasaweb.google.com/data/feed/api/user/$userid/album/$album";
$sxml = simplexml_load_file($feedURL);
$counts = $sxml->children('http://a9.com/-/spec/opensearchrss/1.0/');
$total = $counts->totalResults;
?>
<h1><?php echo $sxml->title; ?></h1>
<?php echo $total; ?> Item(s) found.
<p/>
<?php
foreach ($sxml->entry as $entry) {
$title = $entry->title;
$title = substr("$title", 0, -4);
$summary = $entry->summary;
$gphoto = $entry->children('http://schemas.google.com/photos/2007');
$size = $gphoto->size;
$height = $gphoto->height;
$width = $gphoto->width;
$caption = $gphoto->caption;
$media = $entry->children('http://search.yahoo.com/mrss/');
$thumbnail = $media->group->thumbnail[1];
$tags = $media->group->keywords;
$attributes = attributes();
echo "<table class=common width=640><tr><h3>$title</h3></tr>";
echo "<tr><td width=25%><img src=\"" .
$thumbnail->$attributes->{'url'} . "\"/></td>\n";
echo "<td width=55%><div align=left><span class=\"attr\"><b>Description</span>:</b><br> $summary<br /><br /></div>\n";
echo "<span class=\"attr\"><b>Price</span>:</b> $$tags </td>";
echo "<td width=15%><div align=center><span class=\"attr\">";
echo "<form method=post action=http://emartnet.com/cart/odb/cart.odb>";
echo " <b>";
echo " <input type=hidden name=UPSContainer value=00 />";
echo " <input type=hidden name=cn value='Telephone # Required' />";
echo " <input type=hidden name=UPSRateChart value=Regular Daily Pickup />";
echo " <input type=hidden name=UPSOpts value=011111111 />";
echo " <input type=hidden name=OrigPostal value=07747 />";
echo " <input type=hidden name=taxShip value=1 />";
echo " <br />";
echo " <input type=hidden name=PayPalLogoURL value='images/joelogo2.gif' />";
echo " <input type=hidden name=return value=0 />";
echo " <input type=hidden name=taxRate1 value='7.0' />";
echo " <input type=hidden name=taxRegion1 value='New Jersey' />";
echo " <input type=hidden name=bName value='Small Business>";
echo " <input type=hidden name=logoUrl value='images/joelogo2.gif' />";
echo " <input type=hidden name=PayPalEmail value=email />";
echo " <input type=hidden name=cartCfg value=64 />";
echo " <input type=hidden name=cn value='Telephone # Required' />";
echo " </font></b>";
echo " <p><b>Quantity:";
echo " <input type=tex name=qty size=3 value=1 />";
echo " <br />";
echo " <input type=hidden name=taxable value=1 />";
echo " <input type=hidden name=product value=\"$title\" />";
echo " <input type=hidden name=amount value=\"$tags\" />";
echo " <input type=hidden name=Weight value=15 />";
echo " $$tags</b><br />";
echo " <input type=image src=http://emartnet.com/cart/order5Blue.gif border=0 alt='Order This Item' width=70 height=15 name=I1 />";
echo " <br />";
echo " <a href='http://emartnet.com/cart/odb/cart.odb?merchantID=648&logoUrl=images/joelogo2.gif&return=website'> <img src='http://emartnet.com/cart/checkout5Blue.gif' border='0' alt='Check Out Now' width='70' height='15' /></a> </b></font></font></p></form>";
echo "</td></tr></table><hr>\n";
};
}