SMF Shop

SMFShop => Requested additions => Topic started by: Matthew Gall on July 15, 2007, 04:25:02 am

Title: [SOLVED] "Voucher Code" Item
Post by: Matthew Gall on July 15, 2007, 04:25:02 am
On My Forum I Run Competitions And Games etc And Offer Shop Credits And Awards As Prizes... The Manual Giving Out Of Awards I Can Handle But I Would Love To Have A System Of Say

I Am Guessing That I Would Need A MySQL Table In Which To Store The "Voucher" Code And It's Respective Shop Credit Amount.

Would It be Possible For Someone To Make This Modification For Me? Or Assist Me In Making This Modification? (You Will Be Credited!)

Thank's In Advance
Title: Re: "Voucher Code" Item
Post by: feeble on July 15, 2007, 10:57:09 am
Shouldnt be to difficult.

If you have tinyportal installed, we could make a quick go at it and see how it works out.
If not, no matter

In saying this thou, currently I dont have enough time to write it for you,
but I'm more then happy to help you write it.

Couple of questions:
How would your users obtain said voucher?

And how about, when they input a valid voucher how about just give them an item. Then the item could be anything.
Also would make the mysql table small(id, voucher, itemid)
Title: Re: "Voucher Code" Item
Post by: Matthew Gall on July 15, 2007, 06:18:18 pm
Shouldnt be to difficult.

If you have tinyportal installed, we could make a quick go at it and see how it works out.
If not, no matter

In saying this thou, currently I dont have enough time to write it for you,
but I'm more then happy to help you write it.

Couple of questions:
How would your users obtain said voucher?

And how about, when they input a valid voucher how about just give them an item. Then the item could be anything.
Also would make the mysql table small(id, voucher, itemid)

Thaks For Your Reply Feeble,
Unfortunately I Do Not Have TinyPortal Installed On My SMF Forum As I Have A Joomla Installation Acting As The Main Portal Frontend... But If It Can Be Written So That Users With TinyPortal Installed Can, Say Have A Block Code So That They Can Just Type In The Code And The Voucher Will Be Redeemed I Will Be More Than Happy To. Now To Answer Your Questions:
1) The User Would Not Buy The Voucher,,,,,,, In The SMF Backend There Could Be A Page That Allows The Admin (Or Anyone With Permissions) To Create A "Voucher" And Specify The Amount Of Credits That That Voucher (Very Much Like A Cheque) Is Worth / The Item That WIll Be Given To The User When The Voucher Is Redeemed.
So For Example,
i) The Forum Admin Could Create A "Voucher" Worth 1000 Credits (Or Whatever The Forum Currency Is)
ii) The User Who Needed The Voucher (Or Has Earned It In An Event Or Competition) Could Receive A Personal Message (Does Not Have To Be Automated) With The Voucher Code (Like A Random String Of Numbers Or Letters, e.g f65hglkdf)
iii) Once The User Has Received The Personal Message Or Whateva.... They Could Enter The Shop And Click On A Link (For Example, Voucher Redemption)
iiii) The User Then Enters The Voucher Code And Whatever The Admin Has Specified That Voucher Being Worth (i,e Credit Value Or Item Value) Would Be Added To The User's Items Or Bank (Must Be Specifiable)

2) I Like The Idea Of The Voucher Redeeming An Item But For My Usage I Would Like It To Be Either A Credit Value Or An Item Value As This Would Allow It To Be Very Diverse Even Though It Will Make The MySQL Table Bigger. This Would Most Possible Be (id, voucher_code, credit_value, bank_hand, itemid)
Title: Re: "Voucher Code" Item
Post by: feeble on July 17, 2007, 09:26:24 pm
http://www.leaderless.net/tp-downloads/redeemShop.zip

give this a go should be what you are after

Requires SMF Version 1.1.2 or 1.1.3

to use
goto SMF Action: ?action=redeemShop
Title: Re: "Voucher Code" Item
Post by: Matthew Gall on July 19, 2007, 02:22:47 am
Feeble! You Really Are The Man! Is This A Custom Build?

You Rawk!
+ Rep

However... 1 Small Thing? Is It Possible 2 Select If It Can be Used Once Or Mutliple Times? And Also..... How Can I Add A Link In The Shop Menu To The Voucher Redemption Area?
Title: Re: "Voucher Code" Item
Post by: feeble on July 19, 2007, 03:36:36 am
This A Custom Build?
What do you mean by this? All code is my own.

Can be Used Once Or Mutliple Times?
It is possibly, but Im not entirely sure why you would want this? as what would stop the user inputting the voucher code multiple times to receive every count?

Add A Link In The Shop Menu To The Voucher Redemption Area?
You could...but why?
Dont you have a shop link on the top of your website? already?
If you still require it thou, i can add it in or you can, just open up themes/default/RedeemShop.template.php
should be simple enough
Title: Re: "Voucher Code" Item
Post by: Matthew Gall on July 19, 2007, 03:45:28 am
Sorry About That Feeble..... I Was Quite Excited And Confused......  8) (I Get Like That Sometimes...)

Add A Link In The Shop Menu To The Voucher Redemption Area?
You could...but why?
Dont you have a shop link on the top of your website? already?
If you still require it thou, i can add it in or you can, just open up themes/default/RedeemShop.template.php
should be simple enough
When I Said This, I Meant In The SMF Shop LinkTree. However I Have Worked Out How To Do That And I Have Added It To My Shop...

This A Custom Build?
What do you mean by this? All code is my own.

Just Ignore The Stuff About A Custom Build......

Can be Used Once Or Mutliple Times?
It is possibly, but Im not entirely sure why you would want this? as what would stop the user inputting the voucher code multiple times to receive every count?

I Am Sorry.... I Worded This Completely Wrong..... - I Will try Again.... , If I Was To Issue A Voucher To A User (Say As A Competition Prize) - I Don't Want It Used Repeatedly. So I Meant That If I Wanted It To Be Automatically Deleted After 1 USE (To Avoid Abuse) Or To Allow It To Be A Continual Voucher (i.e Not Expire)

However,
I Thank You For Your Work On This Modification And It Is Excellent!

Title: Re: "Voucher Code" Item
Post by: feeble on July 19, 2007, 05:11:37 am
Well how it works atm, is that once the voucher is used, its marked as "Redeemed" and cant be used again.

If you are asking for say? a voucher that can be used multiple times but only once per member?
Title: Re: "Voucher Code" Item
Post by: Matthew Gall on July 19, 2007, 05:34:48 am
If you are asking for say? a voucher that can be used multiple times but only once per member?

Yes, That Is Exactly What I Want.....

Well how it works atm, is that once the voucher is used, its marked as "Redeemed" and cant be used again.

That However Does Not Seem To Work Correctly - I Have Tried It On An Admin Member And A Normal Member Of The Forum. But That Does Not Seem To Work

Title: Re: "Voucher Code" Item
Post by: feeble on July 19, 2007, 06:26:32 am
Ok ive fixed that bug, and also added "Multiple"

"Multiple" is a voucher that can be redeemed multiple times but only once per member

Just uninstall the mod, delete then download this new version
http://www.leaderless.net/tp-downloads/redeemShop.zip

Title: Re: "Voucher Code" Item
Post by: Matthew Gall on July 19, 2007, 11:53:22 pm
Thanks Very Much feeble
Works Excellently!

Topic Locked
Title: Re: [SOLVED] "Voucher Code" Item
Post by: Matthew Gall on July 23, 2007, 12:21:18 am
Topic Unlocked
Topic Unlocked To Allow Troubleshooting Requests From Other Users
Title: Re: [SOLVED] "Voucher Code" Item
Post by: Joker Grafix on July 28, 2007, 05:56:48 pm
I downloaded, and installed this mod but I don't see any admin controlls anywhere in my admin panel for it.

Any suggestions?
Title: Re: [SOLVED] "Voucher Code" Item
Post by: feeble on July 28, 2007, 07:50:41 pm
to use
goto SMF Action: ?action=redeemShop
Title: Re: [SOLVED] "Voucher Code" Item
Post by: Joker Grafix on July 28, 2007, 08:12:28 pm
I assume that is in my /forum files?
Title: Re: [SOLVED] "Voucher Code" Item
Post by: feildmaster on July 29, 2007, 03:42:17 am
no

after index.php put ?action=redeemShop

looks like this
Code: [Select]
http://mywebsite.com/forum(if you have that..)/index.php?action=redeemShop
the admin is at the redeemShop page...
Title: Re: [SOLVED] "Voucher Code" Item
Post by: Joker Grafix on July 29, 2007, 04:07:56 am
Ah okay. So for me to use the admin settings or for a player to redeem they have to type in

http//www.yourforum.com/forum/index.php?action=redeemShop

Each time? Is there a way to perhaps add a button or something in the shop (Where it says Inventory, Buy Stuff, Bank, etc) that says something along the lines of "Redeem Voucher"?
Title: Re: [SOLVED] "Voucher Code" Item
Post by: feildmaster on July 29, 2007, 06:26:15 am
Yes... Which version u using? 2.X or 3.X

heres code
Code: [Select]
echo '
'<a href="' . $scripturl . '?action=redeemShop">Redeem Voucher</a>';

place it in the shop.template... o.o
Title: Re: [SOLVED] "Voucher Code" Item
Post by: Joker Grafix on July 29, 2007, 06:30:32 am
Shop 3.0
Title: Re: [SOLVED] "Voucher Code" Item
Post by: feildmaster on July 29, 2007, 06:33:03 am
i edited code into post
Title: Re: [SOLVED] "Voucher Code" Item
Post by: Joker Grafix on July 29, 2007, 06:41:52 am
<a href="' . $scripturl . '?action=redeemShop">Redeem Voucher</a>';


Where it says <a href=

Do I add the redeem shop URL here?
Title: Re: [SOLVED] "Voucher Code" Item
Post by: feildmaster on July 29, 2007, 01:49:04 pm
no

you place that code in shop.template.php exactly the way it is...

search for something like... "// Allowed to access the bank?" then put it before or after that
Title: Re: [SOLVED] "Voucher Code" Item
Post by: Joker Grafix on July 29, 2007, 02:15:18 pm
For some reason I can't find this. What is a normal path for this?
Title: Re: [SOLVED] "Voucher Code" Item
Post by: feildmaster on July 29, 2007, 02:49:02 pm
in the themes folder, default theme... there is Shop.template.php...

does that help?
Title: Re: [SOLVED] "Voucher Code" Item
Post by: Joker Grafix on July 29, 2007, 03:12:51 pm
yes...but

Quote
Template Parse Error!
There was a problem loading the /Themes/default/Shop.template.php template or language file. Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\). To see more specific error information from PHP, try accessing the file directly.

You may want to try to refresh this page or use the default theme.
syntax error, unexpected T_STRING, expecting ',' or ';'

I got this after doing that, and when I removed it.

*edit* forgot to remove it echo' when removing it. Going to try to put it before.
Title: Re: [SOLVED] "Voucher Code" Item
Post by: feildmaster on July 30, 2007, 12:49:49 am
where are you putting it? -_-

it should look like this..
Quote
// Allowed to buy stuff?
   if (allowedTo('shop_buy'))
      echo '
                     ', ($context['shop_do'] == 'buy' ? '<b>' : '') . '<a href="' . $scripturl . '?action=shop;do=buy">' . $txt['shop_buy'] . '</a>' . ($context['shop_do'] == 'buy' ? '</b>' : '') . '<br />';
   // The inventory - Everyone can access this!
   echo '
                     ', ($context['shop_do'] == 'inv' ? '<b>' : '') . '<a href="' . $scripturl . '?action=shop;do=inv">' . $txt['shop_yourinv'] . '</a>' . ($context['shop_do'] == 'inv' ? '</b>' : ''), '<br />';
   // Allowed to send money to other people
   if (allowedTo('shop_sendmoney'))
      echo '
                     ', ($context['shop_do'] == 'sendmoney' ? '<b>' : '') . '<a href="' . $scripturl . '?action=shop;do=sendmoney">' . $txt['shop_send_money'] . '</a>' . ($context['shop_do'] == 'sendmoney' ? '</b>' : '') . '<br />';
   
   // Allowed to send items to other people?
   if (allowedTo('shop_senditems'))
      echo '
                     ', ($context['shop_do'] == 'senditems' ? '<b>' : ''), '<a href="' . $scripturl . '?action=shop;do=senditems">' . $txt['shop_send_item'] . '</a>' . ($context['shop_do'] == 'senditems' ? '</b>' : ''), '<br />';
   
   // Allowed to view inventory of others?
   if (allowedTo('shop_invother'))
      echo '
                     ', ($context['shop_do'] == 'invother' ? '<b>' : ''), '<a href="' . $scripturl . '?action=shop;do=invother">' . $txt['shop_invother'] . '</a>' . ($context['shop_do'] == 'invother' ? '</b>' : ''), '<br />';
   //Voucher Code
      echo '
                     '<a href="' . $scripturl . '?action=redeemShop">Redeem Voucher</a>';

   // Allowed to access the bank?
   if (allowedTo('shop_bank'))
      echo '
                     ', ($context['shop_do'] == 'bank' ? '<b>' : '') . ($modSettings['shopBankEnabled']) ? '<a href="' . $scripturl . '?action=shop;do=bank">' . $txt['shop_bank'] . '</a><br />' : '' . ($context['shop_do'] == 'bank' ? '</b>' : '');

   // Allowed to access the trade centre?
   if (allowedTo('shop_trade'))
      echo '
                     ', ($context['shop_do'] == 'trade' ? '<b>' : '') . ($modSettings['shopTradeEnabled']) ? '<a href="' . $scripturl . '?action=shop;do=trade">' . $txt['shop_trade'] . '</a><br />' : '', ($context['shop_do'] == 'trade' ? '</b>' : '');
Title: Re: [SOLVED] "Voucher Code" Item
Post by: Joker Grafix on July 30, 2007, 01:31:53 am
That's where I have it.
Title: Re: [SOLVED] "Voucher Code" Item
Post by: feildmaster on July 30, 2007, 11:44:55 am
AH! My fault!

Code: [Select]
echo '
<a href="' . $scripturl . '?action=redeemShop">Redeem Voucher</a>';
Title: Re: [SOLVED] "Voucher Code" Item
Post by: Joker Grafix on July 30, 2007, 05:08:23 pm
Awesome! Works great now, thanks a lot fieldmaster.  O0
Title: Re: [SOLVED] "Voucher Code" Item
Post by: feildmaster on July 31, 2007, 12:52:17 am
Np, n its Feildmaster... ^^ ;)
Title: Re: [SOLVED] "Voucher Code" Item
Post by: Joker Grafix on August 04, 2007, 03:30:33 am
Ah yes. It is Feildmaster. lol.

Now I have another question.

For multiplie vouchers - what about a way to see (admin only) who all has redeemed a voucher?

For instance say I want to post a random voucher number on my board and say "The first 10 to redeem this voucher" or some such tactic get the prize. And after 10 have been redeemed I can delete that voucher.

As of right now you have no idea of knowing who all or how many has claimed a voucher on multiple vouchers.

In the normal single voucher it puts that "O" inside the "Redeemed" spot.
Title: Re: [SOLVED] "Voucher Code" Item
Post by: feildmaster on August 04, 2007, 01:42:01 pm
sure, gime a sec...

and i will whip up a code that'll do even more than just let you look... =)
Title: Re: [SOLVED] "Voucher Code" Item
Post by: feildmaster on August 04, 2007, 03:33:26 pm
I'll compile it to a mod tomorrow morning...

it's 2 am... honestly im not even sure it works... =) *sorry for double post...*
Title: Re: [SOLVED] "Voucher Code" Item
Post by: Joker Grafix on August 05, 2007, 12:48:01 pm
Awesome.

2am? Where in the world are you located?  ;D
Title: Re: [SOLVED] "Voucher Code" Item
Post by: feildmaster on August 05, 2007, 03:07:17 pm
United States. And it's 1 AM now...

Anyway... here is the package...

Just delete it after you install it... (or keep it... just keep in mind that feeble's redeemShop package uninstalls everything fine...)

to "uninstall" what the addon does... simply uninstall feebles mod, then reinstall it... that simple... =)

now... Info on what the mod does...
Adds the "Who  has redeemed" info to multiple vouchers...
Adds a "Voucher limit" to multiple vouchers... (Limits how many can get the mod... So you don't have to do it yourself. ;))
If the limit is reached it shows "Yar" in reddemed? (excuse my pirate words... :D)
Title: Re: [SOLVED] "Voucher Code" Item
Post by: Joker Grafix on August 05, 2007, 06:28:30 pm
That's great Feildmaster!

Everything seems to show up except the "Who Has Redeemed". Maybe I am just not looking in the right spot? I have inspected all links in Admin for the redeemShop mod and I see where all the new addons are in place except that one.

Thanks for the time you've put into this.

Note: And the pirate words are fine by me.
Title: Re: [SOLVED] "Voucher Code" Item
Post by: feildmaster on August 06, 2007, 01:10:55 am
"Who Has Redeemed"

shows up when you click "edit". =)

and of course, it only shows up when it is a "multiple" voucher
Title: Re: [SOLVED] "Voucher Code" Item
Post by: Joker Grafix on August 06, 2007, 02:17:20 am
Ah yes there it is!  :uglystupid2:

Thanks. This will work out great. Again thanks for all the time you put into it.

Now I need to get back to learning PHP, and whatnot myself so I can start making mods. I have a ton of ideas.
Title: Re: [SOLVED] "Voucher Code" Item
Post by: feildmaster on August 06, 2007, 02:56:41 am
lol, have fun with that. It's pretty simple to learn really... Just confusing to code in general. =)
Title: Re: [SOLVED] "Voucher Code" Item
Post by: AndyII on November 20, 2007, 10:26:50 pm
feildmaster, is your last mod here a cumlative mod?, so it includes all I need, or do I have to start with one of the others.
BTW, this may be a Good way to get aroumd giving credits to "Post Count Members  O0
Title: Re: [SOLVED] "Voucher Code" Item
Post by: feildmaster on November 22, 2007, 03:45:00 am
no the mod i posted is an upgrade...

Install the mod in the first page posted by feeble to get the whole mod.
Title: Re: [SOLVED] "Voucher Code" Item
Post by: AndyII on November 22, 2007, 04:13:51 am
thanks, was being lazy at first lol,
already installed and that is what I did, looked through the files and seen that the 1st (revised) was needed, then the add on
great mod . Hats off to you that put this together   O0 O0 (2 thumbs up)
Title: Re: [SOLVED] "Voucher Code" Item
Post by: Joker Grafix on February 16, 2008, 01:31:31 am
Man. I go away for a year and everything changes. lol.

Feildmaster - how are things with you?

Does anyone know if this mod (the original) will work with 1.1.4?

Feild - will the addon still work with the new version of SMF as well?
Title: Re: [SOLVED] "Voucher Code" Item
Post by: Joker Grafix on April 03, 2008, 09:49:31 am
Bump - Anyone?
Title: Re: [SOLVED] "Voucher Code" Item
Post by: Eliana Tamerin on April 07, 2008, 12:14:03 am
Weird, it's not giving me the Who has redeemed area. I can set a limit on the item just fine, so the mod IS working.

My bad. Looked at the wrong section.
Title: Re: [SOLVED] "Voucher Code" Item
Post by: CKWT on May 13, 2010, 12:10:01 pm
Is there anyway we can get this mod compatible with 1.1.11