joe_gcart Textpattern Plugin

I would use yab_shop instead of this cludge.

Shopping Cart Example:

No items in cart

Product Example:

Downloads

Summary

This plugin is designed to be a simple starting point for the development of a session based textpattern shopping cart with support for flat rate shipping and Google Checkout. joe_gcart will only support simple items with no variations (color, size, etc…) and a single flat rate shipping cost per item.

My goal for developing this plugin was mainly to scratch an itch or two. I wanted to play around with Google Checkout, and more importantly I wanted to mess with Textpattern plugin’s.

Revisions

  • 2006.07.17 Initial Release

Client Plugin Tags

  • joe_gcart

joe_gcart

This will output a list based shopping cart with grand total, shipping total, subtotal and and item list with quantity, price, and subtotal.

Tag attributes:

  • merchant_id – required
  • merchant_key – required
  • subtotal_label – optional
  • shipping_total_label – optional
  • grand_total_label – optional

Installation

  1. Signup for Google Checkout
  2. Install Plugin
  3. Custom Fields
  4. Cart Article
  5. Article Form
  1. Product Article

Google Checkout

Signup for Google Checkout and get your merchant key and id.
https://sandbox.google.com/sell/settings?section=Integration

Install Plugin

Your reading this…

Custom Fields

In order to manage your products you will need to use three custom fields:

  • Price
  • Availability
  • Shipping

Cart Article

Create a new article. Tag it with joe_gcart:
<txp:joe_gcart merchant_key="a1b2c3d4" merchant_id="0123" />

Article Form

This form will add items to your cart. You need to modify the form action to point to your ‘cart’ article.


<h3><txp:permlink><txp:title /></txp:permlink></h3>
<txp:article_image align="left" />
<txp:if_custom_field name="Price">
<ul>
<li><b>Price:</b> $<txp:custom_field name="Price" /></li>
<li><b>Availability:</b> <txp:custom_field name="Availability" /></li>
</ul>
<form method="POST" action="/article/7/path_to_cart_article">
<input type="hidden" name="itemid" value="<txp:article_id />" />
<input type="hidden" name="price" value="<txp:custom_field name="Price" />" />
<input type="hidden" name="shipping" value="<txp:custom_field name="Shipping" />" />
<input type="hidden" name="title" value="<txp:title />" />
<input type="text" name="qty" size="2" value="1">
<input type="submit" value="Add to cart" name="add">
</form>
</txp:if_custom_field>
<txp:body />

Product Article

Write a new article and make it a product by specifing a Price.

Resources / Inspiration

Flame / Feedback

Please use the comment form below or email me: joe[@]joecode.com

License

I’m not sure, I’ve borrowed and lightly modified code from LGPL and Apache 2.0 sources.

http://www.gnu.org/licenses/lgpl.txt
http://www.apache.org/licenses/LICENSE-2.0

My preference is to release this as LGPL software with respect to wfCart who enabled this cludge ;)

Permanent Link |

Comments:

name
email
http://
Message
  Textile Help