tag:blogger.com,1999:blog-6072463814914813547.post5591687972511848866..comments2023-06-22T05:09:08.890-07:00Comments on Django E-Commerce: "Beginning Django E-Commerce" Book Release!Jim McGawhttp://www.blogger.com/profile/02849525770389840778noreply@blogger.comBlogger29125tag:blogger.com,1999:blog-6072463814914813547.post-25980895630861284642013-07-19T14:09:54.961-07:002013-07-19T14:09:54.961-07:00I just want to say thank for your great book, it a...I just want to say thank for your great book, it allowed me to get a better understand of django. so with it i get a way to implement everything front chapter 1 to 15 and everything is perfect. but i want to tell that couple of things are changed with django 1.5 so we have sometime to do a little research to get things works. <br />i would like to know which book can you recommend to learn about google apps engine? before to be able to understand chapter 16.<br />thanks again !!!!!alpha2020https://www.blogger.com/profile/12306030334393018831noreply@blogger.comtag:blogger.com,1999:blog-6072463814914813547.post-72710107577558300592012-02-15T12:43:07.746-08:002012-02-15T12:43:07.746-08:00Thanks Trevor and co - I was pulling out my hair w...Thanks Trevor and co - I was pulling out my hair with the "Text instance has no attribute 'tagName'" issueRickBhttps://www.blogger.com/profile/08707462699888760568noreply@blogger.comtag:blogger.com,1999:blog-6072463814914813547.post-76871357309921097202011-12-11T12:37:42.780-08:002011-12-11T12:37:42.780-08:00Hi Jim,
Thanks for the great book. I was getting ...Hi Jim,<br /><br />Thanks for the great book. I was getting the same error as jUaN, ColdZero and Armen B until I changed the GOOGLE_CHECKOUT_URL from 'https://sandbox.google.com/checkout/api/v2/merchantCheckout/Merchant/' + GOOGLE_CHECKOUT_MERCHANT_ID to 'https://sandbox.google.com/checkout/api/checkout/v2/merchantCheckout/Merchant/' + GOOGLE_CHECKOUT_MERCHANT_ID.<br /><br />Hope this helps anyone else with this problem.bigspottycathttps://www.blogger.com/profile/18400078887195767822noreply@blogger.comtag:blogger.com,1999:blog-6072463814914813547.post-19013671994544751812011-10-29T13:29:30.268-07:002011-10-29T13:29:30.268-07:00Kinda late (I started with the book now).
The pro...Kinda late (I started with the book now).<br /><br />The problem with the XML stuff is the uri of the service, now is:<br /><br />https://sandbox.google.com/checkout/api/checkout/v2/merchantCheckout/Merchant/ + IDFoxandxsshttps://www.blogger.com/profile/06320315693652245894noreply@blogger.comtag:blogger.com,1999:blog-6072463814914813547.post-63508908181343232992011-10-22T15:14:52.652-07:002011-10-22T15:14:52.652-07:00Having the same issues with Text instance has no a...Having the same issues with Text instance has no attribute 'tagName'ikohttps://www.blogger.com/profile/06443685299400878717noreply@blogger.comtag:blogger.com,1999:blog-6072463814914813547.post-80541470459505592482011-10-19T18:25:05.508-07:002011-10-19T18:25:05.508-07:00I figured out the problem, google changed their v2...I figured out the problem, google changed their v2 URL:<br /><br />OLD - GOOGLE_CHECKOUT_URL = 'https://sandbox.google.com/checkout/api/v2/merchantCheckout/Merchant/' + GOOGLE_CHECKOUT_MERCHANT_ID<br /><br />NEW - GOOGLE_CHECKOUT_URL = 'https://sandbox.google.com/checkout/api/checkout/v2/merchantCheckout/Merchant/' + GOOGLE_CHECKOUT_MERCHANT_ID<br /><br /><br />I hope this helps anyone else solve their problem if this happens to come up, I had to dig into the docs for their API to figure it out, I have no idea why they'd implement such a large breaking change but nonetheless; problem solved.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6072463814914813547.post-24665679257141448212011-10-19T18:14:15.598-07:002011-10-19T18:14:15.598-07:00More information...
u'....(more code removed ...More information...<br /><br />u'....(more code removed here for brevity)... <br /><br />Pretty strange how it is coming back as a mobile doctype, what the?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6072463814914813547.post-28547575618968765012011-10-19T18:10:54.533-07:002011-10-19T18:10:54.533-07:00I am getting Text instance has no attribute 't...I am getting Text instance has no attribute 'tagName' does anyone know what this is from, Django 1.3 is my version, when I inspect the xml it's actually HTML coming back I am not sure why or where this is coming from, can anyone lend a hand?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6072463814914813547.post-86929750970879614272011-06-30T08:07:30.429-07:002011-06-30T08:07:30.429-07:00Hello James,
excuse me for my late reply, but I a...Hello James,<br /><br />excuse me for my late reply, but I assume it's better ever than never. :-)<br /><br />Two years ago I played a bit with Django and wanted to use django-cms, but its development somehow stalled. Satchmo was/is overkill for our needs and LFS was at the beginning...I went back to PHP world and now I'm finishing my site with Concrete5 CMS using their ecommerce module.<br /><br />There are several things I do not like about Concrete5 and considering to use SilverStripe and their Sapphire framework which is now heading towards 3.0 release.<br /><br />Considering I'm not full-fledged web developer and will soon start to write desktop application using Python+Qt, I'm thinking that it would be easier for me to stay & master one language (Python) instead of jumping between Python & PHP.<br /><br />What do you think?<br /><br />That's why I think to try once more with Django, especially seeing that Django-cms is in a good shape now and they're developing django-shop (https://www.django-shop.org/) which should probably play very well with the django-cms.<br /><br />So, although I have to finish our small company site selling 10s of 'products' (services) and create a small site for non-profit organization soon (probably with PHP apps), I'm thinking about the future and to start learning Django to be able to deploy django-cms, django-shop etc. so I wonder:<br /><br />a) do you think your book is still relevant considering it covers Django-1.1 and<br /><br />b) is it still useful learning experience considering we'd need to write our own custom payment module for our local IPSP using form-based API (kind of paypal-like one)?<br /><br />In that case, I'd skip over PHP & SilverStripe and focus on (slowly) learning Django to be able to realize everything using Python...<br /><br /><br />Sincerely,<br />GourAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6072463814914813547.post-51670950205898493042011-06-04T16:12:00.129-07:002011-06-04T16:12:00.129-07:00Hi ColdZero and Jim,
I'm getting the same typ...Hi ColdZero and Jim, <br />I'm getting the same type of reply from Google...an HTML document for a mobile device instead of XML. Did you guys every figure out what was going on?Armen B.https://www.blogger.com/profile/17763170054533336139noreply@blogger.comtag:blogger.com,1999:blog-6072463814914813547.post-59050121431596102982011-03-20T18:22:51.018-07:002011-03-20T18:22:51.018-07:00Hi ColdZero,
I'm not sure where that response...Hi ColdZero,<br /><br />I'm not sure where that response is coming from. You're right, it's just an HTML document, and I've never gotten anything like that in the response at that step. It also looks like it's returning a page for a mobile device. Any reason it would be doing that?Jim McGawhttps://www.blogger.com/profile/02849525770389840778noreply@blogger.comtag:blogger.com,1999:blog-6072463814914813547.post-49496033232026604872011-03-17T11:56:45.486-07:002011-03-17T11:56:45.486-07:00I did what you suggest on step #1 above, assign xm...I did what you suggest on step #1 above, assign xml_doc.toxml() a variable named 'abc'. Here is the content of 'abc' get from TraceBack. It looks weird and like a normal html page than a xml content.<br />===============<br />http://dpaste.com/hold/511272/ColdZerohttps://www.blogger.com/profile/17825027704966980571noreply@blogger.comtag:blogger.com,1999:blog-6072463814914813547.post-59794299647795893262010-04-02T13:39:51.159-07:002010-04-02T13:39:51.159-07:00Hi Juan,
It sounds like the Google Checkout XML i...Hi Juan,<br /><br />It sounds like the Google Checkout XML isn't formatted the way our code is expecting. Take this line:<br /><br />node = root.childNodes[1]<br /><br />We expect 'node' will be an instance of xml.dom.minidom.Element. In your case, it isn't. I can't tell you exactly what's wrong, but here's how I would troubleshoot - output the following items as variables so you can view them, either in a template or a debugger, and see if they help you:<br /><br />1. xml_doc.toxml() <br />See if the XML is structured the way you'd expect. I'm betting that the XML contains a single error message node. root.childNodes[1] expects the second child node of the root element to be an element named 'redirect-url'. My guess is that there may be only a single child of the root element, containing an error message.<br /><br />2. help(node) # see what 'node' is an instance of<br /><br />3. dir(node) # see what calls you can make on 'node' to see if that offers any clues.<br /><br />I'm betting it'll be #1. I hope that helps you sort it out!Jim McGawhttps://www.blogger.com/profile/02849525770389840778noreply@blogger.comtag:blogger.com,1999:blog-6072463814914813547.post-22934654079156581362010-04-01T15:44:40.733-07:002010-04-01T15:44:40.733-07:00Hello, I am currently scheduling your book but I h...Hello, I am currently scheduling your book but I have a error when I give click on the google checkout button I get an error:<br />AttributeError at / cart /<br />Text instance has no attribute 'tagName'<br />Exception Value: Text instance has no attribute 'tagName'<br />ecomstore / checkout / google_checkout.py in _parse_google_checkout_response, line 41<br />and Line 41 is:<br />def _parse_google_checkout_response (response_xml):<br /> REDIRECT_URL =''<br /> xml_doc = minidom.parseString (response_xml)<br /> root = xml_doc.documentElement<br /> node = root.childNodes [1]<br /> node.tagName if == 'redirect-url': # Line 41<br /> REDIRECT_URL = node.firstChild.data<br /> node.tagName if == 'error-message':<br /> raise RuntimeError (node.firstChild.data)<br /> return REDIRECT_URL<br /><br />you think this error is caused because I need your helpUnknownhttps://www.blogger.com/profile/01959906587129464816noreply@blogger.comtag:blogger.com,1999:blog-6072463814914813547.post-22157678101075186772010-02-25T17:45:45.065-08:002010-02-25T17:45:45.065-08:00Hi T&W,
I added flatpages to my own project a...Hi T&W,<br /><br />I added flatpages to my own project and briefly deployed it to the App Engine. I couldn't get that error. <br /><br />I'd suggest you post your question to the App Engine Patch Google group and see if anyone else there has encountered this error, or search for possible solutions:<br /><br />http://groups.google.com/group/app-engine-patch<br /><br />Hope it helps!Jim McGawhttps://www.blogger.com/profile/02849525770389840778noreply@blogger.comtag:blogger.com,1999:blog-6072463814914813547.post-53778918546593595352010-02-22T12:50:39.611-08:002010-02-22T12:50:39.611-08:00Hi, I've just taken your source code for Chapt...Hi, I've just taken your source code for Chapter 16 - run the server - tried to add flatpages. It errors with the following:<br /><br /><br /><br />Using the URLconf defined in urls, Django tried these URL patterns, in this order:<br /><br /> 1. ^account/login/$<br /> 2. ^account/logout/$<br /> 3. ^admin/(.*)<br /> 4. ^ ^$<br /> 5. ^ ^category/(?P.+)/$<br /> 6. ^ ^product/(?P.+)/$<br /> 7. ^cart/<br /> 8. ^account/register/$<br /> 9. ^person/<br /> 10. ^account/<br /><br />The current URL, about/, didn't match any of these.<br /><br />Is there a setting I'm missing to get flatpages working on Google App Engine.Tuesday & Wednesday nightshttps://www.blogger.com/profile/01410333424622812624noreply@blogger.comtag:blogger.com,1999:blog-6072463814914813547.post-83182348334835592372010-01-29T22:30:28.060-08:002010-01-29T22:30:28.060-08:00Thanks for the tips Jim. I think I'll definite...Thanks for the tips Jim. I think I'll definitely be looking to implement select_related() going forward.Anonymoushttps://www.blogger.com/profile/01049307534410458288noreply@blogger.comtag:blogger.com,1999:blog-6072463814914813547.post-73909989584786913282010-01-26T09:18:28.129-08:002010-01-26T09:18:28.129-08:00Hi Stephen,
That's a good question. I'm a...Hi Stephen,<br /><br />That's a good question. I'm assuming that you'd want to match products where the search text matches the name of the category? If that's the case, I think you would just add one more 'Q' object to the search filter. For example:<br /><br />products = products.filter(Q(name__icontains=word) |<br /> Q(description__icontains=word) |<br /> Q(sku__iexact=word) |<br /> Q(brand__icontains=word) |<br /> Q(meta_description__icontains=word) |<br /> Q(meta_keywords__icontains=word) |<br /> Q(categories__name__icontains=word))<br /><br />Adding that last line should achieve what you want. Before doing this, I strongly urge you to read about select_related():<br /><br />http://docs.djangoproject.com/en/dev/ref/models/querysets/#id4<br /><br />Using select_related() follow foreign keys when it fetches those instances. In this example, in order to optimize the query being made, you might want to change the line above where we get all product instances from:<br /><br />products = Product.active.all()<br /><br />to this:<br /><br />products = Product.active.select_related().all()<br /><br />This may be result in a slightly larger query up-front to get the categories with each product, but will prevent a subsequent sub-query to the databse to check the category name for each word in the search text. (Just check the django.db.connection.queries list to make sure you're not hitting the database with too many queries.)Jim McGawhttps://www.blogger.com/profile/02849525770389840778noreply@blogger.comtag:blogger.com,1999:blog-6072463814914813547.post-14280065558628156882010-01-25T17:17:48.287-08:002010-01-25T17:17:48.287-08:00Hi Jim,
One thing I have been curious to know how...Hi Jim,<br /><br />One thing I have been curious to know how to implement is also returning search results for products whose category/ies also match the query.<br /><br />How would one approach this?Anonymoushttps://www.blogger.com/profile/01049307534410458288noreply@blogger.comtag:blogger.com,1999:blog-6072463814914813547.post-81116274159576566092010-01-22T22:32:43.402-08:002010-01-22T22:32:43.402-08:00Hi Pablo,
You're right, it's perfectly sa...Hi Pablo,<br /><br />You're right, it's perfectly safe to use access, modify, and use the request.POST dictionary directly. I just chose to copy it in my examples because the performance penalty was likely to be negligible and it's consistent with those times when readers will be pre-processing a form.<br /><br />The fact that the search function is returning a dictionary called "results" with a "products" entry of Product instances is a vestige of earlier code. Originally, I was going to have two sections on the search results page: one for products and one for categories. (So a search for "guitar" would return both guitars and the guitar categories.) I decided to skip the category results, but the "results" dictionary remains. And you're right, it updates the results dictionary for each word, not just once, when the for loop has completed.<br /><br />You're welcome to post on here. Sorry if my responses are ever less than timely! I haven't signed up for email notification when a new comment gets posted.Jim McGawhttps://www.blogger.com/profile/02849525770389840778noreply@blogger.comtag:blogger.com,1999:blog-6072463814914813547.post-33665065717815536472009-12-18T16:44:49.054-08:002009-12-18T16:44:49.054-08:00In you implementation of search you only get produ...In you implementation of search you only get products that match all the search terms in on e of the fields. For example 'ruby java' will return nothing. Maybe it's a good thing.<br /><br />In the search app in the product function, why do you use the following line instead of just returning the products?<br />results['products'] = products<br /><br />This line shouldn't be inside the for loop of words.pablohttps://www.blogger.com/profile/07056804302996675811noreply@blogger.comtag:blogger.com,1999:blog-6072463814914813547.post-91417111184948290152009-12-15T05:25:49.050-08:002009-12-15T05:25:49.050-08:00In add_to_cart function you are using:
postdata=re...In add_to_cart function you are using:<br />postdata=request.POST.copy()<br />productslug=postdata.get('product_slug','')<br />...<br /><br />The only reason I see to use copy() is if you want to modify the post data, usually it's for pre-processing a form. In this case I don't think it is needed.<br /><br />p.s. is this the right place to post this stuf?pablohttps://www.blogger.com/profile/07056804302996675811noreply@blogger.comtag:blogger.com,1999:blog-6072463814914813547.post-14201907428265220072009-12-13T20:52:36.067-08:002009-12-13T20:52:36.067-08:00Hi Pablo,
A very interesting bug! That was also m...Hi Pablo,<br /><br />A very interesting bug! That was also mentioned on the errata page. I played around with it and you're absolutely right, it's because I call delete_test_cookie(). That was a "best practice" move that came from the Django docs. I didn't find that error case in my own testing. <br /><br />If this is an issue, I don't see any harm in just leaving the test cookie, without deleting it. Customers are unlikely to add an item to the cart and then disable their cookies.<br /><br />Thanks!Jim McGawhttps://www.blogger.com/profile/02849525770389840778noreply@blogger.comtag:blogger.com,1999:blog-6072463814914813547.post-30840358418052028332009-12-12T04:00:39.330-08:002009-12-12T04:00:39.330-08:00A small bug:
In www.django-ecommerce.com go to a p...A small bug:<br />In www.django-ecommerce.com go to a product and click "Add to cart" you are now in the cart page.<br />Click the browser back button to go back to the product page and try to click on the "Add to cart" button again. You get the "Cookies must be enabled."<br /><br />This is because you check for the test-cookie and then delete it. Maybe you can use the session cookie?pablohttps://www.blogger.com/profile/07056804302996675811noreply@blogger.comtag:blogger.com,1999:blog-6072463814914813547.post-35574167241224105852009-12-05T10:01:36.587-08:002009-12-05T10:01:36.587-08:00Hi Pablo,
There are some XML purists who will tel...Hi Pablo,<br /><br />There are some XML purists who will tell you that you should never, ever build XML documents by hand, and that you should rely only on libraries for building them. I don't necessarily agree with this 100% (in Chapter 11, I create the complex "Google Base" XML product feed using a template), but since the example was (relatively) simple, I wrote Chapter 5 with them in mind.<br /><br />Using object.select_related() to handle the querying between the shopping cart items and the products themselves is a really good idea, and a great thing to point out. I think it's well worth testing if you're out there in development land. I'll re-examine my code to see if it can be improved.<br /><br />As of now, here is the select_related() docs, for those interesting in playing around:<br /><br />http://docs.djangoproject.com/en/dev/ref/models/querysets/#id4Jim McGawhttps://www.blogger.com/profile/02849525770389840778noreply@blogger.com