Zen Cart Logo
Forums / Addon Sideboxes / How To Create Your Own sidebox in v1.3.x

How To Create Your Own sidebox in v1.3.x

Views: 5,187

Results 1 to 18 of 18
30 Mar 2010, 3:19 AM
#1
madpricersales avatar

madpricersales

New Zenner

Join Date:
Jul 2006
Posts:
60
Plugin Contributions:
0

How To Create Your Own sidebox in v1.3.x

A sidebox consists of three files, which are located in the includes directory:

  1. modules/sideboxes/custom/name_of_sidebox.php
  2. languages/english/extra_definitions/custom/
    name_of_sidebox_defines.php
  3. templates/custom/sideboxes/tpl_name_of_sidebox.php
    You need to replace custom and name_of_sidebox with your template name and the sidebox name respectively.
    For example, let us build a sidebox named my_sidebox. Then, my_sidebox.php file will read like this:

<?php $show_my_sidebox = true; if ($show_my_sidebox == true){ require($template->get_template_dir('tpl_my_sidebox.php', DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_my_sidebox.php'); $title = BOX_HEADING_MY_SIDEBOX; $left_corner = false; $right_corner = false; $right_arrow = false; require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default); } ?>

This page actually defines what is to be shown in that sidebox. Note that this page also includes the corresponding template file. Here, we have used a constant BOX_HEADING_MY_SIDEBOX.

You need to define this in the includes/languages/english/extra_definitions/custom/my_sidebox_defines.php file. This file will look like this:


<?php define('BOX_HEADING_MY_SIDEBOX', 'My Sidebox'); ?>

Now, you have to build its template file includes/templates/custom/sideboxes/tpl_my_sidebox.php
which will read as:


<?php $content = "This is my first Sidebox. I have created it in 5 minutes. Although it is not of practical use yet, I hope I can eventually build a good sidebox."; ?>

NOTE: Remember to replace custom with your over rides template name. And Remember to place them in the right folder paths. PLease comment if this helped you. I will post more on other features later.

30 Mar 2010, 3:29 AM
#2
schoolboy avatar

schoolboy

Totally Zenned

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

Re: How To Create Your Own sidebox in v1.3.x

... or you could just go HERE

30 Mar 2010, 3:36 AM
#3
madpricersales avatar

madpricersales

New Zenner

Join Date:
Jul 2006
Posts:
60
Plugin Contributions:
0

Re: How To Create Your Own sidebox in v1.3.x

schoolboy:

... or you could just go HERE

Yes you could, but doing it yourself will help you to see how the php code works. Learning by doing. Plus will allow you to see how the overrides work.

30 Mar 2010, 4:10 AM
#4
schoolboy avatar

schoolboy

Totally Zenned

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

Re: How To Create Your Own sidebox in v1.3.x

I'm not an airline pilot, so if I want to go to New York from London, I buy an air ticket... I don't train to be a pilot.

There may be some merit in the "tutorial" aspect of what you are suggesting, but why re-invent the wheel?

30 Mar 2010, 4:58 AM
#5
gjh42 avatar

gjh42

Black Belt

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

Re: How To Create Your Own sidebox in v1.3.x

If you do want to build the files yourself, you should leave out the

$left_corner = false;
$right_corner = false;
$right_arrow = false;

as these are from a very old version of the sidebox and not actually used for anything in the current version of Zen Cart.

22 Apr 2010, 9:49 PM
#6
monkeytown avatar

monkeytown

New Zenner

Join Date:
Nov 2007
Posts:
78
Plugin Contributions:
0

Re: How To Create Your Own sidebox in v1.3.x

Actually, I find this board to be helpful, just what I was looking for. Thanks.

17 May 2010, 1:29 PM
#7
pdiamond avatar

pdiamond

New Zenner

Join Date:
May 2010
Posts:
18
Plugin Contributions:
0

Re: How To Create Your Own sidebox in v1.3.x

Yes good info. This also gives me the info to modify existing sideboxes in a way as now I know how they actually work.. Thanks for the thread..:clap:

19 May 2010, 8:03 PM
#8
iluvedancin avatar

iluvedancin

New Zenner

Join Date:
Nov 2009
Location:
england
Posts:
36
Plugin Contributions:
0

Re: How To Create Your Own sidebox in v1.3.x

Hi there

I so far have been able to follow your thorough and clear instructions and the sidebox is now in my admin panel. I am stuck however on what to do next because I have created a menu using coffecup, which is in text/javascript form and I am not quite sure where I should put this code instead of having the normal catagories sidebox, are you able to advise at all?

Many thanks in advance.

Claire :)

19 May 2010, 8:52 PM
#9
gjh42 avatar

gjh42

Black Belt

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

Re: How To Create Your Own sidebox in v1.3.x

You might try searching the forum for info on using javascript in sideboxes.
What are you trying to achieve with your custom categories-type menu? Unless you have integrated the PHP logic that builds it from the database, your hard-coded menu will be static and need to be edited manually every time a category changes.
There are existing mods in Free Addons for a number of common category menu arrangements.

21 May 2010, 3:17 PM
#10
hitcher avatar

hitcher

New Zenner

Join Date:
May 2010
Posts:
4
Plugin Contributions:
0

Re: How To Create Your Own sidebox in v1.3.x

Hi, is there a way to build multiple sideboxes that will display different EZ page links in each box? Or is there another way of achieving it? My intentions are to have different groups of static page links in different boxes if it is possible at all. I also would be setting different heading names for each box.

Thanks.

16 Jun 2010, 2:10 PM
#11
ardhill avatar

ardhill

New Zenner

Join Date:
Dec 2007
Location:
Belfast, N.Ireland
Posts:
99
Plugin Contributions:
0

Re: How To Create Your Own sidebox in v1.3.x

Actually, I think it's a good idea to explain the workings of parts of zen cart. It helps when customising your site to see how it works.

I would love to see the various aspects of Zen cart broken down in an easy to understand format - maybe in the wiki.

Just a couple of points I would add to your break down:

Not all side boxes use the following file:
/languages/english/extra_definitions/custom/name_of_sidebox_defines.php

Some boxes have the box title name specified in:
\includes\languages\custom_template\english.php

Paul

17 Jun 2010, 1:53 AM
#12
gjh42 avatar

gjh42

Black Belt

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

Re: How To Create Your Own sidebox in v1.3.x

Standard sideboxes may have their names specified in english.php; any new custom sideboxes should use a file in extra_definitions for clarity of identifying what is new.

4 Oct 2010, 3:58 PM
#13
cybeme avatar

cybeme

New Zenner

Join Date:
Oct 2010
Posts:
2
Plugin Contributions:
0

Re: How To Create Your Own sidebox in v1.3.x

thanks so much for this information, it works perfectly and it was so easy to work through the simple and straightforward instructions, much easier to use and much more educational than the other sidebox download.
cheers

24 Feb 2011, 7:15 PM
#14
luciano9876 avatar

luciano9876

New Zenner

Join Date:
Jan 2011
Posts:
26
Plugin Contributions:
0

Re: How To Create Your Own sidebox in v1.3.x

I like it! Instead of adding a box with searching for prices, I was able to adapt my categories box and put the price search inthere!

Thanks!:clap:

13 Mar 2011, 8:19 PM
#15
sstewart avatar

sstewart

New Zenner

Join Date:
Feb 2011
Posts:
5
Plugin Contributions:
0

Re: How To Create Your Own sidebox in v1.3.x

I am using v 1.3.9h. I am trying to create a sidebox using the same data as the "Manufacturer" sidebox. I created a new english.php and put it into my includes/languages/english/pure_green/english.php. Please let me know if I have added too many or any suggestions.

I created a file for extra_definitions:
includes/languages/english/extra_definitions/pure_green/health_concerns_defines.php. I used the code in this thread. Does this need to be done or does it mess things up by a duplication in english.php?

I will appreciate any help on getting it completed.

Changes were:

Existing:

// manufacturers box text in sideboxes/manufacturers.php

define('BOX_HEADING_MANUFACTURERS', 'Manufacturers');

**Added: **

// manufacturers box text in sideboxes/health_concerns.php

define('BOX_HEADING_HEALTH_CONCERNS', 'Shop by Health Concern');

Existing:

// manufacturer box text

define('BOX_HEADING_MANUFACTURER_INFO', 'Manufacturer Info');

define('BOX_MANUFACTURER_INFO_HOMEPAGE', '%s Homepage');

define('BOX_MANUFACTURER_INFO_OTHER_PRODUCTS', 'Other products');

Added:

// health_concerns box text

define('BOX_HEADING_HEALTH_CONCERNS_INFO', 'Health Concerns Info');

define('BOX_HEALTH_CONCERNS_INFO_HOMEPAGE', '%s Homepage');

define('BOX_HEALTH_CONCERNS_INFO_OTHER_PRODUCTS', 'Other products');

Existing:

// boxes defines

define('PULL_DOWN_ALL','Please Select');

define('PULL_DOWN_MANUFACTURERS','- Reset -');

Added:

// boxes defines

define('PULL_DOWN_ALL','Please Select');

define('PULL_DOWN_HEALTH_CONCERNS','- Reset -');


I also copies a file and made changes to any references of manufacturers to "health_concerns". The file I copies was:

includes/templates/pure_green/sideboxes/tpl_manufacturers_select.php.


The end result of all my changes:

Layout Boxes Controller - OK
Try to Preview - Error message:

1146 Table 'rem1106609263720.TABLE_HEALTH_CONCERNS' doesn't exist
in:
[select m.health_concerns_id, m.health_concerns_name from TABLE_HEALTH_CONCERNS m order by health_concerns_name]


14 Mar 2011, 1:48 AM
#16
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How To Create Your Own sidebox in v1.3.x

Did you create a new database table for this sidebox?

That database table would hold the data that the sidebox you are modeling after uses ...

Manufacturers sidebox uses the tables:
manufacturers
manufacturers_info

for gathering all of the information about Manufacturers ...

What are you doing with the Health Concerns sidebox? Are you trying to add new database tables to hold information that you later want to display in this new sidebox?

Or, did you perhaps select a sidebox to model that does not really match what you are trying to do? :unsure:

14 Mar 2011, 1:19 PM
#17
sstewart avatar

sstewart

New Zenner

Join Date:
Feb 2011
Posts:
5
Plugin Contributions:
0

Re: How To Create Your Own sidebox in v1.3.x

Perhaps I have not selected the best sidebox to model. I want to list the top 5 health concerns in the box with another link to a page with a listing of all health concerns.
The link from one of the top 5 would search the database for products that match the health concern ie. acne. This is my first attempt at a shopping cart other than using the PayPal cart. I am open to any suggestions.

I thought I was creating the database table when creating and copying the file from Manufacturers:

Existing:

// manufacturer box text

define('BOX_HEADING_MANUFACTURER_INFO', 'Manufacturer Info');

define('BOX_MANUFACTURER_INFO_HOMEPAGE', '%s Homepage');

define('BOX_MANUFACTURER_INFO_OTHER_PRODUCTS', 'Other products');

Added:

// health_concerns box text

define('BOX_HEADING_HEALTH_CONCERNS_INFO', 'Health Concerns Info');

define('BOX_HEALTH_CONCERNS_INFO_HOMEPAGE', '%s Homepage');

define('BOX_HEALTH_CONCERNS_INFO_OTHER_PRODUCTS', 'Other products');

14 Mar 2011, 1:49 PM
#18
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How To Create Your Own sidebox in v1.3.x

Probably a better choice might be either the More Information or Information boxes as they have links in them that could help you make your new links ...