vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Add Product Actions to Lesane's Store Hack! (https://vborg.vbsupport.ru/showthread.php?t=48338)

ChurchMedia 01-30-2003 10:00 PM

Add Product Actions to Lesane's Store Hack!
 
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

---------------------------------------------------------
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).

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

Quote:

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...

dkny 01-31-2003 06:53 AM

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

Quote:

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

Quote:

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 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 :).

ranger2kxlt 01-31-2003 04:32 PM

Quote:

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.

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.

Dean C 01-31-2003 05:48 PM

Quote:

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 :)

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

Quote:

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/showthrea...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
Quote:

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

Quote:

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!

-------------------------------------------------------
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[/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];

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

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.

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

Quote:

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:

PHP Code:

mail$to$subject$message,"From: $bbuserinfo[email]") or print "Could NOT send mail"

and this one

PHP Code:

mail$to$subject$message,"From: [email]youremail@yourdomain.com[/email]") or print "Could NOT send mail"

If everything looks okay and you still get the message, just delete (in both lines):

Code:

or print "Could NOT send mail"
So, it would look like this:

PHP Code:

mail$to$subject$message,"From: [email]youremail@yourdomain.com[/email]"); 

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).


All times are GMT. The time now is 01:10 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01443 seconds
  • Memory Usage 1,866KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (6)bbcode_php_printable
  • (9)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete