Post by jamescchu » Fri Aug 06, 2010 8:38 pm

Hello all,
I'm trying to duplcate the information module to use it to display news.
I've serached and serached but could not find a post that fully helped me out nor fits exactly in to my situation, so I'm starting a new post.
All your feed backs will be greatly helpful, thanks in advance.

>> What I'm trying to do
I would like to make another module same as the information module to post news. I want to make the news module to have all the functions of the information module.

>> What I have done so far
1. File duplication and rename
<< Files duplicated and renamed on user side >>
duplicated
catalog/language/english/module/information.php
catalog/controller/module/information.php
catalog/module/catalog/information.php
catalog/view/theme/default/template/module/information.tpl

renamed as
catalog/language/english/module/news.php
catalog/controller/module/news.php
catalog/module/catalog/news.php
catalog/view/theme/default/template/module/news.tpl

<< Files duplicated and renamed on admin side >>
duplicated
admin/controller/catalog/information.php
admin/controller/module/information.php
admin/language/english/catalog/information.php
admin/language/english/module/information.php
admin/model/catalog/information.php
admin/view/template/catalog/information_form.tpl
admin/view/template/catalog/information_list.tpl
admin/view/template/module/information_list.tpl

renamed as
admin/controller/catalog/news.php
admin/controller/module/news.php
admin/language/english/catalog/news.php
admin/language/english/module/news.php
admin/model/catalog/news.php
admin/view/template/catalog/news_form.tpl
admin/view/template/catalog/news_list.tpl
admin/view/template/module/news_list.tpl

3. Modification to duplicated files
Changed all of the following wordings.
"Information" and "Informations" has been changed to "News"
"information" and "informations" has been changed to "news"

4. Modifications to admin header files
@ admin/controller/common/header.php
added
$this->data['text_news'] = $this->language->get('text_news');
$this->data['news'] = HTTPS_SERVER . 'index.php?route=catalog/news&token=' . $this->session->data['token'];

@ admin/language/english/common/header.php
added
$_['text_news'] = 'News';

@ admin/view/template/common/header.tpl
added
<li><a href="<?php echo $news; ?>"><?php echo $text_news; ?></a></li>

5. SQL
Duplicated following tables (with "structure only" option)
information
information_description
information_to_store

renamed tables as
news
news_description
news_to_store

>> Reults at this point
From the user side I get follow error
Notice: Undefined variable: news in /hsphere/local/home/jamescchu/advanceddisplaymaterials.com/catalog/view/theme/default/template/common/column_left.tpl on line 3
At above location all I've found is <?php echo ${$module['code']}; ?> and have no clue what needs to be done to it.

From the admin side
Under "Catalog" menu, I am getting the "News" option, but when I click it I get http500 error

As a test I've tried the following and I do get the "information" (information_list.tpl) page.
@ admin/view/template/common/header.tpl
added
<li><a href="<?php echo $information; ?>"><?php echo $text_news; ?></a></li>

Please help me out with these issues, thanks again.

New member

Posts

Joined
Fri Jul 16, 2010 10:53 pm

Post by Xsecrets » Fri Aug 06, 2010 10:16 pm

have you looked at fido's news module? It may save you alot of time.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by jamescchu » Fri Aug 06, 2010 11:27 pm

Xsecrets wrote:have you looked at fido's news module? It may save you alot of time.
Looks like he no longer has this model on his site.
Oh BTW I'm using Opencart v1.4.8b

New member

Posts

Joined
Fri Jul 16, 2010 10:53 pm

Post by jamescchu » Fri Aug 06, 2010 11:44 pm

CORRECTION on my post

>> What I have done so far
1. File duplication and rename
<< Files duplicated and renamed on user side >>
duplicated
catalog/language/english/module/information.php
catalog/controller/module/information.php
catalog/model/catalog/information.php
catalog/view/theme/default/template/module/information.tpl

renamed as
catalog/language/english/module/news.php
catalog/controller/module/news.php
catalog/model/catalog/news.php
catalog/view/theme/default/template/module/news.tpl

<< Files duplicated and renamed on admin side >>
duplicated
admin/controller/catalog/information.php
admin/controller/module/information.php
admin/language/english/catalog/information.php
admin/language/english/module/information.php
admin/model/catalog/information.php
admin/view/template/catalog/information_form.tpl
admin/view/template/catalog/information_list.tpl
admin/view/template/module/information.tpl

renamed as
admin/controller/catalog/news.php
admin/controller/module/news.php
admin/language/english/catalog/news.php
admin/language/english/module/news.php
admin/model/catalog/news.php
admin/view/template/catalog/news_form.tpl
admin/view/template/catalog/news_list.tpl
admin/view/template/module/news.tpl

New member

Posts

Joined
Fri Jul 16, 2010 10:53 pm

Post by jamescchu » Sat Aug 07, 2010 8:04 pm

I was able to resolve above issues but now am faced with another.
Please help out if you can, thank you.

Current situation.
@ Admin side (All looks to be working)
Able to access and edit Catalog => News
Able to access and edit Extensions => Modules => News

@ User side (I seem to have routing crossed somewhere)
Able to see the "News" module with uploaded listing
When clicking a listing I get "The page you requested cannot be found!"

Please help. Thank you.

New member

Posts

Joined
Fri Jul 16, 2010 10:53 pm

Post by jamescchu » Sun Aug 08, 2010 1:27 pm

I was able to resolve the new issue I was having too.
Thanks for looking.

New member

Posts

Joined
Fri Jul 16, 2010 10:53 pm

Post by lxgenius » Wed Aug 18, 2010 4:09 pm

I was able to resolve the new issue I was having too.
Thanks for looking.
I have the same problem: The page you requested cannot be found.
How did you solve the problem?

User avatar
Newbie

Posts

Joined
Mon Aug 09, 2010 3:41 pm

Post by jamescchu » Wed Aug 18, 2010 11:24 pm

lxgenius wrote:
I was able to resolve the new issue I was having too.
Thanks for looking.
I have the same problem: The page you requested cannot be found.
How did you solve the problem?
Hi lxgenius,
Don't know how well I can explain this, but here goes my try.
I'll use my case of dulicating "information" module as "news" module.

I'm sure you may already know these, but as I see it the general layout of Opencart is in 3 parts.
1. Entering data (Entered at Opencart Admin side)
2. Storing data (In your SQL database)
3. Displaying data (Displayed at Opencart User side)

1. from Admin side
Here are the files you'll need to duplicate.

controller => catalog => "information"
language => english => catalog => "information"
view => template => catalog => "information_form"
view => template => catalog => "information_list"

controller => module => "information"
language => english => module => "information"
view => template => module => "information"

model => catalog => "information"

Total of 8 items.
Replace the title "information" to "news"
Open all 8 files and replace all of the wording "information" to "news"
*** NOTE: wording is case sencitive in files, so make sure to make the cases.
*** Example : Information -> News and information -> news

2. from your SQL database
Find following 3 tables and duplicate.
"information"
"information_description"
"information_to_store"

Rename the duplicated files as following.
"information" => "news"
"information_description" => "news_description"
"information_to_store" => "news_to_store"

View the "structure" tab of copied files (listed below) and rename Feild "information_id" to "news_id"
"news"
"news_description"
"news_to_store"

3. from Catalog (User) Side
controller => information => "information"
language => english => information => "information"
model => "information"
view => theme => default => template => information => "information"

Total of 4 items.
Replace the title "information" to "news"
Open all 4 files and replace all of the wording "information" to "news"
*** NOTE: wording is case sencitive in files, so make sure to make the cases.
*** Example : Information -> News and information -> news

Don't forget to modify access permission of the new module "news" from the Admin side, under system, user.

Well I think that's how I did it and this was my 2 cents worth of input, let me know how it turns out... Good luck...

New member

Posts

Joined
Fri Jul 16, 2010 10:53 pm

Post by cpuricelli » Sun Aug 28, 2011 9:05 pm

Hello jamescchu,

I've followed your instructions, just a couple of of questions:
- there is also the table information_to_layout
- in admin panel, how can you manage the catalog -> information pages feature?

Newbie

Posts

Joined
Tue Aug 09, 2011 8:56 pm

Post by cpuricelli » Sun Aug 28, 2011 9:22 pm

cpuricelli wrote:Hello jamescchu,

I've followed your instructions, just a couple of of questions:
- there is also the table information_to_layout
- in admin panel, how can you manage the catalog -> information pages feature?
OK, I answer myself ;D :
You also need to modify header.tpl and header.php on admin side to add the menu item!

Newbie

Posts

Joined
Tue Aug 09, 2011 8:56 pm

Post by Mysh_Eireannach » Mon Feb 04, 2013 6:42 pm

Hello all,
I'm trying to duplicate the information module to use it to display Company Profile at OC 1.5.4

What I'm trying to do
I would like to make another module same as the information module to Company Profile at separate Information relating shop and company profile (Services offline) . I want to make the Company Profile module to have all the functions of the information module.

1. from Admin side
Here are the files you'll need to duplicate.

controller => catalog => "information"
language => english => catalog => "information"
view => template => catalog => "information_form"
view => template => catalog => "information_list"

controller => module => "information"
language => english => module => "information"
view => template => module => "information"
model => catalog => "information"

Total of 8 items.
Replace the title "information" to " profile "
Open all 8 files and replace all of the wording "information" to "profile" every single word.
*** Example : Information -> Profile, infrormations->profiles

2. from your SQL database
Find following 4 tables and duplicate.
"information"
"information_description"
"information_to_store"
“information_to_layout”

Rename the duplicated files as following.
"information" => "profile"
"information_description" => "profile_description"
"information_to_store" => "profile_to_store"
“information_to_layout” => “profile_to_layout”

View the "structure" tab of copied files (listed below) and rename Feild "information_id" to "profile_id"
"profile"
"profile_description"
"profile_to_store"
“profile_to_layout”

3. Modifications to admin header files
@ admin/controller/common/header.php
added
$this->data['text_ profile'] = $this->language->get('text_ profile');
$this->data['profile'] = $this->url->link('catalog/profile', 'token=' . $this->session->data['token'], 'SSL');

@ admin/language/english/common/header.php
added
$_['text_ profile'] = 'Profile';

@ admin/view/template/common/header.tpl
added
<li><a href="<?php echo $profile; ?>"><?php echo $text_ profile; ?></a></li>

4. from Catalog (User) Side, I’m Costumed Theme
controller/information => "information"
controller/module => "information"
language/english/information => "information"
language/english/module => "information"
model/catalog => "information"
view/theme/theme004/template/information => "information"
view/theme/theme004/template/module => "information"

Total of 7 items.
Replace the title "information" to "profile"
Open all 7 files and replace all of the wording "information" to "profile" every single word.
*** Example : *** Example : Information -> Profile, infrormations->profiles

5. Modify access permission of the new module "Profile" from the Admin side, under system, user.

6. Install module "Profile" at Admin -> Extensions -> Moduls

7. Add layout route at admin side Profile profile/profile

As result:

At Admin Side I can use new module and add posts
If I wish delete new posts I see message: Fatal error: Call to undefined method ModelSettingStore::getTotalStoresByProfileId() in /home/temp44/public_html/admin/controller/catalog/profile.php on line 470
At User side I can see new module and new posts, but when I click on one of them I see: The page you requested cannot be found!

What I also need add, remove?


Posts

Joined
Thu Jan 17, 2013 7:31 pm

Post by Mysh_Eireannach » Wed Feb 06, 2013 10:34 pm

This One Solved:
"At Admin Side I can use new module and add posts
If I wish delete new posts I see message: Fatal error: Call to undefined method ModelSettingStore::getTotalStoresByProfileId() in /home/temp44/public_html/admin/controller/catalog/profile.php on line 470"

At Model -> Settings->Store

add:

Code: Select all

public function getTotalStoresByProfileId($profile_id) {
      	$account_query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "setting WHERE `key` = 'config_account_id' AND `value` = '" . (int)$profile_id . "' AND store_id != '0'");
      	
		$checkout_query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "setting WHERE `key` = 'config_checkout_id' AND `value` = '" . (int)$profile_id . "' AND store_id != '0'");
		
		return ($account_query->row['total'] + $checkout_query->row['total']);
	}
But from User side when I click to new added pages at New Profile Module:

/index.php?route=profile/profile&profile_id=5

The page you requested cannot be found!

Also new module not visible at sitemap, why?


Posts

Joined
Thu Jan 17, 2013 7:31 pm
Who is online

Users browsing this forum: No registered users and 6 guests