Post by sqren » Fri Oct 15, 2010 9:52 am

Hi everyone,

I'm new to OpenCart and i'm now trying create a new customized template.
Unfortunately, I'm running into problems and I have some fundamental questions about the architecture of the framework (which is very nice, I must say!).

I want to output the categories with this jQuery plugin: http://razorjack.net/quicksand/
Will I have to make changes to the core category module?: catalog/controller/module/category.php

For instance on line 59-63 (catalog/controller/module/category.php) we have:

Code: Select all

            if ($this->category_id == $result['category_id']) {
                $output .= '<a href="' . $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $new_path)  . '"><b>' . $result['name'] . '</b></a>';
            } else {
                $output .= '<a href="' . $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $new_path)  . '">' . $result['name'] . '</a>';
            } 
If I want to change the links, do I do it directly in the file, or do override the method 'getCategories' ?
If so, where do I do this?

Best regards and thank you for helping!
Soren

Newbie

Posts

Joined
Fri Oct 15, 2010 9:38 am

Post by Johnathan » Fri Oct 15, 2010 10:49 am

I think it's fine to edit the core modules -- many of us do it, especially as currently it's the only way to get some of the functionality that you want. Without a hook system, there's not much other choice.

However, be sure to keep track of the changes you've made, as they'll get overwritten when you upgrade.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by Qphoria » Fri Oct 15, 2010 11:48 am

waiting for Jonathan to write us a hook system :)
For the most part, editing core files is bad practice and any possibilities of writing your code in a separate location, even if it is just an include file, is a more preferred method for nothing more than your own well being when upgrading. Must easier to add 1 include line than to edit a bunch of places. But it also depends on what you are doing. Something like adding new fields cannot be done with includes and requires editing of many core files

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by sqren » Sat Oct 16, 2010 11:13 pm

Thank you for the swift replies!

Newbie

Posts

Joined
Fri Oct 15, 2010 9:38 am
Who is online

Users browsing this forum: No registered users and 2 guests