You are not logged in.
Before all others: I know there are shopping cart plugins like Textcommerce and the »proof of concept« joe_cart. And i know Steves implementation of joe_cart.
But all of these doesn’t really fits my needs. Textcommerce heavenly uses new database tables and seems it would be more a really shop than a simple cart. Joe_cart an lam_paypalcart are a beginning. And these two are the beginng of my implementation, too. Mainly i’ve tried to implement multiply properties per product. And then i want this and then i want that and so on.
This was my intention. And now i’ve done little bit more then i wanted. But don’t care, i’ve learned much about Textpattern.
I’ve set up a demoshop for testing purpose. And if someone is interested in, i will publish the plugin after i’ve write a help and some code comments. And maybe i will write some additional stuff for it.
Update: As promised …
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:
Choose your flavor:
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’am always open for suggestions, especially concerning the resolving of security issues, ‘cause I’m not very skilled in this.
Installation
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.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!
Note: I’ve set up an additional page with a tiny howto and a FAQ about yab_shop.
You have to create one additional section. This section will be 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 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 »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 for yab_shop_config or forum thread!
<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 al 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.
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.
I need feedback about the localized currencies output (number format), ‘cause i don’t know about the specific decimal and thousand delimiters.
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.
Maybe some more information you can get at my weblog entry
 <txp:yab_shop_cart />, so cart output is optional<txp:yab_shop_add_message /> added'custom_field_price_name' other than 'price'<txp:yab_shop_add_message /> (see plugin help)<txp:yab_shop_add_message /> is used in checkout page<txp:yab_shop_cart /> can be used as container tag now<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 /> works in checkout section too<txp:yab_shop_add /> has full article listing support now<txp:yab_shop_cart_subtotal /> and <txp:yab_shop_cart_quantity /> for a flexible output<txp:yab_shop_checkout /> now have the optional attribute ‘summary’ for html table summary (accessability)<txp:yab_shop_price /><txp:yab_shop_show_config /> for returning config valuesLast edited by trenc (2012-08-31 11:01:18)
Offline
Hi trenic, bloody amazing I think you’ll find everyone is interested. Set it free…
Offline
affirmation mail to customer or not (ok, this could be a bug too)
very funny ;)
I’ve played with the shop a bit and found one problem: When I was on the checkout page, I changed a quantity (wanted 3 dots, so I could create not just a dot and colon but also an ellipsis), then submitted the form without entering name and such and got a message “Please fill out all mandatory fields!” followed by a link “Back to Checkout or Shopping”. Clicking that link made Firefox give a warning:
The page your’re trying to view contains POST data that has expired from cache. If you resend the data, any action the form carried out (such as search or online purchase) will be repeated. To resend click OK, otherwise press Cancel.
Instead of providing a link to go back, is it possible to simply show the filled out checkout form again, with the errors printed at the top? Similar to ZCR really (I know, I’m not really objective in this matter)
Offline
Hi ruud,
thanks for testing. Hm, strange behavhior, ‘cause the link to go back at the »Please fill out all mandatory fields!« site is a simple javascript history.back(). This should not take a page reload. But you are right, a redirect with an adequate notice would be a better solution. I’ve marked it on my list. :)
Offline
Ok, i’ve tested it.
In Konqueror — my favorite browser — it doesn’t appear. Firefox reloads the page, ‘cause is the same site and it seems Firefox has another implementation of history.back().
Offline
Firefox behaviour is correct, actually, according to the HTTP1.1 RFC
Responses to this [POST] method are not cacheable, unless the response includes appropriate Cache-Control or Expires header fields.
Offline
I’m very interested
Offline
So am I!
<txp:Els /> ;)
Tag Reference | Unexpected behaviour? Check the tag trace | Still no clue? Check the names of your custom fields
Offline
another thumbs up!
TXP Builders – finely-crafted code, design and txp
Offline