Forums / Templates, Stylesheets, Page Layout / Display Ez-Page Content in Sidebox

Display Ez-Page Content in Sidebox

Views: 2,187

Results 1 to 13 of 13
26 Dec 2012, 5:19 AM
#1
prymlurg avatar

prymlurg

New Zenner

Join Date:
Oct 2012
Location:
Haysville, Ks
Posts:
13
Plugin Contributions:
0

Display Ez-Page Content in Sidebox

I have created some new sideboxes using the Blank Sidebox Mod to display images. It is working correctly. However, I have to edit the file I created call "page"_sidebox_defines.php in order to change the content. I created specific sideboxes for each of my pages (11). So it's going to be a lot of content editing and uploading. What I would like to do is edit the content through an ez-page.

:blink:What file(s) do I need to edit and how would the line code be written.

The page I am working on is http://prymlurg.com/index.php?main_page=page&id=9 if you would like to see what I'm talking about.

Any help would be appreciated. If there is a thread already out there, I have not been able to find it.

26 Dec 2012, 1:05 PM
#2
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Display Ez-Page Content in Sidebox

PrymlUrg:

I have created some new sideboxes using the Blank Sidebox Mod to display images. It is working correctly. However, I have to edit the file I created call "page"_sidebox_defines.php in order to change the content. I created specific sideboxes for each of my pages (11). So it's going to be a lot of content editing and uploading. What I would like to do is edit the content through an ez-page.

:blink:What file(s) do I need to edit and how would the line code be written.

The page I am working on is http://prymlurg.com/index.php?main_page=page&id=9 if you would like to see what I'm talking about.

Any help would be appreciated. If there is a thread already out there, I have not been able to find it.

Content for EZpages is stored in the database - not in files. So you can't develop an editing function using this resource.

There is no feature available to edit sidebox content through a wysiwyg editor - mainly because sideboxes are not used for the purpose you are using them.

I don't think those unclear and postage-stamp size images do your products any favours. Then you've gone to great lengths to add some ugly image zoom feature. It's all bitty and all over the place and generally messy. You should just use the normal product display features of zencart - much easier - much more effective - and (in truth) much more appealing.

20 years a Zencart User

26 Dec 2012, 1:56 PM
#3
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Display Ez-Page Content in Sidebox

You could copy and adapt the ez-page output code to fit a sidebox, then make an ez-page that is set to not display in any menus, but only called up by this sidebox.

You would first adapt this line from /includes/modules/pages/page/header_php.php:php $var_pageDetails = $db->Execute("select * from " . TABLE_EZPAGES . " where pages_id = " . (int)$ezpage_id ); You might possibly want other lines from that file, depending on exactly how you want to handle the functionality. In the simplest variant, using one sidebox to output one specific ez-page, you would just adapt this line from /includes/templates/template_default/templates/tpl_page_default.php:```php
<div><?php echo $var_pageDetails->fields['pages_html_text']; ?></div>

You might use code like this in your blank sidebox module file:
```php
$side_ezpage_id = 23;//replace 23 with whatever ez-page id you want to display
$sidebox_pageDetails = $db->Execute("select * from " . TABLE_EZPAGES . " where pages_id = " . (int)$side_ezpage_id );
$content .= $sidebox_pageDetails->fields['pages_html_text'];
22 Oct 2014, 5:29 PM
#4
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: Display Ez-Page Content in Sidebox

Hi Glenn,

I am not sure I understood your suggestion, i.e. which code goes where exactly, nevertheless I tried some combination, and needless to say it did not work.

Will you please kindly help me understand it better?
Do I need to edit
/includes/modules/pages/page/header_php.php
and
/includes/templates/template_default/templates/tpl_page_default.php

Do I put the third snip all into the includes/modules/sideboxes/blank_sidebox.php
or do I need to split it, and put some of it in
includes/templates/CUSTOM/sideboxes/tpl_blank_sidebox.php

Thank you

23 Oct 2014, 4:38 AM
#5
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Display Ez-Page Content in Sidebox

Hmm... thinking back two years, and not researching the files again, I believe you would just put the third snippet in the blank_sidebox.php file, adjusted for the ez-page id in question. It would need to be put in the right sequence in that file, so if you post the file as you have it, I could make suggestions.

There would be no editing of existing files.

How did it "not work"? What was the actual result?

23 Oct 2014, 12:42 PM
#6
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: Display Ez-Page Content in Sidebox

Thank you.

gjh42:

How did it "not work"? What was the actual result?

The box is blank, save the title, and other text that I have in the languages extra definitions file.
The page loads fine, no breaking.

I am sure you know it, but in case you need to search for it, blank sidebox has 3 files:
includes/modules/sideboxes/blank_sidebox.php
includes/templates/sideboxes/tpl_blank_sidebox.php
includes/languages/english/extra_definitions/blank_sidebox_defines.php

Here is the code for the includes/modules/sideboxes/blank_sidebox.php I am using:
NOTE - I have renamed, and moved the box out of the sideboxex columns, but tested it as a sidebox as well with same result.

<?php

  $show_evidenza_hp_sidebox = true;

  if ($show_evidenza_hp_sidebox == true) {
	require($template->get_template_dir('tpl_evidenza_hp_sidebox.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_evidenza_hp_sidebox.php');
	$title =  BOX_HEADING_EVIDENZA_HP_SIDEBOX;
	$title_link = false;
	require($template->get_template_dir('tpl_box_header.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_box_header.php');
}

$side_ezpage_id = 16;//replace 23 with whatever ez-page id you want to display
$sidebox_pageDetails = $db->Execute("select * from " . TABLE_EZPAGES . " where pages_id = " . (int)$side_ezpage_id );
$content .= $sidebox_pageDetails->fields['pages_html_text'];

?>

I did try adding the snippet on top of the original code as well, same blank output.

27 Oct 2014, 1:01 AM
#7
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Display Ez-Page Content in Sidebox

What happens if you add a debug line or two?

$content .= ' pre-test '; 
$content .= $sidebox_pageDetails->fields['pages_html_text']; 
$content .= ' post-test '; 
27 Oct 2014, 4:28 PM
#9
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: Display Ez-Page Content in Sidebox

I tried adding the query to includes/modules/pages/page/header_php.php file, and use the code from includes/templates/CUSTOM/templates/tpl_page_default.php to display the content, and I did get some content, but from another ez-page although the ID was set to the one I need!

27 Oct 2014, 7:15 PM
#10
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Display Ez-Page Content in Sidebox

Not sure if this is connected to the "no output" in the sidebox, but your site is in Italian, right? Do you have any mods for multi-language ez-pages, or are you just using the base setup? Multi-language ez-pages uses two db tables, one for basic info and one for content, and this query ```php
$sidebox_pageDetails = $db->Execute("select * from " . TABLE_EZPAGES .

28 Oct 2014, 4:33 PM
#11
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: Display Ez-Page Content in Sidebox

gjh42:

Not sure if this is connected to the "no output" in the sidebox, but your site is in Italian, right?

Good memory! Much better than mine ... I always forget about that.

I don't remember installing specific mod for it, but indeed admin>>tools>>ez-pages has two fields for the content, and the database has two tables: "ezpages", and "ezpages_content"; might be it had been included into the Italian package.

I changed

$sidebox_pageDetails = $db->Execute("select * from " . TABLE_EZPAGES . 

to

$sidebox_pageDetails = $db->Execute("select * from " . TABLE_EZPAGES_CONTENT .

Made a little progress, this time the box is not blank, but it returns the error:
"WARNING: An Error occurred, please refresh the page and try again."
Not loading the rest of the page.

Which is not good, but at least as you noticed it has to do with the language.

I then tried using the query from the modules/pages/page/header_php.php file of the multi-language plugin (http://www.zen-cart.com/downloads.php?do=file&id=36) which is this:

$sidebox_pageDetails = $db->Execute("select e.pages_id, e.page_open_new_window, e.page_is_ssl, e.alt_url, e.alt_url_external, e.header_sort_order, e.sidebox_sort_order, 
                                 e.footer_sort_order, e.toc_sort_order, e.toc_chapter, e.status_header, e.status_sidebox, e.status_footer, status_toc, et.pages_title, 
					             et.pages_html_text 
								 from  " . TABLE_EZPAGES . " e, " . TABLE_EZPAGES_TEXT . " et 
					             where e.pages_id = et.pages_id 
	                             and et.languages_id = '" . (int)$_SESSION['languages_id'] . "' 
						         and e.pages_id = " . (int)$ezpage_id );

And this time I get again the blank box.

28 Oct 2014, 11:35 PM
#12
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Display Ez-Page Content in Sidebox

Be sure you are consistent in constant names. TABLE_EZPAGES_TEXT might not be defined while your site is using TABLE_EZPAGES_CONTENT.

If you get a blank page or an error message, there should be a myDebug file in /logs/ or /cache/ depending on your ZC version.

29 Oct 2014, 6:11 PM
#13
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: Display Ez-Page Content in Sidebox

gjh42:

Be sure you are consistent in constant names. TABLE_EZPAGES_TEXT might not be defined while your site is using TABLE_EZPAGES_CONTENT.

If you get a blank page or an error message, there should be a myDebug file in /logs/ or /cache/ depending on your ZC version.

TABLE_EZPAGES_TEXT seems to be defined, indeed I tried both queries:
$sidebox_pageDetails = $db->Execute("select * from " . TABLE_EZPAGES_CONTENT .
$sidebox_pageDetails = $db->Execute("select * from " . TABLE_EZPAGES_TEXT .

TABLE_EZPAGES_TEXT returns a blank box, whereas TABLE_EZPAGES_CONTENT returns this error (from the log)

PHP Fatal error:  1146:Table 'prefix_zc151.TABLE_EZPAGES_CONTENT' doesn't exist :: select * from TABLE_EZPAGES_CONTENT where pages_id = 16 in /home/public_html/includes/classes/db/mysql/query_factory.php on line 120

Like said in previous post the query from the multi-language pack also returns blank with no errors in log, using TABLE_EZPAGES_TEXT.

I also tried the following query which does not give errors, but returns blank box

$side_ezpage_id = 16;//replace 23 with whatever ez-page id you want to display
$side_ezlang_id = 2;
$sidebox_pageDetails = $db->Execute("select * from " . TABLE_EZPAGES_TEXT . " where pages_id = " . (int)$side_ezpage_id . " and languages_id = " . (int)$side_ezlang_id );