Page 1 of 1

[Tutorial] How to Port 1.4.x Extension to 1.5.x

Posted: Fri Apr 29, 2011 11:17 am
by Qphoria
So some of you extension developers have likely been looking through the code to convert your 1.4.x extensions to 1.5.x.

Here is a brief breakdown (tho not limited to just these changes). Using a good code editor, follow the steps below using specific find/replace based on the context. Perhaps a good regex string can make it more global, but for now, some examples for manual completion.

1. URL's have changed to the new url class
a. HTTP, no arguments:
FIND:

Code: Select all

HTTP_SERVER . 'index.php?route=common/home' 
REPLACE WITH:

Code: Select all

$this->url->link('common/home') 
b. HTTP, with arguments:
FIND:

Code: Select all

HTTP_SERVER . 'index.php?route=product/product&product_id=' . $result['product_id'] 
REPLACE WITH:

Code: Select all

$this->url->link('product/product', 'product_id=' . $result['product_id']) 
c. HTTPS, no argument:
FIND:

Code: Select all

HTTP_SERVER . 'index.php?route=account/login' 
REPLACE WITH:

Code: Select all

$this->url->link('account/login', '', 'SSL')  
d. HTTPS, with argument:
FIND:

Code: Select all

HTTP_SERVER . 'index.php?route=product/product&product_id=' . $result['product_id'] 
REPLACE WITH:

Code: Select all

$this->url->link('account/order', 'order_id=' . $result['order_id'], 'SSL') 
e. HTTPS, with token argument:
FIND:

Code: Select all

HTTPS_SERVER . 'index.php?route=catalog/category&token=' . $this->session->data['token'] 
REPLACE WITH:

Code: Select all

$this->url->link('catalog/category', 'token=' . $this->session->data['token'], 'SSL') 
2. Breadcrumbs have moved to the individual controller
GLOBAL FIND:

Code: Select all

$this->document->breadcrumbs
GLOBAL REPLACE WITH:

Code: Select all

$this->data['breadcrumbs'] 
3. Document class is private now and requires the use of accessor functions
FIND:

Code: Select all

$this->document->title = xxxxx
REPLACE WITH:

Code: Select all

$this->document->setTitle('xxxxx') 
4. Render has changed
GLOBAL FIND:

Code: Select all

$this->response->setOutput($this->render(TRUE), $this->config->get('config_compression')); 
GLOBAL REPLACE WITH:

Code: Select all

$this->response->setOutput($this->render()); 

5. Multiple Instance Modules
Modules are a whole new ball game now. They are instance based so your best bet it to look at the existing latest module and see how it breaks down.