Author Topic: How to get shop working in other themes  (Read 85281 times)

Offline Daniel15

How to get shop working in other themes
« on: February 17, 2006, 03:59:26 pm »
Well, if you use a theme other than the default, you'll be upset to find out that SMFShop doesn't put a shop button in that theme. Also, it doesn't display the amount of credits a user has next to posts that they make. But, don't worry! We can fix that!

The first thing to do is request a shop button. Please read the topic entitled 'How to request a Shop button for your theme', and once you have done that, make a new post in the 'Shop Button Requests' subforum. Please, read the How-to topic first!

Next, we need to edit the theme to put the amount of credits next to every post a user makes. To do so, just follow these steps:
Open /themes/[themename]/Display.template.php
Find:
Code: (php) [Select]
                        // Show how many posts they have made.
                        echo '
                                                                ', $txt[26], ': ', $message['member']['posts'], '<br />
                                                                <br />';

SMFShop 3.0 or higher, or development version (revision 37 or higher), replace with:
Code: (php) [Select]
            // BEGIN SMFShop MOD New Version Code
// Removed one <br /> from end of post count line.
echo '
', $txt[26], ': ', $message['member']['posts'], '<br />
';

echo '
', $modSettings['shopCurrencyPrefix'], $message['member']['money'], $modSettings['shopCurrencySuffix'], '<br /><br />
<a href="', $scripturl, '?action=shop;do=invother2;member=', $message['member']['username'], '">View Inventory</a><br />
<a href="', $scripturl, '?action=shop;do=sendmoney;member=', $message['member']['username'], '">Send Money to ', $message['member']['name'], '</a><br />';
//END SMFShop code

SMFShop 2.3 or lower, replace with:
Code: (php) [Select]
// Show how many posts they have made.
// echo '
// ', $txt[26], ': ', $message['member']['posts'], '<br />
// <br />';

            //BEGIN Shop MOD 0.2 Code
echo '
', $txt[26], ': ', $message['member']['posts'], '<br />
';

            //I couldn't find where all these $message['member'][whatever] variables
            //are set, so I just send an extra database query to get the member's
            //money. Can someone tell me where (file and line) the $message variables
            //are set?
            global $ID_MEMBER, $db_prefix;

            $result_money = db_query("SELECT money
                                      FROM {$db_prefix}members
                                      WHERE ID_MEMBER = {$message['member']['id']}
                                      LIMIT 1", __FILE__, __LINE__);
            $row_money = mysql_fetch_array($result_money, MYSQL_ASSOC);

            echo $modSettings['shopCurrencyPrefix'].$row_money['money'].$modSettings['shopCurrencySuffix']."<br><br>";
            //END SHOP MOD
           

//BEGIN SMFShop MOD 1.31 (Build 7) CODE
echo "<a href='$scripturl?action=shop;do=invother2;member={$message['member']['username']}'>View Inventory</a><br>";
//END SMFShop MOD 1.31 code

//BEGIN SMFShop MOD 2.2 (Build 10) code
echo "<a href='$scripturl?action=shop;do=sendmoney;member={$message['member']['username']}'>Send Money to {$message['member']['name']}</a><br />";
//END SMFShop code

Then, the amount of credits a user has, as well as a link to their inventory, will be seen next to every post they make.

If you can't find this segment of code, please make a new post here, stating the name of your theme, and a link to your forum
Thanks for reading! :D
 --daniel15
« Last Edit: March 02, 2007, 05:35:48 pm by Daniel15 »

Offline cpg

Re: How to get shop working in other themes
« Reply #1 on: February 18, 2006, 09:45:18 am »
Daniel-
Thank you for the hard work...I love the mod you made..

One thing. I added the shop button..no problem so the shop is functional as I tested it. But as for the script you supplied above- I found the script to be replaced and did so but was greeted with a parsed error.

I removed it and replaced it with the original script for function.

Is there something I am missing here?

I copy and pasted exactly the code you have listed.

I am running smf 106 and have Helios_Multi_TP so that includes my Tiny Portal. I don't know if that has anything to do with it.

again..Thanks for everything
Andy

Offline cpg

Re: How to get shop working in other themes
« Reply #2 on: April 03, 2006, 12:41:15 pm »
Okay- I redid the fix and everything worls great for me...thanks fo rthe hard work

Offline Daethian

Re: How to get shop working in other themes
« Reply #3 on: July 15, 2006, 06:02:08 am »
I don't have that file?
I'm using RC 2 with Tiny Portal installed
Oxygen theme
www.foreverpurple.com/bb

Offline Daethian

Re: How to get shop working in other themes
« Reply #4 on: July 15, 2006, 11:18:37 am »
Okay that's fixed.  The guys at Tiny Portal told me to use the file from the default theme and edit it and that worked!

Offline Daniel15

Re: How to get shop working in other themes
« Reply #5 on: December 08, 2006, 12:34:00 pm »
I've updated this topic to reflect changes in the latest development version.

Leviyah, please send me your whole Display.template.php file, and I'll have a look

Offline Bill-Kill

Re: How to get shop working in other themes
« Reply #6 on: December 18, 2006, 08:42:50 am »
Problem: I am using DilberMC and there is no file to edit the post thing. What do I do?

Offline Lamarck

Re: How to get shop working in other themes
« Reply #7 on: December 21, 2006, 05:33:04 am »
Hi,I need you help,please.I can't make It work with pnpn template (in SMF 1.1 final).I follow the instructions of this post,but It doesn't show credit and the two links.Any solution?.

Offline BioGene

Re: How to get shop working in other themes
« Reply #8 on: December 31, 2006, 11:16:18 am »
Hi Daniel15,

I am using SMF 1.1.11 with SMFShop version 2.3! I am also using a custom theme called SMF enhanced! Here is a link to my forums:

.::LINK::.

Now when I went into the themes folder I did not find the exact file called: Display.template.php, instead I believe I am supposed to use index.template.php! But I have the problem that I can not find the line of code, I believe it does not exist! So what exactly should I do or where should I put the line of code?
Thanks a lot!

Offline Daniel15

Re: How to get shop working in other themes
« Reply #9 on: January 02, 2007, 08:43:36 pm »
Quote
Problem: I am using DilberMC and there is no file to edit the post thing. What do I do?
If there's no Display.template.php file, you don't need to worry - it will use the one from the default theme

Quote
Hi,I need you help,please.I can't make It work with pnpn template (in SMF 1.1 final).I follow the instructions of this post,but It doesn't show credit and the two links.Any solution?.
Are you sure you edit the correct part? Some themes have this bit twice

Quote
Now when I went into the themes folder I did not find the exact file called: Display.template.php, instead I believe I am supposed to use index.template.php!
index.template.php is for the button, Display.template.php is for the credit count next to all the posts. If your theme doesn't have a Display.tenplate.php, it will use the one from the default theme (check to see that the default was edited properly).

Offline scrappy

Re: How to get shop working in other themes
« Reply #10 on: January 27, 2007, 08:12:00 pm »
Hi,

Am a little confused and just need to clarify a couple of things please...

Have previously installed Shop 2.3 and went to upgrade to 3.0, but using the package manager, i get the warning / error message that there would be an install problem : "Execute Modification     ./Themes/default/Display.template.php     Test failed".

I am using a different theme.

So, do I edit the display.template.php file as stated in the first post of this thread (find and replace code) and then I should be able to upload upgrade?

Should I manually upgrade via FTP?

Apologies if this has been answered elsewhere... just point me and Ill look.

Many thanks.

Offline scrappy

Re: How to get shop working in other themes
« Reply #11 on: February 01, 2007, 09:45:00 am »
Anyone?   :D

Offline Daniel15

Re: How to get shop working in other themes
« Reply #12 on: February 03, 2007, 09:38:42 am »
Quote
but using the package manager, i get the warning / error message that there would be an install problem : "Execute Modification     ./Themes/default/Display.template.php     Test failed".

I am using a different theme.

So, do I edit the display.template.php file as stated in the first post of this thread (find and replace code) and then I should be able to upload upgrade?
It should still install properly. If you don't use the default theme, you don't need to worry.
If you previously edited your custom theme to suppoort SMFShop, you may find the old code in Display.template.php, and replace it with the new code.  The old code still works properly, but the new code is a lot more efficient :)

Offline GhostWriter

Re: How to get shop working in other themes
« Reply #13 on: April 03, 2007, 02:58:21 am »
I edited where you are suppse to edit, everything shows up in the profile but it doesn't show up in the posts. The inventory doesn't show up in the posts..

the site url is

http://www.ghosttec.com

I am have a theme selector up and am using tiny portal 9.8 and smf 1.1.2....
The themes in the selector are
Default
Vampire the masquerade
Arcane Magic.

*********Edit

Never mind this reply I figured it out.....
« Last Edit: April 03, 2007, 03:11:16 am by GhostWriter »

Re: How to get shop working in other themes
« Reply #14 on: November 04, 2008, 02:26:39 am »
Love this mod BTW....

Question..the credits show when you are in the member profile, but not when you post. 

Also how do you change the amount a member gets per post?  right now its set to 10 for one post i would like to take it to 2 or 3 per post. 

Also how do i change the name for credits/tokens etch.