Version: 1.00, by ChurchMedia
Developer Last Online: Jun 2013
Version: 2.2.x
Rating:
Released: 01-30-2003
Last Update: Never
Installs: 24
No support by the author.
Physical Product Hack for Lesane's Store Hack
by ChurchMedia
--------------------------------------------------------- NOTE: This hack has not been updated for the latest version of the Store Hack for VB2. I'll write a new hack if and when there is a VB3 version of the Store Hack
---------------------------------------------------------
What this hack is for:
If you want to sell actual products in your community store, such as books, videos, coffee mugs... whatever. I suggest adding products that promote your site. You can get all sorts of customized merchandise from Cafe Press.
Before you ask, this is not a shopping cart to sell things with real money. It's to redeem points for tangible products. If you don't like the idea of giving stuff away for posting, this isn't the hack for you.
How this hack works/what it does (after initial setup):
1) You add a new action to the database from your admin cp
2) You modify 2 small parts of a code chunk and add it to your store.php
3) When a user purchases an item, they enter their address, etc.
4) You will receive an email with the product info and shipping info
5) The user receives a "receipt" by email as well
Just another thought -- if you aren't thrilled with the idea of giving away product for posting, consider adding products that promote your site. Like mousepads, shirts, mugs, etc. with your logo. You can get all sorts of merchandise from Cafe Press.
Originally posted by ChurchMedia It's really only desinged for redeeming points for product. Like I said, it's kind of a marketing mechanism for my real oline store. I use Miva Merchant with a MySql mod for the database. I've also tried X-Cart, which is an excellent and affordable php-based shopping cart.
Lesane's original store hack was desinged to sell "forum enhancements" redeemable by points. This is just a modification for real product. If you want an actual cart and have people pay real money, check out the carts I mentioned. Also, keep in mind that I am in the "information business", so the more people post to my site, the better. I don't mind paying for a few items to make that happen .
Ouch at the $$$
But still is there any chance you could do something like i mentionned. People are always asking for a proper store for their vbulletin's with intigrated log-in's etc.
Any chance of you doing it ?
I'm sure if you got stuck with anything one of our expert hackers could help you too
Originally posted by BaBa2002 got a litle problem
you said in your instruction page
when i do thet i get a parse error in my store.php
what's my problem?
Make sure you downloaded the zip in the first post. I had posted (and then deleted) a variation that would only send email info. If you downloaded that, don't use it.
The code chunk for the store is:
PHP Code:
// ###################### Start Physical Item Hack by ChurchMedia #######################
if ($action=="buyitem") {
$storeitem = $DB_site->query_first("SELECT * FROM store WHERE action='$storeaction'");
$storeid=$storeitem[id];
$cost=$storeitem[costs];
$title=$storeitem[title];
$need=$points - $cost;
$userstuff = $DB_site->query_first("SELECT userid,username,storep,email FROM user WHERE userid=$bbuserinfo[userid]");
$points=$userstuff[storep];
if ($cost>$points) {
eval("standarderror(\"".gettemplate('store_error')."\");");
} else {
// ##################### Begin Email To Admin ############################
$to = "youremail@yourdomain.com"; //The e-mail address to send the mail to
$subject = "Community Order: $title";
$message = "
A purchase in the community store has been made!
Item Purchased: $title
User Name: $bbuserinfo[username] User Email: $bbuserinfo[email]
Ship To:
$name $company $useraddress $city, $state$zip $country
Phone: $phone";
mail( $to, $subject, $message,"From: $bbuserinfo[email]") or print "Could NOT send mail";
// ##################### Begin Email To User ############################
$to = "$bbuserinfo[email]"; //The e-mail address to send the mail to
$subject = "Community Order: $title"; //Subject name shown on e-mail
$message = "Dear $bbuserinfo[username],
Thanks for your purchase from our community store!
It will be shipped to:
$name $company $useraddress $city, $state$zip $country -------------------------------------------------------
If you have any questions, please reply to this email.";
mail( $to, $subject, $message,"From: [email]youremail@yourdomain.com[/email]") or print "Could NOT send mail";
// ##################### End Email ############################
$DB_site->query("UPDATE user SET storep=storep-$cost WHERE userid='$bbuserinfo[userid]'");
$changestorenow = $DB_site->query("UPDATE store SET sold=sold+1 WHERE action='$storeaction'");
$moneycheck = $DB_site->query_first("SELECT storep,userid FROM user WHERE userid='$bbuserinfo[userid]'");
$money = $moneycheck[storep];
I did find one small error in the code. It does not cause an error, but it doesn't update your items sold. I fixed it in the zip file, but if you alrady downloaded it, in store.php, find
PHP Code:
$changestorenow = $DB_site->query("UPDATE store SET sold=sold+1 WHERE action='kick'");
and replace with
PHP Code:
$changestorenow = $DB_site->query("UPDATE store SET sold=sold+1 WHERE action='$storeaction'");
This will correctly update how many of that product has been sold.