Post by OSWorX » Sat Nov 16, 2013 12:38 am

Code: Select all

class ControllerProductWeeklySpecials extends Controller {
should do it.

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by josee225 » Sat Nov 16, 2013 2:07 am

Thank you soooo much!!!

New member

Posts

Joined
Tue Dec 27, 2011 10:42 pm

Post by marvl » Sun Dec 08, 2013 8:13 pm

MarketInSG, may I suggest you refrain from making "how to" posts? As evidenced by this inept effort, you are not very good at it. A good "how to" post answers specific questions, it does not create more unanswered questions. Yours, in a word, sucks. And in two words, really sucks.

Newbie

Posts

Joined
Sun Dec 08, 2013 8:08 pm

Post by MarketInSG » Mon Dec 09, 2013 1:22 am

marvl wrote:MarketInSG, may I suggest you refrain from making "how to" posts? As evidenced by this inept effort, you are not very good at it. A good "how to" post answers specific questions, it does not create more unanswered questions. Yours, in a word, sucks. And in two words, really sucks.
If you can't contribute, keep the comments to yourself. At least those users before you that read this posts appreciate it more than you do, and pick up knowledge from here. If it does not benefit you, seriously, write a better one yourself.


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by allenmcb » Tue Dec 24, 2013 6:10 am

MarketInSG wrote: If it does not benefit you, seriously, write a better one yourself.
+1 Outstanding contribution (and response).

User avatar
New member

Posts

Joined
Fri Dec 07, 2012 8:18 am

Post by keiron1992 » Sat Feb 01, 2014 8:34 am

awesome contrib, it works great, how can I force a user to be logged in to view the page?

New member

Posts

Joined
Fri Oct 22, 2010 12:02 am
Location - Birmingham, West Midlands, Uk

Post by keiron1992 » Sat Feb 01, 2014 8:36 am

pooks wrote:Im trying to change page name into products getting this error constantly any fix?

Fatal error: Class 'Controllerinformationproducts' not found in /public_html/system/engine/front.php on line 39
On the first line of the controller file you need to replace this:

Code: Select all

    class ControllerInformationStatic extends Controller {
with this

Code: Select all

    class ControllerInformationYOURPAGENAME extends Controller {
It's most likely that you have case sentive search on when using find and replace.

Took me about 2 hours to realise this. Hope it helps

New member

Posts

Joined
Fri Oct 22, 2010 12:02 am
Location - Birmingham, West Midlands, Uk

Post by MarketInSG » Sat Feb 01, 2014 9:41 am

keiron1992 wrote:awesome contrib, it works great, how can I force a user to be logged in to view the page?
use the following

Code: Select all

$this->customer->isLogged();
You can probably check if the person is logged in, and if not, redirect away.


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by keiron1992 » Sat Feb 01, 2014 11:16 pm

MarketInSG wrote:
keiron1992 wrote:awesome contrib, it works great, how can I force a user to be logged in to view the page?
use the following

Code: Select all

$this->customer->isLogged();
You can probably check if the person is logged in, and if not, redirect away.
Thank you, one more question...

I want to run a query on the page, from what I've read so far I understand I need a model file. How do I do that so i can create custom queries?

Thanks, Keiron

New member

Posts

Joined
Fri Oct 22, 2010 12:02 am
Location - Birmingham, West Midlands, Uk

Post by keiron1992 » Sun Feb 02, 2014 6:52 am


New member

Posts

Joined
Fri Oct 22, 2010 12:02 am
Location - Birmingham, West Midlands, Uk

Post by Dhaupin » Tue Jun 10, 2014 7:38 am

Thank you for laying out the schema for this. Still new to OC on this end... We were able to make a pretty useful extension today with this, an "Information Directory" which is much needed table of contents by utilizing static page + harvesting sitemap foreach information + using a VQ to insert breadcrumb on info pages and inject wherever.

Didnt read all these posts, but some thoughts for those having trouble:
  • Routes follow folder + naming schema so name your files well and trace via their literal folder route. They use the last folder, although technically can use the last 2
  • Extends are case sensitive, as well as route sensitive. Name your controller function(s) accordingly with "ProperCapsToMyExtend" that generally follow the same as above
  • Language files get wonky with extra spaces. If something is throwing error, check your lng for random space... to solve, just dont use random extra space in OC even if its full of them by default. Always and always use tabs, fix live JS editor quad spaces when you get home.
  • Breadcrumbs are straight forward but you need to define them (obviously) before you can use them tpl. Use a VQ to put custom parent crumbs into other routes, don't edit them literally in those other files. This way you can revert your mod without mass crumb 404, the crumb simply disappears
If anyone is interested, here is a starting point

Attachments

Information pages landing system (like a table of contents)


https://creadev.org | support@creadev.org - Opencart Extensions, Integrations, & Development. Made in the USA.


User avatar
Active Member

Posts

Joined
Tue May 13, 2014 3:45 am
Location - PA

Post by IP_CAM » Sun Aug 03, 2014 12:07 pm

Thanks a lot, perfect Solution, I was looking for this !!
O owe you something...
Ernie

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by Dhaupin » Wed Aug 06, 2014 2:26 am

No problem brotha :)

https://creadev.org | support@creadev.org - Opencart Extensions, Integrations, & Development. Made in the USA.


User avatar
Active Member

Posts

Joined
Tue May 13, 2014 3:45 am
Location - PA

Post by er.waseem123 » Wed Aug 13, 2014 8:55 pm

“How do I create an custom page and get data from information page (that we add in catalog=>Information tab =>Insert ) in my OpenCart website?” . I create a static page follow the instruction but cant get data from information page. Please suggest me how to do this.;

Newbie

Posts

Joined
Wed Aug 13, 2014 8:42 pm

Post by Dhaupin » Wed Aug 20, 2014 3:10 am

If you just need the pure information found in an info page, and dont need any headers or styles, there is a link you can use: http://www.YOURSITE.com/information/inf ... ation_id=1

So if you want to put it into another php page you can do so by using file_get_contents on that link. The following would output the guts of information page with an ID of #1:

Code: Select all

<?php echo file_get_contents('http://www.YOURSITE.com/information/information/info&information_id=1'); ?>
You can do the same thing for reviews, for example if you wanted to get the contents of some product reviews:

Code: Select all

<?php echo file_get_contents('http://www.YOURSITE.com/index.php?route=product/product/review&product_id=1'); ?>

https://creadev.org | support@creadev.org - Opencart Extensions, Integrations, & Development. Made in the USA.


User avatar
Active Member

Posts

Joined
Tue May 13, 2014 3:45 am
Location - PA

Post by lukelee » Fri Sep 12, 2014 3:06 pm

I couldnt make it work.
After copy & paste your code. I then go to design / layouts, insert a new layout, name is static, Route is information/static
Then I go to information, insert a new page, set Layout Override: static, seo link is static.
then I go to www.mydomain.com/static.
still showing the old information page.
btw, I have used a custom theme, does that matter?

New member

Posts

Joined
Thu Mar 13, 2014 1:49 pm

Post by wilek666 » Tue Dec 30, 2014 11:38 pm

Dear all,

Is there a way to make a dynamic link to custom page, starting from root folder ?
I would like to avoid changing static links in the future.

I would like to instead of:
<a href="http://www.wilek666.vot.pl/index.php?ro ... -firmie">O firmie</a>
put some variable, like this:
$root_folder=http://www.wilek666.vot.pl/
<a href= $root_folder & "index.php?route=information/o-firmie">O firmie</a>
-----------------------------------------
OK I found solution => static links shoud start without page adress (http://www.wilek666.vot.pl/) => <a href="index.php?route=information/o-firmie">O firmie</a>

http://www.ortopediko.pl
http://www.pszczelafarma.pl


User avatar
New member

Posts

Joined
Sun Dec 07, 2014 2:26 am
Location - Warsaw, Poland

Post by Dhaupin » Wed Dec 31, 2014 10:34 pm

You can use the config url to do that (recommended):

Code: Select all

<a href="' . <?php echo $this->config->get('config_url'); ?> . 'index.php?route=information/o-firmie">O firmie</a>
Or you can also do it with a constant if its outside the scope of OpenCart:

Code: Select all

<a href="' . <?php echo HTTP_SERVER; ?> . 'index.php?route=information/o-firmie">O firmie</a>

https://creadev.org | support@creadev.org - Opencart Extensions, Integrations, & Development. Made in the USA.


User avatar
Active Member

Posts

Joined
Tue May 13, 2014 3:45 am
Location - PA

Post by wilek666 » Sun Jan 04, 2015 6:56 am

Dear @Dhaupin thank you.

I would like to share with you my experience with seo urls and custom pages (OC 1.5.X), to recieve short url you should:

1. Enable SEO URLs in your admin panel => System - Settings - Server tab
2. Rename .htaccess.txt to .htaccess (in your root folder) and add your link to custom page:

Code: Select all

ReWriteRule  ^o-firmie/?$  index.php?route=information/o-firmie  [L]
3. edit your: catalog\controller\common\seo_url.php and add part of /* SEO Custom URL */ from attachment: lines 3-26, 67-70, 120-124, 150-170.
4. Add custom links to: \catalog\controller\information\sitemap.php and \catalog\view\theme\ortopediko\template\information\sitemap.tpl as in the attachment.
5.Add custom page to catalog\controller\feed\google_sitemap.php
$output .= '<url>';
$output .= '<loc>' . $this->url->link('information/o-firmie') . '</loc>';
$output .= '<changefreq>weekly</changefreq>';
$output .= '<priority>1.0</priority>';
$output .= '</url>';
5. Add appropriate row into database, table: oc_url_alias =>
$this->db->query("INSERT INTO `oc_url_alias` (query, keyword) VALUES ('information/o-firmie', 'o-firmie');");

Attachments

custom links seo url

Last edited by wilek666 on Fri Aug 28, 2015 4:36 am, edited 2 times in total.

http://www.ortopediko.pl
http://www.pszczelafarma.pl


User avatar
New member

Posts

Joined
Sun Dec 07, 2014 2:26 am
Location - Warsaw, Poland

Post by MarketInSG » Tue Jan 06, 2015 2:18 pm

from OC 2 onwards, you will need to use $this->url->link in your controller, it would not work on your templates anymore. So it would be good to have a habit of writing at the correct file.


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore
Who is online

Users browsing this forum: No registered users and 20 guests