Post by jbrozz » Thu Jul 02, 2009 4:53 pm

Hello, I'm testing OpenCart on my web server for solving... a personal client problem :-\.

This is a link: http://develop.wooma.it/opencart/

It's ok, installation, configuration and templating! But... there are two PHP erros, on header and footer.
Languages and categories modules returns a several errors.

The categories on header is the menu of ecommerce.
The code for my categorie's menu is:

Code: Select all

  <?php if ($categories) { ?>
  <?php foreach ($categories as $category) { ?>
  <div style="display: inline-block; float: left; text-align: center; width: 25%; margin-bottom: 15px;"><a href="<?php echo $category['href']; ?>"><img src="<?php echo $category['thumb']; ?>" title="<?php echo $category['name']; ?>" alt="<?php echo $category['name']; ?>" style="margin-bottom: 3px;" /></a><br />
    <a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a></div>
  <?php } ?>
  <?php } ?>
And the file is /common/header.tpl.
The error is:

Code: Select all

Notice: Undefined variable: categories in /home/w74720/domains/develop.wooma.it/public_html/opencart/catalog/view/theme/default/template/common/header.tpl on line 11
The code for language is:

Code: Select all

  <?php foreach ($languages as $language) { ?>
  <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data">
    <div style="display: inline;"><input type="image" src="catalog/view/theme/default/image/flags/<?php echo $language['image']; ?>" alt="<?php echo $language['name']; ?>" style="position: relative; top: 4px;" />
    <input type="hidden" name="language" value="<?php echo $language['code']; ?>" />
    <input type="hidden" name="redirect" value="<?php echo $redirect; ?>" /></div>
  </form>
  <?php } ?>
And the file is /common/language.tpl
Where is my problem?

Thank you!

Newbie

Posts

Joined
Thu Jul 02, 2009 4:49 pm

Post by readyman » Thu Jul 02, 2009 10:08 pm

You need to move all the categories code into the header controller file.

http://www.alreadymade.com
Follow me on twitter.com/alreadymade


User avatar
Global Moderator

Posts

Joined
Wed May 20, 2009 5:16 am
Location - Sydney

Post by jbrozz » Thu Jul 02, 2009 11:18 pm

readyman wrote:You need to move all the categories code into the header controller file.
Thank's for reply... I ned to move the code into header... it's ok, but... what? :)

Newbie

Posts

Joined
Thu Jul 02, 2009 4:49 pm

Post by readyman » Fri Jul 03, 2009 7:41 pm

The code that you posted from the category menu. For the $categories variable. That code needs to go into the home.php file, not the categories.php file.
This contribution might help you & it's already done for you.
It displays categories on the frontpage.
http://www.opencart.com/index.php?route ... ion_id=177

http://www.alreadymade.com
Follow me on twitter.com/alreadymade


User avatar
Global Moderator

Posts

Joined
Wed May 20, 2009 5:16 am
Location - Sydney

Post by jbrozz » Fri Jul 03, 2009 9:04 pm

Thansk for reply. I used the homepage_categories modules, but... the problem can't solves

Newbie

Posts

Joined
Thu Jul 02, 2009 4:49 pm
Who is online

Users browsing this forum: Bing [Bot] and 5 guests