Post by ryan_pl » Thu Jun 13, 2013 12:06 pm

I hope this helps somebody. This has been tested on v1.5.5.1

Steps:
1. Create a new Layout at admin > system > design > layout and name it 'All Pages'

2. On catalog > model > design > layout.php, add the ff:

Code: Select all

public function getLayoutForAllPages()
{
	$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "layout
		WHERE name like '%all pages%'
		LIMIT 1");

	if ($query->num_rows) {
		return $query->row['layout_id'];
	} else {
		return 0;
	}
}
3. There are four default positions - column_left, column_right, content_top and content_bottom. We need to edit the controller files for those positions in the catalog.

Here are the steps for the column left position

a. open /catalog/controller/common/column_left.php:

b. look for

Code: Select all

$module_data = array();
in the index function (at line 39) and add this before that line:

Code: Select all

$all_pages_layout_id = $this->model_design_layout->getLayoutForAllPages();
c. look for

Code: Select all

if ($module['layout_id'] == $layout_id && $module['position'] == 'column_left' && $module['status']) {
(line 50) and replace it with this line:

Code: Select all

if (($module['layout_id'] == $layout_id || $module['layout_id'] == $all_pages_layout_id) && $module['position'] == 'column_left' && $module['status']) {
Do the same steps for the other three positions.

4. Go to admin > extension > modules, select the module you want to display on all pages and set the Layout to 'All Pages' .

Attached is the vqmod for all code changes

Attachments

Show module on all pages vqmod


Newbie

Posts

Joined
Thu Jun 13, 2013 11:41 am

Post by acesfp » Sun Jun 30, 2013 4:10 am

will try your method in another opencart site, thanks for your share!

Fiber Optic Transceiver
Optical Transceiver Modules


Newbie

Posts

Joined
Sun Jun 30, 2013 3:36 am
Location - HK

Post by nnnhi » Sat Jul 13, 2013 11:56 pm

it may works for version 1.5.4.1 non vay your

thiết bị nghe lén giá rẻ . Tượng mẫu Hữu Tuấn Ban manocanh và Điện tử 9x bán các loại Máy nghe lén siêu nhỏ


Newbie

Posts

Joined
Mon Mar 18, 2013 1:04 pm

Post by tora » Mon Jul 15, 2013 9:25 pm

ryan_pl wrote:I hope this helps somebody. This has been tested on v1.5.5.1
......
Thanks for sharing this useful bit of code. Do you know how to make it work separately for multi-store?
Currently it works on all pages regardless of the store. What I want to achieve is have a separate "all pages" layout for each store. With other layouts, we can use the layouts for each store by using different routes. Any idea on how to do this for all pages?

New member

Posts

Joined
Mon Apr 02, 2012 3:17 pm

Post by rajithg » Sat Jul 20, 2013 8:24 pm

perfect solution.. We too checked your solution on v1.5.5.1 and its working smoothly.. 8) 8)

New member

Posts

Joined
Tue Mar 27, 2012 11:28 am

Post by dariogene » Fri Aug 02, 2013 8:01 pm

Thanks for sharing this code, really useful and should be a native feature.
I'm using 1.5.4 and to get it to work, you have to make sure that the LIKE string (e.g. "All Pages") in the query matches the name you give the layout in the admin i.e. it is case sensitive.

Newbie

Posts

Joined
Fri Feb 08, 2013 10:32 pm

Post by yapjj1214 » Tue Aug 20, 2013 9:51 pm

Hi, I tested this but I failed. Is the vqmod essential? I installed vqmod and added the xml but still failed. Is it I need to reinstall vqmod?

Newbie

Posts

Joined
Tue Aug 20, 2013 9:44 pm

Post by fabius » Mon Sep 09, 2013 1:54 am

works perfect on oc 1.5.5.1, why don't you publish this solution in the extensions section?

Newbie

Posts

Joined
Mon Sep 09, 2013 1:51 am

Post by thazer » Sat Nov 16, 2013 8:53 pm

Work's perfectly on Opencart 1.5.1.3 (i've tested the manual version, not the VQmod, but they are the same) with only one issue: You must add the layout with lowercase on PHP 5.3 as 'all pages' is not exactly like "All Pages" (as you pointed out in the post).

Anyways - THANK YOU!

Newbie

Posts

Joined
Thu Apr 05, 2012 5:33 am

Post by bevang » Sun Nov 17, 2013 7:49 pm

I registered just for this post to thank you so much for this. Saved me sooo much time. Appreciate the effort to write up your solution. I can't believe it's not a standard feature for such a common site design!

Newbie

Posts

Joined
Sun Nov 17, 2013 7:46 pm

Post by bevang » Sun Jan 12, 2014 5:14 pm

For anyone reading this, is there a way to have a module show on all pages except the home page? I've tried playing around with the 'if' statement in the column_right, left, top, bottom with no luck. Also tried editing home.tpl but it doesn't recognise the $all_pages_layout_id variable.

Newbie

Posts

Joined
Sun Nov 17, 2013 7:46 pm

Post by sunsys » Sat Feb 14, 2015 5:28 pm

@bevang,

Sir will this xml work with OC-1.5.6.4

TY

Regards,
Sun Systems
Industrial Electronics and Instrumentation


User avatar
Active Member

Posts

Joined
Tue Jan 27, 2015 5:19 am

Post by Erielama » Tue Mar 17, 2020 2:35 pm

Someone please share how to do this in V 3.0.3.2

Newbie

Posts

Joined
Wed Mar 11, 2020 6:17 pm

Post by IP_CAM » Thu Mar 19, 2020 11:28 pm


Please don't send me OC Forum Personal Messages, just contact: jti@jacob.ch
---
OC 1.5.6.5 LIGHT Test Site: http://www.bigmax.ch/shop/
OC 1.5.6.5 V-PRO Test Site: http://www.openshop.li/shop/
My Github OC Site: https://github.com/IP-CAM
2'600+ FREE OC Extensions on the World's largest Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by joanneli » Thu Oct 15, 2020 2:20 pm

Hiiii,

Do you know how to make it work separately for multi-store?
Thanks for sharing this bit code. krogereschedule

Newbie

Posts

Joined
Thu Oct 15, 2020 2:16 pm
Who is online

Users browsing this forum: No registered users and 5 guests