Jump to content
Larry Ullman's Book Forums

another_noob

Members
  • Posts

    60
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by another_noob

  1. Started into the book and all went fine up to the part in chapter 2 where I invoke yiic. I would enter C:\xampp\yii-1-1-13\framework>yiic.php webapp C:\xampp\htdocs\testdrive and all that would happen is the yiic.php file would automatically open in Notepad++. I tried different paths as suggested in the book, but all I got was the same thing. I changed yiic.php to yiic.bat, and my webapp was auto-magically created. I found that suggestion after an hour of Google searching. I am running php 5.4.4 on a Windows Vista development machine. Things are working fine from there. Did I miss something somewhere?
  2. Well, I am embarrassed! I have been working on this project for so long, I forgot that I added the transaction_id field to the orders table. It is not even mentioned in chapter 19. That's what I get for trying to do a mash-up of this book and the first example in the E-Commerce book. I see now what I am trying to do is unnecessary...the folly of a newbie. Sorry to waste your time Larry. By the way, I really like the way you present and explain the material in your books, I have learned a lot.
  3. Thank you for replying Larry. Perhaps I am over thinking this situation. You are correct, I am getting the order recorded in the database when the return url I set in PayPal hits my checkout.php script. I took the site live for some tests and the financial transaction is occurring correctly, I get the buyers payment and get an email from PayPal notifying me of the transaction and of course the database "orders" table gets updated through the checkout.php script as written in chapter 19. Of course, as chapter 19 is written, it does not address ipn and that is all explained in the sidebar in the intro to checkout.php, I understand the complexities involved in trying to "sum it up" in one chapter. I am just trying to make sure that I understand ipn. In this case, I don't really see the purpose of ipn other than if the return url from PayPal never finds it's way home I was thinking that the ipn from PayPal would be a back-up notification...if nothing else. Also, as a newbie, I hate to ignore something in a book I don't understand. Specifically speaking, I don't understand the purpose of the transaction_id field in the orders table and how I get ipn.php to update it after a transaction is completed at PayPal. Actually, I don't see why I would want to store the transaction_id in my database when PayPal has that data saved for me in their database. Again, maybe I am over thinking this. Thanks Larry, I hope I cleared up my question a bit.
  4. I have developed a practice site based on chapter 19, just a different product. I have everything working as I want it, without any issues except getting my PayPal ipn.php script to update the database. My return ipn from PayPal is correct because I have saved it to a text file and it is as it should be. The trouble seems to be in my database query in the ipn.php script. When I return the fake buyer from PayPal to the return thank-you url, the database orders and order_ contents tables are both updated as expected. I have tried everything I can think of in ipn.php to simply update the orders table with the 3 fields I need from PayPal, transaction_id, payment_status, payment_amount. The return url from PayPal gets to my site before the ipn data does which makes my UPDATE query ineffective...there is nothing to update yet at that point. I purchased the E-Commerce book and learned a lot, but this final piece of vital code confuses me. Here is my current not working UPDATE script: require(MYSQL); $txn_id=mysqli_real_escape_string($dbc,$_POST['txn_id']); $q = "SELECT order_id FROM orders WHERE transaction_id='$txn_id'"; $r = mysqli_query($dbc, $q); if(mysqli_num_rows($r) == 0){ $uid = (isset($_POST['custom'])) ? (int)$_POST['custom'] : 0; $status = mysqli_real_escape_string($dbc,$_POST['payment_status']); $amount=(float)$_POST['mc_gross']; $q = "UPDATE orders SET transaction_id = '$txn_id', payment_status = '$status', payment_amount = $amount WHERE user_id = $uid"; $r = mysqli_query($dbc, $q); So, my question is, what should the ipn.php mysql query look like to update or insert these 3 fields into the orders table based on Script 19.11 in chapter 19?
  5. Thank you MrJames! That corrected the issue. It is now working great. I searched the vast internet and couldn't find the answer anywhere. Thank You MrJames and Thank You Larry for supporting your books so well.
  6. After reading the PayPal manual chapter 7, I did get a better understanding, thanks for pointing me there. I am still a bit confused though. If I want to send my cart as an aggregate amount for example, I am supposed to use the following example HTML: <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_cart"> <input type="hidden" name="upload" value="1"> <input type="hidden" name="business" value="seller@designerfotos.com"> <input type="hidden" name="item_name_1" value="Aggregated items"> <input type="hidden" name="amount_1" value="3.00"> <input type="submit" value="PayPal"> </form> This HTML works except I always am billing the buyer $3.00. If I put my PHP variable $total (which holds lets say 63.99) as value="$total" I get the following error returned from PayPal "The link you have used to enter the PayPal system contains an incorrectly formatted item amount." If I put literal dollar amount as value, like say 63.99, then everything works. How do I format a PHP variable to send the amount with this HTML? Thanks.
  7. I have an E-Commerce project (running in local host) with a database named "ecommerce". My project has been working fine until I decided to download Zen Cart so I could peek around in the code. Evidently Zen Cart uses a database named "ecommerce" also. The result was that the Zen Cart database was merged with my database and my tables that had the same names were overwritten with the Zen Cart tables. I didn't think that this was even possible. I looked in the MySQL 2nd edition book for help to prevent this in the future, but didn't find anything that specifically addresses this issue. Now I am dropping the 90 or so extra tables and recreating mine. My question is two fold 1) How do I avoid this in the future 2) Can I rename my database to avoid this in the future. I am using version 5.5.25a. Thanks.
  8. Thanks for the reply and the link rob. I will study chapter 7 and the pdf. Maybe I am just overly complicating things in my head. I will step away for a day and re-attack the challenge with (hopefully) a clearer understanding. Thanks.
  9. First, thank you Larry for your great books. I really appriciate your "no nonsense" approach to presenting this complex material. I have learned a lot. I have also learned a lot from this forum. I have a general question about PayPal integration. I have built my site based mainly on the material in "PHP and MySQL for Dynamic Web Sites" with chapter 19 (E-Commerce example) helping me tie things together. I then bought the Effortless E-Commerce book hoping to integrate PayPal. I am stuck on how I send the values in my qty, sub-total, shipping, total etc.. variables to PayPal. The price of my goods vary immensly, so I can't use fixed price "buy it now" buttons. I just want a buyer to put the items in their cart, get a total with shipping (up to here it is all working great) click a PayPal button and have these values magically appear in PayPal and have the financial transaction completed at PayPal's site. I don't understand how I get that data to PayPal. I have a sandbox account to play in, but I can't find the answer at PayPal. Everywhere I look on-line I see the same advice, drop this PayPal HTML button code in and you are all set. Where does the transfer of data from my site to PayPal take place? I am missing something somewhere. I am not live and am running in localhost. I can't even get the sanbox to work with localhost, I never leave localhost when I click a PayPal button. Can someone explain to this noob how this works, i mean just in general? I hope this post makes sense. Thanks.
×
×
  • Create New...