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
AddToAny
Google Analytics (make sure to set up a key)
Mollom (make sure to set up a key for Mollom as well)
Pathauto
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.
Ubercart 是一套在自由軟體領域中快速竄起的電子商務軟體,並與 Drupal 平台整合而成為其外掛模組,若從開發為知名內容管理平台外掛模組的角度來看,不難看出 Ubercart 企圖以強大的內容管理平台結合電子商務功能為賣點,來擴大其市場的接受度,期望透過整合內容管理與電子商務之優點,以發揮一加一大於二之功效。 Ubercart 的起源是由一家販售商業級廚具設備廠商於 2006 年所贊助的開源計畫,該廠商的電子商務平台就是採用 Drupal 加 Ubercart 所建置而成,一直到 2008 年 Ubercart 才釋出 Beta 版本,中間經歷了 1.0 與 2.0 的版本修正,目前共有三位專職人員負責 Ubercart 核心部分的開發與維護,同時致力於提供友善的開發環境以吸引其他開發人員在 Ubercart 上從事開發與應用。在進行內文的閱讀前,我們可以先討論一下建置電子商務網站可能需要的基本功能,通常基本功能包含商品,訂單,支付,會員及配送等功能,而依照商店的需要可能會再考慮是否需要庫存、促銷與物流管理等等之功能,由此可見要討論 Ubercart 的功能應用在電子商務的範圍很廣,並無法在有限的篇幅內做完善的介紹,所以本文主要著墨於介紹 Ubercart 在商品部分的相關設定與應用。
◎ Ubercart 的基本資料:
軟體名稱:Ubercart
檔案大小:17.8 MB
官方網站:http://www.ubercart.org/
適用軟體平台:全平台
授權:GNU General Public License (GPL)
◎ Ubercart 安裝
目前的 Ubercart 已釋出 2.2 版, 2.2 版本適用於 Drupal 6 的平台,若是讀者是使用 Drupal 5 的平台,可選擇 Ubercart 1.9 的版本進行安裝與建置,本文則以 Ubercart 2.2 版本為範例進行解說。在安裝 Ubercart 之前,需先安裝其他相關的模組,包括 Token,Content Construction Kit (CCK),FileField,ImageAPI模組內的 ImageAPI, ImageAPI GD2,ImageCache,ImageField,Thickbox,Google Analytics 與 Views 。詳細的安裝說明可以參考其官方網站的說明。
◎ 商店設定
Ubercart 安裝完成後,可以在管理者選單(Administer › Store administration,若有啟用Clean URL 可直接在網址建入 /admin/store)找到 Ubercart 的主要設定環境,找到以後首先進行商店的設定,請先至Drupal的模組安裝介面確認Ubercart core package模組中的Store是否已被啟用,確認啟用後請至Administer› Store administration › Configuration› Store settings (或 /admin/store/settings/store)進行商店之基本設定,相關設定包括名稱、地址、連絡方法、日期與幣值等等項目,使用者可依實際情況進行設定。
商店設定完成之後,接下來就是重頭戲,有關商品的設定,熟悉 Drupal 的朋友都知道,Drupal 把各種的內容 (content),例如預設的 Page 與 Story 都視為一個 node,所以 Ubercart 中的 Product 也是基於 node 所衍生出來,如此的設計使得 Product 也可以與一般的 node 同樣享有讓使用者回應或評分之功能,甚至可以透過 CCK 來對 Product 增加額外的欄位,換句話說,任何適用 node 的功能,同樣也適用於 Product。而 Product 特有的部分就是商品資訊 (Product information) 與運送設置 (Shipping settings),在商品資訊部分可以設定編號、售價、重量與體積等等資訊,其中售價又可分為建議零售價 (MSRP) ,庫存成本 (Store’s cost) 與實際售價 (Customer purchase price) ,而運送設置部分則有運送類型 (Ship type),商品存放地址與運送費用可以設定。
若是遇到商品的種類眾多,不同商品可能需要提供給使用者不同資訊而 Ubercart 預設的欄位又不夠使用的情況時,例如電腦 CPU 的規格、商品製造地或製造日期等,則可以利用 CCK 的功能幫該商品增加不同的欄位,如此一來在新增商品時,就有額外的欄位可供輸入(CCK 的使用方法並非本文之主要內容,有需要的讀者請自行上網搜尋)。若網站經營者想要的是讓使用者在選購商品時,可以在單一商品的購買上依需求選擇不同屬性時,例如同一款手機可提供不同外觀花色選擇的情況時,則可以利用 Ubercart 的Product Attribute功能來實現,首先先新增一個商品類型 (Product class),請至Administer › Store administration › Product › Mange classes 或 /admin/store/products/classes 新增一商品類型 Cellphone,在新增後,即可以在 Create content 功能上看見一個新的 content 名稱為 Cellphone。
但目前 Cellphone 所需要的欄位與預設的 Product 的欄位一模一樣,此時對 Cellphone 增加一個 color 的欄位以供消費者選擇,請至 Administer › Store administration › Attributes(或 /admin/store/attributes),增加一個 Attribute 命名為 color 並設定 color 為下拉式選單 (select box)。
然後在option for color的介面,增加想要的選項,例如海水藍、香檳金、超淨白與尊貴黑等
值得一提的是在增加選項的介面上 Ubercart 還提供了一個貼心的服務,就是價格的調整,管理者可以依不同選項輸入不同價格,例如外觀為超淨白的 Cellphone 材質較好也較搶手,所以管理者可以設定超淨白項目的調整金額為50,如此一來消費者在選擇購買超淨白花色的 Cellphone 時,需要再加 50 元,當然也可以設定調整金額為負值,以達到促銷的手段。透過 Product Classes,CCK 與 Product Attributes 的搭配下,管理者可以不需撰寫程式就可達到依特性新增不同商品,並同時讓消費者在購買商品時,可以選擇不同的外觀花色,而不同的外觀花色也可能出現金額上的調整。
在介紹完商品的設定後,接下來就是商品的展示,一般來說,電子商務皆會提供商品分類的功能,一方面可讓商品做分類的展示,便利消費者快速找到其需要的商品,另一方面也可以讓管理者將商品做有效的管理,而 Ubercart 核心內的 Catalog 模組,就是用來協助管理者做商品分類的利器,值得一提的是 Catalog 是基於 Drupal 的 Taxonomy 系統所衍生出來的應用,Taxonomy 是 Drupal 用來管理標籤 (Tag),與將內容做分類的技術,而 Catalog 是 Ubercart 用來產生商品目錄與分類商品的技術。通常 Catalog 被安裝並啟用後,在 Taxonomy 設定介面下(請至Administer › Content management › Taxonomy 或 /admin/content/taxonomy)可以看到一個 Taxonomy 的 Vocabulary 名稱為 Catalog,這個 Catalog 就是預設給 Ubercart 的商品來當作分類與目錄使用的,透過編輯介面可以在 Content types 的設定區域看到 Catalog 已設定給 Product 這個 Content 使用。
管理者也可以將之設定給其他 Drupal 的 Content,也可以直接在 Catalog 內加上新的 term,例如新增手機與筆記型這兩個 term,此時若在瀏覽器的網址列上直接在你網址後加上 /catalog,就可以直接看到商品分類的展示畫面(沒錯,就是那麼單純),管理者可以依需求再自行增加不同階層的 term。
而 Catalog 分類完成後,在新增或編輯 Product 的介面上就會有 Catalog 的項目與已設定好的 term 供管理者選擇,term 的選擇也同時代表該商品是被分到這個 term 下,如此一來商品與分類就完成關聯的建立,另外 Catalog 也有提供以 tree view 方式展現的 block,供管理者彈性放在網頁兩旁的 region,而 Catalog 其他的設定管理者則可以至 Administer › Store administration › Configuration › Catalog settings 或 /admin/store/settings/catalog 進行調整。