Jump to content
Larry Ullman's Book Forums

Michael vdP

Members
  • Posts

    24
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Michael vdP

  1. Hi Larry, Not a problem, just something I wanted to share with the forum: Someone at work pointed me to an open-source web analytics tool, that runs on your own server. I had never heard of it before and last night I installed on my server in a bit more than the 5 minutes it claims to need. It looks very promising and stores all the relevant data in your very own MySQL database. I expect it to be better than Google Analytics. This is their site: http://piwik.org/ Greetings from Ireland! Michael
  2. Yes, there is an errata page here http://www.larryullman.com/books/effortless-e-commerce-with-php-and-mysql/errata/
  3. Hi Stephen, Difficult to tell at this stage, which payment methods Stripe will offer in Ireland. It seems, it will at least be Mastercard and Visa but I hope, they will add other methods as soon as they get past the beta stage, especially the debit card of Irish choice: Laser. On their Help page, Ireland isn't mentioned yet: https://support.stripe.com/questions/what-types-of-payments-can-i-accept-with-stripe. Regards, Michael
  4. Hi all, I had checked out https://stripe.com but as I live in Ireland, I couldn't use it. Still, Stripe offered the opportunity to sign up for an alert for when they would be available. True to their word, they sent me an email today and invited me to take part in their "private beta". I am already impressed with them! Thanks, by the way, Larry, for your excellent introduction to Stripe: http://www.larryullman.com/2012/11/07/creating-a-stripe-payments-test-account/ Greetings from the Emerald Island! Michael
  5. Hi Sean and Larry, PayPal has made some changes to the Sandbox in the last week. I ran into the same issue yesterday when code that worked previously, suddenly broke. PayPal is apparently preparing to move to PHP5.2 with cURL and have updated their sample code (https://www.x.com/developers/PayPal/documentation-tools/code-sample/216623). These changes don't have impacted the "real" PayPal yet. You can find comments about this unexpected change on several sites (e.g., http://stackoverflow.com/questions/11810344/paypal-ipn-bad-request-400-error) I got everything working again by adding $header .= "Host: www.sandbox.paypal.com\r\n" but it has to come AFTER the POST: $header = "POST /cgi-bin/webscr HTTP/1.0\r\n"; $header .= "Host: www.sandbox.paypal.com\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; fputs ($fp, $header . $req); It is also important not to change to HTTP/1.1, otherwise you get those empty or 0 responses. By retaining HTTP/1.0, you will get "Received: VERIFIED" at the end of the response again so it can be nicely used as a trigger. Larry, you may have to update your book and the downloadable code with this change. But with that new desk of yours, that shouldn't be a problem ;-) Greetings from Ireland! Michael
  6. Hi all, I came across a very nice bit of jQuery -courtesy of the SpaceNinja (??)- that integrates perfectly with the second example on this site: http://spaceninja.com/2010/02/jquery-slide-down-language-selector You will have to add this in the footer.hmtl file: <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript" charset="utf-8"></script> <script> // scroll the page to display the languages $('#util-int').toggle(function() { $("#util-regions").remove().prependTo("#header").slideToggle('swing'); }, function() { $("#util-regions").slideToggle('swing'); }); </script> Then include the following in the <ul class="top-links"> on the header.html page: <ul class="top-links" id="utilities"> <li><a href="/index.php" class="first"><img alt="" src="/images/icon-home.gif" /></a></li> <li><a href="/cart.php"><img alt="" src="/images/icon-cart.gif" /></a></li> <li><a href="/contact.php"><img alt="" src="/images/icon-mail.gif" /></a></li> <li><a href="/sitemap.php"><img alt="" src="/images/icon-map.gif" /></a></li> <li id="util-int"><a href="#">International</a> <div id="util-regions"> <h4>Select your language</h4> <ul> <li><a href="http://www.mysite.com">English</a></li> <li><a href="http://www.mysite.es">español</a></li> <li><a href="http://www.mysite.de">deutsch</a></li> </ul> </div> </li> </ul> And finally, you make an addition to the style.css file #util-int { z-index: 1000; } #util-regions { display: none; /* hidden by default, will be shown by jQuery */ width: 948px; margin: 0 auto; height: 60px; position: relative; } #placeholder-regions { background: #666; } Of course, you may want to tweak the css but I like the way the page slides down and it looks a lot better than those flags. I hope, you find this useful. Regards, Michael
  7. First "Úll conference" in Dublin :-) http://www.irishtimes.com/newspaper/finance/2012/0430/1224315361556.html
  8. Hi Larry, Thanks for your helpful reply. Yes, I have been checking with various browsers and I can see how their difference in handling the HTTP_ACCEPT_LANGUAGE could cause trouble. I have tackled things differently, while still using the HTTP_ACCEPT_LANGUAGE header. I have invested in the following extensions for my domain: .com, .co.uk, .de, .es and .nl because I want my site to be in English, German, Spanish and Dutch. The language is primarily determined by the country extension but if there is a usable HTTP_ACCEPT_LANGUAGE header, it will be picked up with a simple IF statement, e.g.: $lang = getenv("HTTP_ACCEPT_LANGUAGE"); $set_lang = explode(',', $lang); IF (SUBSTR($set_lang[0],0,2)=='de' || $_SERVER['SERVER_NAME']=='www.mydomain.de' || $_SERVER['SERVER_NAME']=='mydomain.de') The resulting 'language_id' is then set as a cookie. I have used the concept for the "Message Board" in chapter 17 in your "PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)" book. One little difference: I have created a separate table for all language elements in each .php page (table 'index' for 'index.php', table 'shop' for 'shop.php', etc.) and the $words[] array is created at the start of each page with a pretty basic query: "SELECT * FROM `".SUBSTR(basename($_SERVER['PHP_SELF']),0,-4)."` WHERE language_id = {$_COOKIE['language_id']}" That seems to work very nicely because there is a lot more text than in your example. I am still testing (and translating text!) but I impressed how well that works. Thanks for all your guidance! I couldn't have done it without your help and books! Regards, Michael
  9. Hi Larry, But couldn't I use the "HTTP_ACCEPT_LANGUAGE" header to determine the browser's language? Or are there disadvantages to that approach? Of course, I would still offer the user the possibility to change the language to one of their preference. Regards, Michael
  10. Hi Larry, No to worry. It is working very nicely now and I am very happy with the new process (no values in the PayPal button, but passed on through HEADER() in 'gateway_process.php'). But as the user moves to the PayPal site, the sending of the confirmation email depends on his completing the process and returning to the 'final.php' on my site . If for some reason the user abandons that process after his payment, he won't receive the email. So at the moment, I am working on integrating email_receipt.php into the ipn.php file. That shouldn't be too difficult because PayPal returns the order_id that can be used in a stored procedure that runs a simple query: SELECT c.email FROM customers c, orders o, transactions t WHERE c.id=o.customer_id AND o.id=t.id AND t.id= [PayPal's returned order_id] Once that works, I am done! Regards, Michael
  11. BTW, the good thing from this approach is that all those important "hidden" values are no longer in the PayPal button and therefore not visible in the source code. Recently, there was a scam that affected third party sellers on Amazon: scammers used the seller email address to fool sellers into believing that Amazon had received payment from buyers and goods could be released!
  12. Hi all, I have the PayPal Website Payments Standard for the second example working. I have moved most of the values that have to be passed on to PayPal, to the 'gateway_setup.php' file: $data['cmd'] = '_xclick'; $data['business'] = 'seller@gmail.com'; $data['currency_code'] = 'EUR'; $data['button_subtype'] = 'services'; $data['no_note'] = '0'; $data['cn'] = 'Add special instructions to seller'; $data['no_shipping'] = '1'; $data['rm'] = '1'; $data['return'] = 'https://mysite.com/final.php'; $data['cancel_return'] = 'https://mysitecom/cart.php'; $data['bn'] = 'PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted'; $data['address_override'] = '0'; $data['item_name'] = 'Invoice # '.$customer_id; $data['email'] = $_SESSION['email']; $data['first_name'] = $cc_first_name; $data['last_name'] = $cc_last_name; $data['address1'] = $cc_address; $data['city'] = $cc_city; $data['zip'] = $cc_zip; $data['country'] = $cc_state; to the gateway_setup.php file In gateway_process.php, the variable values are established: $data['amount'] = $order_total - $_SESSION['shipping']; $data['shipping'] = $_SESSION['shipping']; $data['custom'] = $customer_id; $data['invoice'] = $_SESSION['order_id']; And in the same file, HEADER() redirects the user to PayPal's site while passing on the information to PayPal: // Convert the data: $post_string = ''; foreach( $data as $k => $v ) { $post_string .= "$k=" . urlencode($v) . "&"; } $post_string = rtrim($post_string, '& '); header("location:https://www.sandbox.paypal.com/cgi-bin/webscr?".$post_string); Finally, I am using the extended ipn.php file to retrieve PayPal's response and add it to the 'transactions' table. That requires minor change to the table and the stored procedure ('CALL add_transaction') because the response values from PayPal are slightly different from the one Authorize returns, mainly I had to change 'tid' from BIGINT to VARCHAR(20). Of course, the flow for the second example is now a bit different so there is some work left. I think, I will have to add a check for the PayPal response to the final.php so a value can be assigned to '$_SESSION['response_code']' there instead of on the 'billing.php' page. Almost there, almost! :-) Regards , Michael
  13. Hi Larry, Or let me rephrase the issue: how can I use something like the 'gateway_process.php' file to submit the POST to PayPal and to re-direct the user to PayPal's site, while 'billing.php' does the POST that calls the stored procedure and inserts the order into the 'order' and 'order_contents' tables? Using 'gateway_process.php' would have the added benefit of hiding all those values (including my PayPal ID or seller email) from prying eyes. I have only a vague understanding of cURL, maybe a cURL session could accomplish that. Obviously, I also have to retrieve PayPal's response (your ipn script in the 1st example) so the 'transaction' table can be updated. I hope, I have explained things clearly! Kind regards, Michael
  14. Hi Larry, Yeah, that issue is still open for me ;-( How can I POST the two forms in billing.php? It took me a while to figure out how to pass values to PayPal and I got that working. I thought, I'd share that on this forum because it is so simple to accomplish but nowhere is it explained on PayPal's help pages. But now with the button, the call to the stored procedure is being bypassed so there are no values for 'order_total' and 'order_id'. Somehow, I have a feeling that the jQuery script can do that but I don't see how (yet). Any help/suggestions are most welcome! Yes, Ireland is a beautiful place, especially Kerry, Clare (Cliffs of Moher!) and Galway. I live in Cork which calls itself "the real capital". I hope, you get to make that second trip! Kind regards, Michael
  15. Hi all, This is not a question. But if you want to create a button in PayPal that is dynamic and accepts values from your scripts, you may find this useful: When creating a Button in your Business Account, there are 3 steps. Under Step 2 ("Track Inventory, profit & loss (optional)", un-tick "Save button at PayPal". Now the button you created, will not be hosted by PayPal and you can pass on values, e.g.: <input type="hidden" name="email" value="<?php echo $_SESSION['email']; ?>"> PayPal offers of tonnes of information but it took me hours and quite some headache to figure this one out. I hope, others will at least benefit from my agony! Regards, Michael
  16. Hi Larry, I am making good progress with the changes that are required for PayPal's Website Payments Standard. Most changes were on the billing.php page because all those credit card values don't have to be captured. I have used the 'phone' field to get a valid value for 'cc_last_four' and that works. I can pass on values successfully to the Sandbox. So far so good. But the PayPal button is causing an issue on 'billing.php', too: as in fact 2 POSTs are being done, the PayPal 'Submit' wins while skipping the billing form's validation and the call to the 'add_order' stored procedure. As a consequence, no rows are being added to the 'order' and 'order_contents' tables and the session has no $_SESSION['order_total'] nor $_SESSION['order_id']. Now I understand why you are using the jQuery script at the end of 'billing.html' (as you explain in http://www.larryullman.com/downloads/EffortlessECommerce_BONUS_Ch10.pdf). But how can I make that work for all those lovely hidden values in the PayPal button? How can I force the POST of the billing form? Just look at all I want to pass on: <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="seller@gmail.com"> <input type="hidden" name="currency_code" value="EUR"> <input type="hidden" name="button_subtype" value="services"> <input type="hidden" name="no_note" value="0"> <input type="hidden" name="cn" value="Add special instructions to the seller"> <input type="hidden" name="rm" value="1"> <input type="hidden" name="return" value="https://mysite.com/final.php"> <input type="hidden" name="cancel_return" value="https://mysite.com/cart.php"> <input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted"> <input type="hidden" name="address_override" value="1"> <input type="hidden" name="item_name" value="Invoice # <?php echo $_SESSION['customer_id']; ?> "> <input type="hidden" name="email" value="<?php echo $_SESSION['email']; ?>"> <input type="hidden" name="first_name" value="<?php echo $_SESSION['cc_first_name']; ?>"> <input type="hidden" name="last_name" value="<?php echo $_SESSION['cc_last_name']; ?>"> <input type="hidden" name="address1" value="<?php echo $_SESSION['cc_address']; ?>"> <input type="hidden" name="city" value="<?php echo $_SESSION['cc_city']; ?>"> <input type="hidden" name="zip" value="<?php echo $_SESSION['cc_zip']; ?>"> <input type="hidden" name="country" value="<?php echo $_SESSION['cc_state']; ?>"> <input type="hidden" name="amount" value="<?php echo $total - $_SESSION['shipping'] ; ?>"> <input type="hidden" name="shipping" value="<?php echo $_SESSION['shipping']; ?>"> <input type="image" src="https://www.sandbox.paypal.com/en_GB/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="PayPal — The safer, easier way to pay online."> <img alt="" border="0" src="https://www.sandbox.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1"> As you can see, for testing purposes I am using $total instead of $_SESSION['order_total'] but don't have a $_SESSION['order_id']. Can you think of a way I can use the jQuery script to achieve that both forms are being posted as intended? BTW, by now you are a household name here. My daughter, 9 years old, specifically loves to ask whether I am reading Larry ULLMAN again, with a strong emphasis on your last name. She points out that "ULL" in Irish means "apple". Poor kids, in Ireland, Irish is mandatory in primary and secondary school but only 5 % of the population speaks the language. Thanks for all your help! Michael
  17. Hi Larry, Thanks for that. Somehow I assumed, there was more drastic changes required. I will give that a shot. I am in Cork, in the Republic of Ireland.
  18. I can't say how grateful I am to Larry for this book. I already used the first example to set up a e-business, selling a digital product, and now I am close to finishing a second one, based on the book's second example. I am hardly a PHP wizard but I have learned so much from Larry's books. I know how to read and debug the PHP code and the MySQL stored procedures and I can figure out what changes to make in order to tweak the example code to my requirements. But at the moment, I am a bit stuck. Two of the concepts for the Coffee store I really like: no user registration and payment processing over IPN without exiting the website. For the latter, the book uses Authorize.net as a payment gateway, but because only American customers can avail of their service, Larry recently in his blog explained how the same would work with PayPal's Website Payments Pro. You can probably imagine my disappointment when last night I discovered that PayPal only offers to service to customers in the UK. So now I am back to Website Payments Standard/Express Checkout. I have looked at other gateways such as Moneybookers.com and none offer something similar to Payments Pro. Here is my question: What changes (and at what point in the check out process) would I have to make to convert the payment method in example 2 to Website Payments Standard/Express Checkout? I may still end up using Moneybookers.com because they offer national debit cards and their fees even seem better than PayPal's. In some European countries, PayPal didn't really catch on or -quite undeservedly, I think- got bad publicity. Greetings from the Emerald Isle and thanks for any help! Michael
  19. Hi Larry, That really helped. I am slowly getting the picture and I am starting to see that probably I won't even need additional view files. So simple and pretty clever. I will try that. And, yes/of course, I have your book. Whenever there is a new edition, I buy it. I will let you know how I get on, especially if I get stuck :-) Thanks for all your help. I am not that strong in JavaScript so maybe a good occasion to treat myself to your latest book. Greetings from the Republic of Ireland! Michael
  20. Thanks for your suggestions, Larry. Frankly, I am not sure yet how your approach would work, but I am giving you the benefit of the doubt ;-). I have created the tables you suggest. "Languages" was straightforward enough: CREATE TABLE `languages` ( `language_id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `language_name` varchar(20) NOT NULL, `language_description` varchar(20) NOT NULL, PRIMARY KEY (`language_id`), UNIQUE KEY `language_name` (`language_name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 "Words" may be a bit more tricky because first I have to establish all the common elements. I've made the following start: CREATE TABLE `words` ( `words_id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `language_id` tinyint(3) unsigned NOT NULL, `coffee` varchar(25) NOT NULL, `goodies` varchar(25) NOT NULL, `sales` varchar(25) NOT NULL, `wish list` varchar(25) NOT NULL, `cart` varchar(25) NOT NULL, `sales items` varchar(25) NOT NULL, `view all` varchar(25) NOT NULL, `products` varchar(25) NOT NULL, `add to cart` varchar(25) NOT NULL, `update quantities` varchar(25) NOT NULL, `checkout` varchar(25) NOT NULL, `continue onto billing` varchar(25) NOT NULL, `place order` varchar(25) NOT NULL, PRIMARY KEY (`words_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 I have populated the "languages" table and for most of the elements in the "words" tables, I have the German values. So together with the English ones, that should be enough for testing purposes. What would be the next step for me? Wouldn't most of the "view" files in HTML have versions in different languages, too? Maybe with subdirectories ("/de" for German, "/nl" for Dutch, etc.). That would surely be one of the benefits of the MVC concept. Finally, one would give the user the option to select a language but it would be great to get the default language of the user's browser (or OS) and change to that language by default (while still offering the option to change). Could that be done through PHP? If so, more stuff to be written to the cookies!!
  21. I am using the second example in the book to develop a website, aimed at the European market. I am making good progress and Larry's recent addition about using PayPal instead of Authorize comes as a godsend. I have made some basic changes to the 'customers' table and the various scripts to capture different formats for zip codes, countries instead of states, etc., and that was quite easy. Slowly, I am starting to form some thoughts on how I could give the user the possibility to change the language of the text from English to another language. Would anyone have any suggestions as to how do so? Many thanks in advance! Michael
  22. Hi Jonathon, Thanks for the link because frankly I had a hard time finding that PDF. Yes, it has exactly the information that I need. Installing Zend Framework shouldn't be a problem. Keep up the good work, guys! Michael
  23. Hi Larry, Thanks for this book! This is one of the few books (well, the only one I know) that covers in depth the set-up of a secure e-commerce website. I have learned so much from it already. In chapter 10, the 'email_receipt.php' isn't really explained. I was glad to find it among the downloadable code, and the idea of being able to send a HTML email appeals to me as a lot of people will see it as more professional. I am not familiar with Zend (yet) and what I learn from a few 'googles', convinces me, it is software that I would like to use. I can figure out most of the script with the exception of line 67: set_include_path('./library/'); To what 'library' is it referring? There is an empty 'library' folder with your code for the Coffee site. What am I missing? Many thanks in advance! Michael
×
×
  • Create New...