News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

SMFShop - Shop MOD

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

Previous topic - Next topic

hcfwesker


shadowedfoe

Hi, I just installed the mod and it's working fine only that I cannot seem to find a link to it in the Admin CP?

vbgamer45

There should be a whole Shop area in the admin area.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

jackk

Just wondering, would it be difficult to add functionality where you can buy virtual points with real money?

vbgamer45

Quote from: jackk on February 09, 2013, 04:18:40 AM
Just wondering, would it be difficult to add functionality where you can buy virtual points with real money?
Yes it would be.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

jackk

Quote from: vbgamer45 on February 09, 2013, 12:32:53 PM
Quote from: jackk on February 09, 2013, 04:18:40 AM
Just wondering, would it be difficult to add functionality where you can buy virtual points with real money?
Yes it would be.
Shame to hear that, overall it's great mod, this is the only feature which i miss.

DEEPSNUYB

These are the errors I am getting.

Unknown column 'money' in 'field list'
File: /var/www/vhosts/domain.com/httpdocs/Sources/shop/Shop.php
Line: 93

Table 'domain.smf_shop_items' doesn't exist
File: /var/www/vhosts/domain.com/httpdocs/Sources/shop/ShopAdmin.php
Line: 692

Table 'domain.smf_shop_items' doesn't exist
File: /var/www/vhosts/domain.com/httpdocs/Sources/shop/ShopAdmin.php
Line: 692

Table 'domain.smf_shop_items' doesn't exist
File: /var/www/vhosts/domain.com/httpdocs/Sources/shop/ShopAdmin.php
Line: 692

blah blah blah and a bunch more.

I did run the install.php and it ran fine.  Obviously it did not create tables in the database.

To make it easier for everyone who is going to come up with this problem and a lot of these hacks seems to have this issue of the "install" file not creating database tables, to please show us how to manually create these table in mySQL.

Please show us the manual SQL inserts so we can get this mod going.  Thanks.

vbgamer45

Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

DEEPSNUYB


vbgamer45

Download the SMF 1.1.x version and check the install.php it has the full queries in there.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

DEEPSNUYB

Thanks for that but you have to understand as a programmer, the end user is just that, an end user and not a programmer.

db_query("
   CREATE TABLE IF NOT EXISTS {$db_prefix}shop_items (
      id INT UNSIGNED NOT NULL AUTO_INCREMENT,
      name VARCHAR(50) NOT NULL,
      `desc` TEXT NOT NULL,
      price DECIMAL(8,2) UNSIGNED NOT NULL,
      module TINYTEXT NOT NULL,
      stock SMALLINT NOT NULL,
      info1 TEXT NOT NULL,
      info2 TEXT NOT NULL,
      info3 TEXT NOT NULL,
      info4 TEXT NOT NULL,
      input_needed TINYINT UNSIGNED DEFAULT '1' NOT NULL,
      can_use_item TINYINT UNSIGNED DEFAULT '1' NOT NULL,
      delete_after_use TINYINT(1) UNSIGNED DEFAULT '1' NOT NULL,
      image TINYTEXT NOT NULL,
      category SMALLINT NOT NULL,
      PRIMARY KEY (id)
   )", __FILE__, __LINE__);

This I understand but I am sure that will create errors in the insert.  $db_prefix, do we use SMF? 
   )", __FILE__, __LINE__); is this part of the insert? 

See what I mean.  That is why if you could please just POST it here for everyone can cut and paste and the question will not be asked again.  Thanks so much for your great hacks, they are the best.

vbgamer45

Grab this part and change yeah to smf_

CREATE TABLE IF NOT EXISTS smf_shop_items (
      id INT UNSIGNED NOT NULL AUTO_INCREMENT,
      name VARCHAR(50) NOT NULL,
      `desc` TEXT NOT NULL,
      price DECIMAL(8,2) UNSIGNED NOT NULL,
      module TINYTEXT NOT NULL,
      stock SMALLINT NOT NULL,
      info1 TEXT NOT NULL,
      info2 TEXT NOT NULL,
      info3 TEXT NOT NULL,
      info4 TEXT NOT NULL,
      input_needed TINYINT UNSIGNED DEFAULT '1' NOT NULL,
      can_use_item TINYINT UNSIGNED DEFAULT '1' NOT NULL,
      delete_after_use TINYINT(1) UNSIGNED DEFAULT '1' NOT NULL,
      image TINYTEXT NOT NULL,
      category SMALLINT NOT NULL,
      PRIMARY KEY (id)
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

DEEPSNUYB

Not working. 

#1064 - 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 '' at line 17

The last line, I tried , and ;  still same error

EDIT:  It needs the ) at the end.

DEEPSNUYB

Ugh, what about the rest of these.  Can you upload everything in a TXT file so people can download what to copy and paste?

// Settings used in $modSettings array
db_query("REPLACE INTO {$db_prefix}settings (variable,value) VALUES ('shopVersion', '3.1.1')", __FILE__, __LINE__);
db_query("REPLACE INTO {$db_prefix}settings (variable,value) VALUES ('shopDate', 'May 20, 2009')", __FILE__, __LINE__);
db_query("REPLACE INTO {$db_prefix}settings (variable,value) VALUES ('shopBuild', '1')", __FILE__, __LINE__);
db_query("INSERT IGNORE INTO {$db_prefix}settings (variable,value) VALUES ('shopCurrencyPrefix', '')", __FILE__, __LINE__);
db_query("INSERT IGNORE INTO {$db_prefix}settings (variable,value) VALUES ('shopCurrencySuffix', ' credits')", __FILE__, __LINE__);
db_query("INSERT IGNORE INTO {$db_prefix}settings (variable,value) VALUES ('shopPointsPerTopic', '10')", __FILE__, __LINE__);
db_query("INSERT IGNORE INTO {$db_prefix}settings (variable,value) VALUES ('shopPointsPerPost', '8')", __FILE__, __LINE__);
db_query("INSERT IGNORE INTO {$db_prefix}settings (variable,value) VALUES ('shopInterest', '2')", __FILE__, __LINE__);
db_query("INSERT IGNORE INTO {$db_prefix}settings (variable,value) VALUES ('shopBankEnabled', '1')", __FILE__, __LINE__);
db_query("INSERT IGNORE INTO {$db_prefix}settings (variable,value) VALUES ('shopImageWidth', '32'), ('shopImageHeight', '32')", __FILE__, __LINE__);
db_query("INSERT IGNORE INTO {$db_prefix}settings (variable, value) VALUES ('shopTradeEnabled', '1')", __FILE__, __LINE__);
db_query("INSERT IGNORE INTO {$db_prefix}settings (variable, value) VALUES ('shopItemsPerPage', '10')", __FILE__, __LINE__);
db_query("INSERT IGNORE INTO {$db_prefix}settings (variable, value) VALUES ('shopMinDeposit', '0')", __FILE__, __LINE__);
db_query("INSERT IGNORE INTO {$db_prefix}settings (variable, value) VALUES ('shopMinWithdraw', '0')", __FILE__, __LINE__);
db_query("INSERT IGNORE INTO {$db_prefix}settings (variable, value) VALUES ('shopRegAmount', '0')", __FILE__, __LINE__);

// New settings in SMFShop New Version (Build 12)
db_query("INSERT IGNORE INTO {$db_prefix}settings (variable,value) VALUES ('shopPointsPerWord', '0')", __FILE__, __LINE__);
db_query("INSERT IGNORE INTO {$db_prefix}settings (variable,value) VALUES ('shopPointsPerChar', '0')", __FILE__, __LINE__);
db_query("INSERT IGNORE INTO {$db_prefix}settings (variable,value) VALUES ('shopPointsLimit', '0')", __FILE__, __LINE__);
db_query("INSERT IGNORE INTO {$db_prefix}settings (variable,value) VALUES ('shopFeeWithdraw', '0')", __FILE__, __LINE__);
db_query("INSERT IGNORE INTO {$db_prefix}settings (variable,value) VALUES ('shopFeeDeposit', '0')", __FILE__, __LINE__);

//SMFShop 1.0 items
db_query("INSERT IGNORE INTO {$db_prefix}shop_items ( id , name , `desc` , price , module , stock ) VALUES (
'', 'Test Item', 'Just a test item!', '10.00', 'testitem', '50')", __FILE__, __LINE__);
db_query("INSERT IGNORE INTO {$db_prefix}shop_items ( id , name , `desc` , price , module , stock ) VALUES (
'', 'Random Money', 'Get a random amount of money, between -190 and 190!', '75', 'RandomMoney', '50')", __FILE__, __LINE__);
db_query("INSERT IGNORE INTO {$db_prefix}shop_items ( id , name , `desc` , price , module , stock ) VALUES (
'', 'Add 100 to Post Count', 'Increase your Post Count by 100!', '50', 'AddToPostCount', '50')", __FILE__, __LINE__);
db_query("INSERT IGNORE INTO {$db_prefix}shop_items ( id , name , `desc` , price , module , stock ) VALUES (
'', 'Increase Karma', 'Increase your Karma by 5', '100', 'IncreaseKarma', '50')", __FILE__, __LINE__);
db_query("INSERT IGNORE INTO {$db_prefix}shop_items ( id , name , `desc` , price , module , stock ) VALUES (
'', 'Change Username', 'Change your Username!', '50', 'ChangeUsername', '50')", __FILE__, __LINE__);
db_query("INSERT IGNORE INTO {$db_prefix}shop_items ( id , name , `desc` , price , module , stock ) VALUES (
'', 'Change User Title', 'Change your User Title', '50', 'ChangeUserTitle', '50')", __FILE__, __LINE__);
db_query("INSERT IGNORE INTO {$db_prefix}shop_items ( id , name , `desc` , price , module , stock ) VALUES (
'', 'Increase Total Time', 'Increase your total time logged in by 12 hours.', '50', 'IncreaseTimeLoggedIn', '50')", __FILE__, __LINE__);
db_query("INSERT IGNORE INTO {$db_prefix}shop_items ( id , name , `desc` , price , module , stock ) VALUES (
'', 'Change Other\\'s Title',  'Change someone else\\'s title', '200', 'ChangeOtherTitle', '50')", __FILE__, __LINE__);
db_query("INSERT IGNORE INTO {$db_prefix}shop_items ( id , name , `desc` , price , module , stock ) VALUES (
'', 'Decrease Posts by 100', 'Decrease <i>Someone else\\'s</i> post count by 100!!', '200', 'DecreasePost', '50')", __FILE__, __LINE__);

//updating pre-1.1 items to 1.1 items
db_query("UPDATE {$db_prefix}shop_items SET info1 = '100', input_needed = 0 WHERE module = 'AddToPostCount'", __FILE__, __LINE__);
db_query("UPDATE {$db_prefix}shop_items SET info1 = '5', input_needed = 0 WHERE module = 'IncreaseKarma'", __FILE__, __LINE__);
db_query("UPDATE {$db_prefix}shop_items SET info1 = '43200', input_needed = 0 WHERE module = 'IncreaseTimeLoggedIn'", __FILE__, __LINE__);
db_query("UPDATE {$db_prefix}shop_items SET info1 = '-190', info2 = '190', input_needed = 0 WHERE module = 'RandomMoney'", __FILE__, __LINE__);
db_query("UPDATE {$db_prefix}shop_items SET info1 = '40', input_needed = 1 WHERE module = 'Steal'", __FILE__, __LINE__);

//SMFShop 1.1 items
db_query("INSERT IGNORE INTO {$db_prefix}shop_items ( id , name , `desc` , price , module , stock, info1, input_needed, can_use_item) VALUES ('', 'Steal Credits', 'Try to steal credits from another member!', 50, 'Steal', 50, '40', 1, 1)", __FILE__, __LINE__);
db_query("INSERT IGNORE INTO {$db_prefix}shop_items ( id , name , `desc` , price , module , stock, input_needed, can_use_item) VALUES ('', 'Rock', 'Well.... It does nothing', 5, 'Rock', 50, 0, 0)", __FILE__, __LINE__);

//SMFShop 1.2 items
db_query("INSERT IGNORE INTO {$db_prefix}shop_items (name, `desc`, price, module, stock, input_needed, can_use_item) VALUES (
'Change Display Name', 'Change your display name!', 50.00, 'ChangeDisplayName', 49, 1, 1)", __FILE__, __LINE__);

//SMFShop 2.1 items
db_query("INSERT IGNORE INTO {$db_prefix}shop_items (name, `desc`, price, module, stock, input_needed, can_use_item) VALUES ('Sticky Topic', 'Make any one of your topics a sticky!', 400.00, 'StickyTopic', 50, 1, 1)", __FILE__, __LINE__);

//default all items to use 'blank.gif'
db_query("UPDATE {$db_prefix}shop_items SET image = 'blank.gif'", __FILE__, __LINE__);

//add money columns to members table, if they don't already exist
$result = db_query("SHOW COLUMNS FROM {$db_prefix}members LIKE 'money'", __FILE__, __LINE__);
if (mysql_num_rows($result) == 0)
   db_query("ALTER TABLE {$db_prefix}members ADD money DECIMAL(9, 2) UNSIGNED DEFAULT '0.00' NOT NULL", __FILE__, __LINE__);
   
$result = db_query("SHOW COLUMNS FROM {$db_prefix}members LIKE 'moneyBank'", __FILE__, __LINE__);
if (mysql_num_rows($result) == 0)    
   db_query("ALTER TABLE {$db_prefix}members ADD moneyBank DECIMAL(9, 2) UNSIGNED DEFAULT '0.00' NOT NULL", __FILE__, __LINE__);

//give admin money :-)
db_query("UPDATE {$db_prefix}members SET money = '10000' WHERE ID_MEMBER = '1' LIMIT 1", __FILE__, __LINE__);

//New field in boards table. This specifies whether credits is increased in this board or not.
$result = db_query("SHOW COLUMNS FROM {$db_prefix}boards LIKE 'countMoney'", __FILE__, __LINE__);
if (mysql_num_rows($result) == 0)
   db_query("ALTER TABLE {$db_prefix}boards ADD countMoney TINYINT(1) UNSIGNED DEFAULT '1' NOT NULL", __FILE__, __LINE__);

// Field for custom credits per topic
$result = db_query("SHOW COLUMNS FROM {$db_prefix}boards LIKE 'shop_pertopic'", __FILE__, __LINE__);
if (mysql_num_rows($result) == 0)
   db_query("ALTER TABLE {$db_prefix}boards ADD `shop_pertopic` DECIMAL (9, 2) UNSIGNED NOT NULL", __FILE__, __LINE__);

// Field for custom credits per post
$result = db_query("SHOW COLUMNS FROM {$db_prefix}boards LIKE 'shop_perpost'", __FILE__, __LINE__);
if (mysql_num_rows($result) == 0)
   db_query("ALTER TABLE {$db_prefix}boards ADD `shop_perpost` DECIMAL (9, 2) UNSIGNED NOT NULL", __FILE__, __LINE__);

// Field for whether bonuses are enabled in this board
$result = db_query("SHOW COLUMNS FROM {$db_prefix}boards LIKE 'shop_bonuses'", __FILE__, __LINE__);
if (mysql_num_rows($result) == 0)
   db_query("ALTER TABLE {$db_prefix}boards ADD `shop_bonuses` TINYINT (1) UNSIGNED NOT NULL DEFAULT '1'", __FILE__, __LINE__);


   
// ---------- Insert the permissions --------------
// Initialise the values array. Give the permissions to all ungrouped members (ID_GROUP = 0)
$values = array("
      ('shop_main', 0, 1),
      ('shop_buy', 0, 1),
      ('shop_invother', 0, 1),
      ('shop_sendmoney', 0, 1),
      ('shop_senditems', 0, 1),
      ('shop_bank', 0, 1),
      ('shop_trade', 0, 1)");

// Get all the non-postcount based groups.
$request = db_query("
   SELECT ID_GROUP
   FROM {$db_prefix}membergroups
   WHERE minPosts = -1", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
   // Add this to the values we need
   $values[] = "
      ('shop_main', $row[ID_GROUP], 1),
      ('shop_buy', $row[ID_GROUP], 1),
      ('shop_invother', $row[ID_GROUP], 1),
      ('shop_sendmoney', $row[ID_GROUP], 1),
      ('shop_senditems', $row[ID_GROUP], 1),
      ('shop_bank', $row[ID_GROUP], 1),
      ('shop_trade', $row[ID_GROUP], 1)";
      
      
// Give them all their new permission.
db_query("
   INSERT IGNORE INTO {$db_prefix}permissions
      (permission, ID_GROUP, addDeny)
   VALUES
      " . implode(', ', $values), __FILE__, __LINE__);
?>

vbgamer45

Just repeat remove the db_Query part and the ending and change the prefix
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

DEEPSNUYB

I have given up.  It is too difficult.  Maybe in your next zip update you can just include a text file with the exact syntax that users can copy and paste into mysql. 

all your other hacks are great.

vbgamer45

That is how it is for SMF 2.0 which is why I said to look to SMF 1.1.x
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

atlys

I think I have over-edited. I love this mod, and it functions mostly the way I want it to. But somewhere along the line of editing my code for other mods i can no longer set specific boards to only gain currency.

For example, I want only x amount of boards to gain money when posting. The same amount is fine but currently all boards get currency per post and in my board settings it's not an option to change.

Running SMF 2.0

Thanks for any help

vbgamer45

[qoute]
I want only x amount of boards to gain money when posting. The same amount is fine but currently all boards get currency per post and in my board settings it's not an option to change.
[/quote]
Don't think I ever had that in the SMF 2.0 version of the shop mod.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

atlys

Someone posted this in another type of similar post threasd. But that person wants different denominations per thread I just want certain threads to not gain at all.

"If you go to "Boards" in the Admin center, then to the settings of a specific board, you can set whether a users post will count towards the shop or not"

This is not an option I see

Advertisement: