Post by netseeker » Tue Feb 21, 2012 8:21 pm

Hi,

I want to create a module based on the currency selection on top of the header , I want to move that part to sides either left or right

and I thought I can make it as a module

I have create a skeleton module which has the structure as following :

Code: Select all

moneydropdown
----admin
           ---controller
                       -----module--->moneydropdown.php
           ---language
                       ----english
                              -----module--->moneydropdown.php
           ----view
                   ---template
                            default----->module--->moneydropdown.tpl
----catalog
           ---controller
                       -----module--->moneydropdown.php
           ---language
                       ----english
                              -----module--->moneydropdown.php
           ----view
                   ---template
                            default----->module--->moneydropdown.tpl
inside my view/template/default/module/moneydropdown.tpl
I want to iterate number of currencies that I have , for this matter I copy the related part from catalog/controller/common/header.php

Code: Select all

 $this->data['currencies'] = array();
		 
		$results = $this->model_localisation_currency->getCurrencies();	
		
		foreach ($results as $result) {
			if ($result['status']) {
   				$this->data['currencies'][] = array(
					'title'        => $result['title'],
					'code'         => $result['code'],
					'symbol_left'  => $result['symbol_left'],
					'symbol_right' => $result['symbol_right']				
				);
			}
and this piece of code needs to have access to the model/localisation/currency.php
and since I have a module without a model I don't know who to solve my problem anybody can help me here?

and one more question : is there any proper skeleton for creating extentions in oc 1.5.3? so I can study it?
cheers

Newbie

Posts

Joined
Wed Sep 16, 2009 6:15 pm

Post by amdev » Thu Feb 23, 2012 9:50 am

Put

Code: Select all

		$this->load->model('localisation/currency');
before

Code: Select all

$results = $this->model_localisation_currency->getCurrencies();  
U can load any model to your controller by call

Code: Select all

		$this->load->model('Model-Directory-Name/model-name');
e.g:U need to access to a model of product(catalog/model/catalog/product.php)
Just load

Code: Select all

		$this->load->model('catalog/product');
Then u can access to any function of products's model.

ร้านค้าออนไลน์
OpenCart Thailand Support Forum
How to Upgrade oc1.5 to 2.0.1.1
Upgrading OpenCart From v.1.4 or v.1.5 to V.2.2 Step by step


User avatar
Active Member

Posts

Joined
Fri Nov 27, 2009 3:40 pm
Location - Bangkok - Thailand
Who is online

Users browsing this forum: No registered users and 59 guests