Advertisement:

Author Topic: SMFShop - Shop MOD  (Read 1172863 times)

Offline SMFHacks.com Team

  • Jr. Member
  • **
  • Posts: 368
    • smfhacks on Facebook
    • @smfhacks on Twitter
    • SMFHacks.com
SMFShop - Shop MOD
« on: December 27, 2004, 06:46:17 AM »
Link to Mod

SMFShop is a Shop Mod for SMF (that should be fairly obvious :P). Members of your Forum will collect credits every time they make posts, and can exchange the points for items in the shop (eg. Random Points, Add 100 to Post Count, Increase Karma, etc.) This mod is very similar to IBStore for Invision Board.
Documentation for SMFShop may be found at the

Note that if you use a different theme, you must make some modifications to that theme's templates (otherwise the shop button won't appear). Please see http://www.smfshop.com/forum/index.php?topic=39.0 for more information!

4.0.1
!Fixed an issue with countMoney on board level. Enable/disabling a board for shop now works.

4.0
!Fixed all the board level settings for SMF 2.0
Count Shop Points, Shop Credits, and Enable Shop Bonuses

3.3.5
!Bug fixes for SMF 2.0.x disable sending partial currency.

3.3.4
!Removed some mysql_ functions from SMF 2.0 version
!Fixed bug in download file item not removing it from the inventory SMF 2.0
!Some minor security fixes admin side. SMF 2.0

Version 3.3.3
!Fixed a bug in the SMF 2.0 package

Version 3.3.2
!Fixed sending money on Shop-Send.php for users allowing both real_name,member_name instead of just member_name.

Version 3.3.1
!Fixed bug in SMF 2.0 version on removetopic edits.

Version 3.3
!Better remove topic shop points code thanks to Liam_michael

Version 3.2
!Fixed some caching issues if you used the caching. The money is now cleared when being added/subtracted from a user.

Version 3.1.8
!Fixed bug in the bank for accepting float values.

Version 3.1.7
!Added better request protection for race conditions when sending items/shop money

Version 3.1.6
!Fixed issue sending money only checking for username and not displayname too
+Now using comma separators for points/cash

Version 3.1.5
!Fixed some bugs with inserts for SMF 2.0 RC2
!Fixed bug with send email item if a textarea was included as an extra field
!Fixed bug for SMF 1.1.x for only using integers instead of floats for board bonuses.

Version 3.1.4
+Added support for SMF 2.0 RC2


Version 3.1.1
+Added checking if the username already exists when using the Change Username item.
+Edited several item files to use updateMemberData() instead of using a database query
+Added support for board-specific credit amounts, based off request at http://www.daniel15.com/forum/index.php/topic,554.html. This may not be fully functional at the moment.
![Shop.template.php] Fixed bug on View Other Members' Inventory page (reported by Sakuragi - http://www.daniel15.com/forum/index.php/topic,525.45.html)
![install_SMF1-1.xml] Fixed bug regarding Load.php edit (reported by feeble - http://www.daniel15.com/forum/index.php/topic,635.html)
![Steal.php] Fixed bug reported by jdv (thanks to Sakuragi) - http://www.daniel15.com/forum/index.php/topic,559.0.html
![Shop-Inventory.php] Fixed bug when viewing member's inventory, reported by thelastkiss (http://www.smfshop.com/forum/index.php/topic,532.msg2772.html#msg2772)
![Shop.template.php] Removed unneeded (commented) code
![Shop.template.php] Fixed 'Buy Stuff' display issue in Firefox


Version 3.1 for SMF 1.1.X
!Fixed missing global in ChangeDisplayName item
!Fixed missing global IncreaseKarma item
!Fixed issues with mod_security with ;id= in the url
!Fixed two broken link trees action=shop;do=invother and action=shop missing ?
!Fixed some joins for better mysql 5 support
+Added Shop.english-utf8.php if you are using utf8 on your board
!Fixed some spelling bugs in Shop.english.php
!Removed ` from queries in the installScript file for Shop which could fail in some setups.

VERSION 3.0 RELEASED! This is quite a major release, and several things have changed. This version does not support SMF 1.0!

Changes in this release
Major:
 - Lots of code cleanup
 - Category support: You can now categorize your items
 - Permissions: You can disable access to the shop for certain membergroups
 - Bonuses per character and word: Give bonuses to a user depending on the number of characters or words in their post
 - Bank deposit/withdrawal fees
 - Option to not delete item after use: Great for items you'd like members to keep
 - When editing an item, you can now edit the item_info (custom info entered when adding the item)
 
Minor
 - Several minor formatting changes
 - Fixed problem with SMF 1.1's "Find Members" popup
 - Bold the current section on the left menu
 - In "10 Richest Members" list, have links to their profiles
 - When sending an item to someone, show an error if they don't exist
 - Allow floating point values for interest
 - And several other (minor things)

Some Quick Info:
* To access the Shop MOD control panel, just go into your Admin panel, and scroll to the bottom. On the left there should be some links for shop administration

* To get into the shop, click on the 'Shop' button at the top of your forum.

* To choose which forums credits are accumulated on, go into the 'Manage Boards' section of your SMF admin panel. There will be an option for it there.

NOTE: In order to get the bank interest working, you MUST set a cron job. If your web host uses cPanel, please see http://www.daniel15.com/smfshop_wiki/Bank_Interest for details on how to get this working

(c) 2009-2017 http://www.smfhacks.com
(c) 2005-2008 DanSoft Australia - http://www.dansoftaustralia.net/
« Last Edit: November 29, 2014, 12:58:29 AM by SMFHacks.com Team »
Disclaimer: SMFHacks.com Team is not affiliated with the SMF Team or the SimpleMachines NPO.

http://ForumRankings.net - Get Forum Ranked!
SMFHacks.com -  Paid Modifications for SMF
Latest Mods:
Community Suite
Newsletter Pro SMF Gallery Pro SMF Classifieds SMF Store

Offline Midgard

  • Jr. Member
  • **
  • Posts: 271
  • Gender: Male
Re: SMFShop - Shop MOD
« Reply #1 on: December 27, 2004, 06:50:44 AM »
Good work, i'm previewing...

Offline Daniel15

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,222
  • Gender: Male
  • http://dan.cx/
    • daaniel on Facebook
    • Daniel15 on GitHub
    • daniel15 on LinkedIn
    • @Daniel15 on Twitter
    • Daniel15
Re: SMFShop - Shop MOD
« Reply #2 on: December 27, 2004, 06:58:22 AM »
hold on, i'm just getting some screenshots...
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

Offline Jerry

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,903
  • Gender: Male
  • What? I can't hear you over my awesomeness!!
    • PlanetSMF
Re: SMFShop - Shop MOD
« Reply #3 on: December 27, 2004, 07:04:02 AM »
daniel it works fine so far, but when you have no items in inventory the menu spans the whole page, is there a way to make a box eqaul size to the inventory box (when you have items) show text that says no items?

And:
Code: [Select]
Fatal error: shop(): Failed opening required 'Sources/shop/items/ChangeUsername.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /xxx/xxx/public_html/test/Sources/shop/Shop.php on line 238
- Jerry
Find me on:
Facebook
Twitter
PlanetSMF

"If all you look for is the negative in things, you will never see the positive."

Offline Daniel15

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,222
  • Gender: Male
  • http://dan.cx/
    • daaniel on Facebook
    • Daniel15 on GitHub
    • daniel15 on LinkedIn
    • @Daniel15 on Twitter
    • Daniel15
Re: SMFShop - Shop MOD
« Reply #4 on: December 27, 2004, 07:12:44 AM »
oh damn case sensitive files... rename Sources/shop/items/ChangeUserName.php to ChangeUsername.php (note different case of the 'N').

and to fix the inventory problem, open /Themes/default/Shop.template.php, look for line like this:

{$context['shop_items_list']}

and replace with:
 {$context['shop_items_list']}

that should work. i'm uploading a fixed ZIP file now

--daniel15
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

Offline Jerry

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,903
  • Gender: Male
  • What? I can't hear you over my awesomeness!!
    • PlanetSMF
Re: SMFShop - Shop MOD
« Reply #5 on: December 27, 2004, 08:29:44 AM »
thanks for the update :) I think it may also have given my display.template.php a parse error :-\
« Last Edit: December 27, 2004, 08:32:13 AM by Jerry »
- Jerry
Find me on:
Facebook
Twitter
PlanetSMF

"If all you look for is the negative in things, you will never see the positive."

Offline codenaught

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 14,653
  • Gender: Male
  • Formerly Known As akabugeyes
Re: SMFShop - Shop MOD
« Reply #6 on: December 27, 2004, 11:15:35 AM »
Hey great mod! I am just looking for more items in the future as there aren't that many in the first release. So far it looks quite good!  :)
Dev Consultant
Former SMF Doc Coordinator

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: SMFShop - Shop MOD
« Reply #7 on: December 27, 2004, 11:15:56 AM »
From install.xml:
> SET money = money + {$modSettings['shopPointsPerTopic']}
> SET money = money + {$modSettings['shopPointsPerPost']}

I suggest using $modSettings[shopPointsPerTopic], as it will parse ever so very slightly faster.

> $context['admin_areas']['shop'] = array (

You should probably check permissions.  It's possible a moderator could get into this section (and have permission to do other things, but not manage the shop...)

if (allowedTo('shop_admin'))
   $context['admin_areas']['shop'] = array(
...


> "{$txt['shop_admin_items']}"

Erm... why not just $txt['shop_admin_items']?  Forcing interpolation will end up wasting memory.

> echo "dode";

Typo?  Note that this section is only for converting template.php's, so you won't see it active at all.

The $message['member'] array is set in Load.php.  Look for loadMemberData() and loadMemberContext().

> <br><br>

XHTML -> <br /><br />.

Code: [Select]
        $newSettings['shopPointsPerTopic'] = $_POST['pertopic'];
        $newSettings['shopPointsPerPost'] = $_POST['perpost'];

You should probably cast pertopic and perpost to ints, just to make sure they typed numbers... like so:

Code: [Select]
        $newSettings['shopPointsPerTopic'] = (int) $_POST['pertopic'];
        $newSettings['shopPointsPerPost'] = (int) $_POST['perpost'];

I notice you use several different templates, Invision-style.  The general method in SMF is to use one larger template and use sub templates.  For example, you might change this:

    loadTemplate('ShopAdminInventory');

To:

    loadTemplate('ShopAdmin');
    $context['sub_template'] = 'inventory';

And then instead of:

function template_main() {

Use:

function template_inventory() {

You may, from your experience with Invision, prefer the other way - and that's fine, this is of course only a suggestion... but I would say that staying with "the way SMF works" will make things easier for those who use your mod.

And, lastly, db_stuff.php uses smf_ hardcoded.  I strongly suggest you use $db_prefix instead, because this forum, as an example, uses a different prefix than smf_.

And, personally, I might replace this:

Code: [Select]
//give admin money :-)
db_query("UPDATE `smf_members` SET `money` = '10000' WHERE `ID_MEMBER` = '1' LIMIT 1", __FILE__, __LINE__);

With:
Code: [Select]
// Reward whoever's installing this with a lot of money :-).
updateMemberData(empty($ID_MEMBER) ? 1 : $ID_MEMBER, array('money' => 10000));

Don't take these suggestions the wrong way, or anything, I'm just trying to give you some helpful advice on integrating into SMF; I know there are not a whole ton of examples available quite yet.

-[Unknown]

Offline Daniel15

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,222
  • Gender: Male
  • http://dan.cx/
    • daaniel on Facebook
    • Daniel15 on GitHub
    • daniel15 on LinkedIn
    • @Daniel15 on Twitter
    • Daniel15
Re: SMFShop - Shop MOD
« Reply #8 on: December 27, 2004, 09:17:39 PM »
thanks for your comments [Unknown] ;) Since i have no previous knowledge of modding SMF, most of the code is rough

Quote
The $message['member'] array is set in Load.php.  Look for loadMemberData() and loadMemberContext().
Thanks for that.

Quote
I notice you use several different templates, Invision-style.  The general method in SMF is to use one larger template and use sub templates.  For example, you might change this:

    loadTemplate('ShopAdminInventory');

To:

    loadTemplate('ShopAdmin');
    $context['sub_template'] = 'inventory';

And then instead of:

function template_main() {

Use:

function template_inventory() {

You may, from your experience with Invision, prefer the other way - and that's fine, this is of course only a suggestion... but I would say that staying with "the way SMF works" will make things easier for those who use your mod.

i've never actually looked through the code of Invision Board MODS, i was just guessing that's how to do templates... i'll fix that in the next version

Quote
And, lastly, db_stuff.php uses smf_ hardcoded.  I strongly suggest you use $db_prefix instead, because this forum, as an example, uses a different prefix than smf_.
I was going to do that, but then i forgot to... I just grabbed the database stuff using phpMyAdmin, and dumped it into the php file.


The new version should be ready in a couple of days... or maybe tomorrow? i don't know yet.
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

Offline WebPlanetHost.com

  • Semi-Newbie
  • *
  • Posts: 23
Re: SMFShop - Shop MOD
« Reply #9 on: December 27, 2004, 09:43:18 PM »
Oh thankyou Daniel!!!! I love you!!!!! I have been waiting for a mod like this for ages!!! If you want a free .com, .net or .org domain please contact me on my forum www.webplanethost.com/forum [nofollow]

I am so happy now  ;D

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: SMFShop - Shop MOD
« Reply #10 on: December 28, 2004, 07:27:19 PM »
http://stickboarder.info/forum/index.php?action=shop

I suggest you use the is_not_guest function to ensure guests don't use the shop (or try to buy things, at least) like so:

is_not_guest($optional_error_message);

> You have credits

I suggest you cast that to an int so it always shows a number.  E.g. (int) $credits (psuedo code.)

http://stickboarder.info/forum/index.php?action=shop;do=buy

Personally I'd add a titlebg to the top something along the lines of:

Item   Description   Price/Stock

And, further, I suggest you consider adding the cabability to display icons for the items.  Then, you want to have ones that do... nothing.  Just note in the member's profile that they own that item (or one more of it, that is.)  Then, you want to load a list of items they own - I suggest into $message['member']['shop_items'] or similar.

This would allow items to be listed like "Sword", "Well crafted sword made of Mythril", "$50"... which would only be shown in your profile and next to your posts as a little sword icon.  People will go nuts, and hearald you as the bringer of the shop mod :P ;).  There's more expansion to be done even after that, but it's a big step in the direction a lot of people (seem) to want.

Again, this is something someone made my promise I would work on when I could/when SMF was released.  So I'm helping you work on it, which counts ;). (or... I think I'm helping?)

-[Unknown]

Offline SkyFlyer

  • Jr. Member
  • **
  • Posts: 122
  • Gender: Male
    • *CF* Clanless Fraggers *CF*
Re: SMFShop - Shop MOD
« Reply #11 on: December 29, 2004, 12:04:21 AM »
Thanks man this is awesome... I cant wait until its in the public stages. I will definately be using it.

Offline Elijah Bliss

  • Sophist Member
  • *****
  • Posts: 1,340
Re: SMFShop - Shop MOD
« Reply #12 on: December 29, 2004, 12:40:34 AM »
Yes! I can't wait!

I'm not familiar with how IPB shops work. Can someone either show me a link to one or give me a brief run down on how they work?


Offline Daniel15

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,222
  • Gender: Male
  • http://dan.cx/
    • daaniel on Facebook
    • Daniel15 on GitHub
    • daniel15 on LinkedIn
    • @Daniel15 on Twitter
    • Daniel15
Re: SMFShop - Shop MOD
« Reply #13 on: December 29, 2004, 01:03:57 AM »
Version 0.2 is now out!!! This fixes a whole heap of bugs! for everyone that has 0.1, please download the new version

and to [Unknown]: Thanks, you're really helping a lot! I'll do all the updates you said, but unfortunately i'm busy during the next couple of days... maybe i'll fix the shop on the weekend? ;)

--daniel15

oh man these christmas smilies are really annoying me now...  ;) <--- that smilie looks weird
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

Offline Jerry

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,903
  • Gender: Male
  • What? I can't hear you over my awesomeness!!
    • PlanetSMF
Re: SMFShop - Shop MOD
« Reply #14 on: December 29, 2004, 01:50:08 AM »
you can choose your smileys in your profile ;)
- Jerry
Find me on:
Facebook
Twitter
PlanetSMF

"If all you look for is the negative in things, you will never see the positive."

Offline SkyFlyer

  • Jr. Member
  • **
  • Posts: 122
  • Gender: Male
    • *CF* Clanless Fraggers *CF*
Re: SMFShop - Shop MOD
« Reply #15 on: December 29, 2004, 03:21:50 AM »
In the readme, where it says...
Copy the file 'shop_install.php' to your forum's directory. Then go to http://www.yourname.tld/forum/shop_install.php (eg. if your forum is located at http://mysite.webplanethost.com/forum then you should go to http://mysite.webplanethost.com/forum/shop_install.php) Understand? 

I'm done, right? Or do I need to do step 3? Or is that just for updating?

Offline KuraWeb

  • Semi-Newbie
  • *
  • Posts: 14
Re: SMFShop - Shop MOD
« Reply #16 on: December 29, 2004, 09:33:14 AM »
Orale Muchas Gracias, me ah servido de mucho el mod, me gustaria saber como agregar  items osea uno  que le ponga Glow o Shadow en el nick. eres un Semi Dios de SMF  :).


Traslate by http://traductor.ya.com [nofollow]

Thank you very much, me ah served as a lot of the mod, I Like add  articles to be able Glow or Shadow in the nick. you are SMF's Semi God:).

In the Nick Or In The Nick

johnm

  • Guest
Re: SMFShop - Shop MOD
« Reply #17 on: December 29, 2004, 11:34:54 AM »
getting an error

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY smf_shop_inventory.id' at line 8
File: /home/user/public_html/forum/Sources/shop/ShopAdmin.php
Line: 74

this only seems to happen if you try to see a members inventory and they are also an admin

???

****edit****

its ok i was entering some ones display name and not actually their username!!! 

great mod
« Last Edit: December 30, 2004, 08:57:38 AM by johnm »

Offline SkyFlyer

  • Jr. Member
  • **
  • Posts: 122
  • Gender: Male
    • *CF* Clanless Fraggers *CF*
Re: SMFShop - Shop MOD
« Reply #18 on: December 30, 2004, 04:13:11 AM »
error here too...

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in blah/blah/forum/Sources/Subs.php on line 1548

Here is the code.
Code: [Select]
// Gotta be special for the javascript.
$context['fader_news_lines'][$i] = strtr(addslashes($context['news_lines'][$i]), array('/' => '\/', '<a href=' => '<a hre" + "f='));
}
$context['random_news_line'] ']']']= $context['news_lines'][rand(0, count($context['news_lines']) - 1)];

This is the error the editor gives me.
"Marked invalid because it contains a duplicate attribute."


Offline trenchteam

  • Sr. Member
  • ****
  • Posts: 901
  • Gender: Male
    • NO WALLS STANDING
Re: SMFShop - Shop MOD
« Reply #19 on: December 30, 2004, 05:23:43 AM »
^^ i had the exact error. I just put back the original subs.php and it works fine ??? NOw how do you edit the store? admin the store? I cannot find the panel on the left!  Is that in the subs.php file that I did not edit!
« Last Edit: December 30, 2004, 05:27:49 AM by trenchteam »