Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-07-14 20:46:50

joewils
Archived Plugin Author
From: Snoqualmie, WA
Registered: 2004-10-12
Posts: 6
Website

[plugin] [ORPHAN] joe_gcart - wfCart with Google Checkout

I’ve posted a little proof of concept wfCart based shopping cart with Google Checkout support.

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 supports simple items with no variations (color, size, etc…) and a single flat rate shipping cost per item.

Last edited by joewils (2006-07-15 22:38:20)


From here to there and there to here funny things are everywhere.

Offline

#2 2006-07-14 21:21:53

Walker
Plugin Author
From: Boston, MA
Registered: 2004-02-24
Posts: 592
Website

Re: [plugin] [ORPHAN] joe_gcart - wfCart with Google Checkout

Very cool. You’ve done an excellent job on this one.

I’d like to extend this to do options (color & size).

Offline

#3 2006-07-15 10:26:43

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,912
Website

Re: [plugin] [ORPHAN] joe_gcart - wfCart with Google Checkout

Nice start Joe. (I love Snoqualmie, beautiful country). One thing I think you’re going to need to add into the equation is an image. Most store products generally offer up a glimpse so people know what their getting.

I’m about to launch a new client site where I did a small shopping cart with PayPal; not fully integrated, but using their standard process and creating a Txp article/form situation like yours that displays the items as a nice menu in Textpattern, including image. I used the <code><txp:article_image /></code> field to add the image ID for each product. Works nice. Each product article is floated left, much like a photo gallery grid, giving that typical store products display.

As soon as the site launches, I’ll write up a tute and maybe that can help shed light on further plugin aim.

P.S. By the way, you can add this plugin to the plugin archive too and supply a PayPal button for potential donations. You might also look at the plugin requests for a similar plugin for PayPal, since you’re motoring down that road (though I think the request there is for a completely integrated solution where the whole transaction takes place in the Txp site). ;)

Last edited by Destry (2006-07-17 07:24:34)

Offline

#4 2006-07-16 21:12:21

duchamp
Member
From: Patagonia
Registered: 2005-02-03
Posts: 222
Website

Re: [plugin] [ORPHAN] joe_gcart - wfCart with Google Checkout

Oh! This is great step to manage an e-commerce site with TXP!
The thing is that sometimes you need to redirect your clients to your site after the payment to give them access to a file, program, document, etc.
Eg.: if you have a music store and would like to sell songs or albums in MP3 or Ogg format.

Any idea about how to do it using Textpattern?

As I know the big trouble is that files uploaded through Textpattern are not really safe to do this …

Thx in advance!

Offline

#5 2006-07-17 07:28:46

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,912
Website

Re: [plugin] [ORPHAN] joe_gcart - wfCart with Google Checkout

duchamp wrote:

The thing is that sometimes you need to redirect your clients to your site after the payment to give them access to a file, program, document, etc.

With PayPal anyway (don’t know about Google) this is easily done. Part of the code in my recent project I was referring to above adds a redirecting URL that brings a user back to the site after the transaction is done, wherever you want. This is something PayPal provides, you only need to add it to your form code.

Offline

#6 2006-07-17 14:41:58

joewils
Archived Plugin Author
From: Snoqualmie, WA
Registered: 2004-10-12
Posts: 6
Website

Re: [plugin] [ORPHAN] joe_gcart - wfCart with Google Checkout

You can use the <code><continue-shopping-url></code> field to direct users back to a download page after processing their payment with Google Checkout. Currently joe_gcart does not have an option for <code><continue-shopping-url></code>, but I can work on adding it.


From here to there and there to here funny things are everywhere.

Offline

#7 2006-07-17 14:45:37

duchamp
Member
From: Patagonia
Registered: 2005-02-03
Posts: 222
Website

Re: [plugin] [ORPHAN] joe_gcart - wfCart with Google Checkout

Thx both! The sunshine is coming!
Going to search for other threads to learn about this subject …

Offline

#8 2006-07-24 15:10:45

gerhard
Plugin Author
From: London, UK
Registered: 2005-06-29
Posts: 409
Website

Re: [plugin] [ORPHAN] joe_gcart - wfCart with Google Checkout

Hi Joe,

I am trying to use wfCart with TXP to build an e-commerce website and I am getting grief with session initialization. This is my header code:

<pre>&lt;txp:php&gt;
include “bck_cart.php”;
session_start();
global $cart; // so that $cart is accessible in other forms etc.
$cart = $_SESSION[‘bck_cart’];
if(!is_object($cart)) $cart = new bckCart();
&lt;/txp:php&gt;</pre>

The error that I am getting is

<pre>tag_error &lt;txp:php&gt; -&gt; Notice: Undefined index: bck_cart on line 8

textpattern/publish/taghandlers.php:1865 eval()
textpattern/publish.php:904 php()
processTags()
textpattern/publish.php:878 preg_replace_callback()
textpattern/publish.php:440 parse()
index.php:28 textpattern()</pre>

If I use <pre>$cart =& $_SESSION[‘bck_cart’];</pre> (because that’s how the original code is), I am getting non-object errors e.g.

<pre>tag_error &lt;txp:php&gt; -&gt; Notice: Trying to get property of non-object on line 23

textpattern/publish/taghandlers.php:1865 eval()
textpattern/publish.php:904 php()
processTags()
textpattern/publish.php:878 preg_replace_callback()
textpattern/publish.php:440 parse()
index.php:28 textpattern()</pre>

Any help will be appreciated since this is doing my head in.

I am including the above code through a doc_head form.

Offline

#9 2006-07-24 15:13:37

Walker
Plugin Author
From: Boston, MA
Registered: 2004-02-24
Posts: 592
Website

Re: [plugin] [ORPHAN] joe_gcart - wfCart with Google Checkout

<code>include(‘bck_cart.php’);</code> &larr; like that

and assign <code>$_SESSION[‘bck_cart’]</code> to <code>$cart</code> with just an equals sign (no ampersand).

Should work…..i think.

Last edited by Walker (2006-07-24 15:14:36)

Offline

#10 2006-07-24 15:35:43

gerhard
Plugin Author
From: London, UK
Registered: 2005-06-29
Posts: 409
Website

Re: [plugin] [ORPHAN] joe_gcart - wfCart with Google Checkout

Nope, still doesn’t work.

It didn’t seem right with an ampersand in the first place, but that’s the code on Webforce website: http://www.webforce.co.nz/cart/php-cart.php.

There is something wrong with sessions… Yet when I download the original code from Webforce, it seems to work (even with that ampersand…).

Help!

Offline

#11 2006-07-24 23:06:57

joewils
Archived Plugin Author
From: Snoqualmie, WA
Registered: 2004-10-12
Posts: 6
Website

Re: [plugin] [ORPHAN] joe_gcart - wfCart with Google Checkout

I believe the problem may be with your global declaration of $cart.

What happens if you comment out <code>global $cart;</code>?

<code>=&</code> assignment and references: return references


From here to there and there to here funny things are everywhere.

Offline

#12 2006-07-25 06:03:45

gerhard
Plugin Author
From: London, UK
Registered: 2005-06-29
Posts: 409
Website

Re: [plugin] [ORPHAN] joe_gcart - wfCart with Google Checkout

joewils wrote:

I believe the problem may be with your global declaration of <code>$cart</code>.
What happens if you comment out <code>global $cart;</code>?

Cheers Joe, you were spot-on!

I used <code>global</code> to have <code>$cart</code> available in other parts of the website (header for cart overview, cart page for data manipulating etc.). I use <code>&lt;txp:php&gt;</code> and, as you might now, TXP doesn’t pass variables between <code>&lt;txp:php&gt;</code> chunks. Even if statements don’t work across multiple <code>&lt;txp:php&gt;</code>. Re-assigning <code>$cart</code> to <code>$_SESSION</code> did the trick! I was also able to use <code>$cart</code> by reference and thus <code>cart()</code> is called correctly.

Unfortunately Checkout isn’t available to the UK market, but that would have been my first option if I was working on a US e-commerce website. Your plugin would have been invaluable in that case! Great job!

Everything seems to be working now. If I get into any more trouble, I will let you know. You really are a great community ; ).

One more time, cheers Joe!!!

Offline

Board footer

Powered by FluxBB