Zen Cart Logo
Forums / Addon Sideboxes / Put A Zc Sidebox On A Page Outside Zc?

Put A Zc Sidebox On A Page Outside Zc?

Views: 21,138

Results 1 to 20 of 68
14 Apr 2006, 9:02 PM
#1
dbrewster avatar

dbrewster

Zen Follower

Join Date:
Jul 2005
Location:
Charlottesville, VA
Posts:
376
Plugin Contributions:
0

Put A Zc Sidebox On A Page Outside Zc?

Hi,

I tried searching but could not formulate a productive set of keywords.

I'd like to put the ZC Featured box on an HTML web page that is outside of my ZC store. The rest of my website is hosted on the same server, in a directory at the same level as my store.

Anyone recall seeing a discussion about doing this, and what keywords I should try to find it?

Thanks!

---Diana

14 Apr 2006, 9:19 PM
#2
borzoid avatar

borzoid

Totally Zenned

Join Date:
Feb 2004
Location:
Michigan
Posts:
589
Plugin Contributions:
1

Re: Put A Zc Sidebox On A Page Outside Zc?

Hi dbrewster,

I've done this before using an Iframe. Make a new page with just your sidebox on it and then call that page into an Iframe on the html page.

Just be aware that search engine spiders hate iframes and won't spider their content. I did this for a while when I first started out and then moved everything into Zen Cart. Made life so much easier.

Connie

17 Apr 2006, 2:08 PM
#3
dbrewster avatar

dbrewster

Zen Follower

Join Date:
Jul 2005
Location:
Charlottesville, VA
Posts:
376
Plugin Contributions:
0

Re: Put A Zc Sidebox On A Page Outside Zc?

Thanks very much for the tip, Connie.

(I think your website is beautifully customized,.)

17 Apr 2006, 11:21 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Put A Zc Sidebox On A Page Outside Zc?

Here's one approach to do it from .php pages within your own website. (This was built based on a Zen Cart v1.3.0 setup):

Create a file like this (I called it single_sidebox.php) in the root of your store area (ie: same place as index.php and ipn_main_handler.php etc):```php

<?php /** * single_sidebox.php used to display a Zen Cart sidebox on some external resource * * @package general * @copyright Copyright 2003-2006 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: single_sidebox.php based on index.php 2942 2006-02-02 04:41:23Z drbyte $ */ /** * Load common library stuff */ require('includes/application_top.php'); /** * PLEASE ENTER THE NAME OF THE SIDEBOX YOU WANT TO CALL HERE: */ $sidebox_name = 'featured.php'; //which sidebox template to use: $column_box_default='tpl_box_default_left.php'; $column_width = BOX_WIDTH_LEFT; /** * Load required functions and processing to generate the sidebox: */ $language_page_directory = DIR_WS_LANGUAGES . $_SESSION['language'] . '/'; $box_id = zen_get_box_id($sidebox_name); if ( file_exists(DIR_WS_MODULES . 'sideboxes/' . $template_dir . '/' . $sidebox_name) ) { require(DIR_WS_MODULES . 'sideboxes/' . $template_dir . '/' . $sidebox_name); } else { require(DIR_WS_MODULES . 'sideboxes/' . $sidebox_name); } /** * Load general code which runs before page closes */ require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

To use, on line 21 change "featured.php" to the name of the sidebox file you want displayed (see /includes/modules/sideboxes for the list).

Then do a **<?php require ('single_sidebox.php'); ?>** from the page you want the sidebox to appear on. (Your page will have to be a .php script or the <?php tags will simply display as-is, and not execute anything.)


**UPDATE:  This code has been updated and packaged for download in the contributions area:**
<http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=79>
17 Apr 2006, 11:26 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Put A Zc Sidebox On A Page Outside Zc?

Here's another approach, which may work, and was framed prior to Zen Cart v1.3.0:

http://www.zen-cart.com/forum/showthread.php?t=26952

18 Apr 2006, 2:00 PM
#6
dbrewster avatar

dbrewster

Zen Follower

Join Date:
Jul 2005
Location:
Charlottesville, VA
Posts:
376
Plugin Contributions:
0

Re: Put A Zc Sidebox On A Page Outside Zc?

Dr. Byte,

Fantastic!

Why couldn't this be called as a PHP scripted region within an HTML page?

---Diana

19 Apr 2006, 8:28 AM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Put A Zc Sidebox On A Page Outside Zc?

dbrewster:

Why couldn't this be called as a PHP scripted region within an HTML page?
You need a way to tell your server's HTML parser to execute the PHP code, rather than simply display it.

3 Jul 2006, 12:22 AM
#8
mz_rich avatar

mz_rich

New Zenner

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

Re: Put A Zc Sidebox On A Page Outside Zc?

i have done this on one of my pages, however, the links are fine they go to the correct place, but the product image is set from where the single_sidebox.php file is called from, ie a different domain.
is there a way to hard-code the beginning of the url into the product image so it loads correctly?

thanks

rich

20 Jul 2006, 7:51 PM
#10
zblofu avatar

zblofu

New Zenner

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

Re: Put A Zc Sidebox On A Page Outside Zc?

Thanks for the code! I have been looking for something like this for awhile.

Your code works perfectly for all the sideboxes I tested except the shopping_cart.php sidebox. I realize there maybe additional issues with this particular sidebox but i would love to get it to work. Can you think of an easy way to get the shopping cart box to work?

Thanks again I really appreciate it and let me know if you need more detail.

  • zblofu
4 Aug 2006, 3:56 AM
#11
tinas avatar

tinas

Totally Zenned

Join Date:
Jan 2005
Location:
Lake Havasu, AZ
Posts:
1,090
Plugin Contributions:
0

Re: Put A Zc Sidebox On A Page Outside Zc?

Dr. Byte - I have a question about this.

Does this mod work if I put the external page inside a folder ?

What i am trying to accomplish is a vbulletin template which looks like it is "in" the store but is actually in a sub directory. The client only uses 3 sideboxes at all on their site, categories, information, and more information. I am assuming I can rename this file 3 times to call the three boxes, but I want to know if calling it from within a sub directory rather than a root directory is going to work.

Thanks muchly :D

4 Aug 2006, 4:22 AM
#12
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Put A Zc Sidebox On A Page Outside Zc?

Calling from a subdirectory is very complicated ... others have posted notes saying they had trouble doing that. I haven't had time to look at it in enough detail to find the solution for that.

Using it three times is not a problem.

4 Aug 2006, 4:32 AM
#13
tinas avatar

tinas

Totally Zenned

Join Date:
Jan 2005
Location:
Lake Havasu, AZ
Posts:
1,090
Plugin Contributions:
0

Re: Put A Zc Sidebox On A Page Outside Zc?

Well then I guess I will play guinea pig on this one :)

Thanks - will let you know if I get it to work.

15 Aug 2006, 8:42 PM
#14
jla avatar

jla

Zen Follower

Join Date:
Jul 2005
Posts:
128
Plugin Contributions:
0

Re: Put A Zc Sidebox On A Page Outside Zc?

We did this and it seems to work with one exception

We have placed the php call code on a website on another domain

The side box is generated and the URLS are correct but the IMAGES/IMAGE urls are not showing up correct

When looking at the image properties, they are showing the other domain as the place where the image files are located at instead of our store domain.

Anyway to fix this?

Thanks

15 Aug 2006, 10:27 PM
#15
jla avatar

jla

Zen Follower

Join Date:
Jul 2005
Posts:
128
Plugin Contributions:
0

Re: Put A Zc Sidebox On A Page Outside Zc?

DrByte:

Here's one approach to do it from .php pages within your own website. (This was built based on a Zen Cart v1.3.0 setup):

Create a file like this (I called it single_sidebox.php) in the root of your store area (ie: same place as index.php and ipn_main_handler.php etc):```php

<?php /** * single_sidebox.php used to display a Zen Cart sidebox on some external resource * * @package general * @copyright Copyright 2003-2006 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: single_sidebox.php based on index.php 2942 2006-02-02 04:41:23Z drbyte $ */ /** * Load common library stuff */ require('includes/application_top.php'); /** * PLEASE ENTER THE NAME OF THE SIDEBOX YOU WANT TO CALL HERE: */ $sidebox_name = 'featured.php'; //which sidebox template to use: $column_box_default='tpl_box_default_left.php'; $column_width = BOX_WIDTH_LEFT; /** * Load required functions and processing to generate the sidebox: */ $language_page_directory = DIR_WS_LANGUAGES . $_SESSION['language'] . '/'; $box_id = zen_get_box_id($sidebox_name); if ( file_exists(DIR_WS_MODULES . 'sideboxes/' . $template_dir . '/' . $sidebox_name) ) { require(DIR_WS_MODULES . 'sideboxes/' . $template_dir . '/' . $sidebox_name); } else { require(DIR_WS_MODULES . 'sideboxes/' . $sidebox_name); } /** * Load general code which runs before page closes */ require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
> 
> To use, on line 21 change "featured.php" to the name of the sidebox file you want displayed (see /includes/modules/sideboxes for the list).
> 
> Then do a **<?php require ('single_sidebox.php'); ?>** from the page you want the sidebox to appear on. (Your page will have to be a .php script or the <?php tags will simply display as-is, and not execute anything.)



Ok, tried this again - was able to solve the main image problem by just mapping a virtual directory to the image folder where Zen is located, but the box graphics still do not show up and the formatting is a bit off - due to the lack of proper CSS mapping.

The BIGGEST problem with this is that when running this one thing on another page it makes the page query time go to 10 to 12 seconds (from about 1 second or less)

It appears to be taking a LONG time for this thing to run the query.  Any ideas why?
16 Aug 2006, 2:56 AM
#16
jla avatar

jla

Zen Follower

Join Date:
Jul 2005
Posts:
128
Plugin Contributions:
0

Re: Put A Zc Sidebox On A Page Outside Zc?

Ok, we finally figured the majority of this out

We place two side boxes on our site

http://www.jlaforums.com

One is on the right hand side after you scroll down which displays random new products and the other is further down on the left which displays random featured products.

We also have a text link in the 468 banner at in the header of the page.

Now we need to figure out how to display multiple items in these boxes as well as reduce the picture size even smaller for banner adds

We also custom formatted the boxes as well.

With this new code, you could display product boxes for your store on any website on the internet with a small snip of code

Great mod...Thanks

16 Aug 2006, 2:57 AM
#17
jla avatar

jla

Zen Follower

Join Date:
Jul 2005
Posts:
128
Plugin Contributions:
0

Re: Put A Zc Sidebox On A Page Outside Zc?

Oh, figured out what the lag was. Had the convert IP to hostname turned on. Once we turned that off, it runs much quicker.

12 Nov 2006, 11:24 PM
#18
mz_rich avatar

mz_rich

New Zenner

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

Re: Put A Zc Sidebox On A Page Outside Zc?

JLA:

With this new code, you could display product boxes for your store on any website on the internet with a small snip of code

whats the extra bit of code?

thanks

rich

27 Mar 2007, 10:19 AM
#19
mattkevan avatar

mattkevan

New Zenner

Join Date:
Mar 2007
Posts:
3
Plugin Contributions:
0

Re: Put A Zc Sidebox On A Page Outside Zc?

Hi,
I want to put multiple sideboxes on my custom index.php page using the single_sidebox.php method.

I've got the first sidebox working fine, but when I try and add a second one using a renamed version of single_sidebox.php, I just get the following error:

Fatal error: Cannot redeclare class base in /home/t/h/theillustration/public_html/includes/classes/class.base.php on line 17

Does anyone know what this means – and how can I get rid of it?
Ideally I want to put five different sideboxes on the index page.

Many thanks

15 Apr 2007, 10:05 AM
#20
figster avatar

figster

New Zenner

Join Date:
Feb 2006
Posts:
85
Plugin Contributions:
0

Re: Put A Zc Sidebox On A Page Outside Zc?

I am trying this, I get most of the box just below theses errors:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home2/bigjim/public_html/HotStuffLeatherandLaceMediaPage.php:8) in /home2/bigjim/public_html/includes/functions/sessions.php on line 108

Warning: Cannot modify header information - headers already sent by (output started at /home2/bigjim/public_html/HotStuffLeatherandLaceMediaPage.php:8) in /home2/bigjim/public_html/includes/init_includes/init_templates.php on line 78

Any idea what I did wrong?

Thanks,