Jump to content

davey_b_

Members
  • Posts

    34
  • Joined

  • Last visited

    Never

Everything posted by davey_b_

  1. I know this can be done, I'm just having one of those days where I can't seem to think about it... I have an add to cart form and want to include multiple 'quantity' buttons: Add1 | Add2 | Add3 |... and so on. I'd appreciate any help on this I'm using Virtuemart as the engine for this and here is my form code. This one is set "add 15 to cart" <form action="index.php" method="post" name="addtocart" id="addtocart_4a5f54948b17a" class="addtocart_form" onsubmit="handleAddToCart( this.id );return false;"> <input type="hidden" name="product_id" value="21" /> <input type="hidden" name="prod_id[]" value="21" /> <label for="quantity21" class="quantity_box"> </label> <input type="hidden" id="quantity21" name="quantity[]" value="15" style="vertical-align: middle;"/> <input type="submit" class="addtocart_button" value="Add 15 to Cart" title="Add to Cart" /> <input type="hidden" name="flypage" value="shop.flypage.tpl" /> <input type="hidden" name="page" value="shop.cart" /> <input type="hidden" name="manufacturer_id" value="1" /> <input type="hidden" name="category_id" value="6" /> <input type="hidden" name="func" value="cartAdd" /> <input type="hidden" name="option" value="com_virtuemart" /> <input type="hidden" name="Itemid" value="64" /> <input type="hidden" name="set_price[]" value="" /> <input type="hidden" name="adjust_price[]" value="" /> <input type="hidden" name="master_product[]" value="" /> </form> I
  2. Yeah thought as much - thank you so much for your help
  3. ok - that got rid of the loop and appears to have sorted the original issue but now I'm getting "Warning: Division by zero" message... is it related or a seperate issue?? <?php $sql=" SELECT od.*, s.order_status FROM ".$tableprefix."order_details od INNER JOIN ".$tableprefix."order_status s ON s.order_status_id = od.item_status WHERE od.artist_id = '".addslashes($artistid)."' and od.order_id = '".addslashes($orderid)."' " . $qryopt . " "; $result1 = mysql_query($sql) or die("Query Error: ".mysql_error()); $i=$begin+1; while($rw = mysql_fetch_array($result1)){ $check = "<input type='checkbox' class='textbox' name='chkitems[]' value='" . $rw["order_detail_id"] . "' > "; $rate = $rw["product_price"]; $qty = $rw["product_quantity"]; $price = $rate * $qty; $discountstr=""; $ratestr=$rate; if($rw["product_discount"] !="0"){ $rate2=$rate- ($rate*$rw["product_discount"])/100; $ratestr="<font color=red size=1><del>" .$currency_attributes[0]. "" .$rate. "</del></font><br>" .$currency_attributes[0]. "".number_format(($rate2),2 ,".","" ); $price=$price-($price*$rw["product_discount"]/100); $discountstr="<br>Discount (".$rw["product_discount"]."%)"; } $subtotal += $price + $postagetotal; $rate = number_format($rate,2,".","" ); $price = number_format($price,2,".","" ); ?> <tr> <td valign=top align="left"><? echo $i; ?></td> <td valign=top align="left"><? echo htmlentities($rw["product_name"]).$discountstr; ?></td> <td valign=top align="left"><? echo htmlentities($rw["product_code"]); ?></td> <td valign=top align="left"><? echo htmlentities($rate/$row["nexchange_price"]); ?></td> //HERE <td valign=top align="left"><? echo htmlentities($qty); ?></td> <td valign=top align="left"><? echo htmlentities($price/$row["nexchange_price"]); ?></td> //HERE <td valign=top align="left"><? echo htmlentities($rw["order_status"]); ?> </td> </tr>
  4. OK, line 167 from vieworder.php is marked below... <?php $result = mysql_query($sql)or die("Query Error: ".mysql_error()); while(mysql_num_rows($result)!=0){ $row = mysql_fetch_array($result); $ordernumber = $row["order_id"]; $username = $row["user_name"]; $ordertotal = ($row["total"]/$row["nexchange_price"]); // Line 167 $orderstatus = getArtistOrderStatus($orderid, $artistid); $orderdate = $row["order_date"]; $orderdate = dateFormat($orderdate,"Y-m-d","d-M-Y"); $userid = $row["user_id"]; }
  5. With that code I'm getting, same as with my alternative code..... Warning: Division by zero in /var/www/httpdocs/mmviii/artists/vieworder.php on line 167 Warning: explode(): Empty delimiter. in /var/www/httpdocs/mmviii/includes/functions.php on line 1446 Warning: explode(): Empty delimiter. in /var/www/httpdocs/mmviii/includes/functions.php on line 1447 Warning: array_values(): The argument should be an array in /var/www/httpdocs/mmviii/includes/functions.php on line 1432 Warning: array_values(): The argument should be an array in /var/www/httpdocs/mmviii/includes/functions.php on line 1433 Warning: in_array(): Wrong datatype for second argument in /var/www/httpdocs/mmviii/includes/functions.php on line 1449 Warning: in_array(): Wrong datatype for second argument in /var/www/httpdocs/mmviii/includes/functions.php on line 1451 The relivent lines in functions.php <?php function dateFormat($input_date, $input_format, $output_format) //Line 1442 { preg_match("/^([\w]*)/i", $input_date, $regs); $sep = substr($input_date, strlen($regs[0]), 1); $label = explode($sep, $input_format); $value = explode($sep, $input_date); $array_date = array_combine($label, $value); if (in_array('Y', $label)) { $year = $array_date['Y']; } elseif (in_array('y', $label)) { $year = $year = $array_date['y']; } else { return false; } $output_date = date($output_format, mktime(0, 0, 0, $array_date['m'], $array_date['d'], $year)); return $output_date; }
  6. got ya, Query Error: Unknown column 'o.user_id' in 'on clause'
  7. Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www....... this is my sql string echoed... SELECT o.*, u.user_name, u.email,s.order_status,od.product_discount, cm.nexchange_price,vcurrency_name, sum((od.product_price-(od.product_price*product_discount/100)) * od.product_quantity) AS total FROM tug_orders o,tug_currency_master cm INNER JOIN tug_users u ON o.user_id = u.user_id INNER JOIN tug_order_status s ON o.order_status = s.order_status_id INNER JOIN tug_order_details od ON o.order_id = od.order_id WHERE od.artist_id = '1' AND o.vorder_currency = cm.vcurrency_code AND o.order_id = '1020157' GROUP BY o.order_id ORDER BY o.order_date DESC
  8. I'm trying to get this to work in MySQL 5 - I know my issue is to do with mixing comma and JOIN but I'm not sure how to solve it - can someone please help <?php // just for code colours SELECT o.*, u.user_name, u.email,s.order_status,od.product_discount, cm.nexchange_price,vcurrency_name, sum((od.product_price-(od.product_price*product_discount/100)) * od.product_quantity) AS total FROM ".$tableprefix."orders o,".$tableprefix."currency_master cm INNER JOIN ".$tableprefix."users u ON o.user_id = u.user_id INNER JOIN ".$tableprefix."order_status s ON o.order_status = s.order_status_id INNER JOIN ".$tableprefix."order_details od ON o.order_id = od.order_id WHERE od.artist_id = '".addslashes($artistid)."' AND o.vorder_currency = cm.vcurrency_code AND o.order_id = '".addslashes($orderid)."' " . $qryopt . " GROUP BY o.order_id ORDER BY o.order_date DESC "; I tried this but it just creates a load of errors - I'm a bit lost... <?php SELECT o.*, u.user_name, u.email,s.order_status,od.product_discount, cm.nexchange_price,vcurrency_name, sum((od.product_price-(od.product_price*product_discount/100)) * od.product_quantity) AS total FROM ".$tableprefix."orders o INNER JOIN ".$tableprefix."currency_master cm ON ( o.vorder_currency = cm.vcurrency_code ) INNER JOIN ".$tableprefix."users u ON ( o.user_id = u.user_id ) INNER JOIN ".$tableprefix."order_status s ON ( o.order_status = s.order_status_id ) INNER JOIN ".$tableprefix."order_details od ON ( o.order_id = od.order_id ) WHERE od.artist_id = '".addslashes($artistid)."' AND o.order_id = '".addslashes($orderid)."' ".$qryopt." GROUP BY o.order_id ORDER BY o.order_date DESC ";
  9. of course... here's the rest plus the sql update <?php if ($message != "") { // error $message = "<br>Please correct the following errors to continue!<br>" . $message; } else { // no error so insert user details if($picsmallname != ""){ move_uploaded_file($_FILES['userfile']['tmp_name'][0], "../products/".$final_image_small); if($_FILES['userfile']['tmp_name'][0] != "") { chmod("../products/$final_image_small", 0777); generateThumbNail("../products/".$final_image_small,"../products/".$final_image_small,150,150); } } if($picbigname != ""){ move_uploaded_file($_FILES['userfile']['tmp_name'][1], "../products/".$final_image_big); if($_FILES['userfile']['tmp_name'][1] != "") { chmod("../products/$final_image_big", 0777); generateThumbNail("../products/".$final_image_big,"../products/".$final_image_big,400,400); } } $sql = "UPDATE ".$tableprefix."products SET product_name = '".addslashes($txtProductName)."', product_code = '".addslashes($txtProductCode)."', product_description = '".addslashes($txtDescription)."', product_short_desc = '".addslashes($txtShort_desc)."', product_price = '".addslashes($txtPrice)."', product_postage = '".addslashes($txtPostage)."', product_addpostage = '".addslashes($txtAddpostage)."', product_youtube = '".addslashes($txtYoutube)."', product_category = '".addslashes($ddlCategory)."', product_tags = '".addslashes($txtTags)."', "; if($picsmallname != ""){ $sql .= "product_image_small = '".addslashes($final_image_small)."',"; } if($picbigname != ""){ $sql .= "product_image_big = '".addslashes($final_image_big)."',"; }
  10. I found this one to be decent but you might want to look around... http://www.openwebware.com/products/openwysiwyg/ Hope it helps.
  11. i have a basic upload image script but when no image is selected it still puts "productsmall_1209413585" in the database. if the image is true then "productsmall_1209412913ne_grp1.gif" is entered and all works fine... what have i done wrong?? <?php //////////// Image config ////////////// $picsmall = $_FILES['userfile'][0]; $picbig = $_FILES['userfile'][1]; $picsmallname = $_FILES['userfile']['name'][0]; $picbigname = $_FILES['userfile']['name'][1]; $picsmalltype = $_FILES['userfile']['type'][0]; $picbigtype = $_FILES['userfile']['type'][1]; $final_image_big = "productlarge_".time().$picbigname; $final_image_small = "productsmall_".time().$picsmallname; $picsmalldest = $prodimagedir . $picsmallname; $picbigdest = $prodimagedir . $picbigname; if (!is_readable($prodimagedir) || !is_writable($prodimagedir) || !is_executable($prodimagedir)) { $error = true; $message .= " * Change the permission of 'products' folder in the root to 777 <br>"; } if ($picsmalltype != "") { if (!isValidWebImageType($picsmalltype)) { $message .= " * Invalid product picture (small)! Upload an image (jpg/gif/png)" . "<br>"; $error = true; } else { if (file_exists($picsmalldest)) { $message .= " * Product picture (small) with the same name exists! Please rename the product picture (small) and upload! " . "<br>"; $error = true; } } } if ($picbigtype != "") { if (!isValidWebImageType($picbigtype)) { $message .= " * Invalid product picture (big)! Upload an image (jpg/gif/png)" . "<br>"; $error = true; } else { if (file_exists($picbigdest)) { $message .= " * Product picture (big) with the same name exists! Please rename the product picture (big) and upload! " . "<br>"; $error = true; } } } PS. I need to time stamp it in case 2 images with the same name get uploaded.
  12. Yeah, I tried to do that but I just wasn't woking for me - I'm not a very seasoned php'er yet!
  13. Hey, I want to create a feedback form similar to ebay. users leave feedback for sellers and give a rating. however i don't want users to be able to leave loads of feedback for the same seller at once. Maybe limit them to once a week or month, but only for each seller. How can I do this, or is this more a MySQL question??? Here's what I have so far... it works ok but allows users to flood the admin with feedback (admin reviews and publishes). I'm going to change the rating from drop down to radio buttons. <?php include "includes/config.php"; include "includes/session.php"; include "includes/functions.php"; if (get_magic_quotes_gpc()) { $_POST = array_map('stripslashes_deep', $_POST); $_GET = array_map('stripslashes_deep', $_GET); $_COOKIE = array_map('stripslashes_deep', $_COOKIE); } if(isset( $_SESSION["sess_userid"]) and $_SESSION["sess_userid"]!= ""){ $userid = $_SESSION["sess_userid"]; }else{ header("Location:login.php"); exit; } if(isset( $_GET["artistid"]) and $_GET["artistid"]!= ""){ $artistid = $_GET["artistid"]; }else if(isset( $_POST["artistid"]) and $_POST["artistid"]!= ""){ $artistid = $_POST["artistid"]; }else{ header("Location:viewcatalog.php"); exit; } if(isset( $_GET["productid"]) and $_GET["productid"]!= ""){ $productid = $_GET["productid"]; }else if(isset( $_POST["productid"]) and $_POST["productid"]!= ""){ $productid = $_POST["productid"]; } if ($_POST["btnPostFeedback"] == "Post Feedback") { $txtFeedback = $_POST["txtFeedback"]; $ddlRating = $_POST["ddlRating"]; if (!isNotNull($txtFeedback)) { $message .= "* Feedback cannot be empty! <br>"; } if ($message != "") { // error $message = "<br>Please correct the following errors to continue!<br>" . $message; } else { // no error so insert user details $sql = "INSERT INTO ".$tableprefix."artist_feedbacks ( feedback_content, rating, user_id, artist_id, date_added, published ) VALUES ( '".addslashes($txtFeedback)."', '".addslashes($ddlRating)."', '".addslashes($userid)."', '".addslashes($artistid)."', now(), 'N') "; //echo $sql; $message = "Thank you for posting your valuable feedback about <b>". getArtistName($artistid)."</b>"; $message .= "<br>Your feedback is pending for review and approval by the administrator"; mysql_query($sql); $txtFeedback = ""; $ddlRating = ""; } } $ratinglist = array(); for($i=1;$i<11;$i++){ $ratinglist[$i] = $i; } /*display the active template*/ $active_template = displayTemplate(); include "includes/htmltop.php"; /* Top File Name */ include_once ("includes/".$active_template[0]); ?> <div align="left" class="main_body"> <!--mainbody area start --> <div align="left" id="body_left_area"> <!--body left area start --> <!--categories area start --> <?php include_once("includes/categorylist.php"); ?> <!--categories area end --> <!--body left area end --> </div> <!--center content area start--> <form name="frmPostFeedback" action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST"> <input type="hidden" name="artistid" value="<?php echo $artistid;?>" > <input type="hidden" name="productid" value="<?php echo $productid;?>" > <div align="left" id="item_details"> <!--items display area start --> <div align="left" id="items_top_area"> <img src="<?php echo $active_template[3]?>/top_title_left.gif" alt="" class="items_top_area_img" /> <div align="left" id="items_top_area_ttl"><?php echo getArtistName($artistid); ?>'s Feedback</div> <img src="<?php echo $active_template[3]?>/top_title_right.gif" alt="" class="items_top_area_img" /> </div> <div id="items_display_area"> <div class="text_information" align="center"><?php echo $message?></div> <div> <table cellpadding="2" cellspacing="2" width="100%" border=0 class="heading"> <tr> <td colspan="3" align="right"><span class="required">*</span>Required Fields</td> </tr> <tr><td colspan="3"> </td></tr> <tr><td align="left" valign="top" width="32%">Your Feedback <span class="required">*</span></td><td > </td><td align="left"><input name="txtFeedback" type="text" class="textbox" value="<?php echo $txtFeedback;?>" size="100" maxlength="120" /></td></tr> <tr><td align="left" valign="top" >Your rating (1-10, 10 Best) <span class="required">*</span></td><td > </td><td align="left"><?php echo makeDropDownList("ddlRating", $ratinglist, $ddlRating, false,"textbox", $properties, $behaviors)?></td></tr> <tr><td colspan="3"> </td></tr> <tr><td colspan="3" align="center"> <input type="submit" class="button" value="Post Feedback" name="btnPostFeedback"> <input class="button" type="button" value="Back to Listing" onClick="window.location.href='productdetails.php?productid=<?php echo $productid;?>';" ></td></tr> </table> </div> <div align="left" class="float_clear1"></div> <!--items display area end --> </div> </div> </form> <!--center content area end--> <div align="left" class="float_clear"><img src="images/clear.gif" alt="" width="1" height="1" /></div> <!--mainbody area end --> </div> <div align="left" class="float_clear"><img src="images/clear.gif" alt="" width="1" height="1" /></div>
  14. Yes MySQL 5.0.22. All i can say is wow, thanks for the lesson. Put the new code in and it worked like a charm. Guess they don't give those many stars to just anyone Thanks again.
  15. Being a bit of a n00b! Query: SELECT o.*, u.user_name, u.email, od.artist_id,cm.nexchange_price FROM tug_orders o,tug_currency_master cm INNER JOIN tug_users u ON o.user_id = u.user_id INNER JOIN tug_order_details od ON o.order_id = od.order_id WHERE o.order_id = '5' AND o.vorder_currency = cm.vcurrency_code AND o.user_id = 1 ORDER BY o.order_date DESC Error: (1054) Unknown column 'o.user_id' in 'on clause'
  16. Why am i not getting a result when there is information in the database for it to retrieve? This problem has really confused me!
  17. Why am I getting this??? Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/.../vieworder.php on line 130 <?php $sql=" SELECT o.*, u.user_name, u.email, od.artist_id,cm.nexchange_price FROM ".$tableprefix."orders o,".$tableprefix."currency_master cm INNER JOIN ".$tableprefix."users u ON o.user_id = u.user_id INNER JOIN ".$tableprefix."order_details od ON o.order_id = od.order_id WHERE o.order_id = ".GetSQLValueString($orderid,"text")." AND o.vorder_currency = cm.vcurrency_code AND o.user_id = ".$_SESSION["sess_userid"]. $qryopt . " ORDER BY o.order_date DESC "; $result = mysql_query($sql); if(mysql_num_rows($result) !=0) { $prow = mysql_fetch_array($result); $ordernumber = $prow["order_id"]; $username = $prow["user_name"]; $ordertotal = $prow["order_total_price"]; $orderdate = $prow["order_date"]; $orderdate = dateFormat($orderdate,"Y-m-d","d-M-Y"); $userid = $prow["user_id"]; $exchange_price = $prow["nexchange_price"]; } else { $order_flag = 1; }
  18. 2147483647 is PHP's max integer value... but i'm not an expert with your problem. Sorry! You could try $CollectID = rand(1000000000,2147483646);
  19. The code works fine for selecting between the currencies but here's the problem... If I leave echo "<script type='text/javascript'> window.location='".$_SERVER['HTTP_REFERER']."';</script>"; enabled then the page just continously reloads, if I comment it out then all works but you can't delete any products from the cart - or anywhere else for that matter!!! Here's the code... <?php /*currency section starts*/ $currency_selected = ""; session_register('SESS_currency_type'); if(isset($_POST)) { foreach($_POST as $k => $v) $_SESSION['SESS_currency_type'] = $k; echo "<script type='text/javascript'> window.location='".$_SERVER['HTTP_REFERER']."';</script>"; // <-- problem line!! } else { if (!isset($_SESSION['SESS_currency_type']) OR $_SESSION['SESS_currency_type'] == "") { $_SESSION['SESS_currency_type'] = "1"; $currency_type = "1"; } } /*currency section ends*/ ?> Does anyone know whats wrong??
  20. but my dropdown list is created with the following code... <?php echo makeDropDownList_search("ddlCategory", $catlist, $ddlCategory, true, "", $properties, $behaviors); ?>
  21. Yeah, i can do that uniformly by adding SELECT{ height:16px; margin:0; BACKGROUND-COLOR : #fff; .... But I just wanted to affect 1 select menu.
  22. Can you add CSS to a makeDropDownList function - if so, how? I want to be able to change the height/font of the dropdown menu.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.