Author Topic: [SOLVED] [PLEASE HELP] Buy- table header  (Read 3049 times)

Offline djhvi3

[SOLVED] [PLEASE HELP] Buy- table header
« on: August 30, 2007, 04:19:24 am »
Ok, so I want to add a table head to the buy page in smfshop. If I go to the shop home on my forum it says "Shop  Welcome to the Shop!" ect.

Now when you go to the buy page it doesn't have a header by default, rather it just shows the categories ect.

So I went to the template for shop (shop.template.php) and found this

Code: [Select]

// The main shop page (ie. the index)
function template_main()
{
global $txt, $context, $modSettings, $scripturl, $settings;

echo '
<table width="100%" cellpadding="5" cellspacing="1" border="0" class="bordercolor">
<tr class="titlebg">
<td align="center" colspan="2" class="largetext">', $txt['shop'], '</td>
</tr><tr>
<td class="windowbg" valign="top" style="padding: 7px;">
<b>', $txt['shop_welcome'], '</b>
<div style="font-size: 0.85em; padding-top: 1ex;">
', sprintf($txt['shop_welcome_full'], formatMoney($modSettings['shopPointsPerTopic']), formatMoney($modSettings['shopPointsPerPost']));

// Are we using any bonuses at all?
if ($modSettings['shopPointsPerWord'] != 0 || $modSettings['shopPointsPerChar'] != 0)
{
echo $txt['shop_welcome_full2'];
// Are they capped?
if ($modSettings['shopPointsLimit'] != 0)
printf($txt['shop_welcome_full3'], formatMoney($modSettings['shopPointsLimit']));
}

so I tryed changing that a little and then inserting it to the shop-buy.php page... but everytime I insert somethign like that it'll just give me like "error unexpected ';' or '}' or T-something or other ect. on line 117 or something...

so basically...

how do you add the correct code for $txt to the php file and how do you end it correctly so it works  :)

Offline Daniel15

Re: [PLEASE HELP] Buy- table header
« Reply #1 on: August 31, 2007, 08:12:47 pm »
The Buy stuff page uses the "inventory" template, which is also shared by a few other pages.
The header in that template looks a little like:
Code: [Select]
echo '
<table width="100%" cellpadding="5" cellspacing="0" border="0" class="tborder"> <!-- style="margin-top: 1.5ex;"> -->
<tr valign="top" class="titlebg">
<td style="padding-bottom: 2ex;" width="32">
<b>', $txt['shop_image'], '</b>
</td>
<td>
<b>', $txt['shop_name'], '</b>
</td>
<td>
<b>', $txt['shop_description'], '</b>
</td>';
With the code for the sort box and category box above that. Just insert whatever you want into that.

If you need any further help, please feel free to ask :)

Offline djhvi3

Re: [PLEASE HELP] Buy- table header
« Reply #2 on: August 31, 2007, 11:54:08 pm »
I guess I'm kinda confused... how would I edit the buy page without editng the rest?

like here

 I would like to add a table header... something like this

to another page on the shop-- the buy page


I don't know how/ where to insert the code to make that table... if not a table, maybe just some text.

thanks

Offline Daniel15

Re: [PLEASE HELP] Buy- table header
« Reply #3 on: September 01, 2007, 10:31:37 am »
In Themes/default/Shop.template.php, find:
Code: [Select]
// If we need the sort box _or_ categories box (or both)
Add above
Code: [Select]
// Edited as per http://www.daniel15.com/forum/index.php/topic,1150.html
// Are we on the buy page?
if ($context['shop_inv']['last_col_type'] == 'buy')
{
echo '
<table width="100%" cellpadding="5" cellspacing="1" border="0" class="bordercolor">
<tr class="titlebg">
<td align="center" colspan="2" class="largetext">', $txt['shop'], '</td>
</tr><tr>
<td class="windowbg" valign="top" style="padding: 7px;">
<b>', $txt['shop_welcome'], '</b>
<div style="font-size: 0.85em; padding-top: 1ex;">
Whatever message you want.
</div>
</td>
</tr>
</table>';
}
You can change the headings and stuff if you like.

Hope this helps you :)

Offline djhvi3

Re: [PLEASE HELP] Buy- table header
« Reply #4 on: September 01, 2007, 03:46:19 pm »
oh my gosh thank you sooooo much!!!! you're amazing!

 :D

Offline Daniel15

Re: [PLEASE HELP] Buy- table header
« Reply #5 on: September 01, 2007, 05:25:13 pm »
No worries :)