Jump to content

swissbeets

Members
  • Posts

    57
  • Joined

  • Last visited

    Never

Everything posted by swissbeets

  1. I am a very new to designing webpages and just recently got my site up and running. i am now at the point i want to validate my page, (only because i have read that it is important to have ur page validated) but i came up with so many errors i may never get through it. I am getting a lot of errors in the Javascript functions that preload the images for my navigation bar, i know these are fine because i copied them directly from dreamweaver? anyone else ever had this problem?
  2. ok i believe i have the correct code now but for some reason when i click the link, it brings up that i am downloading the picture (the google checkout picture) i cannot figure this out, especially since it worked before i added more items here is my code $cart_set1 = get_cart($cookie_id); while($row = mysql_fetch_array($cart_set1)) {?> <?php $number=1; ?> <form method="POST" action="https://sandbox.google.com/checkout/api/checkout/v2/checkoutForm/Merchant/722419656118816"> <input type="hidden" name="<?php echo "item_name_".$number; ?>" value="<?php echo $row['product_name']; ?>"/> <input type="hidden" name="<?php echo "item_quantity_".$number; ?>" value="<?php echo $row['qty']; ?>"/> <input type="hidden" name="<?php echo "item_price_".$number; ?>" value="<?php echo $row['product_price']; ?>"/> <input type="hidden" name="<?php echo "item_currency_".$number; ?>" value="USD"/> <input type="hidden" name="<?php echo "ship_method_name_".$number; ?>" value="UPS Ground"/> <input type="hidden" name="<?php echo "ship_method_price_".$number; ?>" value="10.99"/> <input type="hidden" name="<?php echo "item_description_".$number; ?>" value="<?php echo $row['size']; ?>"/> <input type="hidden" name="tax_rate" value="0.0875"/> <input type="hidden" name="tax_us_state" value="NY"/> <input type="hidden" name="_charset_"/> <?php $number++; ?> <?php } ?> <input type="image" name="Google Checkout" alt="fast checkout through google" src="http://checkout.google.com/buttons/checkout.gif?merchant_id=722419656118816&w=180&h=46&style=white&variant=text&loc=en_US" height="46" width="180"/> </form any ideas?
  3. sorry about that, i am putting this information into google checkout and need certain things to be posted, i think. i am having a terrible time trying to work with google checkout i am saving all of my information for my cart into a db and only need to query the database and send this info to google when the person clicks submit. i took this fromm the sample and added my own information to it. my problem is i need that to be looped through and post all the information to google, i am assuming that in order for google to tell that they are seperate items, the item number must increment. but i dont know that much html and was hoping i was just making the form do something that was not allowed in html and someone would pretty easily see it.
  4. ok, i understand a cron file is a cgi file that is always running... so i would make this my php file <?php $twodays = strtotime("two days ago"); $query = "DELETE FROM `cart` WHERE `cart`.`cookie_id` <= $twodays"; ?> then my cron would be something like (taken from the tutorial) MAILTO=cron@username.plus.com 00 18 * * * /usr/local/bin/php $HOME/php/script.php the tutorial still confused me and i cannot find anyone that knows anything about these files
  5. $product_set = get_cart($cookie_id); while($row = mysql_fetch_array($cart_set)) { <form method="POST" action="https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/************" accept-charset="utf-8"> <----as you can see below this i have name="item_name_"++ this is because i need the item_name_ to go up as we go through this while loop(this is also the same with all of the variables)---> <input type="hidden" name="item_name_"++ value="<?php echo $row['product_id']; ?>"/> <input type="hidden" name="item_quantity_1" value="<?php echo $row['qty']; ?>"/> <input type="hidden" name="item_price_1" value="<?php echo $row['product_price']; ?>"/> <input type="hidden" name="item_currency_1" value="USD"/> <input type="hidden" name="ship_method_name_1" value="UPS Ground"/> <input type="hidden" name="ship_method_price_1" value="10.99"/> <input type="hidden" name="tax_rate" value="0.0875"/> <input type="hidden" name="tax_us_state" value="NY"/> <input type="hidden" name="_charset_"/> <?php } ?> <input type="image" name="Google Checkout" alt="Fast checkout through Google" src="http://checkout.google.com/buttons/checkout.gif?merchant_id=*************&w=180&h=46&style=white&variant=text&loc=en_US" height="46" width="180"/> </form> the image is not even working as a link that is why i think there is a problem
  6. ok i have posted this on numerous forums and done as much reading as i possibly could find but still no prevail i have a shopping cart that works perfectly for what i need, it saves everything anytime a user clicks add to cart onto mysql server with a primary key that is unique to anyone who clicks the button and then saves it. so basically i query the database for this unique id and get all the info i need for ashopping cart. but now i need a checkout. i do not want ot make one because of the liabilities but can find nothing that will work with my ideas? if anyone has ever used google checkout or paypal it would be greatly appreciatted just a little bit of input since this is my first ecommerce site.
  7. so my php file would be something like $twodays = strtotime("two days ago"); DELETE FROM `cart` WHERE `cart`.`cookie_id` = .$twodays; then i would put the cron job somewhere else in the file?
  8. so you specify when it will run in the code of the file? when i use the time() i got 1215734150 how can i decipher this?
  9. from what i have found on cron job's you need to a create a new file, can this new file be any format (php?) then i still dont understand where you put the code to run this file?
  10. very true... while($row2 = mysql_fetch_array($result2)) { $products[$row2['product_id']][] = $row2; } $sub_totals = array(); foreach ($products as $product_id => $n) { foreach ($products[$product_id] as $data) { $sub_totals[$product_id] = $data['product_price'] * $data['qty']; } } echo '<pre>' . print_r($sub_totals, true) . '</pre>'; now it is displaynig them in the array but and seperately which i want, but i need to get them to add together also for a total i found very little information on this on the net (basic math functions)
  11. i have a database holding all of the products that someone has click add to cart, in order to make each persons database unique i set it up so that cart_id would take the time and save that as a cookie, so if they have a cookie with that time stamp it is their shopping cart but my db will fill sooner or later so i want to empty this out every 2 days or so but i have no idea what code i should use to do this
  12. i am trying to make it so that i can display the total at the bottom of my shopping cart but i have no idea how to use math in php someone helped me to here but all that is being displayed is Array ( [8] => 14.95 [9] => 14.95 ) and it is not taking into consideration the quantity here is my code $query3= " SELECT * FROM `cart` WHERE cookie_id = ".$cookie_id; $result2 = mysql_query($query3); $products = array(); while($row2 = mysql_fetch_array($result2)) { $products[$row2['product_id']][] = $row2; } $sub_totals = array(); foreach ($products as $product_id => $n) { foreach ($products[$product_id] as $data) { $sub_totals[$product_id] += $data['product_price']; } } echo '<pre>' . print_r($sub_totals, true) . '</pre>';
  13. is that guna be SQL or php? and the cart id is already saving the time so that shouldnt be bad
  14. dont know what the problem was, but solved it with this function get_cart($cookie_id) { global $connection; $query= " SELECT * FROM `cart` WHERE cookie_id = ".$cookie_id; $cart_set = mysql_query($query); return $cart_set; } after this though i need have the database empty after a certain amount of time, any ideas?
  15. i found the problem but dont know why it is happening with this code, $cart_set = get_cart($cookie_id); echo $cookie_id; echo "<br/>"; echo $cart_set; echo "<br/>"; $cart_set = mysql_query($query) OR die(mysql_error()); by changing the function to function get_cart($cookie_id) { global $connection; $cart_set= " SELECT * FROM `cart` WHERE cookie_id = ".$cookie_id; return $cart_set; } i get this 1215709849 SELECT * FROM `cart` WHERE cookie_id = 1215709849 Query was empty when i put that SQL into my mysql client IDE it returned fine, how could this be?
  16. function confirm_query($result_set) { if (!$result_set) { die("Database query failed: " . mysql_error()); } } i changed the query to this and still doesnt work function get_cart($cookie_id) { global $connection; $query = " SELECT * FROM `cart` WHERE cookie_id = ".$cookie_id; $cart_set = mysql_query($query); return $cart_set; }
  17. it is saying that the query is empty...? which i am assuming means the problem is in the function?
  18. i changed it so its not a function but am getting an error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\Copy (3) of website\shoppingcart.php on line 67 $cart_set = get_cart($cookie_id); echo $cart_set; while($row = mysql_fetch_array($cart_set))<----line 67 this is the function get_cart() function get_cart($cookie_id) { global $connection; $query = " SELECT * FROM `cart` LIMIT 0 , 30 WHERE 'cookie_id' = ".$cookie_id; confirm_query($query); $cart_set = mysql_query($query); return $cart_set; } any suggestions?
  19. yes, that is why i want to have the cookie_id, so that i can query the cookie_id, not the cart_id the cart id is kind of useless actually.... but i have got something like this so far function getcookieid() { $cookie_id= $_SESSION['cart']; if (!isset($cookie_id)){ $cookie_id = time(); echo $cookie_id;//this is just to make sure it is working $_SESSION['cart'] = $cookie_id; }return $cookie_id; } but when i call it on my shopping cart page, getcookieid(); echo $cookie_id; i get nothing
  20. well i do not want to have this information save for very long anyway because my database could get too large, storing their ip address as the cookie seems like it would be the best way for me to do it, should i store it as a cookie or a session? i have been working on this shopping cart for so long now, everything is making sense though right? i had to build it myself because i could not find one that i thought would work thanks
  21. Crayon, yes that is exactly what i want mbeals, i do not have a customer table, i do not want to require users to log in since i am going to have a checkout (maybe google checkout) just take the information and run the sale itself. how would i timestamp this? i am very new to php so am going to have to lookup all these commands so if anyone knows these off hand it will save me a lot of time could i somehow make the cookie_id be the timestamp? does this seem like it will implement with a checkout easily? thank you very much for your help
  22. i thought when u called a session it was storing a cookie....... well i guess i am using a session then, which would be better? this doesnt seem like it should be hard to assign a random number but any ideas on a better way to set this cookie_id? crayon i am trying to make the cookie id be unique for each user so that i can query the cart WHERE cookie_id = (the specific number assigned to the customer) and it will return on the items that this customer added to the cart
  23. i just built my shopping cart to sell clothing i decided to have it save into a db called cart , cart has these tables cart_id <---- auto increments cookie_id <--- product_id <--------- same as my product id on my products table to be able to get the information related qty <----------- the amount of pieces of clothing they want to buy size <-------------the size of the clothing they would like to buy product_price <-----------price is being saved here and in my products for ease product_name <-----------name is also being saved on both for ease now my question is, does making the cookie id unique for each user and only storing the the cookie_id in a session make sense? also i have no idea how to do this, would i want to generate a random number then i could query with WHERE cookie_id= rand number does this make sense to do it like this? also i am going to be using google checkout and thought it would be easy to just query the db for cookie_id and send it in i have all of this code written but still need to do this last step to make it work for the unique cookie_id any help is greatly appreciated
×
×
  • 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.