SMFShop - Shop MOD

Started by SMFHacks.com Team, December 27, 2004, 06:46:17 AM

Previous topic - Next topic

SMFHacks.com Team

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-2019 http://www.smfhacks.com
(c) 2005-2008 DanSoft Australia - http://www.dansoftaustralia.net/
Disclaimer: SMFHacks.com Team is not affiliated with the SMF Team or the SimpleMachines NPO.
SMFHacks.com -  Paid Modifications for SMF
Latest Mods:
Community Suite
Newsletter Pro SMF Gallery Pro SMF Classifieds SMF Store

Midgard

Good work, i'm previewing...

Daniel15

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!

Jerry

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

Daniel15

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!

Jerry

#5
thanks for the update :) I think it may also have given my display.template.php a parse error :-\


- Jerry
Find me on:
Facebook
Twitter
PlanetSMF

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

codenaught

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

[Unknown]

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


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


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

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


With:
// 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]

Daniel15

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!

WebPlanetHost.com

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

[Unknown]

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]

SkyFlyer

Thanks man this is awesome... I cant wait until its in the public stages. I will definately be using it.

Elijah Bliss

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?


Daniel15

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!

Jerry

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

SkyFlyer

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?

KuraWeb

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

#17
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

SkyFlyer

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


trenchteam

#19
^^ 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!

Advertisement: