Post by fido-x » Tue Jul 08, 2008 7:20 pm

Hi Everybody,

This is my first "real" contribution to the community, apart from a couple of templates I uploaded to the OpenCart contributions site. Thank you to those who have been downloading them.

From browsing the forums, I have noticed that there is a desire to control the contents of the home page from the database. The common method has been to use one of the information pages for the purpose. While a viable work-around, it degrades the importance of your home page.

Your home page is special! It is the gateway to your store and should be treated as a separate, individual entity.

With that in mind, I present to you my Homepage Upgrade package.

Overview
By adding 2 tables to your database, and with the necessary administration controller/template files, you can gain full control over the contents of your home page.

How does it work?
Once installed, 2 tables (homepage and homepage_description) are added to your database to contain the data that appears on your home page.
Log in to your administration and select "Catalog->Home Page" from the menu. Here you can insert, edit and delete entries in the same way as you would for "Information" entries. By clicking the "Insert" or "Edit" buttons, you will be taken to a screen where you can enter the title (heading) and the description (block of text below the heading) entries for your home page. The "Data" tab allows you to set the status of each entry to "Enabled" or "Disabled".
On the Catalog side of things, the replacement catalog/controller/home.php file extracts the entries from the database and presents these entries to the new catalog/template/content/home.tpl file, which displays all enabled items.

All necessary files are included in the package, including sql for the additional database tables. The accompanying "readme" includes full installation instructions.

Available as a free download from my website at http://www.fido-x.net for registered members - registration is free.

Hope you find this useful.

Regards, Fido-X.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by fido-x » Thu Jul 17, 2008 12:41 am

First of all, I would like to say thank you to those who have visited my site and shown their interest.

And secondly, I've just updated this package to include a sort order and an image handle. The images swap sides on the home page depending on whether the sort order is odd or even.

Regards, Fido-X.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by fido-x » Fri Jul 18, 2008 12:47 am

This package has been uploaded to the OpenCart contributions site to make it more available.

I've done this primarily because some commercial company's web browser's security phishing filter doesn't seem to like my security certificate. I host my own site on my own machine from home, and created my own security certificate to go with it. It seems that Internet Exploiter doesn't like self-signed certificates.

And, yes it is the updated version.

Regards, Fido-X.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by WallyJ » Thu Sep 11, 2008 10:54 pm

I am looking forward to this working, but it is throwing an error at me.

I just installed Homepage Upgrade and on my homepage, the initial default entry shows up, but...

My "Featured Products" do not show up any more, nor do my Latest Products.

I also get two errors, the first comes above the HompageUpgrade entry, the second comes below:

THE FIRST
Notice: Undefined variable: text_greeting in /home/username/public_html/catalog/template/default/content/home.tpl on line 6

THE SECOND
Notice: Undefined variable: text_latest in /home/username/public_html/catalog/template/default/content/home.tpl on line 21

Notice: Undefined variable: products in /home/username/public_html/catalog/template/default/content/home.tpl on line 22

Warning: Invalid argument supplied for foreach() in /home/username/public_html/catalog/template/default/content/home.tpl on line 22


Please advise...  Thanks!

Newbie

Posts

Joined
Wed Sep 10, 2008 11:47 pm

Post by WallyJ » Thu Sep 11, 2008 11:02 pm

Ok... I found osglass getting "errors" when he installed the HomepageUpgrade... Here...
http://forum.opencart.com/index.php/top ... ml#msg7934

So I noticed the apology from fido-x, so I went and deleted the code... Wallah... the errors are gone...

BUT...

Now I don't see my featured products or my latest products...
I even went into the admin panel and "uninstalled" them both and reclicked the plus sign. I am thinking of reinstalling the whole "featured/latest/etc." module somehow on top of the homepage module.

Advice?
Last edited by WallyJ on Thu Sep 11, 2008 11:05 pm, edited 1 time in total.

Newbie

Posts

Joined
Wed Sep 10, 2008 11:47 pm

Post by SiteE@se » Fri Sep 12, 2008 1:01 am

This is one of OC's achilles heels (or should that be 'hells'  ;D) IMHO.  Different modules and contributions all wanting to modify the same files and causing conflict.  Qphoria's over-ride proposals discussed elsewhere on this forum have a lot of merit!

Anway,  note this quote from the Latest/Featured/Specials instructions:
Being Modules, these only seem to function in layout.tpl.
so, for example, if you only want them to appear on your home page, something of the form :


     
         
     
     
         
     
     
         
     


inserted in layout.tpl should do the trick.
Try adding something similar to the above.

Caveat:  Because of the "" statement, things don't display if someone lands directly at your homepage - they do once they click your 'home' or equivalent button in your main navigation IF you haven't enabled aliasing.  If you ARE using aliasing a hack is to set the priority order that index pages will be looked for at server level (index.html, index.htm, index.php, default.cfm etc etc) to index.html ... them in .htaccess do a re-direct:

Redirect /index.html /index.php?controller=home

Isn't life complicated?  ::)

ADDENDUM:  I should have made it clearer that the above aliasing hack works with Dave Gilbert's version of alias support: http://forum.opencart.com/index.php/top ... .html  If your store is not in the root of your web directory you'll need to put a .htaccess with the redirect code there.  It'll be a little different if you use 0.7.8 standard aliasing but it should still work even with that if you simply upload a dummy index.html file to the root of your store
Last edited by Anonymous on Fri Sep 12, 2008 1:53 am, edited 1 time in total.

Chris @ SiteE@se Web Design


Active Member

Posts

Joined
Mon Dec 17, 2007 7:40 am
Location - UK

Post by WallyJ » Fri Sep 12, 2008 2:53 am

So let me get this straight... I can put the code in my layout.ptl , but it will not show up on the home page until someone pushes the "Home" navigation?!?!

What's the point in that? I need the function to work when people type in the site address.

This particular cart IS in the root.

I went ahead and put the code you gave me in replacement of what was suggested in the forums. Now I get only this error on the homepage:
Notice: Undefined index: controller in /home/bradley/public_html/catalog/template/default/layout.tpl on line 44
It looks like it does not recognize the line about the "controller".

HERE is my layout.tpl file:

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html dir="<?php echo $direction; ?>" lang="<?php echo $code; ?>">
<head> 
<title><?php echo $title; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?>">
<base href="<?php echo $base; ?>">
<link rel="stylesheet" type="text/css" href="catalog/template/<?php echo $this->directory; ?>/css/default.css">
<link rel="alternate" type="application/rss+xml" title="<?php echo $title; ?>" href="rss.php">
</head>
<body>
<h1><a href="./"><?php echo $title; ?></a></h1>
<div id="container">
  <?php if (isset($header)) { ?>
  <div id="header"><?php echo $header; ?></div>
  <?php } ?>
  <div id="bar">
    <?php if (isset($language)) { ?>
    <?php echo $language; ?>
    <?php } ?>
    <?php if (isset($currency)) { ?>
    <?php echo $currency; ?>
    <?php } ?>
    <?php if (isset($search)) { ?>
    <?php echo $search; ?>
    <?php } ?>
  </div>
  <div id="column">
    <?php if (isset($cart)) { ?>
    <?php echo $cart; ?>
    <?php } ?>
    <?php if (isset($category)) { ?>
    <?php echo $category; ?>
    <?php } ?>
    <?php if (isset($review)) { ?>
    <?php echo $review; ?>
    <?php } ?>
    <?php if (isset($information)) { ?>
    <?php echo $information; ?>
    <?php } ?>
  </div>
  <?php if (isset($content)) { ?>
  
<div id="content">

<?php if ($_REQUEST['controller'] == 'home') { ?>
     <?php if (isset($latest)) { ?>
         <?php echo $latest; ?>
     <?php } ?>
     <?php if (isset($featured)) { ?>
         <?php echo $featured; ?>
      <?php } ?>
     <?php if (isset($specials)) { ?>
         <?php echo $specials; ?>
     <?php } ?>
<?php } ?>

</div>

  <?php } ?>
  <?php if (isset($footer)) { ?>
  <div id="footer"><?php echo $footer; ?></div>
  <?php } ?>
</div>
<?php if (isset($time)) { ?>
<div id="time"><?php echo $time; ?></div>
<?php } ?>
</body>
</html>

What is wrong in my code in the layout.tpl file?

Thanks

Newbie

Posts

Joined
Wed Sep 10, 2008 11:47 pm

Post by WallyJ » Fri Sep 12, 2008 3:02 am

Ok... I went BACK through the forums and found Bruce's post here:
http://forum.opencart.com/index.php/top ... ml#msg3898

I followed these steps in order to change the home.php file (which had been replaced during the install of HomepageUpgrade) as well as the change in layout.tpl.

Now I have HomepageUpgrade and Latest and Featured,etc. working now.

Thanks to all in the community...

Newbie

Posts

Joined
Wed Sep 10, 2008 11:47 pm

Post by SiteE@se » Fri Sep 12, 2008 6:04 am

Well sorted  :)  I'd not come across Bruce's offering on this and it is sooo much more elegant.  Thanks for pointing it out!

Chris @ SiteE@se Web Design


Active Member

Posts

Joined
Mon Dec 17, 2007 7:40 am
Location - UK
Who is online

Users browsing this forum: No registered users and 1 guest