Post by Elzora » Wed Apr 18, 2012 10:08 pm

English is not my first language, so excuse any mistake. Thanks.

Hi everyone! ;D

I need a bit of help for my web site (a lot of help actually).
I looked everywhere but even if some people did seem to have the same problem, I could not find any answer.


I need to add two extra positions for my modules. If there is a step by step guide to do it, please let me know (it must be well hidden because I’ve been searching for days). :D

----------------------------------------------
I’m using the last version of Opencart (v1.5.2.1)
I didn’t add any extension, module or language (only English).

You can visit my website (still under construction) at this address: http://www.fijiblend.com/online_store/
----------------------------------------------

Before I continue with my design, I really need to have two new zones for my modules.

1 . First, I need a new zone where to put my slideshow (situate between Column left and Column right).
2 . Under that Slideshow zone, I’ll be able to use the Content zone as usual for my information and products (content top, content bottom).
3. Under that Content zone, I’ll need a zone for the carrousel that will go from one side of the page to the other.
See document attach for a visual example.

I try to create a new module position. I follow the same step than iain_darkflare (on this forum) (http://forum.opencart.com/viewtopic.php?f=21&t=41736).

I try to be as logical as possible but, still no new position in my admin. I’m missing something, obviously.

Can someone help me with this, please? That will be very appreciated!!!!!!

Elzora

Attachments

new_position_needed.jpg

Exemple of the new position I want to add - new_position_needed.jpg (121.85 KiB) Viewed 8701 times


Newbie

Posts

Joined
Wed Apr 18, 2012 4:43 am

Post by Elzora » Wed Apr 18, 2012 11:30 pm

I'm doing some trial while waiting for some good advice.

Right now, I'm only working with the Welcome module and trying to change the code as to be able to give Welcome a new position.

My new module position is call : content_self.

So far, I was able to make something appear in the adminitrastion panel when selectiong Module/Welcome (HURRAY!).

BUT (of course!), in the position choice, I receive a warning... grrr.

Here is what I did :
In admin/view/template/module/welcome.tpl
I add

Code: Select all

                  <?php if ($module['position'] == 'content_self') { ?>
                  <option value="content_self" selected="selected"><?php echo $text_content_self; ?></option>
                  <?php } else { ?>
                  <option value="content_self"><?php echo $text_content_self; ?></option>
                  <?php } ?>
Here is the exact warning I received when viewing the Module in the Administration Panel :

Notice : Undefined variable : text_content_self in online_store/admin/view/template/module/welcome.tpl on line 82

Line 82 = <option value="content_self"><?php echo $text_content_self; ?></option>

So, where do I have to ''define'' my content_self?????

I'm feeling that I'm only missing a little piece of this puzzle. Its driving me crazy!!! :choke:

Any help will be appreciated!

Newbie

Posts

Joined
Wed Apr 18, 2012 4:43 am

Post by Elzora » Thu Apr 19, 2012 2:57 am

Here is a step by step of what I already did:

IN ADMIN SECTION

1.
In /admin/language/english/module/welcome
I add my new module name - content_self -

Code: Select all

<?php
// Heading
$_['heading_title']       = 'Welcome';

// Text
$_['text_module']         = 'Modules';
$_['text_success']        = 'Success: You have modified module welcome!';
$_['text_content_top']    = 'Content Top';
$_['text_content_bottom'] = 'Content Bottom';
$_['text_content_self']   = 'Content Self';
$_['text_column_left']    = 'Column Left';
$_['text_column_right']   = 'Column Right';

2. A
I add a new position here /admin/view/template/module/welcome.tpl

Code: Select all

                  <?php if ($module['position'] == 'content_self') { ?>
                  <option value="content_self" selected="selected"><?php echo $text_content_self; ?></option>
                  <?php } else { ?>
                  <option value="content_self"><?php echo $text_content_self; ?></option>
                  <?php } ?>
2. B
In the same document /admin/view/template/module/welcome.tpl
I add a line here for my new position

Code: Select all

	html += '      <td><?php echo $entry_position; ?></td>';
	html += '      <td><select name="welcome_module[' + module_row + '][position]">';
	html += '        <option value="content_top"><?php echo $text_content_top; ?></option>';
	html += '        <option value="content_bottom"><?php echo $text_content_bottom; ?></option>';
	html += '        <option value="content_self"><?php echo $text_content_self; ?></option>';
	html += '        <option value="column_left"><?php echo $text_column_left; ?></option>';
	html += '        <option value="column_right"><?php echo $text_column_right; ?></option>';
	html += '      </select></td>';
3.
Then I go to /admin/controller/module/welcome.php
And add this line :

Code: Select all

		$this->data['text_content_self'] = $this->language->get('text_content_self');
IN MY THEME SECTION

1.
In /catalog/controller/common/home.php
I add my new position

Code: Select all

		$this->children = array(
			'common/column_left',
			'common/column_right',
			'common/content_top',
			'common/content_bottom',
                        'common/content_self',
			'common/footer',
			'common/header'
2.
I created a new php file in /catalog/controller/common/
and named it content_self.php

I put this code inside : (note: I try to change the term ''home_one'', for ''content_self'' but it did not work anyway.)

Code: Select all

<?php
class ControllerCommonHomeOne extends Controller {
    public function index() {
        $this->load->model('design/layout');
        $this->load->model('catalog/category');
        $this->load->model('catalog/product');
        $this->load->model('catalog/information');
 
        if (isset($this->request->get['route'])) {
            $route = $this->request->get['route'];
        } else {
            $route = 'common/home';
        }
 
        $layout_id = 0;
 
        if (substr($route, 0, 16) == 'product/category' && isset($this->request->get['path'])) {
            $path = explode('_', (string)$this->request->get['path']);
 
            $layout_id = $this->model_catalog_category->getCategoryLayoutId(end($path));
        }
 
        if (substr($route, 0, 15) == 'product/product' && isset($this->request->get['product_id'])) {
            $layout_id = $this->model_catalog_product->getProductLayoutId($this->request->get['product_id']);
        }
 
        if (substr($route, 0, 23) == 'information/information' && isset($this->request->get['information_id'])) {
            $layout_id = $this->model_catalog_information->getInformationLayoutId($this->request->get['information_id']);
        }
 
        if (!$layout_id) {
            $layout_id = $this->model_design_layout->getLayout($route);
        }
 
        if (!$layout_id) {
            $layout_id = $this->config->get('config_layout_id');
        }
 
        $module_data = array();
 
        $this->load->model('setting/extension');
 
        $extensions = $this->model_setting_extension->getExtensions('module');
 
        foreach ($extensions as $extension) {
            $modules = $this->config->get($extension['code'] . '_module');
 
            if ($modules) {
                foreach ($modules as $module) {
                    if ($module['layout_id'] == $layout_id && $module['position'] == 'home_one' && $module['status']) {
                        $module_data[] = array(
                            'code'       => $extension['code'],
                            'setting'    => $module,
                            'sort_order' => $module['sort_order']
                        );
                    }
                }
            }
        }
 
        $sort_order = array();
 
        foreach ($module_data as $key => $value) {
            $sort_order[$key] = $value['sort_order'];
        }
 
        array_multisort($sort_order, SORT_ASC, $module_data);
 
        $this->data['modules'] = array();
 
        foreach ($module_data as $module) {
            $module = $this->getChild('module/' . $module['code'], $module['setting']);
 
            if ($module) {
                $this->data['modules'][] = $module;
            }
        }
 
        if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/home_one.tpl')) {
            $this->template = $this->config->get('config_template') . '/template/common/home_one.tpl';
        } else {
            $this->template = 'default/template/common/home_one.tpl';
        }
 
        $this->render();
    }
}
?>
3.
I created the corresponding tpl file in /view/theme/xxxx/template/common/
I called it centent_self.tpl and add this code insinde

Code: Select all

<?php foreach ($modules as $module) { ?>
<?php echo $module; ?>
<?php } ?>
Now, I try to add a line of code in /template/common/home.tpl

Code: Select all

<?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?><?php echo $content_self; ?>
<div id="content"><?php echo $content_top; ?>
<h1 style="display: none;"><?php echo $heading_title; ?></h1>
<?php echo $footer; ?>
Of course, it did not work. :P

I received this error
Notice: Undefined variable: content_self in /catalog/view/theme/fiji/template/common/home.tpl on line 1

and still got the error in my admin when I try to choise the new position.

Anyone can help please?

Newbie

Posts

Joined
Wed Apr 18, 2012 4:43 am

Post by Elzora » Tue Apr 24, 2012 1:17 am

I'm really stuck. Anyone, please? Even if its only to say that I'm crazy and that thing wont ever work! :P

Please!

Newbie

Posts

Joined
Wed Apr 18, 2012 4:43 am

Post by Elzora » Thu May 10, 2012 9:12 pm

Oh well, its seems no one here will be able to help me. First time since I use technical forum that I dont even receive one tiny answer to my question... Even a ''good luck with that'' will have been appreciated.

I found a lot of topic who goes unanswered also. Really weird for a place as big as this community. Sad. I will have to find my way around this problem alone.

If anyone happen on this topic by reseach, well ''Good luck with that''! :laugh:

No hard feeling guys!

Regards!
Elzora

Newbie

Posts

Joined
Wed Apr 18, 2012 4:43 am

Post by ecigg » Tue Jun 12, 2012 5:37 pm

gday mate,

take a look at this

http://htmyell.com/adding-positions-to-opencart-theme


hope it helps

Regards,
eCigg

Newbie

Posts

Joined
Sun Jun 10, 2012 8:05 am

Post by Dreamvention » Sun Jun 17, 2012 7:23 pm

You can use a simple extension for it. it adds two positions to header and footer with VQmod , so you don't neet to change any core files. and you can use it in development if you want to move the positions to different tpl files. A very clean solution.

http://www.opencart.com/index.php?route ... on_id=6916

Many OpenCart users struggle to find quality extensions. We know how frustrating the need to fix the shop is just because of one poorly coded extension. We created quality OpenCart Extensions, tested by real developers and provide professional support.

AJAX QUICK CHECKOUT - #1 one-page checkout solution
VISUAL DESIGNER - Page builder for Opencart
View more extensions here

Tested by Shopunity.net


User avatar
Administrator

Posts

Joined
Sun Jun 17, 2012 7:04 pm
Location - Europe

Post by Ljubo » Fri Sep 21, 2012 6:37 am

I really do not know what is going on with this forum...

a guy asks for help, it seems like nobody knows the answer (which is impossible), and at the end a solution pops up.
solution which does not help the guy!
but a solution that has to be paid for.

thank you but no thank you.

Active Member

Posts

Joined
Mon Jan 31, 2011 10:07 pm
Location - Serbia

Post by catalinux » Sun Jan 27, 2013 8:50 am

I know it's a little bit too late but if you still need a solution check this: http://htmyell.com/adding-positions-to-opencart-theme/

I hope that helps.

Regards

Newbie

Posts

Joined
Tue Jul 08, 2008 9:24 pm
Who is online

Users browsing this forum: No registered users and 7 guests