Default / 默认 · 8月 31, 2021

“使用Drupal & Ubercart 5小时搭建在线图书电子商务网站”

For a friend, on a Saturday afternoon: Michael Steinberg, who writes and publishes books as Black Rain Press.
Install Drupal. This specific site is in 5; normally I would do 6, but it was in a folder with other friends’ sites that I didn’t want to upgrade at the time.
Enable the following modules:
The following core modules: Blog, Contact, Search, and Taxonomy
Content Construction Kit (CCK) and its bundled Node Reference
Imagefield (Drupal 6 version also requires FileField)
Image API and its bundled Image API GD2
ImageCache and its bundled ImageCache UI
Messaging and its bundled Simple Mail
Notifications and its bundled Content Notifications, Notifications Autosubscribe, and Notifications UI
Google Analytics (make sure to set up a key)
Mollom (make sure to set up a key for Mollom as well)
Token (required by Pathauto and other modules)
Update Status (comes automatically with Drupal 6)
Printer-friendly pages and Send by e-mail (bundled with Printer, e-mail and PDF versions)
Ubercart: (lots of modules here, but the setup will be simple: Cart; Order; Product; Store; Notify; Payment; Reports; Cart Links; PayPal)
Views and its bundled Views UI
Workflow-NG and its bundled Workflow-NG UI (required by Ubercart in Drupal 5, but not in 6)
Install the Zen theme, and create a quick subtheme with their instructions (or for Drupal 6) (you can grab zpress.css if you need to see how that’s customized)
Create the following content types & fields:
Book (not to be confused with the Book module in core; if you also need that content type, then call this type something else so they don’t conflict), with a Book Cover (an ImageField with default settings)
Excerpt, with a Node Reference to Book (default settings, but select the type as the above ‘Book’ content type)
Create an ImageCache preset named ‘book_front’ with Scale And Crop: width: 150, height: 231.
Create a view like this:
Basic info: Name: books
Page: check ‘provide page’; URL is ‘books’; View Type is ‘List View’; Title is ‘Books’; check ‘Use pager’; leave at 10 nodes
Fields: Image: Cover, with an option to ‘book_front as link to node’; Node: Title
Filters: Node Type is one of ‘book’; Node: Published Equals Yes
Sort by Node Title Ascending
Create another view:
Basic info: Name: excerpts
Block: check ‘provide block’; View Type: ‘List View’, Title: ‘Book Excerpts’; Uncheck ‘More’ Link
Fields: Node: Title; Node: Body as Teaser; Node: View Link with option of ‘Read more…’
Arguments: Node Reference: Book (field_book) with Option of ‘Book Excerpts from %1′; Argument Handling Code: “if (arg(1) && is_numeric(arg(1))) { return array(arg(1)); }”
Filters: Node Type is one of excerpt; Node Published equals Yes
Sort by Node: Created Type (Descending)
Configure some blocks:
Content Top: a custom ‘Ordering Info’ block, with some static HTML with the basic ordering info that you see on the site. Shows up on book* and cart*.
Left Sidebar: Navigation menu; Recent blog posts; Recent comments; User login
Right Sidebar: Excerpts (we created a view for that, remember?)
Site Info: The regular (Name, e-mail, etc). Most of this is set up during installation, but we also want to set the front page to ‘books’, so our fancy new View goes on the home page.
Ubercart configuration for E-Commerce:
Store administration > Products > Manage classes: Add a class of ID: book, Name: Book, which seems to turn on product info for our Book content type. I really don’t know Ubercart, but that’s literally all I had to do besides
Store administration > Configuration > Payment settings — set up a Payment method for PayPal, where you enter the required PayPal information.
Set up the contact page
Make sure the Navigation menu has what you want
Make sure you have all the Print, AddToAny, and any other settings you want configured
Set up the PathAuto settings to turn your ugly node/123 URLs into pretty book/[title-raw] or what-have-you.
(Optional): Migrate your content, if this is coming from WordPress or somewhere. In this case, it was actually just the books and about a dozen e-mail posts that were turned into blog entries; just a 20 minute cut & paste.
Hope that’s useful to some folks! Let me know any questions or comments you have.
PS: I did all the graphics for that, and even created the logo for him some years ago, when I fancied myself an artist…
%d 博主赞过: