Post by emmetje » Wed Jun 22, 2011 7:06 am

I'm quite new to OpenCart (former osCommerce user) and installed version 1.5.0.5 a few days ago. I do like the script a lot but I'm having some trouble understanding the Layouts part under Configuration > design.
There is a layout saying default so in my opinion the modules linked to default should be on every page. But if I link a module to layout default I can't see it anywhere.

So the question is: What means layout default and how can I make a module appear to every page.

Thanks a lot in advance.
Hope everyone can follow along, english is not my native language.

User avatar
New member

Posts

Joined
Wed Jun 22, 2011 2:18 am

Post by raviG » Tue Jun 28, 2011 4:39 am

I'm stuck on that too!
Did you manage to get a module to display on every page?

For theme Installation and Customization, please send me a private message.


Newbie

Posts

Joined
Mon Sep 06, 2010 7:52 pm

Post by emmetje » Tue Jun 28, 2011 4:45 am

I did manage. You have to assign the module to all the options in the dropdown including the default.

User avatar
New member

Posts

Joined
Wed Jun 22, 2011 2:18 am

Post by Xsecrets » Tue Jun 28, 2011 4:51 am

yeah I think that's a bug in the system. For now just add it to each page. It's not like there's that many.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by raviG » Tue Jun 28, 2011 4:56 am

What do you mean by assign?
Let's take the "Welcome Module" to appear on all pages of the site. If there are 15 options in the dropdown you create 15 welcome messages?

For theme Installation and Customization, please send me a private message.


Newbie

Posts

Joined
Mon Sep 06, 2010 7:52 pm

Post by celestial » Tue Jun 28, 2011 5:07 am

raviG wrote:What do you mean by assign?
Let's take the "Welcome Module" to appear on all pages of the site. If there are 15 options in the dropdown you create 15 welcome messages?
15 places where you put the same welcome message :crazy:

Celestial - Martín Abel Rosales
WhatsApp: 50671482211
Email: martinrosales2012@hotmail.com
Skype: martin.abel.rosales
San José , Costa Rica


User avatar
Expert Member

Posts

Joined
Sat Mar 20, 2010 4:19 am
Location - Costa Rica

Post by raviG » Tue Jun 28, 2011 5:15 am

celestial wrote:15 places where you put the same welcome message :crazy:
Yeah that's what I meant and this should not be the way to do it.
It's probably a bug since there is an option "Default" and I can't seem to understand its use.

How to report that to the opencart devs?
Last edited by raviG on Tue Jun 28, 2011 5:15 am, edited 1 time in total.

For theme Installation and Customization, please send me a private message.


Newbie

Posts

Joined
Mon Sep 06, 2010 7:52 pm

Post by Xsecrets » Tue Jun 28, 2011 5:15 am

raviG wrote:What do you mean by assign?
Let's take the "Welcome Module" to appear on all pages of the site. If there are 15 options in the dropdown you create 15 welcome messages?
Yes, though the welcome one is the only one where it's that big of a deal at all. all the other modules you simply click add module 15 times then select the different pages. Not that big of deal. Yes I would conciser it something that needs to be fixed, but it's not a major deal particularly since you only do it once when you first set your store up.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by Xsecrets » Tue Jun 28, 2011 5:16 am

[quote="raviG"
It's probably a bug since there is an option "Default" and I can't seem to understand its use.

How to report that to the opencart devs?[/quote]
there is a sticky post for 1.5.0.5 bugs. You can post it there and you can add it to the google code bug tracker.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by JNeuhoff » Tue Jun 28, 2011 5:21 am

Looking at the code it seems that the 'Default' layout isn't being used anywhere in Opencart 1.5.0.x. In particular, it has no associated route to a controller attached to it.

Override Engine * Integrated VQMod * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Rich Snippets * Google Tag Manager * Export/Import Tool * SpamBot Buster * Survey Plus


User avatar
Expert Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by raviG » Tue Jun 28, 2011 7:29 am

Managed to display the "Welcome" module on all pages without creating it 11 times. :P

Just paste the following code wherever you want in your template file:

Code: Select all

<? echo html_entity_decode($this->config->get('welcome_1_description_1')); ?>
Cheers. :drunk:

For theme Installation and Customization, please send me a private message.


Newbie

Posts

Joined
Mon Sep 06, 2010 7:52 pm

Post by Xsecrets » Tue Jun 28, 2011 7:42 am

JNeuhoff wrote:Looking at the code it seems that the 'Default' layout isn't being used anywhere in Opencart 1.5.0.x. In particular, it has no associated route to a controller attached to it.
true, but it is selected as the "default" layout for the main store so one would assume (yes I know) that if you attached something to it, it would show up on all pages, but maybe that would only happen if there was no layout for a particlar page. Ok tested and that's what it is. Modules assigned to default take affect if there is no other layout assigned for that page. on one of my test installs I removed all layouts, but default then things assigned to default did show up on every page.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by AndyGaskell » Sun Jul 24, 2011 3:54 am

I was playing around with this for a wee while, looking for a solution for something like the original posts. Although I've used OC for a few years, it has mostly been with 1.3 and 1.4 lately. So I was pulled 1.5.1 down and started using it.

At first I was a bit confused by the new layout stuff, both on the modules, and under system->design->layouts. I think I've figured out a good use case and explanation, so thought I'd share it.

The client has a shop side of the site, and an info side of the site. As such some modules should display on all shop type pages, and some on all info type pages. They also wanted to set the homepage to look different too. So, I...
  • Went into system->design->layouts and notes what route was under each layout, then deleted them all, except the default, which you cant delete.
  • Added a new layout called Info
  • Added a couple of routes under this "affiliate/" and "information/"
  • Added a new layout called Shop
  • Added a couple of routes under this "product/", "checkout/" and "account/"
  • Added a new layout called Home
  • Added a couple of routes under this "common/home"
...So, now the module can just be applied once to the layout that is appropriate, either Shop, Info, or Home.

Hope this makes sense, I think this is the intended use case for this new layout feature. I thought this might be a handy share. Any Qs, just post here.

Thanks
Andy

I'm a web developer at http://www.ssofb.co.uk in Aberdeen, Scotland.
Got a random blog at http://www.andygaskell.blogspot.com/.


User avatar
New member

Posts

Joined
Thu Dec 10, 2009 3:59 am
Location - Aberdeen UK

Post by mortz » Fri Jul 29, 2011 3:18 am

Well, maybe someone else will find this useful. Although, I'm sure everything works in the previous posts.. I couldn't make sense of it.

I have two stores. I managed to get the welcome message to work on both stores (with different text). However, store one search box did not work.

The easiest method (easy now but painful searching for the answer) for me is as follows:

Create a new Layout for each store. (Store1)(Store2)

No matter how I set the second store it continually reverts it's store setting to "Account" My first store setting is now set to: "Default"

In Store1 layout I have it set to "Default" >> common/home
In Store2 layout I have it set to "http://www.Store2.com" >> common/home

All modules I want assigned to my two stores have each store added as layouts. So.. Welcome has two tabs, first tab uses Store1 layout and the second tab has Store2 layout.

I thought I would throw this out there because the searching I did helped me figure out my problem. Maybe this post will help someone else.

Newbie

Posts

Joined
Wed Dec 22, 2010 1:01 am

Post by affect » Tue Aug 16, 2011 7:01 am

I needed to make my module appear on all pages by default and I stumbled upon this topic.

What I did was check what parameters are sent when a module gets hooked to every route and what happens afterwards. Then I added a piece of code to the install() function of my module that mirrors that behavior without user needing to do it all manually.

You'll need to replace modulename with the actual name of your module and change the position to the one you need. I wanted to hook it to content_top.

For 1.5.0.x

Code: Select all

for ($i=0;$i<=10;$i++) {
    $settings["modulename_{$i}_layout_id"] = $i+1;
    $settings["modulename_{$i}_position"] = 'content_top';
    $settings["modulename_{$i}_status"] = 1;
    $settings["modulename_{$i}_sort_order"] = '';
    $settings["modulename_module"] .= "$i,";
}
$settings["modulename_module"] = substr($settings["modulename_module"],0,-1);
$this->model_setting_setting->editSetting('modulename', $settings);
For 1.5.1.x

Code: Select all

for ($i=1;$i<=11;$i++)
$settings['modulename_module'][] = Array (
	'layout_id' => $i,
	'position' => 'content_top',
	'status' => 1,
	'sort_order' => ''
);
$this->model_setting_setting->editSetting('modulename', $settings);
Also posted it in my blog: http://ffct.cc/opencart-hook-module-to-all-pages/

MultiMerch Marketplace for OpenCart

Image


User avatar
Active Member

Posts

Joined
Sat Aug 13, 2011 5:04 pm


Post by MrSmileyJr » Sun Sep 11, 2011 6:11 pm

raviG wrote:Managed to display the "Welcome" module on all pages without creating it 11 times. :P

Just paste the following code wherever you want in your template file:

Code: Select all

<? echo html_entity_decode($this->config->get('welcome_1_description_1')); ?>
Cheers. :drunk:
This only gets the first welcome module & completely ignores the layout assignment. This is not the way you should be coding it.

Never lose data again! Use Dropbox - DO THIS BEFORE YOU SIGNUP for Extra Space!!
http://db.tt/inKP3mv Signing up via this link gives you a bonus of 256 MB
More Bonuses: http://www.dropbox.com/free .5 GB
http://www.dropbox.com/edu = double your bonus referrals by giving an edu address.
Total ~ 3gb


New member

Posts

Joined
Fri Mar 11, 2011 5:07 am
Who is online

Users browsing this forum: No registered users and 7 guests