Zen Cart Logo
Forums / All Other Contributions/Addons / Wordpress On ZC [Support Thread]

Wordpress On ZC [Support Thread]

Views: 620,622

Results 801 to 820 of 1,861
15 May 2009, 7:34 PM
#801
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Wordpress On ZC [Support Thread]

rainthebat:

I am sorry, that is incorrect. That line does not go at the end of wordpress-config.

However, I still believe that it is the $template variable problem.

When does this problem occur? Is it when accessing the wordpress_default.php page? Or when accessing any wordpress page?

Yes, in a quick search of the whole forum the only other reference to this error had it down to a issue about when and how the variable $template is defined. In their case it seemed to be a session issue but that isn't the issue here I think.

When it occurs for me is in the wp admin section when I try to change themes- so this really isn't a great problem ( ie so despite your kindness do not waste huge amounts of time on it ) as long as it isn't the first sign of anything horrible !

In my head at the moment I have an problem when a Zen Cart/Wordpress preview page is called from the Wordpress admin area as a preview. This sounds like there is a weirdness in the way the variable $template is defined in the two programs. I am guessing that the variable is used in both lots of code? I'll have a look when I get a minute.

As long as I believe it is what I have described then I don't have too much problem in just sidestepping it.

Thanks again guys.....

15 May 2009, 8:04 PM
#802
rainthebat avatar

rainthebat

Zen Follower

Join Date:
Feb 2007
Posts:
314
Plugin Contributions:
0

Re: Wordpress On ZC [Support Thread]

niccol:

In my head at the moment I have an problem when a Zen Cart/Wordpress preview page is called from the Wordpress admin area as a preview. This sounds like there is a weirdness in the way the variable $template is defined in the two programs. I am guessing that the variable is used in both lots of code? I'll have a look when I get a minute.

As long as I believe it is what I have described then I don't have too much problem in just sidestepping it.

Thanks again guys.....

Funny, it must be contagious! After I looked into the theme.php file in wp-admin, I changed the wp_redirect function name just as a test, and started to get the same error that you describe - I absolutely was not getting this error before I edited the file. To my amazement, after reverting the file to its original, the error still appears!

Well I gave up on trying to figure it out because I've settled down on a theme anyways, just wanted to see.

The $template variable is used frequently. I am not sure where it starts or what its exact powers are though, because it is used in different ways on different occasions.

15 May 2009, 8:36 PM
#803
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: Wordpress On ZC [Support Thread]

Thanks again both Rainthebat and divavocals.

Sidestepping the problem works for me!:clap: If I have time I'll look into it deeper but probably it will turn out that other things are more interesting and useful :smile:

Thanks guys....

15 May 2009, 10:15 PM
#804
divavocals avatar

divavocals

Totally Zenned

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

Re: Wordpress On ZC [Support Thread]

niccol:

Thanks again both Rainthebat and divavocals.

Sidestepping the problem works for me!:clap: If I have time I'll look into it deeper but probably it will turn out that other things are more interesting and useful :smile:

Thanks guys....You're welcome.. sidestepping is what worked best for me too..:yes: For example, I take my hats off to those willing to work through the quirks of getting embedded WP content to work.. I didn't have the patience!:laugh: Working with the WOZ sideboxes only solved my real need to link WP to Zen.. Embedded content would be nice, but I have resigned myself to styling WP blogs to match Zen, and that's worked out well.. (WP is super easy to style..)

But one last thing.. WHAT'S THE LINK TO YOUR SITE??? all this advice, and you haven't shared!!! show us what you're doing!!!:laugh:

20 May 2009, 4:29 AM
#805
busymom avatar

busymom

New Zenner

Join Date:
Jul 2007
Posts:
61
Plugin Contributions:
0

Re: Wordpress On ZC [Support Thread]

I've spent the better part of the past two days trying to track down some silliness on my in-development site (sorry, it's under xampp on my laptop, can't give you any pointers). I started pulling together a listing of the code structure which I'll try to post tomorrow. I didn't go all the way through it, but I documented the front-end summarizing the pathway from ZC index.php into WOZ. Thought this might help some of you less code-oriented users.

I do have these latest variable/constant conflicts on my mind right now, though, and I wanted to share the info before I forgot about it...

  1. $title
    In wp-trackback.php the variable $title obviously conflicts with a variable in ZC. I didn't bother going back to see the ZC places where it was used, but clearly it was retaining the value of one of my sidebox titles. If you click the trackback URL in a post (assuming your template displays the trackback URL), you are supposed to be redirected back to the post. I still have to debug why I'm not getting through the wp_redirect code, but I wasn't even getting to it because the $title variable wasn't empty as it should have been (I think mine had 'Reviews [more]'). I renamed the variable and all its instances in wp-trackback to $woz_title and now I'm moving on to the next section of debug. I haven't looked yet, but maybe my feed problem is similar.

  2. ABSPATH
    This is littered everywhere - in admin, in includes, etc. This is the same constant used in ZC and most likely isn't causing anyone any problems that haven't been gotten around already, but it occurred to me that perhaps this variable conflict is at the root of some of the issues people have had when installing the two apps in different directories. It would be a major effort to change all of your WP files to use WOZ_ABSPATH instead of ABSPATH and keep it maintained from version to version, but if you are still having issues, you might want to check if this is causing you problems.

Hope this information helps someone!
Karen

20 May 2009, 10:50 AM
#806
busymom avatar

busymom

New Zenner

Join Date:
Jul 2007
Posts:
61
Plugin Contributions:
0

Re: Wordpress On ZC [Support Thread]

busyMom:

  1. ABSPATH
    This is littered everywhere - in admin, in includes, etc.

More precisely, this should say
"This is littered everywhere - in wp-admin/.php, in wp-includes/.php, etc." It is in a LOT of places. I found one place, can't remember the file right now, where it is defined again and used within its own file, so I changed this to a unique constant from the WOZ_ABSPATH I changed everywhere else for testing purposes and just made that one file use MY_WOZ_ABSPATH.

I probably won't be leaving these changes in the code, but I was working my way through errors trying to get to the bottom of a dreaded 'headers already sent' problem and I wasn't sure which things would matter and which wouldn't. So for the time being, I'm removing those errors (as well as removing blank lines after the ?> in many files) from the fray to get to the big stuff and then I'll probably try restoring what I can to the released code to make it easier to maintain from level to level. If I find that there is a need to change some of these permanently, I'll post back here about it, but I think the problems are more functional than these minor changes (like the $title having a value when it should have been empty!). I have WP and ZC installed in the same directory right now, so I wouldn't be seeing some of the ABSPATH conflicts that others might experience if the constant conflict is a problem.

20 May 2009, 2:16 PM
#807
busymom avatar

busymom

New Zenner

Join Date:
Jul 2007
Posts:
61
Plugin Contributions:
0

Re: Wordpress On ZC [Support Thread]

Here are the notes I took yesterday. It's not formatted particularly pretty, but I was trying to document the hierarchical path the code took and what led to what. As I mentioned in an earlier post, it doesn't document the whole path, just from the kickoff of ZenCart's index.php to where the WOZ stuff starts running.

direction to index.php (this is the ZC version)
 ..   requires <includes/application.php> (still ZC)
       .. includes <includes/configure.php> (still ZC)
            {... bunch of defines ... }
       .. includes <includes/extra_configures/*> (still ZC)              {... includes wordpress-config.php which is where
                   the wordpress processing starts ...}
            .. includes wordpress-config.php (WOZ/WP file)
                 {... defines a bunch of constants ...}
                .. requires wp-config.php (WOZ/WP file)
                    {... defines a bunch of constants ...}
                    .. requires wp-settings.php (WOZ/WP file)
                        {... defines some constants ...}
                        {... defines a bunch of to check/setup
                              environmental settings ...}
                         .. includes wp-content/advanced-cache.php
                            if constant set (WP file)
                         .. requires wp-includes/compat.php (WP file)
                             {... provides some compatibility for old
                                   PHP, most likely not needed 
                                   anymore ...}
                          .. requires wp-includes/functions.php
                              {... defines wp utility functions ...}
                          .. requires wp-includes/classes.php (WP)
                              {... defines more wp utility functions 
                                    and classes ...}
                           .. executes require_wp_db() function 
                               {... defined in functions.php that was
                                     loaded above ...}
                            .. executes wp_cache_init() function
                            .. requires and includes a bunch of functions
                               from wp-includes (get details from file
                               directly)
                            .. defines a bunch of constants
                            .. executes force_ssl_login(FORCE_SSL_LOGIN)
                            .. requires wp-includes/vars.php
                            .. requires my-hacks.php if it exists
                            .. loads the plugins if there are any
                            .. requires wp-includes/pluggable.php
                            .. lots of other stuff!!!
                            .. includes theme's functions.php
                            .. inits everything
```Sorry if there are any mistakes or not enough detail for your use. If anyone wants to build on this by adding your own level of detail (or corrections), please feel free and re-post your amended version on this thread so we can have a running summary of how the code runs from one program into the other. Things will obviously change when ZC 2.0 is ready, but at least understanding how things flow today will help those of us who want to keep using this mod, or a version of it, when it's time to migrate our platforms.

Karen
20 May 2009, 2:56 PM
#808
busymom avatar

busymom

New Zenner

Join Date:
Jul 2007
Posts:
61
Plugin Contributions:
0

Re: Wordpress On ZC [Support Thread]

Last set of tidbits for now...

There have been a few pieces of information that have been invaluable for me debugging some of the problems that I've been trying to address over the last few days, so I wanted to share my miscellaneous notes to myself. I realize a lot of these tips are WP specific, but since those of us that are here in the ZC support group are more than likely dug into ZC instead of WP, I figured I'd share it as a source of info all in one place!

Oh, first, one extra piece of information. I do not need Kiddo's fix because I use pretty permalinks. But that said, while I was trying to fix one particular rewrite in my .htaccess that was taking me for a ride, I had his fix code in there so that I could access the pages directly. Users of pretty permalinks (to understand what this is, you should refer to WP documentation, it is not a mod, it is a way of using the built-in permalinks feature) probably will not be affected by Kiddo's fix for the better or worse.

OK, now back to the intended post...

(1) Turn on WP debug via the wp-config.php file
Change this:

define('WP_DEBUG', false);
```to this:```
define('WP_DEBUG', true);
```Remember to turn it back off when you are finished!! You don't want to run your published site like that

(2) Make LIBERAL use of echo statements in the area you are trying to debug. Depending on where you need to sprinkle them, they may cause subsequent 'header already sent' errors or other failures, but at least you'll get to see what the variable values are while the code is executing. I'm sure there are probably preferred debug environments, but I'm not familiar with them and the echo statements were QAD solutions for me.
Again, remember to comment them out when you are done, or you could write them to be dependent on the status of constant WP_DEBUG (set above) so that if you have debug on,, the echo's work and if WP_DEBUG is set to false, which is the default, the echo's don't execute.

(3) Know where your functions are. Of course your areas of concern may very well be in different parts of the code than mine, but there are some functions that get called over and over again that help you generically determine where you are and what is going on. It is especially helpful to have echo statements in this code!

**wp-includes/query.php **
Contains most/all of the is_xxx() functions defined, so if you can't figure out why something is being processed a certain way in WP, this is probably a good place to start. Also has a bunch of other useful functions that you might need to debug around such as have_posts(), have_comments(), etc.

**wp-includes/plugin.php**
Contains a bunch of functions that are used everywhere, but the one I found critical was the do_action() function. I found it very helpful to have echo statements in here to determine the actual arguments that were being passed, etc.

**wp-includes/default_filters.php**
Contains a one-stop-shop for at least the bulk of the WP filters and actions, if not all. This is important as the cross-reference between what filters and actions are being queued and which function is actually being executed by that action or filter. If you are unfamiliar with how this part of WP works, you will see lots of do_action('action_name') statements in the code. The 'action_name' argument refers to the name of an action, not an executable function. You need to find the associated add_action in order to see which executable function is going to run when this action runs. Filters are similar to actions.

**wp-includes/pluggable.php**
And last but not least... the infamous pluggable.php which seems to be mentioned in most of the dreaded 'headers already sent' errors. Ah yes, the reason is most likely because this is where the wp_redirect() function resides. And as this is the area of debug I have sitting in front of me as soon as I send this post, I do not yet have much useful information about the function; however, I do know that because this code re-posts the headers, it generates the dreaded error message when it gets here inappropriately. The important thing to note about this is that most likely your execution path is causing this code to be executed when it should not be which is why the headers are being resent. Use all of the tips above to sort out why it is getting here in the first place.

And off I go now to get my feet wet in the wp_redirect code for my own debug... :cry:

HTH Karen
21 May 2009, 8:04 PM
#809
busymom avatar

busymom

New Zenner

Join Date:
Jul 2007
Posts:
61
Plugin Contributions:
0

Re: Wordpress On ZC [Support Thread]

One more debug utility I forgot that I use...

[http://www.zen-cart.com/index.php?main\_page=product\_contrib\_info&products\_id=860](http://www.zen-cart.com/forum/../index.php?main_page=product_contrib_info&products_id=860)

This creates an error debug file in the ZC cache directory so that you can see all the dreaded 'headers already sent' errors and others!

HTH Karen

22 May 2009, 12:02 AM
#810
babltd avatar

babltd

New Zenner

Join Date:
Oct 2007
Posts:
73
Plugin Contributions:
0

Re: Wordpress On ZC [Support Thread]

Hi I have been away for a bit and just finished reading through 8 months of posts!

PHEW! Things have come on a lot.

I still however have the same problem that I had 8 months ago. Site is setup and working fine except for the TITLE, KEYWORD and DESCRIPTION head tags.

I didn't want to have both sets load from WP and ZC and haven't found a way to combine them. Any help here please?

Ed

25 May 2009, 11:06 AM
#811
busymom avatar

busymom

New Zenner

Join Date:
Jul 2007
Posts:
61
Plugin Contributions:
0

Re: Wordpress On ZC [Support Thread]

Discovered a new debug assist yesterday at the bookstore! php has a function called trigger_error that allows you to post the text of a message you want (the default is that it will be a NOTICE type). If you are doing php debug and have the ZC mod installed to help you with debug (I mentioned it above, but here's the link again: http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=860 you can temporarily sprinkle your code with trigger_error calls instead of echo calls and you won't create a scenario where you are forcing the "headers already sent" error because of your echos. Obviously I'm still debugging the logic that is causing me grief!!

1 Jun 2009, 1:16 PM
#812
kennyhoward avatar

kennyhoward

New Zenner

Join Date:
Jun 2009
Posts:
12
Plugin Contributions:
0

Re: Wordpress On ZC [Support Thread]

I have spent the last day trying to find a fix for the headers already sent error:

Warning: Cannot modify header information - headers already sent by (output started at /home/domain-name/public_html/shop/includes/templates/orange/common/html_header.php:22) in /home/domain-name/public_html/blog/wp-includes/pluggable.php on line 850

Here is the all too easy fix:

To turn off Canonical URL Redirection, you can add the following code to your theme’s functions.php file.

remove_filter('template_redirect','redirect_canonical');
http://www.velvetblues.com/web-development-blog/turn-off-wordpress-homepage-url-redirection/

I hope this helps those that haven't already figured this out. The reason the site was trying to redirect was because of the www or lack-there-of in the url. By that I mean the blog displayed correctly when viewing from http://domain-name.com but did not display correctly when viewing from http://www.domain-name.com

Good luck.

2 Jun 2009, 3:15 AM
#813
divavocals avatar

divavocals

Totally Zenned

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

Re: Wordpress On ZC [Support Thread]

kennyhoward:

I have spent the last day trying to find a fix for the headers already sent error:

Here is the all too easy fix:

http://www.velvetblues.com/web-development-blog/turn-off-wordpress-homepage-url-redirection/

I hope this helps those that haven't already figured this out. The reason the site was trying to redirect was because of the www or lack-there-of in the url. By that I mean the blog displayed correctly when viewing from http://domain-name.com but did not display correctly when viewing from http://www.domain-name.com

Good luck.
Thanks for posting your fix.. Give folks a second option for fixing this error... (if you search through this thread, kiddo also posted another fix that works as well..)

4 Jun 2009, 12:16 AM
#814
proteus avatar

proteus

New Zenner

Join Date:
Jun 2009
Posts:
2
Plugin Contributions:
0

Re: Wordpress On ZC [Support Thread]

I've searched all over the place and nothing seems to make this work. I have changed the Define ABSPATH in step 4 to be the directory of my blog. Ive done installs in both seperate, and the same directories. Ive tried every conceivable definition for ABSPATH, but no matter what i do it always says it cant wp-config.php, even when i have made copies of wp-config.php and pasted them into every directory that the error says it cannot find the file in. Look:

I realize the text is small, but it says: file not found /storefront/blog/wp-config.php

Which is exactly where the file is. so......WTF?! Im starting to rage its been three days and ive read a solid 50 pages of this thread.

Here is my wordpress config file:

<?php // // wordpress on zencart by <http://www.s-page.net/> // define ('ABSPATH','/storefront/blog/'); $woz_install=0; if (file_exists(ABSPATH.'wp-config.php')) { $woz_install=1; define('WP_USE_THEMES', true); $wp_did_header = true; require_once(ABSPATH.'wp-config.php'); $i=strlen(DIR_WS_CATALOG); $req=substr($_SERVER['REQUEST_URI'],$i,1); if($req=='?'){ $_GET['main_page']='wordpress'; } if(isset($_GET['feed'])){ wp(); gzip_compression(); // require_once('./wordpress/wp-includes/template-loader.php'); require_once(ABSPATH . WPINC . '/template-loader.php'); exit(); } } ?>
4 Jun 2009, 12:28 AM
#815
divavocals avatar

divavocals

Totally Zenned

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

Re: Wordpress On ZC [Support Thread]

proteus:

I've searched all over the place and nothing seems to make this work. I have changed the Define ABSPATH in step 4 to be the directory of my blog. Ive done installs in both seperate, and the same directories. Ive tried every conceivable definition for ABSPATH, but no matter what i do it always says it cant wp-config.php, even when i have made copies of wp-config.php and pasted them into every directory that the error says it cannot find the file in.

Try this: READ posts 438 - 442 of this thread the answer should be here

4 Jun 2009, 12:40 AM
#816
divavocals avatar

divavocals

Totally Zenned

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

Re: Wordpress On ZC [Support Thread]

Also from Hira's instructions:
.zip/woz_en/readme.html#inst_a"][a] Wordpress and Zen-Cart into separate directories.

[Path of Zen-Cart]
/var/www/vhost/example.com/public_html/(shop/)

[Path of WordPress]
/var/www/vhost/example.com/public_html/blog/
[WordPress admin URL]
*http://example.com/blog/wp-admin/*eg)

============================================

.zip/woz_en/readme.html#inst_b"][b] Wordpress and Zen-Cart into the same directory. eg)
[Path of Zen-Cart]
/var/www/vhost/example.com/public_html/

[Path of WordPress]
/var/www/vhost/example.com/public_html/
[WordPress admin URL]
http://example.com/wp-admin/

4 Jun 2009, 1:03 AM
#817
proteus avatar

proteus

New Zenner

Join Date:
Jun 2009
Posts:
2
Plugin Contributions:
0

Re: Wordpress On ZC [Support Thread]

DivaVocals:

Also from Hira's instructions:
.zip/woz_en/readme.html#inst_a"][a] Wordpress and Zen-Cart into separate directories.

[Path of Zen-Cart]
/var/www/vhost/example.com/public_html/(shop/)

[Path of WordPress]
/var/www/vhost/example.com/public_html/blog/
[WordPress admin URL]
*http://example.com/blog/wp-admin/*eg)

============================================

.zip/woz_en/readme.html#inst_b"][b] Wordpress and Zen-Cart into the same directory. eg)
[Path of Zen-Cart]
/var/www/vhost/example.com/public_html/

[Path of WordPress]
/var/www/vhost/example.com/public_html/
[WordPress admin URL]
http://example.com/wp-admin/

I have tried the posts 438, and i have read the readme. I have also tried installing wordpress into a seperate directory. Three times. If the answer is in 438-442, then i have missed it. Can anyone give me an idea of what the problem is based on the information i have provided?

4 Jun 2009, 7:23 AM
#818
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: Wordpress On ZC [Support Thread]

The point DivaVocals (who pretty much singlehandedly keeps this thread active and useful out of the goodness of his heart) is making is that your abspath looks wrong.

You don't need to understand why. Look at post 440. It will tell you how to find out what the abspath should look like for your server.

thebasher:

In your ZenCart configure.php (includes/configure.php) what does it say here:

// * DIR_FS_* = Filesystem directories (local/physical)
//the following path is a COMPLETE path to your Zen Cart files. eg: /var/www/vhost/accountname/public_html/store/
define('DIR_FS_CATALOG', 'WHAT DOES IT SAY HERE?');

> 
> This should be around line 40. This is the direct path to your ZC. If you are putting WP in it's own directory, as in "blog", all you would have to do in your wordpress-config.php file is add the path to ZC and then add "blog/" at the end. 
> 
> The wordpress-config.php is part of the WOZ install and is located in includes/extra_configures/wordpress-config.php. This is the file where you need to define the path to WP.

Nik
4 Jun 2009, 12:08 PM
#819
k4satin avatar

k4satin

New Zenner

Join Date:
Mar 2006
Location:
Sacramento, CA
Posts:
93
Plugin Contributions:
0

Re: Wordpress On ZC [Support Thread]

Hi there. All the posts I've seen here regarding rewrites seem to relate to the Wordpress pages. I need help getting around my existing rewrites I'm using for my zencart urls before I can even get into my Wordpress installation.

I've installed Wordpress in a subdirectory of my site, but my htaccess file is rewriting the url so I can't even go to the Wordpress admin. Does anyone know the code to add to my htaccess to tell it to NOT rewrite this particular subdirectory filepath. I don't want to change the rest of my rewrites - just the path to wordpress.

Thank you!

4 Jun 2009, 3:30 PM
#820
rainthebat avatar

rainthebat

Zen Follower

Join Date:
Feb 2007
Posts:
314
Plugin Contributions:
0

Re: Wordpress On ZC [Support Thread]

proteus:

Can anyone give me an idea of what the problem is based on the information i have provided?

I ran into the same type of problem. If you have both Zen Cart and Wordpress in the root, try these:

define ('ABSPATH','./');

$woz_install=0;

if (file_exists(ABSPATH.'wp-config.php')) {
    $woz_install=1;
    define('WP_USE_THEMES', true);
    $wp_did_header = true;

    require_once(ABSPATH.'wp-config.php');