"; ?>
Lawn Care Business Forum Lawn Care Business Book Lawn Care Business Blog Lawn Care Software
Home Forum Contract & Flyer Templates Blog Software Videos Podcast Calculators / Estimators Store Mower Review Design It Yourself Lawn Business School

Go Back   GopherHaul Landscaping & Lawn Care Business Marketing Forum

"; $i++; } echo "
"; $i++; } echo "
» Product Profile
"; // Give the store link. echo "Back To Store"; //Include our login information include_once('./uploaded-files/pages/estimator_db_login.php'); include_once('./uploaded-files/pages/ditech_utils.php'); // include_once('./uploaded-files/pages/ditech_utils.php'); // sets to show dollars in u.s. version setlocale(LC_MONETARY, 'en_US'); // set max image size height $MaxImageSize = 200; $connection = mysql_connect($db_host, $db_username, $db_password); if (!$connection) { die ("Could not connect to the database:
". mysql_error()); } // Select the database $db_select = mysql_select_db($db_database); if (!$db_select){ die ("Could not select the database:
". mysql_error( )); } function imageResize($width, $height, $target) { //takes the larger size of the width and height and applies the formula accordingly...this is so this script will work dynamically with any size image if ($width > $height) { $percentage = ($target / $width); } else { $percentage = ($target / $height); } //gets the new value and applies the percentage, then rounds the value $width = round($width * $percentage); $height = round($height * $percentage); //returns the new sizes in html image tag format...this is so you can plug this function inside an image tag and just get the return "width=\"$width\" height=\"$height\""; } // ********************************************************************** // BEGIN Display Product with information from the GET submission // ********************************************************************** if (isset($_GET['ProductID'])) //if (isset($_POST['Submit'])) { $ProductID = mysqlclean($_GET,"ProductID",100,$connection); // $query = "SELECT * FROM StoreProducts JOIN StoreProductsCategories ON StoreProducts.ProductCategory = StoreProductsCategories.UniqueID WHERE StoreProducts.ProductID = '$ProductID'"; $query = "SELECT StoreProducts.ProductName, StoreProducts.ProductID, StoreProducts.ProductImageURL, StoreProducts.PurchaseLink, StoreProducts.ImageWidth, StoreProducts.ImageHeight, StoreProducts.AvailableOnsite, StoreProducts.Price, StoreProducts.ProductDescription, StoreProductsCategories.CategoryName FROM StoreProducts JOIN StoreProductsCategories ON StoreProducts.ProductCategory = StoreProductsCategories.UniqueID WHERE StoreProducts.ProductID = '$ProductID'"; if (!(@mysql_query($query,$connection))) showerror; $result=mysql_query($query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $ProductName=mysql_result($result,$i,"ProductName"); $ProductID=mysql_result($result,$i,"ProductID"); $ProductImageURL=mysql_result($result,$i,"ProductImageURL"); $PurchaseLink=mysql_result($result,$i,"PurchaseLink"); $ImageWidth=mysql_result($result,$i,"ImageWidth"); $ImageHeight=mysql_result($result,$i,"ImageHeight"); $AvailableOnsite=mysql_result($result,$i,"AvailableOnsite"); $Price=mysql_result($result,$i,"Price"); $ProductDescription=mysql_result($result,$i,"ProductDescription"); $CategoryName=mysql_result($result,$i,"CategoryName"); // echo "

$ProductName

$ProductName

category:

$CategoryName

"; echo ""; echo ""; // ************************************************** // BEGIN Show Quantity or the order offsite button // ************************************************** // is this product available onsite? 1 = yes, 0 = no if ($AvailableOnsite == 1) { // only do this if there is a customer session if(session_is_registered(CustomerID)) { $CustomerID = $_SESSION['CustomerID']; $j=0; //initialize this to 0 $QuantityFromDB=0; $query1="SELECT Quantity FROM ShoppingCartOrderItems WHERE CustomerID='$CustomerID' AND ProductID='$ProductID'"; if (!(@mysql_query($query1,$connection))) showerror; $result1=mysql_query($query1); $num1=mysql_numrows($result1); while ($j < $num1) { $QuantityFromDB=mysql_result($result1,$j,"Quantity"); $j++; } } else { $QuantityFromDB=0; } echo ""; } else { echo ""; } // ************************************************** // END Show Quantity or the order offsite button // ************************************************** $StrippedSlashesProductDescription = stripslashes($ProductDescription); echo ""; echo ""; echo"
Product Name $ProductName
"; echo '
'; echo " Qty.
Product Description$StrippedSlashesProductDescription
Price".money_format('%n', $Price)."
"; } // ********************************************************************** // END Display Product with information from the GET submission // ********************************************************************** else // ********************************************************************** // BEGIN Display Product After the quantity has been changed. With information from the POST submission // ********************************************************************** //if (isset($_GET['ProductID'])) if (isset($_POST['Submit'])) { // ******************************** // BEGIN ALTER THE Quantity Amount // ******************************** $UserFirstName = $_POST["UserFirstName"]; $_SESSION['UserFirstName']= $UserFirstName ; // if there is no season registered create one. if(!session_is_registered(CustomerID)){ //so we use the MD5 algorithm to generate a random hash $RandomHash = md5(date('r', time())); $CustomerID = $RandomHash; $_SESSION['CustomerID'] = $CustomerID; } else { $CustomerID = $_SESSION['CustomerID']; } $ProductID = mysqlclean($_POST,"ProductID",100,$connection); $Quantity = mysqlclean($_POST,"ChosenQuantity",100,$connection); // Does this item and qty already exist in the db? if so, don't enter it again. Also don't enter 0 for a product ID if ((!($ProductID == null) ) and ($ProductID > 0)) { $query1="SELECT * FROM ShoppingCartOrderItems WHERE CustomerID='$CustomerID' AND ProductID='$ProductID'"; $result1=mysql_query($query1); $num1=mysql_numrows($result1); } else { $num1=0; } // if there is no record, enter it. if (($num1 == 0) and ($ProductID > 0)) { // if there is data to be entered, enter it. Just don't enter 0 $query = "Insert INTO ShoppingCartOrderItems (CustomerID, ProductID, Quantity, OrderDate, OrderTime, IPAddress) VALUES ('$CustomerID','$ProductID', '$Quantity', '$CurrentDate', '$CurrentTime', '$ip')"; if (!(@mysql_query($query,$connection))) showerror; } // Did someone decide to change their quantity to 0 from a previous number? if (!($ProductID == null) and ($Quantity == 0) ) { // let's first see if there is a record $query2="SELECT * FROM ShoppingCartOrderItems WHERE CustomerID='$CustomerID' AND ProductID='$ProductID'"; $result2=mysql_query($query2); $num2=mysql_numrows($result2); // if a record exists, then delete it. if ($num2 > 0) { $query = "DELETE FROM ShoppingCartOrderItems WHERE CustomerID='$CustomerID' AND ProductID='$ProductID'"; if (!(@mysql_query($query,$connection))) showerror; } } // The quantity has been updated to a number other than 0 so let's update the table elseif (!($ProductID == null) and ($Quantity > 0) ) { $query3="UPDATE ShoppingCartOrderItems SET Quantity='$Quantity' WHERE CustomerID='$CustomerID' AND ProductID='$ProductID'"; if (!(@mysql_query($query3,$connection))) showerror; } // ******************************** // END ALTER THE Quantity Amount // ******************************** $query = "SELECT StoreProducts.ProductName, StoreProducts.ProductID, StoreProducts.ProductImageURL, StoreProducts.PurchaseLink, StoreProducts.ImageWidth, StoreProducts.ImageHeight, StoreProducts.AvailableOnsite, StoreProducts.Price, StoreProducts.ProductDescription, StoreProductsCategories.CategoryName FROM StoreProducts JOIN StoreProductsCategories ON StoreProducts.ProductCategory = StoreProductsCategories.UniqueID WHERE StoreProducts.ProductID = '$ProductID'"; if (!(@mysql_query($query,$connection))) showerror; $result=mysql_query($query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $ProductName=mysql_result($result,$i,"ProductName"); $ProductID=mysql_result($result,$i,"ProductID"); $ProductImageURL=mysql_result($result,$i,"ProductImageURL"); $PurchaseLink=mysql_result($result,$i,"PurchaseLink"); $ImageWidth=mysql_result($result,$i,"ImageWidth"); $ImageHeight=mysql_result($result,$i,"ImageHeight"); $AvailableOnsite=mysql_result($result,$i,"AvailableOnsite"); $Price=mysql_result($result,$i,"Price"); $ProductDescription=mysql_result($result,$i,"ProductDescription"); $CategoryName=mysql_result($result,$i,"CategoryName"); // echo "

$ProductName

$ProductName

category:

$CategoryName

"; echo ""; echo ""; // ************************************************** // BEGIN Show Quantity or the order offsite button // ************************************************** // is this product available onsite? 1 = yes, 0 = no if ($AvailableOnsite == 1) { // only do this if there is a customer session if(session_is_registered(CustomerID)) { $CustomerID = $_SESSION['CustomerID']; $j=0; //initialize this to 0 $QuantityFromDB=0; $query1="SELECT Quantity FROM ShoppingCartOrderItems WHERE CustomerID='$CustomerID' AND ProductID='$ProductID'"; if (!(@mysql_query($query1,$connection))) showerror; $result1=mysql_query($query1); $num1=mysql_numrows($result1); while ($j < $num1) { $QuantityFromDB=mysql_result($result1,$j,"Quantity"); $j++; } } else { $QuantityFromDB=0; } echo ""; } else { echo ""; } // ************************************************** // END Show Quantity or the order offsite button // ************************************************** $StrippedSlashesProductDescription = stripslashes($ProductDescription); echo ""; echo ""; echo"
Product Name $ProductName
"; echo '
'; echo " Qty.
Product Description$StrippedSlashesProductDescription
Price".money_format('%n', $Price)."
"; } // ********************************************************************** // END Display Product After the quantity has been changed. With information from the POST submission // ********************************************************************** else { echo "nothing"; } echo "
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:06 PM.


(C) 2011 Riggs Publications - Terms of use & Privacy Policy

All times are GMT -5. The time now is 09:06 PM.

(C) 2011 Riggs Publications - Terms of use & Privacy Policy