New Zenner
- Join Date:
- Jun 2007
- Posts:
- 48
- Plugin Contributions:
- 0
Put A Zc Sidebox On A Page Outside Zc?
You're a legend! Thank you so much. I was nearly ripping my hair out. Problem solved. All good and sorted. :clap:Yippee!!!!!!!!!!!!!!!!!!!!!!!
Views: 21,138
New Zenner
You're a legend! Thank you so much. I was nearly ripping my hair out. Problem solved. All good and sorted. :clap:Yippee!!!!!!!!!!!!!!!!!!!!!!!
Sensei
Frankly, IMO, the styles should be inserted in your page's main CSS file, and NOT inside the PHP file used for displaying the sidebox.
New Zenner
I haven't figured out the correct way to change the paths to /boutique in the application b thingy page. Help?
Inactive
For all of you that still haven´t knowing how to insert a sidebox into an excternal page, finally i have had succes calling the Dr. Byte´s single_sidebox.php from an iframe, and all works fine!! Now i only must configure css style.
New Zenner
So there are a few threads about this and none (that I have read) seem to answer the question completely, how can this mod be changed to support adding a sidebox to a page in the directory above the ZC install? I've done it by loading a sidebar via AJAX but would like to avoid a javascript or iframes solution.
Any tips?
New Zenner
i tried the single_sidebox script above. my store is in /store directory so it's one level down. as long as i put the page calling this script in the /store folder i'm ok. but if put the page calling the script outside of the /store folder let's say here
-> '/at_the_top' <-- nothing works.
i assume i understand why. the location of my page has changed and is outside or the /store folder. so that means all the zen cart vars and functions relative to my /store are broken now. i guess they rely on a path that the calling script is from..... something like that (dizzy).
is there any way of tricking the /store/side_box_script.php into thinking it's being called by a document inside of the /store folder? i was playing around with the $_SERVER vars but nothing worked there. i don't think setting my include paths because i'd have to set them for every folder in zen cart and then strip all the extra path stuff of in the requires.
if it's possible is seems like i have to trick this script into thinking the file calling it is in the same folder as the store. is there a way to trick this page?
whew hope i'm clear.
maybe there's another script i can use?
thanks,
tony
Sensei
Just add this at the top of the single_sidebox code quoted earlier:```
$startingDir = getcwd();
$zcDir = realpath(dirname(FILE));
chdir($zcDir);
define('DIR_WS_IMAGES', $zcDir . '/images/');
New Zenner
Hey DrByte, does this fix apply to the issue of putting a sidebox a directory up or does it apply to the image path issues some others were having? is there a way to apply this fix to everything so the sidebox can live a directory up? thanks for your help.
Sensei
instantok:
Hey DrByte, does this fix apply to the issue of putting a sidebox a directory up or does it apply to the image path issues some others were having? is there a way to apply this fix to everything so the sidebox can live a directory up? thanks for your help.
It should address both.
Packaged module including the above extra code can be found here:
http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=79
New Zenner
Thanks DrByte. That works. There was a missing semicolon at the end of line 33 in case anyone is getting that error.
I have it working on a bare bones php page with nothing else on it but for some reason when I include it on a Textpattern page i get an error:
Fatal error: Call to a member function on a non-object in /full/path/removed/for/privacy/shop/includes/classes/db/mysql/query_factory.php on line 105
You've already provided a great help to me so I hate to ask for more, but do you have any ideas as to what sorts of things could be causing the error? I have basic php knowledge but pretty much nothing when it comes to databases.
thanks.
Sensei
instantok:
I have it working on a bare bones php page with nothing else on it but for some reason when I include it on a Textpattern page i get an error:
Fatal error: Call to a member function on a non-object in /full/path/removed/for/privacy/shop/includes/classes/db/mysql/query_factory.php on line 105
...
do you have any ideas as to what sorts of things could be causing the error? I have basic php knowledge but pretty much nothing when it comes to databases.
It's not a database problem. It's likely a PHP variable conflict problem ... I suspect that your Textpattern uses $db as a variable somewhere, which is conflicting with the Zen Cart variables? Or maybe some other path definition is having a conflict.
I'm not sure really, as I don't use Textpattern for anything.
New Zenner
cool. thanks for the ideas. hopefully i can figure out some sort of workaround.
thanks again for all your help.
New Zenner
NO work for me
my file nuevos.php:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<link rel="stylesheet" type="text/css" href="catalogo/includes/templates/classic/css/stylesheet.css" />
</head>
<body>
<?php
$zcSBmodule = 'whats_new.php';
$zcSBlayout = 'left';
require ('catalogo/single_sidebox.php');
?>
</body>
</html>
in action: http://www.creacionesjak.com/nuevos.php
Help??
New Zenner
MZ Rich:
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?
I know there is a new release of the single_sidebox.php since this guy's post -- but I am still having a problem with the images showing up.
http://subliminalscience.com/articles/hypnosis-articles.php
When looking at the properties of the image, it seems to be a bad path.
http://subliminalscience.com/home/content/s/u/b/subliminal1/html/images/inductions-deepenersDVD_cov.jpg
I have searched through the forums and can't seem to find a solution to my problem. Anyone have an idea?
Rene
New Zenner
phycel:
I know there is a new release of the single_sidebox.php since this guy's post -- but I am still having a problem with the images showing up.
http://subliminalscience.com/articles/hypnosis-articles.php
When looking at the properties of the image, it seems to be a bad path.
http://subliminalscience.com/home/content/s/u/b/subliminal1/html/images/inductions-deepenersDVD_cov.jpg
I wanted to let everyone know I have fixed the problem. I took advantage of ob_start() and had it find the occurances of the wrong path. I added this snippet of code to the top of the hypnosis-articles.php page where I have my php requires --
<?
ob_start("FixImages");
function FixImages($buffer)
{
return (str_replace("/home/content/s/u/b/subliminal1/html/images/", "/images/", $buffer));
}
?>
All is working well now and the code looks beautiful.
http://subliminalscience.com/articles/hypnosis-articles.php
I still love this forum and thank all you Zen Cart gurus that help us beginner coders along the way!
Rene
New Zenner
I set up the single sidebox code just like it says to, and then got the following errors on the page in which I tried to place the sidebox.
Warning: Cannot modify header information - headers already sent by (output started at /home/path/public_html/page.php:9) in /home/path/public_html/store/includes/init_includes/init_templates.php on line 78
There is a session_start(); at the first line of page.php, to keep the session from within the store going, other than that there's a few include(); statements on the page, but no variables other than the ones required for the single sidebox.
So what's the deal here?
New Zenner
I've been trying to get a random product to appear on page located one folder above Zencart using Sidebox Anywhere. I can get the product name to appear with a broken link to the image but the errors messages that appear overt he broken link read:
"Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/billedmu/public_html/test.php:8) in /home/billedmu/public_html/shop/includes/functions/sessions.php on line 108
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/billedmu/public_html/test.php:8) in /home/billedmu/public_html/shop/includes/functions/sessions.php on line 108
Warning: Cannot modify header information - headers already sent by (output started at /home/billedmu/public_html/test.php:8) in /home/billedmu/public_html/shop/includes/init_includes/init_templates.php on line 78"
My page code is a simple "<?php $zcSBmodule='iC_AthemeV1.3/random.php'; include('/home/billedmu/public_html/shop/single_sidebox.php');?>"
How do get rid of the eeror messages and will correcting them make the images appear?
The test page is located at https://www.billedmunds.com/test.php
Thanks,
Thanks,
Zen Follower
I know this is an old thread at this point, but I'm trying to get this to work as well.
Store is in a sub-directory: public_html/shop/
Images (obviously) are in shop/images/product
single_sidebox.php is in the public_html/shop directory
The main site is at: public_html/
where I have loaded a page: test.php
The module works great! I can see the "featured" sidebox from my store and it rotates accordingly, too!
BUT, NO IMAGES!?
When I attempt to view the image it is going to the wrong directory:
http://my_site/images/product/my_image.jpg
It needs to go to:
http://my_site/**shop/**images/product/my_image.jpg
I have tried adding the "fix" from phycel, above -- but still no luck.
I have even tried editing the image directory path in single_sidebox.php -- but no luck.
If anyone is still around this thread, I'd be quite grateful for any pointers to get this working on my main web site. :lookaroun
New Zenner
I solved the error message problem after reading Dr. Byte's tutorial. Extra spaces was not the problem. My PHP code was inside an HTML page saved as PHP. After I deleted all the HTML (generated by Dreamweaver) the messages went away.
I now have the same problem as Aly22. No images. Let me know if you figure this one out.
Thanks,
Zen Follower
I've gotten nowhere :(
Are we supposed to be editing anything in the single_sidebox.php file itself?
I have exactly what you have, Bill.
Tell staff why this post should be reviewed.