SMF Shop

SMFShop => Coding => Topic started by: greekgod on April 18, 2007, 08:24:23 am

Title: [SOLVED] Please help
Post by: greekgod on April 18, 2007, 08:24:23 am
I am trying to get the `shop` button in place on my forum, I have read the coding made for other custom forums & tried some but, my shop button still doesn`t show.

I am using Tech head by Bloc for version 1.1.1

link:
http://custom.simplemachines.org/themes/index.php?lemma=12

Any suggestions greatly appreciated, cheers.
Title: Re: Please help
Post by: CRONUS on April 18, 2007, 03:26:58 pm
Search in index.template.php :
Code: [Select]
        // The [calendar]!
        if ($context['allow_calendar'])
                echo '<a href="', $scripturl, '?action=calendar"><img name="calendar" id="calendar"  onmouseover="javascript:document.calendar.src=\'' . $settings['images_url'] . '/' . $context['user']['language'] . '/calendar_over.gif\'" onmouseout="javascript:document.calendar.src=\'' . $settings['images_url'] . '/' . $context['user']['language'] . '/calendar.gif\'" src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/calendar.gif" alt="' . $txt['calendar24'] . '" style="margin: 0px 0;" border="0" /></a>';

Add before it:
Code: [Select]
//Begin SMFShop code
//loadLanguage("shop");
echo ($current_action == 'shop' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'shop' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=shop">Shop</a>
</td>' , $current_action == 'shop' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';
//END SMFShop code

But this Bloc theme is using images for buttons so i suggest you to make images for shop and instead of above code add this one:
Code: [Select]
        // The [shop]!
        if ($context['allow_shop'])
                echo '<a href="', $scripturl, '?action=shop"><img name="shop" id="shop"  onmouseover="javascript:document.shop.src=\'' . $settings['images_url'] . '/' . $context['user']['language'] . '/shop_over.gif\'" onmouseout="javascript:document.shop.src=\'' . $settings['images_url'] . '/' . $context['user']['language'] . '/shop.gif\'" src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/shop.gif" alt="Shop'" style="margin: 0px 0;" border="0" /></a>';

So you gonna need shop_over.gif and shop.gif
Title: Re: Please help
Post by: greekgod on April 18, 2007, 04:01:51 pm
Right thanks for that Cronus!  :)

I`l give it a go  O0
Title: Re: Please help
Post by: greekgod on April 20, 2007, 07:55:41 am
Got a parse error  :(

Although I hadn`t uploaded any button images but I wouldnt have thought that would cause an error :-\

Am I wrong ?
Title: Re: Please help
Post by: CRONUS on April 20, 2007, 02:10:26 pm
Could You paste the code? From the button before shop to the one after it?

eg.
Code: [Select]
// Don't remember :)
.....

// The [shop]!
.....

// The [calendar]!
....
Title: Re: Please help
Post by: greekgod on April 20, 2007, 05:02:41 pm
 // Edit Profile... [profile]
        if ($context['allow_edit_profile'])
                echo '<a href="', $scripturl, '?action=profile"><img name="profile" id="profile"  onmouseover="javascript:document.profile.src=\'' . $settings['images_url'] . '/' . $context['user']['language'] . '/profile_over.gif\'" onmouseout="javascript:document.profile.src=\'' . $settings['images_url'] . '/' . $context['user']['language'] . '/profile.gif\'" src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/profile.gif" alt="' . $txt[79] . '" style="margin: 0px 0;" border="0" /></a>';

        // The [calendar]!
        if ($context['allow_calendar'])
                echo '<a href="', $scripturl, '?action=calendar"><img name="calendar" id="calendar"  onmouseover="javascript:document.calendar.src=\'' . $settings['images_url'] . '/' . $context['user']['language'] . '/calendar_over.gif\'" onmouseout="javascript:document.calendar.src=\'' . $settings['images_url'] . '/' . $context['user']['language'] . '/calendar.gif\'" src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/calendar.gif" alt="' . $txt['calendar24'] . '" style="margin: 0px 0;" border="0" /></a>';
Title: Re: Please help
Post by: CRONUS on April 20, 2007, 05:19:49 pm
I can't see Shop button ::)
Title: Re: Please help
Post by: greekgod on April 20, 2007, 06:09:53 pm
Ah right, I copied that from the index template, obviously I removed the `shop` button otherwise the forum wouldn`t work, but basicly I just pasted the one you told me to try for Bloc in between these 2 .
Title: Re: Please help
Post by: CRONUS on April 20, 2007, 06:27:51 pm
It should look like that:
Code: [Select]
        // Edit Profile... [profile]
        if ($context['allow_edit_profile'])
                echo '<a href="', $scripturl, '?action=profile"><img name="profile" id="profile"  onmouseover="javascript:document.profile.src=\'' . $settings['images_url'] . '/' . $context['user']['language'] . '/profile_over.gif\'" onmouseout="javascript:document.profile.src=\'' . $settings['images_url'] . '/' . $context['user']['language'] . '/profile.gif\'" src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/profile.gif" alt="' . $txt[79] . '" style="margin: 0px 0;" border="0" /></a>';

        // The [shop]!
        if ($context['allow_shop'])
                echo '<a href="', $scripturl, '?action=shop"><img name="shop" id="shop"  onmouseover="javascript:document.shop.src=\'' . $settings['images_url'] . '/' . $context['user']['language'] . '/shop_over.gif\'" onmouseout="javascript:document.shop.src=\'' . $settings['images_url'] . '/' . $context['user']['language'] . '/shop.gif\'" src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/shop.gif" alt="Shop" style="margin: 0px 0;" border="0" /></a>';

        // The [calendar]!
        if ($context['allow_calendar'])
                echo '<a href="', $scripturl, '?action=calendar"><img name="calendar" id="calendar"  onmouseover="javascript:document.calendar.src=\'' . $settings['images_url'] . '/' . $context['user']['language'] . '/calendar_over.gif\'" onmouseout="javascript:document.calendar.src=\'' . $settings['images_url'] . '/' . $context['user']['language'] . '/calendar.gif\'" src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/calendar.gif" alt="' . $txt['calendar24'] . '" style="margin: 0px 0;" border="0" /></a>';
Title: Re: Please help
Post by: Daniel15 on April 20, 2007, 10:09:08 pm
Tiny error in the code CRONUS originally posted...
Find:
Code: [Select]
'/shop.gif" alt="Shop'" style="margin: 0px 0;" border="0"
Repalce with:
Code: [Select]
'/shop.gif" alt="Shop" style="margin: 0px 0;" border="0"
Title: Re: Please help
Post by: CRONUS on April 20, 2007, 10:30:12 pm
oops  :-[
but in tle last reply i fixed it ;)
Title: Re: Please help
Post by: Daniel15 on April 20, 2007, 10:48:34 pm
Don't worry, I do stupid things like that all the time :P
Title: Re: Please help
Post by: greekgod on April 21, 2007, 01:35:42 am
Cheers ! I will have another go tonight when the board is quiet  ;)
Title: Re: Please help
Post by: greekgod on April 21, 2007, 07:51:27 am
Ok I inserted that script, no errors this time, I created 2 buttons as gif files & named them accordingly, placed them in the theme/image/english directory but,    they don`t show up on the forum!  :(

The buttons don`t match the existing buttons but are the same size (height) would that make a problem?

Sorry to be a pest guys, i`m even debating switching to default theme to cure this but, as a very last resort.  :-\
Title: Re: Please help
Post by: Daniel15 on April 21, 2007, 10:47:01 am
You sure you put them in Themes/[theme name]/images/english? What happens if you try to access the files in your web browser (if you go to http://[yourforum]/Themes/[theme name]/images/english, do they appear in the directory listing?)
Title: Re: Please help
Post by: greekgod on April 22, 2007, 01:14:39 am
Hi Daniel thanks for the reply,

Yes they are there through Admin on the forum   :(

Should I try a test with say the `help` button which is already created & just rename it shop? see if it shows then ?
Title: Re: Please help
Post by: greekgod on April 22, 2007, 06:21:34 am
Tried that, still nothing !  :(
Title: Re: Please help
Post by: perplexed on April 22, 2007, 06:46:56 am
dumb question but have you done a hard refresh of your screen or logged out and back in, just to make sure you are picking up the changes?  You probably have but it doesnt hurt to check these things out :)
Title: Re: Please help
Post by: greekgod on April 22, 2007, 06:51:50 am
Hi
Yes I tried that too
Title: Re: Please help
Post by: greekgod on April 22, 2007, 07:56:55 am
Daniel, I PM`d you
Title: Re: Please help
Post by: greekgod on April 25, 2007, 07:05:20 am
Ok I sorted it but, i`m confused how or why I had to leave in the  if ($context['allow_calendar'])
It won`t work if I change the calendar to `shop` .see below//
Anyone any thoughts? or shall I just leave it like that ?

The [shop]!
        if ($context['allow_calendar'])
                echo '<a href="', $scripturl, '?action=shop"><img name="shop" id="shop"  onmouseover="javascript:document.shop.src=\'' . $settings['images_url'] . '/' . $context['user']['language'] . '/shop_over.gif\'" onmouseout="javascript:document.shop.src=\'' . $settings['images_url'] . '/' . $context['user']['language'] . '/shop.gif\'" src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/shop.gif" alt="Shop" style="margin: 0px 0;" border="0" /></a>';
Title: Re: Please help
Post by: CRONUS on April 25, 2007, 02:06:34 pm
check permissions if shop is allowed to view for members and then try
Code: [Select]
if ($context['allow_shop'])
Title: Re: Please help
Post by: greekgod on April 26, 2007, 01:44:16 am
Permissions where?
Title: Re: Please help
Post by: CRONUS on April 26, 2007, 02:02:41 pm
http://[your_forum]/index.php?action=permissions

P.S. If even admin can't see the button then i think that SMFShop did not install corectly ::)
Title: Re: Please help
Post by: greekgod on April 27, 2007, 06:16:45 am
Ok thanks Cronus  ;)

Another question,

I`m trying to upload images to shop_images but I keep getting this error !

move /home/username/tmp/cpanel.TMP.EhdoxFgP29xlGFOa, /home/username/public_html/Sources/shop/item_images/101_beer.jpg failed: Permission denied
C:\Documents and Settings\richi\My Documents\My Pictures\101_beer.jpg (101_beer.jpg): upload failed

I tried changing permissions to 777 but it says access denied, yet i have no problem within my theme directory editing or uploading images i.e. shop button images.

Any ideas?  :(
Title: Re: Please help
Post by: Daniel15 on April 28, 2007, 01:07:10 pm
Ok I sorted it but, i`m confused how or why I had to leave in the  if ($context['allow_calendar'])
It won`t work if I change the calendar to `shop` .see below//
Anyone any thoughts? or shall I just leave it like that ?

The [shop]!
        if ($context['allow_calendar'])
                echo '<a href="', $scripturl, '?action=shop"><img name="shop" id="shop"  onmouseover="javascript:document.shop.src=\'' . $settings['images_url'] . '/' . $context['user']['language'] . '/shop_over.gif\'" onmouseout="javascript:document.shop.src=\'' . $settings['images_url'] . '/' . $context['user']['language'] . '/shop.gif\'" src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/shop.gif" alt="Shop" style="margin: 0px 0;" border="0" /></a>';

Get rid of the "allow_calendar" line. It should just look like:
Code: [Select]
              echo '<a href="', $scripturl, '?action=shop"><img name="shop" id="shop"  onmouseover="javascript:document.shop.src=\'' . $settings['images_url'] . '/' . $context['user']['language'] . '/shop_over.gif\'" onmouseout="javascript:document.shop.src=\'' . $settings['images_url'] . '/' . $context['user']['language'] . '/shop.gif\'" src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/shop.gif" alt="Shop" style="margin: 0px 0;" border="0" /></a>';

Quote
I`m trying to upload images to shop_images but I keep getting this error !

move /home/username/tmp/cpanel.TMP.EhdoxFgP29xlGFOa, /home/username/public_html/Sources/shop/item_images/101_beer.jpg failed: Permission denied
C:\Documents and Settings\richi\My Documents\My Pictures\101_beer.jpg (101_beer.jpg): upload failed

I tried changing permissions to 777 but it says access denied, yet i have no problem within my theme directory editing or uploading images i.e. shop button images.

Any ideas? 
This happens on some hosts. Ask your host to chown /home/username/public_html/Sources/shop/item_images/ to your username. This should fix the issue ;)
Title: Re: Please help
Post by: greekgod on April 30, 2007, 06:42:16 am
Thanx Daniel, sorted all them issues now  ;)