Content last modified Monday 5 May 2008
hop to #bottom
Categories:
Author:
Current version:
0.3.2
About It:
Get it:
Rate it:
  • Helpful?
  • 2 Yes
  • 0 No
Flag it:
Contact Reason [ ? ]

yab_shop

As written in the textpattern forum I want to publish yab_shop . Yab_shop is a simple shopping cart plugin with paypal support for textpattern.

Small feature list

  • L10n for output
  • encrypted paypal checkout
  • automatic output the currency symbols and number formatting, depending on your config (supported paypal iso 4217 currency codes, see paypal supported currencies and additional EEK and RSD (ask for more))
  • tax rate support
  • tax rate exclusive or inclusive
  • selectable shipping costs and free shipping limit
  • multiple product properties up to three variants (e.g. size, color or whatever you want)
  • affirmation mail to customer or not (ok, this could be a bug too)
  • should work with all url types
  • output is xhtml 1.0 strict
  • it’s a plugin (can easily be installed in addition to an already existing txp installation)
  • all the advantages of txp for the products (customizable, categories, all(?) plugins etc.)

Download and installation

Grab the current plugins here — you need both — install and activate them. If you have problems with upload and install, try to install the compressed version.

Plugins:
yab_shop_v0.3.2.txt (compressed)
yab_shop_config_v0.3.0.txt

Source:
yab_shop_v0.3.2.phps
yab_shop_config_v0.3.0.phps

If you want see the code, please use the source, ‘cause it’s commented. I’am always open for suggestions, especially concerning the resolving of security issues, ‘cause I’m not very skilled in this.

Setup

You have to create two additional sections. The first one is used for the products and the second is used for checkout (table and form).

Further you have to create at least one additional custom field in where you can store the price for the products. So create one and name it. Remember the used custom field for the config plugin. Place the used name and the used custom field number for the price in the config plugin. Now you can create up to three addtional custom fields if you want multiple product properties.

Next you have to configure your shop. So go into yab_shop_config which contains the configuration and phrases that you can change own. See the yab_shop_config plugin help for further information.

For encrypted paypal button setup see plugin help for yab_shop_config!

Tags for output

  • <txp:yab_shop_add />
    This tag outputs the add-to-cart form for the specific product. You have to place it into the individual product/article form (maybe “default”). Placing in arcticle listing forms works too, but is not recommended, because the add-to-cart form redirects to the single product view.
  • <txp:yab_shop_cart output="cart" />
    This tag is used for adding products and it’s outputs the little cart. It must be placed somewhere in the shop section. You can change the output by the attribute: output=“cart”
    • cart – outputs the little cart in sidebar or somewhere you want
    • message – outputs only a message by successfully adding to cart (maybe use it with an js effect library)
    • none – no ouput
    • default is cart
  • <txp:yab_shop_add_message message="your message here" />
    This tag is optional and can be placed everywhere in your shop section. It outputs an additional message if an product is added to cart.
    Attribute:
    • message="your message here" – optional, outputs an individual message
    • default message is taken from config ('message_added')
  • <txp:yab_shop_custom_field name="price custom field" />
    This a little modified <txp:custom_field /> from Textpattern. It outputs the price. So use it with the name of the custom field for the product price.
    It can be placed in all article/product forms (individual and listings).
  • <txp:yab_shop_checkout />
    This tag outputs the checkout table, where you can edit product quantities. And it outputs the checkout form, where you can finally submit your order.

Important notes on setup and maintaining

All numbers for prices in custom field or shipping costs in config can be written with comma or dot as decimal delimter. But beware: Do not use any thousand delimiter!
The output format in HTML or mail depends on the selected currency in the config.

How do I input product properties?

If you use one, two or all three custom fields for different product properties you have to fill the input fields with values separated by a semicolon, followed by a whitespace (you can leave the whitespace out, it will work both ways).
E.g. for custom field »Size«: 0.2mm; 3m; 5km; 100pc

Notes

Since products are stored like normal articles, you are able to use (all?) relevant plugins. (Not tested!)
You can see a live demo on demoshop.yablo.de.
Please refer to the forum thread for support, bugs, feedback etc.

Something like a roadmap

  • encrypted paypal button it’s done
  • a small admin interface to manage orders

Chaneglog

  • 08-02-25 – v0.1.0:
    • internal release
  • 08-02-27 – v0.1.1:
    • some variables and functions renamed, demoshop published
  • 08-03-01 – v0.1.2 :
    • error messages for required fields and cache handling (see forum) – public release
  • 08-03-04 – v0.1.3:
    • extended iso 4217 currencies (prepared for paypal support)
    • mime encoded headers for mail (thx ruud, see forum)
    • minor changes for ouput
  • 08-03-07 – v0.1.4:
    • fixed CAD ouput
    • fixed tax rate calculating, when tax rate is float with a comma as decimal delimiter
    • removed &thinsp;
    • new attribute output added for <txp:yab_shop_cart />, so cart output is optional
    • minor changes in plugin help
  • 08-03-11 – v0.2.0:
    • non-encrypted paypal checkout
  • 08-03-15 – v0.2.1:
    • support for EEK (estonian kroon)
    • changed payment method output (if only one payment method available)
  • 08-03-27 – v0.3.0:
    • fixed too paranoid sanitization
    • dynamical encrypted paypal button implemented
  • 08-04-09 – v0.3.1:
    • new tag <txp:yab_shop_add_message /> added
  • 08-04-16 – v0.3.2:
    • support for RSD (serbian dinar)
Article Request Count:
Keywords/tags:
Initially released:
02 Mar 2008
Posted here:
02 Mar 2008
Article modified:
16 Apr 2008

If there is a comment form at the Information URL, you may want to leave your comments/questions there or at the Forum thread for quicker feedback. Otherwise, comment away:

Your comment will NOT be submitted until you click the 'Submit' button on the next pageload.

Commented (3)

qweryu:

Great job!

This looks really nice. Excellent for small and simple webshops. Would it be easy to integrate this with VISA payment?

This plugin has a paypal support. AFAIK paypal business accounts from us or uk (maybe more, but not germany) can offer a credit card payment for costumers wihtout a paypal account.

For a single credit card implementation I know too little about it. There a many possible integrations for many countries. Which should I take? So I think it would not be easy to integrate. Best would be a world wide accepted credit card implementation, but I don’t know one, except paypal and google checkout, which are available in many countries.

Subscribe to this article's comments RSS feed. [ ? ]   View Recent Comments across the site. Get a Gravatar.

You know you want to visit the Archives.

Browse

Categories


Articles

There are also tag clouds, 'cause those are fun.
TxP · TxD · GG