Sorry I am to the party so late, but hopefully I can provide some insight on how to integrate this into a MODx install. Hopefully I will be able to remember how I implemented it myself, so as to document it in digestible steps for you to consume.
1. Create a chunk that will serve as the template for your list of products. In this example we will name it "products". The content should contain the following:
[+productid+]|[+productname+]|[+productprice+]|[+productdescription+]|;
2. Create template variables to match the above code. So you should have a TV called "productid", "productname", "productprice","productdescription". I set the input type to "Text" for all but "productdescription" which I set to "Text Area." Make sure to provide "Template Access" to these TVs by checking the appropriate box.
3. Now create a new document to hold all your products. In this example we will name it "Catalog" and it will be the parent document for all products. Make sure it is published.
4. Create another new document, which will generate the product list based on the chunk you created it. In this example I call mine "Product-List". It should be published and have the following content:
[[Ditto?parents=`48`&tpl=`products`&display=`all`]]
Make sure to replace "48" with the ID of the "Catalog" document we created earlier.
5. Download the PHPCart file at
http://cmssandbox.com/MODx096/assets/snippets/sss/FlatFileCart.php.txt and look for the following:
define("PRODUCTS_FILE_PATH", "http://cmssandbox.com/MODx096/index.php?id=49");
Make sure to replace the "49" with the ID of the "Product-List" document we created earlier. Rename this file to "FlatFileCart.php" and upload this file to the snippet directory in a folder called "sss".
6. Now create a snippet called "sss" with the following code:
<?php
include_once('assets/snippets/sss/FlatFileCart.php');
$productTVs = array ('productprice','productdescription','productid','productname');
$id = $modx->documentObject['id'];
$productTVs = $modx->getTemplateVarOutput($productTVs,$docid=$id, $published="1");
$title = $modx->documentObject['pagetitle'];
$longtitle = $modx->documentObject['longtitle'];
return ReturnAddLinkHTML($productTVs[productid], "Add to Cart",$id);
?>
7. Create another snippet called "sss_cart" with the following code:
<?php
include_once('assets/snippets/sss/FlatFileCart.php');
$id = $modx->documentObject['id'];
if (!isset('tpl') $tpl = 'No template was set.';
else $tpl = $modx->getChunk($tpl);
$sss_cart = ReturnCartHTML(1,$id,$tpl);
echo $sss_cart;
return ReturnConditionalClearLinkHTML("<br />", "", "Clear the cart",$id);
//add a placeholder for the cart in eForm
function returnCartReport( &$fields ){
global $modx;
include_once('assets/snippets/sss/FlatFileCart.php');
$id = $modx->documentObject['id'];
if (!isset('tpl') $tpl = 'No template was set.';
else $tpl = $modx->getChunk($tpl);
$sss_cart = ReturnCartHTML(1,$id,$tpl);
ClearCart();
$fields['sss_cart'] = $sss_cart;
//return succes
return true;
}
?>
8. We are getting closer. In your catalog parent, start creating documents that represent each individual product. Make sure the template is set to one that hass access to the TVs created earlier. Fill in the appropriate information in each respective TV and make a call to the snippet in the content of the document as: [!sss!]
9. Now create a chunk to serve as the template for the cart. You can call your template "Cart_TPL" and place the following in it:
{+quantity+} x {+name+} = ${+quantityprice+} - <a href="{+addlink+}">Add</a>/<a href="{+removelink+}">Remove</a><br />
10. Next place a call to the snippet in your template where you want your cart to appear. The snippet to call is [!sss_cart? &tpl=`Cart_TPL`!]. Follow that call with some code like this:
<br /><a href="[~6~]">Checkout</a>
Make sure to replace the "6" with the ID of the document containing your eForm call (See next step.)
11. Lastly, you need to create a document with an eform call. The eform call should look like this:
[!eForm? &formid=`ContactForm` &subject=`[+subject+]` &to=`[email protected]` &ccsender=`1` &tpl=`ContactForm` &report=`ContactFormReport` &eformOnBeforeMailSent=`returnCartReport` &gotoid=`46`!]
Make sure to change the "46" to the ID of your thank you page. The "ContactForm" is the standard one included with the demon content, included for your convenience:
<p class="error">[+validationmessage+]</p>
<form method="post" action="[~[*id*]~]" id="EmailForm" name="EmailForm">
<fieldset>
<h3> Contact Form</h3>
<input name="formid" type="hidden" value="ContactForm" />
<label for="cfName">Your name:
<input tabindex="1" name="name" id="cfName" class="text" type="text" eform="Your Name::1:" /> </label>
<label for="cfEmail">Your Email Address:
<input tabindex="1" name="email" id="cfEmail" class="text" type="text" eform="Email Address:email:1" /> </label>
<label for="cfMessage">Message:
<textarea tabindex="1" name="message" id="cfMessage" rows="4" cols="20" eform="Message:textarea:1"></textarea>
</label>
<label> </label><input type="submit" name="contact" id="cfContact" class="button" value="Send This Message" />
</fieldset>
</form>
The ContactFormReport is as follows:
<p>This is a order sent by <b>[+name+]</b> using the feedback form on the website. The details of the order follow below:</p>
Cart Contents:
[+sss_cart+]
<p>Name: [+name+]</p>
<p>Email: [+email+]</p>
<p>comments:<br />[+message+]</p>
<p>You can use this link to reply: <a href="mailto:[+email+]?subject=RE: Your Order">[+email+]</a></p>
I tried to recreate my steps from memory. Let me know if you run into trouble. Plus this likely could be made more efficient, but this is how I implemented back when it was implemented. Good luck.