View Full Version : Add Product Actions to Lesane's Store Hack!
ChurchMedia
01-30-2003, 10:00 PM
Physical Product Hack for Lesane's Store Hack (https://vborg.vbsupport.ru/showthread.php?s=&threadid=36991)
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 (http://www,cafepress.com).
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
---------------------------------------------------------
INSTRUCTIONS:
1) Follow the instructions in:
initial_hack_instructions.txt
You only have to do this once!
---------------------------------------------------------
2) For new actions, follow the instructions in
add_action_instructions.txt
You have to follow these instructions for each new action/product you add, so keep them handy!
---------------------------------------------------------
Modifications:
1 Initial Modification to store.php
1 Modification to index.php in admin
Templates:
2 new templates are added
Screenshots are included in the zip file.
Enjoy!
ChurchMedia
01-31-2003, 05:01 AM
Screen shot of admin -- adding a new action to the database
ChurchMedia
01-31-2003, 05:03 AM
Screenshot of admin: after adding a new action
ChurchMedia
01-31-2003, 05:04 AM
Screenshot of store after adding product
ChurchMedia
01-31-2003, 05:05 AM
Screenshot of user buying product and filling out shipping info
ChurchMedia
01-31-2003, 05:06 AM
Screenshot of final screen when user completes the purchase
ChurchMedia
01-31-2003, 05:06 AM
Screenshot of the email that the admin receives
ChurchMedia
01-31-2003, 05:07 AM
Screenshot of the email that the user receives
EcpHosting
01-31-2003, 05:30 AM
All I can say is that it is ABOUT time! Sheesh. I will be installing this over the weekend! This matches clearly with my request way back when (located here (https://vborg.vbsupport.ru/showthread.php?s=&threadid=47300)).
Q) Is there a way you can bypass the address part and simply just send an email with the email only?
ChurchMedia
01-31-2003, 05:43 AM
Q) Is there a way you can bypass the address part and simply just send an email with the email only?
Yeah, it would be pretty easy. I was going to attach a variation, but you can probably figure it out yourself. Just take out the form fields in the store_item_address template, and then remove all references to addresses, etc. ($name, $useraddress, etc) from the code chunk...
Let me know if you have any questions....
ChurchMedia
01-31-2003, 05:58 AM
If you downloaded the variations zip (which I deleted now), don't use it. I just realized there still needs to be a verify step. Just follow the instructions in the post above if you want to skip the shipping info...
Great job!
One question, is there a way to sort items in price order (from lowerest to highest)?
ChurchMedia
01-31-2003, 01:18 PM
Originally posted by dkny
Great job!
One question, is there a way to sort items in price order (from lowerest to highest)?
I haven't figured that one out yet. I'll post it if/when I do...:)
NuclioN
01-31-2003, 02:32 PM
ehm..is this for fun or is it a serious sort of ecommerce kind of thing? Shipments to what and where? Are they pay with points for gizmo's?
ChurchMedia
01-31-2003, 03:05 PM
Originally posted by NuclioN
ehm..is this for fun or is it a serious sort of ecommerce kind of thing? Shipments to what and where? Are they pay with points for gizmo's?
That's up to you :). It's not a shopping cart, if that's what you're asking. Yes, they pay with points. For me, it's a way to increase forum activity by offering a tangible reward for posting. Since I also have a (real) online store, chances are they may pay real money for some of the items rather than wait for their points to rack up. Either way, it increases traffic to the site, which increases real sales in the long run....
NuclioN
01-31-2003, 03:35 PM
Ok :) It looks almost as a miniature itemshop and could act that way if there were icons or mini images to display in the postbit. Very nice CM.
Dean C
01-31-2003, 04:01 PM
Lovely add-on :)
However i wouldn't offer my members something for free for just for posting :D.
Any chance you could modify this like so:
- When entering the store main you have 2 places you can go. One where you sell actual products and another place where you can buy real products.
- then on the real products page you put in your information as such and then it takes you to paypal with some info filled in the form and where you can pay in real money :)?
Regards
- miSt
ChurchMedia
01-31-2003, 04:21 PM
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 (http://www.miva.com) with a MySql mod for the database. I've also tried X-Cart (http://www.x-cart.com), 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 :).
ranger2kxlt
01-31-2003, 04:32 PM
Originally posted by Mist
Lovely add-on :)
However i wouldn't offer my members something for free for just for posting :D.
Any chance you could modify this like so:
- When entering the store main you have 2 places you can go. One where you sell actual products and another place where you can buy real products.
- then on the real products page you put in your information as such and then it takes you to paypal with some info filled in the form and where you can pay in real money :)?
Regards
- miSt
that would be nice, with Tax for certain states as well :-)
ChurchMedia
01-31-2003, 04:43 PM
It's not a shopping cart. I suppose you could do a bunch of coding and turn it into one, but that's a whole different ball game and doesn't have anything to do with forum posting. You would be better off with x-cart. You could do some mods to x-cart to access VB's database for login info and look, so in a way it would be integrated with VB.
Just to add some perspective, be sure you understand Leane's original hack, Found Here (https://vborg.vbsupport.ru/showthread.php?s=&threadid=36991).
ChurchMedia
01-31-2003, 04:54 PM
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 (http://www.cafepress.com/cp/info/).
Dean C
01-31-2003, 05:48 PM
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 (http://www.miva.com) with a MySql mod for the database. I've also tried X-Cart (http://www.x-cart.com), 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 :)
Kindest Regards
- miSt
bitbender
01-31-2003, 07:37 PM
/me clicks install
ghroob
02-02-2003, 07:20 AM
Hello
sorry i didn't find store.php file in your attachment ..
Thanx:)
JHSoundZ
02-02-2003, 08:34 AM
Originally posted by ghroob
Hello
sorry i didn't find store.php file in your attachment ..
Thanx:)
Thats because its a addon to lesanes store hack.
https://vborg.vbsupport.ru/showthread.php?s=&threadid=36991
you need that hack added before you can add this
BaBa2002
02-02-2003, 09:32 AM
got a litle problem
you said in your instruction page 4) In "store.php"
>>>>>>>>>>>FIND
?>
>>>>>>>>>>>ADD BEFORE
The store_code_chunk.txt contents
when i do thet i get a parse error in my store.php
what's my problem?
ethics
02-02-2003, 02:00 PM
ChurchMedia, THANK you!!!
Will install this as soon as possible. I have magazine subscriptions I give away but this will automate this a lot!!! Thanks!
ChurchMedia
02-02-2003, 03:12 PM
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:
// ###################### 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
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!
-------------------------------------------------------
Item purchased: $title
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") 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];
eval("dooutput(\"".gettemplate("store_item_bought")."\");");
}
}
// ##################### End Physical Item Hack by ChurchMedia ############################
If you're still having problems, PM me and we'll arrange for you to send me your store.php file and I'll take a look :)
ChurchMedia
02-02-2003, 03:26 PM
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
$changestorenow = $DB_site->query("UPDATE store SET sold=sold+1 WHERE action='kick'");
and replace with
$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.
BaBa2002
02-02-2003, 05:55 PM
cool thx churchmedia
BaBa2002
02-02-2003, 05:56 PM
got a question
is it possible when users buy the item the they get a link to download instead of a email.
ChurchMedia
02-03-2003, 02:57 AM
Originally posted by BaBa2002
got a question
is it possible when users buy the item the they get a link to download instead of a email.
You could do this -- It would require 2 templates per downloadable item and some code modifications. I can get that to you if you really want it...
The only "danger" I can see is that the download link would not be secure -- so once it's bought, the user could share it with someone else....
It might be better to just strip out all of the shipping info stuff from the templates and from the code and then email them a unique download link....
BaBa2002
02-03-2003, 09:26 AM
ok thx bud
and what about a page that creat a random password and protect the directory of the file or is that to much work?
ps i'm a newbi to php
ChurchMedia
02-03-2003, 01:14 PM
Believe it or not, I'm a newbi too ;). I'm sure there's a way you could do it. Maybe when I have a few more months of programming under my belt I can write something like that....
ethics
02-09-2003, 03:32 PM
Church. First of all, thanks again for doing this.
Question: I've installed the hack, added an item and tried testing it out. When I hit submit my order on top it said, "Could not send email" but it did send it and I got it in my email box with all of the pertinent information.
ChurchMedia
02-11-2003, 02:09 PM
Strange... Double-check this line of code in the store chunk:
mail( $to, $subject, $message,"From: $bbuserinfo") or print "Could NOT send mail";
and this one
mail( $to, $subject, $message,"From: [email]youremail@yourdomain.com") or print "Could NOT send mail";
If everything looks okay and you still get the message, just delete (in both lines):
or print "Could NOT send mail"
So, it would look like this:
mail( $to, $subject, $message,"From: youremail@yourdomain.com");
That will get rid of the message. Good luck!
ethics
02-11-2003, 10:40 PM
Thank you very much, sir.
ethics
02-13-2003, 02:33 PM
Another question if I may.
Say I set quantity of 3. Anyway I can make the code say something like, you can't buy anymore once the quantity == to sold#?
ChurchMedia
02-13-2003, 02:43 PM
That's a good idea and should be pretty simple. You would need to run a query to find out how many have been sold and then use an "if" statement. Unfortunately, I'm really swamped right now and wouldn't be able to code it for a couple of weeks. I'm actually a little new to PHP, otherwise I bet I could bang it out in a few minutes. If anyone else sees this request, feel free to give us some code. It would have to be hard-coded in the product action sections, otherwise a new field would have to be added and some admin modifications...
If no one comes up with something I'll get to it ASAP. Good luck :)
ethics
02-13-2003, 07:07 PM
Sounds great. I wish I was a decent programmer. Unfortunately, I have a mental block (although I think I would have been very good at this).
midnightz
03-14-2003, 12:51 PM
Hi There,
I would like to add a Image showing the product in the item box. How is that done. Such as 500 points for a CD and showing a pic of it, if they click on the pick, I could activate a popup window that tells more about the product.
midnightz
Fking
04-27-2003, 08:36 PM
How to edit the body of the mail sent to user who just purchased something?
ChurchMedia
04-27-2003, 08:41 PM
Today at 03:36 PM Fking said this in Post #42 (https://vborg.vbsupport.ru/showthread.php?postid=388133#post388133)
How to edit the body of the mail sent to user who just purchased something?
In the store_code_chunk edit the stuff below this line:
// ##################### Begin Email To User ############################
midnightz
05-24-2003, 07:09 PM
02-02-03 at 11:57 PM ChurchMedia said this in Post #32 (https://vborg.vbsupport.ru/showthread.php?postid=349820#post349820)
You could do this -- It would require 2 templates per downloadable item and some code modifications. I can get that to you if you really want it...
The only "danger" I can see is that the download link would not be secure -- so once it's bought, the user could share it with someone else....
It might be better to just strip out all of the shipping info stuff from the templates and from the code and then email them a unique download link....
You can try to use amember, its is a script that helpes with secure downloads after processing http://membership.cgi-central.net/scripts/amember/ It is a retail script, but they have a lite version if I remember. Vbskins uses this as thier DL manager (I think)?
But thats what I use :)
midnightz
05-24-2003, 07:10 PM
Hi ChurchMedia,
I would like to make the form with all fields required, since I can imagine a user processing thier points and sending me a blank email.
Is that possible if please, How?
Thanks,
midz
WebMasterAJ
06-02-2003, 06:36 PM
This works perfectly, but I'm hacking this for a person who doesn't know too much about computers, and as simple as it sounds, editing store.php can be quite tedious and time consuming when we start to add/delete items.
So, is it possible to make it so you don't have to edit store.php?
Please let me know, I appreciate your help!
Sincerely,
Andrew Tatum
WebMasterAJ
06-04-2003, 05:40 PM
Any takers? :(
ChurchMedia
06-09-2003, 05:46 PM
WebMasterAJ,
It's a great idea. Unfortunately I'm not that great of a PHP programmer. There should be a way to add the code to the file without having to do it manually, but I just don't know how. Sorry!
I just came across this add on.
And i must say with this add-on hack, you just gave me a reason to install Lesane's Store hack ! :D
Thanks ChurchMedia :)
EWorld
09-06-2003, 05:14 PM
I am a bit confused, what is Action Code? I mean how do I know what to put that as? I am very confused. Anyone have any ideas?
- EWorld
i took a guess at the action code and just added like 123 or wand or whatever to the action code, but the prodcut doesnt show up! i need help. thanks.
- Speedy
ChurchMedia
09-06-2003, 07:26 PM
You just make one up. So if you were selling a t-shirt you could call that action code SHIRT. Then that's the code you replace in the code chunk that you add to store.php. You have to edit store.php every time you add a new product (I don't know how else to do it).
Good luck :)
Today at 12:14 PM EWorld said this in Post #50 (https://vborg.vbsupport.ru/showthread.php?postid=431775#post431775)
I am a bit confused, what is Action Code? I mean how do I know what to put that as? I am very confused. Anyone have any ideas?
- EWorld
i took a guess at the action code and just added like 123 or wand or whatever to the action code, but the prodcut doesnt show up! i need help. thanks.
- Speedy
MaDCaT75
09-06-2003, 10:44 PM
I dont get it.... once they buy something.... do they actually purchase a physical object or is it like all pretend? :rolleyes:
ChurchMedia
09-07-2003, 03:52 AM
Read the first post in the thread -- it's for selling physical product. It works great for me to get people posting and the products don't cost me much. It actually increases sales in my real store. :)
NexDog
09-07-2003, 10:32 PM
Very cool add-on. At the moment I only use teh Store Hack for the points system and people can redeem points for disk space, domains, plans etc. Now i can hard code the lot. T'is great!
reismarktq2
09-11-2003, 02:40 PM
I'm not sure exactly what you mean by this...
1) In the "newstoreaction.php" script
>>>>>>>>>>>FIND
$link = mysql_connect("localhost","yourusername","yourpassword");
>>>>>>>>>>>CHANGE
yourusername and yourpassword
Help?
Logikos
09-12-2003, 07:30 AM
how do yuo remove an item?
Logikos
09-12-2003, 07:31 AM
I'm not sure exactly what you mean by this...
Help?
database user name, database password
so ifi want to remove an action. How do i do it? removing the code doesnt work. This is my only question, Otherwise works flawless with no screw ups
stamos2003
12-31-2003, 10:08 AM
i have a problem with this.
i installed all right away and good, but when i add an item to the shop it adds it to the database with all empty fields ?!
when i go then to edit the item there are also all empty fields.. :confused:
seems like its not putting the data in to the database, allthough i have no mysql error....
MindTrix
12-31-2003, 04:10 PM
What version of the store are you running? Note if you recently downloaded the store hack then it is a new version called 3.0 and no add ons will work with it unless converted.
So basically this add on should only work with the old store hack which is no longer available for download. Hope this helps.
stamos2003
12-31-2003, 06:27 PM
oh.... so i must wait until the add on is gonna updated ? if ever it's updadet :( sad......
MindTrix
12-31-2003, 06:28 PM
Well if you are using the new store, then yes im afraid (about 95% sure ;) )
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.