Page 1 of 1

[FINISHED] Need Help Writing My First Mod

Posted: Tue Dec 23, 2014 3:13 pm
by Selective555
So I decided to try a simple Mod which is just taking existing script, and copying it with a name change to create a second text field in the Admin panel, for the purpose of adding scrolling text to the top of the front shop page.

Here are my notes, what I did so far
I finished the mod, so I removed the notes as they had some errors
Refreshed my shop and all is fine in the admin panel, and the extra option is there and saves the text in the text field. Refreshed the online shop, and looks fine, but when I go to the contact page, the text isn't there and there's an error there instead that reads "Undefined Variable: news in /catalog/view/theme/default/template/information/contact.tpl on line 25".

Do I need to do something in the database?

Re: Need Help Writing My First Mod

Posted: Thu Dec 25, 2014 12:26 am
by yodapt
Th error says you're missing a file, that calls contact.tpl (should be catalog/controller/information/...), and fetch the new field into the tpl.

Re: Need Help Writing My First Mod

Posted: Thu Dec 25, 2014 1:48 am
by Selective555
yodapt wrote:Th error says you're missing a file, that calls contact.tpl (should be catalog/controller/information/...), and fetch the new field into the tpl.
Thanks, I forgot about doing that page when I decided to test it on that page.

Here are my notes for what I did on that page.
I finished the mod, so I removed the notes as they had some errors
Now I'm getting a white page with this error message.

Code: Select all

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /catalog/controller/information/contact.php on line 124
I'm going to start looking at my notes, and see if I missed anything.

Re: Need Help Writing My First Mod

Posted: Thu Dec 25, 2014 2:24 am
by Selective555
I just checked all of my notes, and went through all of those pages again. I did everything exactly like the "Open" script, and the "Open" script works, so why this isn't, I'm not sure!

Is there something not done in the script on the pages that would cause this?

Re: Need Help Writing My First Mod

Posted: Thu Dec 25, 2014 3:23 am
by Selective555
This is odd, I guess.....

I just removed this line of code

Code: Select all

					'news'        => nl2br($location_info['news']),
and now it works!

I guess I didn't need that last piece of code.

I'll now look into adding the scroll script.

Any suggestions on where I should put it so it becomes embedded into the "news" word with the text?

Re: Need Help Writing My First Mod

Posted: Thu Dec 25, 2014 3:58 am
by Selective555
I want to add this scroll script so that it makes the text scroll, but how do I insert it into an already existing php echo script for "news"?

here is my scroll script
I finished the mod, so I removed this script as it had some errors

Re: Need Help Writing My First Mod

Posted: Thu Dec 25, 2014 11:42 am
by Selective555
I figured it out, how to add the scroll script to the text.

I'm now seeing about placing it on the front page.

Re: Need Help Writing My First Mod

Posted: Thu Dec 25, 2014 12:15 pm
by Selective555
I got it on the top of the front page, but now it pushed the top links (that were on the top right) a space row a few spaces below it!

Here is the code I used, and how it is currently placed
I finished the mod, so I removed this script as they had some errors
There isn't anything in the scroll script to make it jump down a line, so I guess I could try using an html table to position everything.

Re: Need Help Writing My First Mod

Posted: Thu Dec 25, 2014 1:16 pm
by Selective555
I just finished this mod, so I'll be posting it soon.

Here are screen shots of it

What it looks like on the front shop page
News Scroll Mod For OpenCart 2.0 SCREENSHOT 1.png

News Scroll Mod For OpenCart 2.0 SCREENSHOT 1.png (18.1 KiB) Viewed 851 times

What it looks like in the Admin panel
News Scroll Mod For OpenCart 2.0 SCREENSHOT 2.png

News Scroll Mod For OpenCart 2.0 SCREENSHOT 2.png (32.61 KiB) Viewed 851 times


Re: Need Help Writing My First Mod

Posted: Mon Jan 05, 2015 11:57 am
by mattalt
Hi! Have you finished the scroll module? Is it available? Regards

Re: Need Help Writing My First Mod

Posted: Mon Jan 05, 2015 8:05 pm
by Selective555
mattalt wrote:Hi! Have you finished the scroll module? Is it available? Regards
Yeah, it's finished!

Here it is
Latest News/Messages Scroll Across Top Of Shop (MOD)