I agree that something integrated into CMSMS is the ideal. I'm glad people are working on that, but right at the moment, I've got to get something out there so my client can go live this week, so I'm working on this.
Mal's has a paid version, but the free version has worked for all my needs for years, and has lots of power left over. It's extremely customizable, and also very well documented. There are all sorts of help files and tutorials out there for everyone from total newbie at HTML forms (which I was when I found Mal's) to advanced coders building complex and dynamic sites.
I've seen one person who has built some kind of integration of Mal's into Wordpress. I'd love to see something similar for us here.
But! We're still a ways off, and I've got a site to finish. I've done some work and had some successes, and I'll post what I've got so far, perhaps it will help someone else. And, since I'm not quite where I want to be yet, I'll post my questions at the end of this and maybe someone will help me.
What I have so far:
How to make Buy Now and Show Cart buttons in your Cataloger Item template that will send to Mal's the price and other info about each item AND get your shopper back to the page they were on:
Okay. First you need an account at Mal's. http://www.mals-e.com You'll particularly need the userID, but once you're signed up over there, you're going to have that plus TWO passwords, one for getting into the settings and preferences, and one for seeing your payments.
Go ahead and log in with the first password, and click on Cart Set-Up. You can play around with the various settings, there is a LOT there, but for our purposes right now, the main thing is just to have the default settings in place for Return Link. You
don't have to have the first field, the URL of your site filled in, unless you only want to have one page that people can shop from. I'm assuming you have more, so you probably can leave this blank. You can fill in the name of your site, though.
Just be sure the default button is ticked at the very bottom, where it says "A hyperlink (the default). GET request". Save changes.
Okay, back to CMSMS now. Go make a Global Content item, and call it something like "buynow." You're going to put your first form in here. Instead of some of the values of things like price, weight, etc, you're going to put your attributes like this: {$price} {$weight}. This has been covered
http://forum.cmsmadesimple.org/index.php/topic,10020.msg50412.html#msg50412, but I'll spell it out a bit to keep things in one place.
You may choose to do your button differently, but it could look something like this:
Code: Select all
<form method="post" action="http://www.aitsafe.com/cf/add.cfm">
<input type="hidden" value="xxxxxx" name="userid" />
<input type="hidden" value="{$title}" name="product" />
<input type="hidden" value="{$price}" name="price" />
<input type="hidden" value="http://{$smarty.server.SERVER_NAME}{$smarty.server.SCRIPT_NAME}?page={$smarty.get.page}" name="return" />
<input type="submit" value="Buy Now" class="submit" />
</form>
You can put any attributes in you want. Shipping weight would be a good thing. That long thing with all the smarty tags in it is the return link. It'll get your shopper back from Mal's to your site to shop some more.
Next, make another Global Content item for the Show Cart button. Mine looks like this:
Code: Select all
<form action="http://www.aitsafe.com/cf/review.cfm" method="post">
<input type="hidden" value="xxxxxx" name="userid" />
<input type="hidden" value="http://{$smarty.server.SERVER_NAME}{$smarty.server.SCRIPT_NAME}?page={$smarty.get.page}" name="return" />
<input type="submit" value="Show Cart" class="submit" />
</form>
Now you can just call these from your Item templates.
Code: Select all
<div class="catalog_item">
<img name="item_image" id="item_image" class="left_item" src="{$image_1_url}" />
<div class="info">
{$notes}<br />
<span class="note">Height:</span> {$dimensions}<br />
<span class="note">In stock:</span> {$instock}<br />
<span class="note">Price:</span> {$price}<br />
{*eval var=$attrlist[at].key*}
{*/section*}
{global_content name='buynow'}
{global_content name='showcart'}
</div>
</div>
</div>
This is all wonderful, and I really appreciate the folks who got me this far. That return link thing up there is my boyfriend's first Smarty tagl I didn't realize I was asking him to put in 20 minutes when I asked how to dynamically generate the return link.
My next goal is to have these buttons appear beside every item in the Category page. I want to have all the Items in the Category appear with the Buy button, and maybe put the Show Cart button every five items or so.
I'm just beginning with Smarty and with coding in general, so we'll see. If anyone has any tips, I'd appreciate it, might save me an hour or two.
Another thing for the wish list. The current return link tag will get the site visitor back to the exact page they came from...which is fine. But I think it would be a little slicker if they were to be sent back to the nearest Category page, if they started from an Item page.
Does that make sense? You're shopping on a page full of similar items, you click on one to get more detail, you buy it, and now you want to continue shopping. Where do you want to go? Back to the item you just bought, or back to the page full of items?