yab_navigation – A navigation management plugin for Textpattern

Grab it here
yab_navigation_v0.1.beta.zip
or here
yab_navigation_v0.1.beta.tar.gz

There are a couple of browser issues this time, namely for Opera, all Internet Explorer versions and Konqueror. Some are CSS-related, some Javascript related. Because of these issues this is a beta release. I will try to fix these issues asap.

Feature Screencast

Feature Screencast of yab_navigation from trenc on Vimeo.

What you need to know

The navigation used and generated by yab_navigation is based on a »simple« template of Textpattern tags (<txp:variable />, <txp:section_list />, <txp:article_custom /> etc.). This navigation will be saved in a form called »yab_navigation« (Opps!). This form will be created automatically.

Since the navigation is saved in this form you can call the navigation with the following command in your page template:

<txp:output_form form="yab_navigation" />

And your articles you can call simply with:

<txp:if_individual_article>
  <txp:article status="4" limit="1" />
<txp:else />
  <txp:article status="5" limit="1" />
</txp:if_individual_article>

in your page template(s).

For your frontpage you need a section with the value »On front page« set to »yes« and the same title as the home_title in the configuration (see below).

That’s all actually, but

What you really need to know

Since Textpattern sections and articles are completly different in behaviour and database structure and they are not only pages – as maybe known from other CMS – this plugin can only be an approach, of course. For understanding the concept I have to explain something.

The first section on the left side in your backend navigation will represent your frontpage aka your home. So the name of this section is only shown in the plugin, The real name, which is shown as a link in your frontend navigation is set in the config (see below).

The first article (first list point) of every section in the backend navigation will represent the parent section in the frontend navigation. This article will always be fixed (status 5) and is not displayed in the frontend navigation. So the name of the article is only shown in the backend navigation.

The rest of the articles will be shown in the frontend navigation in the order you choose.

What you maybe need to know

When you install the plugin and you go to the backend navigation, your whole navigation is shown of the right.

Reload the site again

Now your navigation should be shown on the left side but maybe it looks weird. This is because the plugin reads the whole stuff from database and not from a navigation template, because this is still empty. You have to move a section to force the generating of the navigation template. When done, reload the backend page again.

Now you should see on the right side a place where you can see hidden or new detected sections – if they exist.

If something won’t work or you can’t see the navigation on the left side, go to you form templates and empty the yab_navigation form. Then begin anew in the navigation backend.

Useful things you need to know

Every new created section is hidden by default, you have to move it from the right side in your backend navigation. Every created article is hidden by default, except if it is the first article of a section, then it’s fixed.

Btw. hiding the first article of a section doesn’t really make sense. :)

Renaming a section or an article will not change the name of section or the URI of the article. It will only rename the title of the element. I’ve decided for this behaviour because of the URI consistence (»Cool URI’s don’t change!«).

If you ever delete or rename a section in the Textpattern section menu you are lost.
Not really but …
If you have deleted a section this way you only have to hide this section in the backend navigation. Next time (or after a reload) this section will disappear.
If you have renamed a section this way … uh … fucked up! You have have to empty the yab_navigation form and build your navigation in the backend anew. Sorry!

Really useful things you need to know

There are configuration options for the plugin. You will find them in an array $yab_nav_prefs in the plugin code:

Option Description Default
home_title The title of the frontpage. Has to be the same title as your frontpage section title. Home
sort The sort order for the articles position asc
active_class Active class for sections or articles active
passive_class Passive class for sections or articles passive
exclude_sections Here you can completly exclude sections from navigation listing (comma delimited) (empty)
exclude_articles Here you can set sections, which articles will not be listed in the navigation. Useful for a news section or a section which does not have a single article as content. And you can’t move other articles in this section in the backend. (comma delimted) (empty)
section_default_page Default page template when creating a section default
section_default_css Default CSS when creating a section default
section_default_rss Should be created sections include in RSS Feed? 0
section_default_frontpage Should be created sections on frontpage? 0
section_default_searchable Should be created sections searchable? 1
jquery_ui The link to the jQueryUI Script min. JS from Google CDN
article_limit Hard limit for backend navigation article list 30

If you develop sites locally with no internet connection or you don’t like Google, you can change the jquery_ui link to a local jQueryUI framework. If you want to minfy the script, you don’t need to load the complete jQueryUI framework. The only things you need are Core, Widget, Mouse and Sortable. (http://jqueryui.com/download)

The function yab_nav_gTxt below the configuration array is used for the localisation and language. You can edit this on your own.

Other things you need to know

Deleting sections or articles will not be implemented. For deleting sections or articles you have to go the standard way.
The rights management (user privileges) could be bypassed by this plugin, if you set the rights for this plugin lazier than other rights are (for example access to editing sections in the section tab).
The plugin does only know the article status fixed (5), live (4) and hidden (2). Other status – as draft or pending – will be overwritten!

Things you really don’t want to know

This plugin is made with some Javascript, jQuery, jQuery UI, XML (really), AJAX, PHP, Textpattern, Debian, Kate, Firefox/Iceweasel. I like the Allman style for php coding with a maximal measure of 80 chars – if you ever look at the plugin code. And if you have seen the feature screencast, this is made with recordMyDesktop and converted with mencoder.

yab_email -- Email obfuscate/defuscate as textpattern plugin

yab_email is a tiny Textpattern CMS-Plugin for obfuscating and defuscating email adresses to prevent harvesting email adresses.

This plugin will use jQuery and is based on the jQuery plugin Email Defuscator.

Download

yab_email_v0.7.txt

yab_email plugin help

A simple email obfuscator/defuscator (jQuery based)

Version: 0.7

Plugin requirements

yab_email’s minimum requirements:

  • Textpattern 4.x
  • jQuery 1.3.x

Tags

yab_email

Place this in your site to hide your email address from harvesters and bots.

email: a valid email address
Default: name@example.com
An email address, you want to be obfuscated.

class: class name
Default: yab-email-link
A class name for generated <span /> or <a /> element.

at: word between parenthesis
Default: at
A text string, that will be in parenthesis in obfuscated email.

link: boolean
Default: 1
Generate a link or show email as span element.

text: a link text
Default: not set
A text string, that will be the link text. Overwrite a link="0".

set_js: boolean
Default: 1
Generate Javascript for this very tag.

yab_email_javascript

If you have more email addresses you want to be obfuscated or your jQuery inlcude is at the bottom of your site, you can place this tag after the jQuery include.

class: class name
Default: yab-email-link
A class name for generated <span /> or <a /> element. Has to be the same as in <txp:yab_email />

link: boolean
Default: 1
Generate a link or show as span element.

Examples

Example 1

Example with a jQuery inlcude in the head and only one address to obfuscate.

<!doctype html>
<html>
<head>
	<meta charset="utf-8" />
	<title>Your tilte</title>
	<link rel="stylesheet" href="/path/to/your/stylesheet.css" />
	<script src="/path/to/your/jQuery.js"></script>
</head>
<body>

<p><txp:yab_email email="contact@example.com" /></p>

</body>
</html>
Example 2

Example with a jQuery inlcude at the bottom and probably more address to obfuscate.

<!doctype html>
<html>
<head>
	<meta charset="utf-8" />
	<title>Your tilte</title>
	<link rel="stylesheet" href="/path/to/your/stylesheet.css" />
</head>
<body>

<p><txp:yab_email email="contact@example.com" set_js="0" /></p>
<p><txp:yab_email email="ceo@example.com" set_js="0"  /></p>

</body>
<script src="/path/to/your/jQuery.js"></script>
<txp:yab_email_javascript />
</html>

Licence

This plugin is released under the GNU General Public License Version 2 and above

Author contact

Changelog

  • 2009-09-20 v0.1
    • initial release
  • 2009-09-20 v0.2
    • bugfix: releated DOM load
  • 2009-09-20 v0.3
    • feature: added class attribute
    • bugfix: style in plugin help
  • 2009-09-21 v0.4
    • bugfix: fixed XHTML validation errors
    • feature: added new attribute link
  • 2012-09-04 v0.5
    • bugfix: withespaces in href are now correctly escaped
    • bugfix: removed redundant type attributes in script tag
    • bugfix: plugin help rewritten and extended (plugin help guidelines)
  • 2012-09-24 v0.6
    • bugfix: does now work with jQuery >= v1.8.0
  • 2017-02-10 v0.7
    • bugfix: TXP 4.6-ready

HowTo an FAQ about the textpattern shopping cart plugin yab_shop

This FAQ is outdated. You can use it for general questions. For specific questions please use the plugin help!

Due some maybe unclear plugin help or the lack of documentation of yab_shop I want to introduce the basic functionality of the plugin with a guide how to set up a simple shop and a — hopefully useful — FAQ section. I will try to continue this page with some information that are useful, so it’s not complete this time. If you have useful guides or information on how to set up this or that scenario, feel free to contact me or use the comments below, so I can complete this page, bit by bit.

If you think the textpattern cms and yab_shop rocks, be kind and donate! Donating is a fine way to say »Thank you«.

For Textpattern: Donate here!
For yab_shop: Donate here!

Some requirements of using yab_shop

  1. an installed and working textpattern cms on you webhosting
  2. some knowledge of textpattern tags <txp:... />
  3. some knowledge of how textpattern manage a site structure (mean section, pages, forms, articles etc.)
  4. knowledge of how to install textpattern plugins

Setting up a simple shop (with yab_shop v0.7.0 and above)

Step 1
Download the plugin yab_shop.

Step 2
Install and activate the yab_shop_core, yab_shop_admin and yab_shop_third_party.

Step 3
Go Presentation->Pages and create a page called checkout and place <txp:yab_shop_checkout /> as content.

Step 4
Go Presentation->Sections and create a section called checkout with using the page checkout.

Step 5
Go Presentation->Pages and add the tag <txp:yab_shop_cart /> in all sections which will include your product articles and in section page checkout. In doubt place it in every section page. This tag will output a little cart, so it will be useful to place in a sidebar.

Step 6
Go Presentation->Forms and add in your article form (maybe default) the tags <txp:yab_shop_price /> and <txp:yab_shop_add />. So maybe it looks like this:

<h3><txp:title /></h3>
<p>Price: <txp:yab_shop_price /></p>
<txp:yab_shop_add />
<txp:body />

Step 7
Create an »Thank-You-Article« or Page. This will be showed after an successful shop order.

Step 8
Go Admin->Preferences->Advanced and set up Custom Field with Price.

Step 9
Go to Extensions->Yab_Shop common preferences and edit the configuration with the following:

»Name of the checkout section«: checkout
»Checkout thank-you-site (Full URI)«: http://domain.tld/thanks/thank-you
»Name of the custom field price«: Price
»Admin Mail (Receives the orders)«: your email address

The other entries can be edited on your own. See the plugin help of yab_shop_admin for details!

Step 10
Go Content->Write and create your first product! The section doesn’t matter. You can arrange your products in many sections if needed, it only shouldn’t be the checkout section. The price for the product can be added in your created custom field.

Now you can add more and more products and — hopefully — make some money.

FAQ

Can you implement this or that feature?
Feel free to ask in the forum thread for this plugin. Some features are very special so probably they will never be impemented. I want yab_shop as light, flexible and efficient as textpattern is. For some other features maybe another plugin will work (in conjunction with yab_shop).

Can you help me with setting up the shop or with a feature I want to implemented?
Due yab_shop is a hobby project my time is limited, but I’m trying to help if I can.

I discovered a bug in your yab_shop, what should I do?.
Please contact me here or in the forum thread. I’m always interested in bugfixing and open for suggestions.

Will there be an admin interface?
Yes, it’s planned.

Can I set up yab_shop with credit card payments?
No. There are too many solutions for different countries and companies. Maybe one or two will be impleneted sometimes.

yab_shop doesn’t support my currency. Can you include this?
Tell me your country and currency (use the forum thread, please) so I can add these to the supported currencies.

The cart will only be updated with added products after a page reload. What’s wrong?
Go Admin->Preferences->Advanced and set Send "Last-Modified" header? to »No«.

Your English is crappy!
Yep! You’re right. Feel free to correct sentences, would be nice.


Comments for this entry are disabled for a while, ‘cause of massive spam. If you have questions or suggestions use the forum thread instead, please!

yab_image: another image plugin for textpattern

Yes, another image plugin for textpattern. :)

What it does

This plugin allows you to display an image with an assigned caption as caption :). The width of the caption will always fits the width of the displayed image.

The problem

In textpattern you have an option to give an uploaded image a caption, but textpattern will show this caption via textile, tag <txp:image /> or html only as title attribute of the image element. This is not a real image-caption aka image-subtitle.

If you want a real image-caption in textpattern so you have to work with different <span> in your body with textile or with raw html. The next problems are the different widths of the images and the caption (subtitle) below.

Here is an example what I mean:


Example Picture 1 This is a caption with an appropriate width Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.

Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim.

Example Picture 1 This is a longer caption and the width could break your layout Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.

Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim.


Solution

If you know this problem and you often use or want to use image-captions then maybe yab_image is a solution for you. The example above will with <txp:yab_image /> look like this:

Example Picture 2This is a longer caption of the image. With yab_image the caption doesn't break your layout.Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.

Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim.

Usage

You can use this plugin almost the same as <txp:image />. The behavior is a little bit different: If a caption for an image is available and if you want to float the image and the caption, use the align attribute. This will float the image and the caption.

If no image caption (neither as tag attribute nor in image tab) is given <txp:yab_image /> works similar as <txp:image />·

F.i.: <txp:yab_image id="5" align="right" />

Attributes

The following attributes works as expected (as in <txp:image />·) when no caption is given:

id
Specifies the id assigned at upload of the image to display. Can be found on the images tab. If both name and id are specified, name is used while id is ignored.
(Integer)
name
Specifies which image to display by its image name as shown on the images tab.
(String)
class
CSS class attribute applied to the wraptag, if set, otherwise to the img tag.
(Default: unset)
escape
Escape HTML entities such as <, > and & for the image’s alt and title attributes.
(Default: unset)
html_id
The HTML id attribute applied to the wraptag, if set, otherwise to the img tag.
(Default: unset)
style
Inline CSS style rule.
(Default: unset)
wraptag
HTML tag to be used to wrap the img tag, specified without brackets.
(Default: unset)

The following attributes are new oder modified:

align
Alignment of the image and the caption.
left, right, center (default: center)
alt_caption
Alternate caption, overwrites caption given in image tab.
(Default: unset)
alt_alt
Alternate img alt, overwrites alternate text given in image tab.
(Default: unset)
alt_title
Alternate title, overwrites caption text given in image tab, which is regulary used for img title attribute.
(Default: unset)
alt_as_title
If set, the alt_alt tag attribute or the alternate text is used for the img title attribute.
(Default: 0)

Some weird logic and priorities:

Tag attributes will always overwrites given text in the image tab!

Intentionally usage of alt_as_title tag attribute:
Mainly it could be used for displaying hyperlinks in the caption (the thingy, which is shown under the image) without breaking the HTML validity.
If you want to display hyperlinks in the caption so you can either write these hyperlinks as raw HTML in the caption field in your image tab or as textile markup in the tag attribute:

F.i.: <txp:yab_image id="5" align="right" alt_caption='This is a "Link (Link)":http://textpattern.com/ in a caption' />

Important:

  • Use single quotes for tags when insert double quotes!
  • Don’t start with an double quote (alt_caption='"Link (Link)":http://textpattern.com/ in a caption' will not work).
    Use a beginning whitespace or text before the double quote (alt_caption=' "Link (Link)":http://textpattern.com/ in a caption').
  • Be sure the line will be textiled.

Problem: The generated img title attribute is broken, because the hyperlink with the double quotes breaks it.
Solution: Now you can additionally use the alt_title tag attribute to set a specific img title or the alt_as_title so that the img title will generated from alternate text in the image tab.

F.i.: <txp:yab_image id="5" align="right" alt_caption='This is a "Link (Link)":http://textpattern.com/ in a caption' alt_as_title="1" />

or

F.i.: <txp:yab_image id="5" align="right" alt_caption='This is a "Link (Link)":http://textpattern.com/ in a caption' alt_title="Nice picture which shows something" />

Styling

The plugin will create new html elements:

If an image caption is given:
<small class="caption">given caption here</small>: This elements will wrap the caption.

And if additionally the attribute align is used:
<span class="img-caption-{align}">image+caption</span>, where {align} will be your given align: This span is wrapped around the image and the caption. So you have the ability to set different paddings for different floats.

You can always use the wraptag attribute to wrap all with another html element.
Depending on your usage and used wraptag you have to clear the floats.

As of version 0.3 <txp:yab_image /> will produce (X)HTML-strict output. The align attribute in the image element will be completly removed. So the HTML-markup will be different from <txp:image />.

Download

yab_image_v0.5 plugin
yab_image v0.5 source

Changelog

  • 08-11-28 – v0.1
    • release
  • 08-11-30 – v0.2
    • added: alt_caption attribute for alternative captions
  • 09-04-08 – v0.3
    • removed image align attribute in html markup, so output will be (X)HMTL-strict
    • added different css classes for different floats for styling purpose
  • 10-09-24 – v0.4
    • can now handle hyperlinks in captions
    • added: alt_alt attribute for alternative img alt attribute
    • added: alt_title attribute for alternative img title attribute
    • added: alt_as_title attribute for alternative img title attribute
  • 2017-02-10 – v0.5
    • TXP 4.6-ready

yab_download: Tiny textpattern plugin to offer downloads

I wrote a tiny textpattern plugin for a customer of mine. It’s nothing spectacular, but if someone need it, feel free to download.

What it does

This plugin allows you to offer a download of multiple files (per file id and/or category) with or without a confirmation button. Additionally you can offer an option to download all the files as zip archive on the fly. The names of the files are read from the files description. If no description is given the filenames are displayed.

Usage

This plugin has only one tag: <txp:yab_download />. You have to place it in an individual article.
The following attributes are available:

  • files: The IDs of the files, which are for download (seperated by comma). If no files assigned with an ID an error message will displayed in the option field.
  • label1: Label for select
  • label2: Label for confirmation checkbox
  • label3: Label for the submit input
  • label4: Label for zip download checkbox
  • notice: Error notice, if confirmation is not set but required
  • size: Display filesize additionally (values are B, KB,MB, GB,PB).
  • confirm : Form used with a confirmation checkbox (values: ‚1‘ or some other string)
  • formid: html id of the element form, used for anchor, if you use more than one <txp:yab_download /> in a single site, make different entries here; (default yab_cd_download)
  • cats: File categories you will add to download (seperated by comma); will additional displayed with files from files attribute above
  • exclude: IDs of the files you will exclude; Does only work with cats attribute.
  • sort: Sort the files from cats; (defaul description asc)
  • zip: Offfers an checkbox with an option to download all offered files as zip instead (values: ‚1‘ for zip creation; ‚2‘ to force zip creation in memory)
  • zipname: the name of the offered zip (default all.zip)
  • hidelist: hides the select list of the files, usefull if you offer only one file or offer many files zipped without a seletion (values: ‚1‘)
  • hidezip: hides the zip checkbox (download as zip is forced), useful if you offer only one file as zip or many files as zip wihtout a file selection; can be combined with ‚hidelist‘, so only a download button will be displayed (values: ‚1‘)

Example usage

simple
<txp:yab_download files="1,2,3,4" />

full
<txp:yab_download files="1,2,3,4" label1="Choose your download" label2="Accept Download at your own risk" label3="Klick here for download" label4="Yeah give me all as zip" notice="You have to accept the condition below" size="MB" formid="form-no-1" confirm="1" cats="category1, category2" exclude="5,7" sort="filename desc" zip="1" zipname="archive.zip" />

The full example above will show you a form with two checkboxes. First one offers an option to download all the files zipped. The second checkbox is a confirmation checkbox.
The offered files will be the files with the file id #1, #2, #3, #4 and all files of the categories category1 and category2. If in category1 or category2 a file with the file id #5 and #7 so these will be excluded from download. The zipped file will be named as archive.zip.

Note on zip creation

If you are running a php version 5.2.0 or above so the attribute zip="1" will try to create the zip on harddisk instead in memory. If you have php 5.2.0 or above and you have problems with some restrictions like safe_mode, open_basedir etc., so try the attribute zip="2". This will force the zip creation in memory.

Download

This download of the plugin shows you a real world example.

If you have yab_confirmed_download v0.1 installed, disable or remove it, please! The plugin has been renamed.

Changelog

  • 08-11-23 – v0.1
    • release
  • 08-11-27 – v0.2
    • renamed the plugin to yab_download
    • added: confirmation is now optional
    • added: support files per categories
    • added: sort per category
    • added: files exclude
    • added: zip-on-the-fly
    • added: attribute formid for unique html ids for multiple plugin usage per page
  • 08-12-01 – v0.3
    • bugfix: filesize of category listing will now correctly calculated
    • bugfix: minor code improvement
  • 08-12-21 – v0.4
    • bugfix: code improvement (see comment below, thanks Geoffrey)
  • 09-01-08 – v0.5
    • bugfix: code improvement (see comment below, thanks Geoffrey); if a php 5.2.0 is running so zip creation will be on harddisk instead in memory
  • 09-11-16 – v0.6
    • bugfix: filenames and filedescriptions are now correctly escaped
    • added: new attribute ‚hidelist‘ hides the file selection list
    • added: new attribute ‚hidezip‘ hides the download-as-zip checkbox
  • 2017-02-10 – v0.7
    • TXP 4.6-ready

Textpattern Shop - 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
  • google 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, RSD, BRL, PHP, RON and ZAR (ask for more))
  • tax rate support
  • tax rate exclusive or inclusive
  • support for promotional discounts by promo-key
  • selectable shipping costs and free shipping limit
  • multiple product properties up to three variants (e.g. size, color or whatever you want)
  • special prices for a property (Huh? What?: See live in demoshop!)
  • 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. Due the size of the whole plugin I have to split in three single plugins. You have to install all three plugins. If you have problems with upload and install, try to install the compressed version (is included in the download file).

Content of download files:

  • Three plugin files
  • Three source code files
  • Optional language files
  • One little readme

If you find this plugin useful, feel free to donate:

If you want see the code, please use the source, ‚cause it’s commented. I’m always open for suggestions, especially concerning the resolving of security issues.

Installation

  1. Install and activate these plugins.
  2. Go »Extensions->Yab_Shop Preferences« and install the needed database tables.
  3. (optional): Install a prepared and prefilled language/localisation plugin (yab_shop_add_language_xx-xx_vx.x.txt)
  4. Set your preferences and language/localisation

Update

Mostly you can seemlessly update the plugin. With version 0.8.0 config and language strings will saved in additional database tables.

Updating from a version before v0.8.0

  1. Make a copy of your settings and language/localisation strings.
  2. Remove or disable the yab_shop_config plugin
  3. Install the ones (yab_shop_core, yab_shop_admin, yab_shop_3rd_party)
  4. Go »Extensions->Yab_Shop Preferences« and install the needed database tables.
  5. (optional): Install a prepared and prefilled language/localisation plugin (yab_shop_add_language_xx-xx)
  6. Set your preferences and language/localisation

Updating from a version before v0.7.0

For an easy usage to newcomers and by the reasons of new features some tags has been removed or renamed.

  • <txp:yab_shop_cart output="message" />
    Attribute value output="message" doesn’t exists any more. See below the for changes.
    And now you have to place it in checkout section to (f.i. with <txp:yab_shop_cart output="none" />)!
  • <txp:yab_shop_add_message message="your message here" output="message" />
    Removed.
    Now use <txp:yab_shop_cart_message /> instead.
  • <txp:yab_shop_custom_field name="price custom field" />
    Renamed to <txp:yab_shop_price /> without an usage of attributes.
  • <txp:yab_shop_property_prices />
    Removed. Now load the jquery.js manually please!

Setup

Note: I’ve set up a page with a tiny howto and a FAQ about yab_shop.

You have to create one additional section. This section is used for the 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.
Place the used name 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 »Yab_Shop Preferences« which contains the configuration and go »Yab_Shop L10n« which contains the phrases where you can change on your own. See the yab_shop_admin plugin help for further information.

For encrypted paypal button and google checkout setup see plugin help of yab_shop_admin!

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"). Since yab_shop_v0.7.0 you can place it in article listings too.

<txp:yab_shop_cart />

This tag is used for adding, editing and deleting products and it’s outputs the little cart. It must be placed somewhere in the shop sections and in the your checkout section. Since yab_shop_v0.7.0 it can be used as a container tag. You can change the output by the following attribute:

  • output="cart" – default, outputs the little cart
  • output="none" – no output, so you can use it checkout section without any output
Usage as container tag
<txp:yab_shop_cart>
  <txp:yab_shop_cart_items />
  <txp:yab_shop_cart_quantity />
  <txp:yab_shop_cart_subtotal />
  <txp:yab_shop_cart_link />
  <txp:yab_shop_cart_message />
</txp:yab_shop_cart>

<txp:yab_shop_cart_items />

Outputs the items in the cart as a list. Can only be used inside the container tag <txp:yab_shop_cart>. No attributes.

<txp:yab_shop_cart_quantity />

Shows the quantity of the items in the cart. Can be used standalone or inside the container tag <txp:yab_shop_cart>. The following attributes are available:

  • output=„single“
    Choose your itemcount. ‚single‘ for different products. ‚all‘ for all product items (default ‚single‘).
  • showalways=„1“
    Displaying it even if cart is empty (default ‚1‘).
  • break=„br“
    Break after output (default ‚br‘).
  • label=„Quantity“
    Label or name before itemcount output (default ‚Quantity‘).
  • wraptag=„span“
    Wraptag around the output (default blank).
  • class=„someclass“
    Class for wraptag (default blank).

<txp:yab_shop_cart_subtotal />

Shows the cart subtotal. Can be used standalone or inside the container tag <txp:yab_shop_cart>. The following attributes are available:

  • showalways=„1“
    Displaying it even if cart is empty (default ‚1‘).
  • break=„br“
    Break after output (default ‚br‘).
  • label=„Subtotal“
    Label or name before itemcount output (default ‚Subtotal‘).
  • wraptag=„span“
    Wraptag around the output (default blank).
  • class=„someclass“
    Class for wraptag (default blank).

<txp:yab_shop_cart_link />

Shows a link to your checkout page. Can be used standalone or inside the container tag <txp:yab_shop_cart>. The following attributes are available:

  • showalways=„1“
    Displaying it even if cart is empty (default ‚1‘).
  • break=„br“
    Break after output (default ‚br‘).
  • label=„proceed to checkout“
    Label or name before itemcount output (default ‚to_checkout‘ from yab_shop_config).
  • wraptag=„span“
    Wraptag around the output (default blank).
  • class=„someclass“
    Class for wraptag or link, if no wraptag is set (default blank).

<txp:yab_shop_cart_message />

Shows a message depending on a done action. Can be used standalone or inside the container tag <txp:yab_shop_cart>. The following attributes are available:

  • add=„Product has been added“
    Shows a message when a products has been added to cart (default ‚Product has been added‘).
  • edit=„Cart has been updated“
    Shows a message when a product count has been changed in checkout page (default ‚Cart has been updated‘).
  • del=„Product has been deleted“
    Shows a message when a product has been deleted from cart in checkout page (default ‚Product has been deleted‘).
  • break=„br“
    Break after output (default ‚br‘).
  • wraptag=„span“
    Wraptag around the output (default blank).
  • class=„someclass“
    Class for wraptag (default blank).

<txp:yab_shop_price />

It outputs the price. It can be placed in all article/product forms (individual and listings).
The following attributes are available:

  • wraptag=„span“
    Wraptag surrounded the Price (default ‚span‘).
  • class=„yab-shop-price“
    Class for the wraptag (default ‚yab-shop-price‘).

<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.
The following attributes are available:

  • summary=„your summary here“
    Summary attribute of the HTML table element.

<txp:yab_shop_show_config />

Outputs a value of the current yab_shop_config, so it can be used for weird things (<txp:if ... />, <txp:variable ... /> etc. pp.).
The following attributes are available:

  • name=„config value here“
    The value of the config.

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

And how do I input prices for a property?

Note: You can only assign one property with a price.
First go in »Yab_Shop Preferences« and change the Use property prices to Yes.
Then, if not yet done, load the jquery.js in your shop sections. Add the following line in your form or site template between the <head> and </head>:

<script type="text/javascript" src="<txp:site_url />textpattern/jquery.js"></script>

Input the Prices:

If you want use a property price you must give a price in your price field (custom field) even so. You can use it as an base price.
Now you can give prices to the properties in one property field (custom field). Use double minus as delimter between property and price. E.g for the property field color:

red; white--2,50; black--12,00; green--0,55

The properties with no price declaration will use the base price of the price field (custom field). The first property price should be the same as the base price. That’s all!

How do I use promo-codes, coupons etc.?

Go in »Yab_Shop Preferences« and set the Promocode key with a key, which a customer have to insert on the checkout page to get the promotional discount (E.g. 'XFHTE' or another value). With Given promo discount (%) you can set the promotional discount in percent (E.g. '5'). Absolute discounts like 5€ on all products are not supported due the lack of support by paypal and google checkout.

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.
See forum thread for support.

Something like a roadmap

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

Changelog

  • 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
    • dynamic 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)
  • 08-06-04 – v0.3.3:
    • Bugfix: All three product properties now submitted to paypal (property 2 and property 3 are merged in paypal submit form)
  • 08-06-18 – v0.4.1:
    • google checkout support
    • removed specific shop section (products can be organized in all sections now)
    • minor typo fix
  • 08-06-19 – v0.4.2
    • bugfix misformed google checkout xml if no item description is given
  • 08-08-12 – v0.4.3
    • paypal encryption now uses temp directory from txp advanced preferences
    • html class and id names are now css compliant (ascii)
  • 08-08-15 – v0.4.4
    • support for BRL (Brazilian real)
  • 08-09-27 – v0.5.0
  • 08-10-28 – v0.5.1
    • added support for ZAR (South African rand)
  • 08-12-19 – v0.5.5
    • new feature: support for promotional discounts (see plugin help)
    • new feature: remember checkbox for submitted data
  • 09-01-14 – v0.5.6
    • fixed bug when property prices are used and 'custom_field_price_name' other than 'price'
    • bugfix: using „:“ in properties in chekout table
    • bugfix: using „: „ as delimter instead of misleading „ – „ in property select element
  • 09-01-27 – v0.5.7
    • new feature: products in cart an checkout table are now linked back to their product site
    • new feature: support for article image thumbnails in checkout table
  • 09-02-20 – v0.6.0
    • bugfix: property prices now works with non-ascii chars in custom field name
    • bugfix: fixed a bug related with property prices and custom fields (if not used)
    • bugfix: removed invalid html (p>p)
    • new feature: added a redirect for a thanks site (for site tracking/conversion)
    • new feature: optional state form in checkout
    • new feature: special shipping cost for single products
  • 09-03-17 – v0.6.1
    • new feature: enhanced <txp:yab_shop_add_message /> (see plugin help)
    • new feature: support for PHP (Philippine Peso)
    • bugfix: changed html code in checkout form
    • bugfix: added anchor for error messages
  • 09-03-18 – v0.6.2
    • bugfix: fixed some bugs, when <txp:yab_shop_add_message /> is used in checkout page
    • bugfix: minor typo in plugin help
  • 09-05-03 – v0.7.0
    • bugfix: forms are now valid (X)HTML
    • bugfix: product properties are correctly escaped now
    • bugfix: order of postcode/city in mail does now match the html order
    • bugfix: minor typos (but maybe some others are added:/)
    • bugfix: name of property custom field can include whitespace and are html-escaped now (class names has been changed)
    • new feature: support for RON (Romanian lei)
    • new feature: terms of use checkbox is now optional (via config)
    • new feature: <txp:yab_shop_cart /> can be used as container tag now
    • new feature: new tag: <txp:yab_shop_cart_items />
    • new feature: new tag: <txp:yab_shop_cart_quantity />
    • new feature: new tag: <txp:yab_shop_cart_subtotal />
    • new feature: new tag: <txp:yab_shop_cart_link />
    • new feature: new tag: <txp:yab_shop_cart_message />
    • new feature: <txp:yab_shop_cart /> works in checkout section too
    • new feature: <txp:yab_shop_add /> has full article listing support now
  • 09-06-05 – v0.7.1
    • bugfix: forms and select elements in article listings now have an unique id for XHTML-validity and form has an anchor
    • bugfix: replaced array_flip() with another method in yab_shop_field_names() to prevend some warnings and errors
    • bugfix: removed hardcoded withespace and doublepoint from label in <txp:yab_shop_cart_subtotal /> and <txp:yab_shop_cart_quantity /> for a flexible output
    • new feature: <txp:yab_shop_checkout /> now have the optional attribute ‚summary‘ for html table summary (accessability)
    • new feature: added the attributes ‚wraptag‘ and ‚class‘ for <txp:yab_shop_price />
    • new feature: added new tag <txp:yab_shop_show_config /> for returning config values
  • 09-07-29 – v0.8.0
    • new feature: configuration and language/localisation now stored in database
    • new feature: admin UI for configuration/preferences and language/localisation
    • new feature: support for selectable languages and localisations (Depending on set Textpattern language)
  • 12-08-31 – v0.8.1
    • bugfix: fix a bug with PHP 5.3 and a deprecated warning (referencing new instances)
    • bugfix: fixed a bug in the install/update procedure
    • bugfix: refurnished admin UI for TXP 4.5.0
    • bugfix: partial using of plugin flags (prefs and delete)
  • 2017-02-09 – v0.8.2
    • bugfix: TXP v4.6-ready
    • bugifx: PHP v7.1-ready
    • bugfix: incorrectly formatted item amount when using paypal and promo code
    • bugfix: serbian dinar (RSD) know corrcetly shown as »din«

Comments for this entry are disabled for a while, ‚cause of massive spam. If you have questions or suggestions use the forum thread instead, please!

neuere Einträge | ältere Einträge