Forums / All Other Contributions/Addons / Editable Home Page Centerboxes [Support]

Editable Home Page Centerboxes [Support]

Views: 50,593

Results 141 to 160 of 347
8 Jan 2012, 2:08 AM
#141
gjh42 avatar

gjh42

Black Belt

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

Editable Home Page Centerboxes [Support]

Then it would seem to be a valuable feature to add the ability to select positions independently:)
I haven't looked at the controlling code myself to know how big of a job that would be.

8 Jan 2012, 5:10 AM
#142
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Editable Home Page Centerboxes [Support]

gjh42:

Then it would seem to be a valuable feature to add the ability to select positions independently:)
I haven't looked at the controlling code myself to know how big of a job that would be.
LOL well seeing that you wrote the current controlling code.. :laugh: But yes.. I agree.. Though in my defense I had not considered this as I was trying to solve a very specific layout need.. :blush: (not that I would know how to code the feature in anyway..)

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

8 Jan 2012, 5:18 PM
#143
gjh42 avatar

gjh42

Black Belt

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

Re: Editable Home Page Centerboxes [Support]

Hmm... I had forgotten exactly which part of the code I had had a hand in:) Well then, I suppose I can have a look at it when I get time and see what it would involve. I didn't have anything to do with admin files, though.

8 Jan 2012, 9:02 PM
#144
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Editable Home Page Centerboxes [Support]

gjh42:

Hmm... I had forgotten exactly which part of the code I had had a hand in:) Well then, I suppose I can have a look at it when I get time and see what it would involve. I didn't have anything to do with admin files, though.You had a VERY instrumental hand in the current version sir (still grateful to you for that too..:smile:)

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

10 Jan 2012, 3:10 AM
#145
gjh42 avatar

gjh42

Black Belt

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

Re: Editable Home Page Centerboxes [Support]

When first looking at the workings of this mod, I had in mind allowing individualized middlebox control, though I would have done it by defines rather than admin settings. I didn't pursue it at that time.

With this challenge, I have poked into admin configuration settings for the first time (learning something about how they work along the way), and have a package of alterations that I think will do the job when applied in full to the files.
install_middleboxes.sql ```php
//install_middleboxes.sql

SET @mid4=0;
SELECT (@mid4:=configuration_group_id) as mid4
FROM configuration_group
WHERE configuration_group_title= 'Editable Centerboxes';
DELETE FROM configuration WHERE configuration_group_id = @mid4;
DELETE FROM configuration_group WHERE configuration_group_id = @mid4;

INSERT INTO configuration_group VALUES (NULL, 'Editable Centerboxes', 'Settings for Editable Centerboxes', '100', '1');
UPDATE configuration_group SET sort_order = last_insert_id() WHERE configuration_group_id = last_insert_id();
SET @mid4=0;
SELECT (@mid4:=configuration_group_id) as mid4
FROM configuration_group
WHERE configuration_group_title= 'Editable Centerboxes';
/MIDDLEBOX_QTY becomes obsolete/
/INSERT INTO configuration VALUES (NULL, 'Middleboxes - Number to Display', 'MIDDLEBOX_QTY', '3', 'Define the number of middleboxes to display. The module comes with 9 middleboxes.', @mid4, 49, now(), now(), NULL, 'zen_cfg_select_option(array(''1'', ''2'', ''3'', ''4'', ''5'', ''6'', ''7'', ''8'', ''9''), ');
INSERT INTO configuration VALUES (NULL, 'Middleboxes - Position', 'MIDDLEBOX_POSITION', '0', 'Positioning options for the middleboxes.<br /><br /> 0=Off<br /><br />Above or Below the <strong>Main Page Define</strong> content.<br /><small><em>If the Main Page Define content is set to not display, the Above or Below Main Page Define options yield the same result.</em></small><br />1=Above Main Page Define content<br />2=Below Main Page Define content<br />3=Below <em>New, Specials, Featured</em> etc. centerboxes<br /><br />If you set <strong>Categories - Always Show on Main Page</strong> to <strong>Yes</strong>. <br /><small><em>If the Main Page Define content is set to not display, the Above or Below Main Page Define options yield the same result.</em></small><br />4=Above Main Page Define content and Categories<br />5=Between Main Page Define content and Categories<br />6=Below Categories<br />7=Below Categories and <em>New, Specials, Featured</em> etc. centerboxes', @mid4, 49, now(), now(), NULL, 'zen_cfg_select_option(array(''0'', ''1'', ''2'', ''3'', ''4'', ''5'', ''6'', ''7''), ');
/
/allow middleboxes on internal category listings if desired/
INSERT INTO configuration VALUES (NULL, 'Middleboxes - Homepage Only?', 'MIDDLEBOX_HOME', '1', 'Display middleboxes on homepage only, or allow to display on internal categories pages?', @mid4, 49, now(), now(), NULL, 'zen_cfg_select_option(array(''0'', ''1''), ');
INSERT INTO configuration VALUES (NULL, 'Middlebox 1 - Position', 'MIDDLEBOX_NUMBER_1', '0', 'Location to display middlebox 1.<br /><br /> 0=Off<br /><br />Above or Below the <strong>Main Page Define</strong> content.<br /><small><em>If the Main Page Define content is set to not display, the Above or Below Main Page Define options yield the same result.</em></small><br />1=Above Main Page Define content<br />2=Below Main Page Define content<br />3=Below <em>New, Specials, Featured</em> etc. centerboxes<br /><br />If you set <strong>Categories - Always Show on Main Page</strong> to <strong>Yes</strong>. <br /><small><em>If the Main Page Define content is set to not display, the Above or Below Main Page Define options yield the same result.</em></small><br />4=Above Main Page Define content and Categories<br />5=Between Main Page Define content and Categories<br />6=Below Categories<br />7=Below Categories and <em>New, Specials, Featured</em> etc. centerboxes', @mid4, 49, now(), now(), NULL, 'zen_cfg_select_option(array(''0'', ''1'', ''2'', ''3'', ''4'', ''5'', ''6'', ''7''), ');
INSERT INTO configuration VALUES (NULL, 'Middlebox 2 - Position', 'MIDDLEBOX_NUMBER_2', '0', 'Location to display middlebox 2.<br /><br /> 0=Off<br /><br />Above or Below the <strong>Main Page Define</strong> content.<br /><small><em>If the Main Page Define content is set to not display, the Above or Below Main Page Define options yield the same result.</em></small><br />1=Above Main Page Define content<br />2=Below Main Page Define content<br />3=Below <em>New, Specials, Featured</em> etc. centerboxes<br /><br />If you set <strong>Categories - Always Show on Main Page</strong> to <strong>Yes</strong>. <br /><small><em>If the Main Page Define content is set to not display, the Above or Below Main Page Define options yield the same result.</em></small><br />4=Above Main Page Define content and Categories<br />5=Between Main Page Define content and Categories<br />6=Below Categories<br />7=Below Categories and <em>New, Specials, Featured</em> etc. centerboxes', @mid4, 49, now(), now(), NULL, 'zen_cfg_select_option(array(''0'', ''1'', ''2'', ''3'', ''4'', ''5'', ''6'', ''7''), ');
/repeat for 9 middleboxes/

tpl_index_default.php and tpl_index_categories.php ```php
<?php
//test 20120109 - code for tpl_index_default.php and tpl_index_categories.php
//replicate for each location changing == 1 to == 2 etc.
if($this_is_home_page or !MIDDLEBOX_HOME) {//only in tpl_index_categories.php
if (isset($middleboxes_group)) unset $middleboxes_group;
for ($i=1; $i<=9; $i++) {
  if (constant('MIDDLEBOX_NUMBER_' . $i) == 1) $middleboxes_group[] = $i;
}
if (isset($middleboxes_group)) {?>
<!-- Begin Main Page Middleboxes Above Main Page Define -->
<?php
require($template->get_template_dir('tpl_middlebox_controller.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_middlebox_controller.php');
?> 
<!-- End Main Page Middleboxes Above Main Page Define -->
<?php }
}//only in tpl_index_categories.php
//test ?>


<?php if (MIDDLEBOX_POSITION == 1) {//original code for tpl_index_default.php and tpl_index_categories.php ?>
<!-- Begin Main Page Middleboxes Above Main Page Define -->
<?php
if($this_is_home_page) require($template->get_template_dir('tpl_middlebox_controller.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_middlebox_controller.php');
?> 
<!-- End Main Page Middleboxes Above Main Page Define -->
<?php } ?>

/includes/templates/your_template/templates/tpl_middlebox_controller.php ```php

<?php /* * /includes/templates/your_template/templates/tpl_middlebox_controller.php test gjh42 2010-09-20 20120109 */ ?> <div class="navColumnMiddleWrapper"> <?php for($i=1; $i<=sizeof($middleboxes_group); $i++) { $box_no = $middleboxes_group[$i]; ?> <div class="middleBoxContainer" id="middlebox_<?php echo $box_no; ?>"> <h2 class="middleBoxHeading" id="middlebox<?php echo $box_no; ?>Heading"><?php echo constant('BOX_HEADING_MIDDLEBOX' . $box_no); ?></h2> <div class="middleBoxContent" id="middlebox<?php echo $box_no; ?>Content"> <?php require zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', constant('FILENAME_DEFINE_MIDDLEBOX_' . $box_no), 'false');?> </div></div> <?php }//for ?> </div> <br class="clearBoth" /> ``` ```php <?php // in tpl_middlebox_x_default.php, the heading should not be <h1> which will already be on the page, // but <h2> or <h3> like stock centerboxes ?> <h1 id='middlebox_1-heading'><?php echo HEADING_TITLE; ?></h1> <?php /* * /includes/templates/your_template/templates/tpl_middlebox_controller.php test gjh42 2010-09-20 20120109 */ ?> ``` To be honest, I am not clear on the relationship between tpl_middlebox_controller.php and tpl_middlebox_x_default.php, as they appear to produce duplicate content. Are the tpl_middlebox_x_default.php files actually ever active?
10 Jan 2012, 3:29 AM
#146
gjh42 avatar

gjh42

Black Belt

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

Re: Editable Home Page Centerboxes [Support]

This will allow each of nine middleboxes to be activated for one of the seven page positions. If 'Middleboxes - Homepage Only?' is set to 0, positions 4 through 7 would be able to display on internal category listing pages (useful when tpl_index_default is active on the homepage).
The middleboxes active in each position will display in numeric order within that section.

This line and its closing } are only needed in tpl_index_categories.php, since tpl_index_default.php is never used elsewhere than the homepage.

if($this_is_home_page or !MIDDLEBOX_HOME) {//only in tpl_index_categories.php

I have not tested this code, so I would appreciate feedback on how it works when put into the files (and if it doesn't work, we can work on debugging:). Look over the SQL carefully, as I'm not sure I understand it well enough to have edited it correctly.

10 Jan 2012, 3:41 AM
#147
gjh42 avatar

gjh42

Black Belt

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

Re: Editable Home Page Centerboxes [Support]

Something that needs to be confirmed by testing is ```php
if (constant('MIDDLEBOX_NUMBER_' . $i) == 1) $middleboxes_group[] = $i;

10 Jan 2012, 4:25 AM
#148
gjh42 avatar

gjh42

Black Belt

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

Re: Editable Home Page Centerboxes [Support]

Noticed another mistake: This test needs to go from 0 to sizeof -1, as auto-indexed arrays start with item 0.```php
for($i=1; $i<=sizeof($middleboxes_group); $i++) {

```php
for($i=0; $i<=sizeof($middleboxes_group)-1; $i++) {

or ```php
for($i=0; $i<sizeof($middleboxes_group); $i++) {

10 Jan 2012, 4:58 AM
#149
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Editable Home Page Centerboxes [Support]

Eyes crossing.. :laugh: If I have some spare time this weekend, I might be able to test this.. Got three sites I'm working on and a singing gig Saturday night to rehearse for.. So I've got a LOT on my plate.. But I'll do my best.. :smile:

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

30 Jan 2012, 5:41 PM
#150
nu_oro avatar

nu_oro

New Zenner

Join Date:
Oct 2006
Posts:
7
Plugin Contributions:
0

Re: Editable Home Page Centerboxes [Support]

is there an update to this module so it can work with Zen cart 1.5 ?

31 Jan 2012, 11:52 PM
#151
renz avatar

renz

Zen Follower

Join Date:
Jun 2006
Posts:
439
Plugin Contributions:
0

Re: Editable Home Page Centerboxes [Support]

Hi which version can I use on 1.3.8a
Many Thanks
Regards
RR

1 Feb 2012, 5:40 AM
#153
gjh42 avatar

gjh42

Black Belt

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

Re: Editable Home Page Centerboxes [Support]

I have been working on the details of integrating the control improvements into the mod, and have a number of suggestions.

First, a change in the install sql, per swguy's post, to avoid a common mod bug that deletes configuration_group 0 on initial install.

Trimming completely unnecessary files from the package. Several of the files (repeated 9 times) are never used for anything. Some of the files can probably be consolidated into one middlebox_filenames.php and one middlebox_defines.php file.

I will test these changes on my development site when I have time, and will be happy to send you a full set of the proposals if you want to work on them now.

1 Feb 2012, 5:45 AM
#154
renz avatar

renz

Zen Follower

Join Date:
Jun 2006
Posts:
439
Plugin Contributions:
0

Re: Editable Home Page Centerboxes [Support]

gjh42:

Don't use it on v1.3.8a; upgrade to v1.3.9h and use the latest mod version, if you can't upgrade to v1.5.0 now.

Hi thanks for your response, however I am not in a position currently to upgrade, do you have any other suggestions on how I can get some content on the home page below the feautred/speacials etc.
Thanks
RR

1 Feb 2012, 5:49 AM
#155
gjh42 avatar

gjh42

Black Belt

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

Re: Editable Home Page Centerboxes [Support]

It may work on v1.3.8a; I haven't tested it. V1.0 of the mod will definitely work. It is more basic, but should still do the job you want.

1 Feb 2012, 4:02 PM
#156
nu_oro avatar

nu_oro

New Zenner

Join Date:
Oct 2006
Posts:
7
Plugin Contributions:
0

Re: Editable Home Page Centerboxes [Support]

gjh42:

Don't use it on v1.3.8a; upgrade to v1.3.9h and use the latest mod version, if you can't upgrade to v1.5.0 now.

So far this latest version of this MOD hasn't been working on zen cart 1.5 I can find the defines pages, however the options in the admin configurations tab are missing....any help on how to fix this is appreciated :cool:

1 Feb 2012, 4:03 PM
#157
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Editable Home Page Centerboxes [Support]

nu-oro:

So far this latest version of this MOD hasn't been working on zen cart 1.5 I can find the defines pages, however the options in the admin configurations tab are missing....any help on how to fix this is appreciated :cool:
That's because the latest version doesn't WORK with v1.5 of Zen Cart.. If you follow Glenn's posts just above, you'll see he is working on a v1.5 ready version..

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

1 Feb 2012, 4:16 PM
#158
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Editable Home Page Centerboxes [Support]

gjh42:

I have been working on the details of integrating the control improvements into the mod, and have a number of suggestions.I'm glad you are working on this, as the changes you are making to improve this are necessary but a tad over my head to implement.

gjh42:

First, a change in the install sql, per swguy's post, to avoid a common mod bug that deletes configuration_group 0 on initial install.The SQL bug in this mod is truly as a result of "monkey see, monkey do". I copied off of someone else's homework (Fual Slimbox I believe), not knowing at the time that I was copying an error..:wacko:. Won't be making that mistake again.:D

gjh42:

Trimming completely unnecessary files from the package. Several of the files (repeated 9 times) are never used for anything. Some of the files can probably be consolidated into one middlebox_filenames.php and one middlebox_defines.php file.
Some of the files you see in the current version are there because frankly I did not know another way to do this other than what you see executed..:laugh::blush: I assumed that for each editable box, you would need a separate editable defined page.

It was a down and dirty solution for a site I was working on at the time, and I shared it because I thought others might want this kind of functionality as well.. I was trying to replicate a feature available in WordPress where you can create themes with "widgetized areas" located in places other than the sidebar.

I wanted to be able to show/display admin editable content along with specific sideboxes in the center content area of the homepage. I stuck with using defined pages for the centerboxes because I did not know how to get specific sideboxes to appear in the middle content area of the home page and so I used the defined pages instead to "recreate" the sideboxes I wanted to display in the center..

It would be nice if these centerboxes could display specific sideboxes as well as allow for admin editable content. (hint hint..:laugh:)

gjh42:

I will test these changes on my development site when I have time, and will be happy to send you a full set of the proposals if you want to work on them now.I would be very interested in testing the code to if you don't mind sending me a copy.. I'll PM you my e-mail info.

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

1 Feb 2012, 4:34 PM
#159
gjh42 avatar

gjh42

Black Belt

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

Re: Editable Home Page Centerboxes [Support]

The superfluous files may be proper parts of a standard define page, but as the middleboxes are not being used that way, only the files required to allow the Define Pages Editor to handle them are needed here. I'll experiment to see for sure which ones are necessary.

For v1.5.0 compatibility, I am reading mixed signals from those who fully understand admin configurations... "Pages" are supposed to be registered, but there are also comments about using the same (corrected) SQL, presumably for current mod writers to apply. I don't know if this configuration group represents a new page that needs additional handling.
Any file upgrades will be straightforward.

My current code is all contained in one holding file, and still needs to be distributed into individual new and modified files for use.

I think lots of mod writers copied the wrong example - swguy gives a long list of mods that all have the same issue.

1 Feb 2012, 4:53 PM
#160
gjh42 avatar

gjh42

Black Belt

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

Re: Editable Home Page Centerboxes [Support]

The "sideboxes in the center" idea would be great, but I had been thinking that it would require completely different handling. A thought just occurred to me that perhaps the define page file could be written to require/include the desired sidebox module file, which would then use the sidebox tpl_ file... It would probably be necessary to include a bunch of setting statements in the define so that the sidebox believed itself to be in the right environment, and might not be possible without widespread code changes (not practical)... we'll see:)