We’re rolling out the features here slowly but surely. As always, we appreciate everyone’s support and patience. One major gap in our plugin suite was the lack of an actual shopping cart to add products to. I’m happy to release an implementation of just that. (Next up is the PayPal checkout but first things first.)
This plugin is fairly simple and only contains two tags that need to be implemented.
This tag displays the “Add to cart” button for your product along with the functionality to actually add something to your cart.
Attributes
Example
<txp:tc_shopping_cart_add
redirect_section="cart" add_message="Add to Cart!"/>
This tag displays the shopping cart detail.
Attributes
Example
<txp:tc_shopping_cart_add checkout_section="checkout" />
Here’s some examples of how you might implement the plugin.
Create an article form to display your product:
product detail form
<h4><txp:title /></h4>
<h5><txp:tc_price /></h5>
<txp:tc_product_image_1 />
<txp:body />
<txp:tc_shopping_cart_add redirect_section="cart" add_message="Add to Cart!"/>
Be sure that you create a section to display your shopping cart detail table. In this example we’ve called the section “cart”. On the cart page we’ve put the following tag:
cart page html
<div id="content">
<txp:tc_shopping_cart_detail />
</div>
That’s an example of how you can simply implement this plugin.
We tried to keep our HTML markup very semantic with the shopping cart so be prepared to apply some CSS rules for everything to look good.
Otherwise let me know if you run across any bugs and have fun. Next up PayPal.
— Levi Nunnink
Ads help support TextCommerce
Commenting is closed for this article.
I’m excited to see something like this being developed. I was wondering if the next release could have support for U.S. states. Sales tax rates in the U.S. vary by state, but right now TextCommerce only supports one rate for the entire U.S. I’m sure other countries could use similar functionality. Thanks!
— Jon Capps · Dec 7, 08:24 AM · #
thanks for the hard work. gonna try this out now!
— steve · Dec 7, 02:45 PM · #
just a request to make the store section configurable rather than it being hardcoded to ‘store’
— steve · Dec 7, 08:07 PM · #
also, should we still be using tc_product_display 0.0.1?
there seems to be a spelling mistake in the plugin code (theres a medium spelt ‘meduim’).
also when i use the tag <txp:tc_product_image_1 size=“small” /> it outputs the filename correctly (it outputs -> <img src=‘product-14-medium.gif’ alt=’‘ class=’‘/>) but leaves out the relative directory where the images actually are. in my case its just the default ‘images’ directory used by textpattern. so the images don’t actually show up.
also for some reason the alt is blank. it should be using the products title attribute as its default if its not specified in the tag attribute right? i have titles for my products but the alt attribute stays blank for whatever reason.
— steve · Dec 7, 08:51 PM · #
another possible bug: if i use clean url scheme ‘section/title’, all of the products in the store section come up as 404 not founds. but if i use messy or ‘section/id/title’, they do show up.
just to be sure, i used ‘section/title’ and my regular articles show up just fine.
— steve · Dec 7, 08:57 PM · #
hmm i just realized <txp:tc_product_image_1 size=“small” /> should be outputting <img src=‘product-14- small .gif’ alt=’‘ class=’‘/>
but instead outputs -> <img src=‘product-14-medium.gif’ alt=’‘ class=’‘/>
(relative /images directory and alt text still missing and thus not showing up)
— steve · Dec 7, 09:15 PM · #
well nevermind seems like tc_product_display 0.0.1 is obsolete. i see the code in tc_core_products_library.
still can’t seem to display the images though hmm…will look myself.
— steve · Dec 7, 09:27 PM · #
disregard the obsolete comment about tc_product_display. i really need to get some sleep :)
— steve · Dec 7, 09:30 PM · #
ok heres my patched version of tc_product_display:
http://pastebin.com/m50952dcb
* corrected all of the ‘meduim’ spellings
*added a global declaration of $thisarticle to the “getImages” function which solved my blank alt text problem
* added global $img_dir declaration to the “getImages” function and modified the $final_image variable which solved my issue of a lack of ‘/images’ directory in the final html output.
don’t know if these issues were apparent for others but worked for me.
— steve · Dec 7, 09:49 PM · #
alright so far the simple cart seems to be working fine!
additions i’d like to see:
ability to specify quantity when adding a product to the cart as well as the ability to update any quantities on the actual cart section as well.
— steve · Dec 7, 10:13 PM · #
issue with tc_simple_cart:
subtotal always displays the total for a single qty.
for example: product costs $10.
you add it twice to the cart for a qty of 2.
the total from ‘shopping_cart_detail’ correctly shows $20. but the ‘subtotal’ for each item still shows $10 (despite there being a qty of 2).
— steve · Dec 7, 10:58 PM · #
Holy cow, Steve! You’re awesome, Sir! Your comments and code are much appreciated.
— Levi · Dec 7, 11:11 PM · #
no problem! just curious if you have some form of roadmap for the next release? not specifically a date but any features/changes you were planning to add soon (besides paypal checkout).
just curious how is the customer signup going to work? will that be using the mem_self_register plugin or something of your own?
so far this undertaking looks like a lot of work and you guys have gone far and beyond in terms of simple store features. thanks for the work so far!
— steve · Dec 8, 06:16 PM · #
As far as a roadmap, we don’t have anything official. There’s definitely some ideas floating around but we’ve been focused on getting all the bugs addressed and providing some form of checkout integration. I think the next plugin we will probably build will be a Authorize.net checkout solution.
Customer signup will be handled during the checkout process. However, seeing as we’re using the txp_users table to store customer data – any txp user plugin — like mem_self_register — should work. That was the reason we decided to store customer data in the txp_users table in the first place.
Yeah, this is a big job. :-) But it’s people like yourself that help make it happen.
— Levi · Dec 10, 09:50 AM · #
nice,…
job well done.
The only red flag i see so far,… is that the new tags do not accept class attributes thats kind of a bummer….
anyway to write that in?
— richard · Dec 10, 02:30 PM · #
after playing around with the simple cart plugin for awhile it occured to me that being able to assign a custom form for the cart itself might be nice and would certainly keep it closer to the blank slate approach of txp
… just a thought
— richard · Dec 11, 10:23 AM · #
Hi Levi and everyone else,
I am so psyched about this! I just did an install on my testing server for the first time, even though I’ve been following the project for awhile.
I don’t know any PHP and can’t help with development or troubleshooting, but I’d like to contribute financially and/or in any other way I can. It looks like the dropcash drive is done. Anything else I can do?
— Raina Gustafson · Dec 11, 07:54 PM · #
Hi Raina,
Thanks for the offers of financial support. We did the DropCash fundraiser and we we’re really appreciative of everyone who donated. However, we’re planning on keeping all development on this project pro-bono for the time being. If we could keep things on a more tight schedule then we might feel more comfortable asking for ongoing donations but we’re all so busy with day jobs that it puts us in a tough position when people have donated money towards a specific goal and we can’t deliver quickly enough.
This site does get some pretty heavy traffic though so I am planning to put up some advertising as a way of making money. That way people who want to support us can get a more immediate benefit from their donations.
And moral support is always appreciated! Thanks!
— Levi · Dec 17, 10:17 AM · #
Its been sometime since the announcement of textcommerce.
Mind you this is something i look forward to with great enthusiasm but how much money would it take to get this project finished ASAP? I am sure I am not the only one willing to pay for services.
Thanks Again and fantastic job!
— White Dog · Jan 1, 03:56 PM · #
I posted this over in the official TXP forums – thought I’d share my trials and tribulations here, too. Since I’m not a code whiz, perhaps as an early adopter I can help out with documentation.
I’m totally interested in this! Been testing it today – a little confused about the examples on the TextCommerce site as far as sections, pages and forms go with the txp:tc tags. I’ve been getting quite a few error messages – mostly I think because I was trying to use some of the article tags in a non-article context.
Right now, I have 3 separate sections devoted to the shopping cart – store, cart and checkout. This may be more or less than are really necessary. I’m not sure yet.
I keep getting these warnings, and I’m not knowledgeable enough to systematically figure out why:
Tag error: <txp:tc_price/> -> Textpattern Warning: tag does not exist on line 973
Tag error: <txp:tc_product_image_1/> -> Textpattern Warning: tag does not exist on line 973
Tag error: <txp:tc_product_image_2/> -> Textpattern Warning: tag does not exist on line 973
Tag error: <txp:tc_product_image_3/> -> Textpattern Warning: tag does not exist on line 973
Tag error: <txp:tc_product_image_4/> -> Textpattern Warning: tag does not exist on line 973
Tag error: <txp:tc_weight/> -> Textpattern Warning: tag does not exist on line 973
Tag error: <txp:tc_sku/> -> Textpattern Warning: tag does not exist on line 973
Tag error: <txp:tc_stock/> -> Textpattern Warning: tag does not exist on line 973
Tag error: <txp:tc_vendor/> -> Textpattern Warning: tag does not exist on line 973
Oh *** I’m only getting these errors in my “store” section, but not in my “cart” section – which is why I think I’m doing something wrong.
I don’t understand in what context to use which tags, nor have I yet figured out how TextCommerce is using the custom fields. I have been in the habit of using custom 1 & 2 for metadata as outlined in the TextPattern Solutions book – but when I view the article created by TextCommerce for the 1 product I uploaded, my first 2 custom fields are being used by the price and weight of the product. However – they haven’t been labeled as such in the preferences pane.
If anyone can shed any light, I’d be most appreciative. Otherwise, as I slug away and figure it out I will post what I learn.
— Raina Gustafson · Jan 14, 03:51 PM · #
Feel free to edit my earlier post. Steve just explained over on the forum that tc_product_display does still need to be installed. I was confused on that point since I installed it incorrectly earlier and came across Steve’s post where he questioned if it was still required.
— Raina Gustafson · Jan 14, 04:47 PM · #