Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2006
    Posts
    229
    Plugin Contributions
    0

    Default Having an inssue with WordPress (NOT using Woz_en!)

    Hey all,

    I've added WordPress to a customized ZenCart site. I'm really well-versed in WordPress, and I'm better than i used to be at Zencart. So when the client asked to have a WordPress blog added to the site, I did so. Orginally, I used Woz_en - but the current version of WordPress is 2.7.1, and we had some serious issues in using it. I found some solutions in the thred, but there were still problems, blah blah and to make life easier I just did a separate install. no biggie. The clients wanted the most recent post pulled intot he ZenCart index page, so I simply did what I usually do when someone wants a static site to display WP stuff: I put in a call to the blog_header.php file.

    It worked like a charm. In the html_header.php file, I just put this in at the top:

    Code:
    /** WordPress **/
    $basehref = $_SERVER['DOCUMENT_ROOT'];
    require($basehref . '/blog/wp-blog-header.php');
    It *has* to appear before anything else - if it doesn't then you get those "headers already sent" errors.

    Anyway, so it worked fine - but we've recently discovered that when you go to check out, as soon as you hit the"checkout" button (and thus go to checkout_shipping.php) that page goes blank. I was pretty sure it had to do with the wp-blog-header.php call, because once you get into the login areas, you enter the https zone. (For the record, https is NOT enabled right now - so initially I'd think it would have something to do with that, but it's definitely not that) Going along with that, I removed the call to the wp-blog-header.php, and the checkout_shipping pages worked just fine.

    So I tired using a conditional in the html_header.php - since all we want to do is pull in the WordPress content on the index page, I changed it to this:

    Code:
    if($this_is_home_page) {
    $basehref = $_SERVER['DOCUMENT_ROOT'];
    require($basehref . '/blog/wp-blog-header.php');
    }
    and of course ALL of the site went blank. Which, honestly, woudl make sense. I mean really, I've just placed the whole site in a catch-22 right?

    So my question is this: how can I make the WordPress stuff get pulled into the index page without using a conditional, and without making the checkout process stop functioning?

    I was *thinking* maybe I could do the RSS feed trick (there's a way where you can grab the content of the WP RSS feed and pull it into a static page without the need of the wp-blog-header.php file) but I didn't know how well ZenCart worked with RSS feeds. But if anyone has a suggestion on how to get around my dilemma, I'd appreciate it.

    Thanks!

  2. #2
    Join Date
    Jan 2006
    Posts
    229
    Plugin Contributions
    0

    Default Re: Having an inssue with WordPress (NOT using Woz_en!)

    For the record, I found a solution to this problem. It's using a small snippet of PHP code that's placed in the templates/tpl_index_default.php file.

    Code:
    <div class="wordpress">
    <?php
    // rss page from your blog -
    $feed_url = "PUT WORDPRESS FEED URL HERE";
    
    # INITIATE CURL.
    $curl = curl_init();
    
    # CURL SETTINGS.
    curl_setopt($curl, CURLOPT_URL,"$feed_url");
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 0);
    
    # GRAB THE XML FILE.
    $xmlTwitter = curl_exec($curl);
    
    curl_close($curl);
    
    # SET UP XML OBJECT.
    # Depending on your PHP version, use one of the lines below.
    # Comment out the one you are not using.
    //$xml = new SimpleXMLElement($xmlTwitter);
    $xml = simplexml_load_string($xmlTwitter);
    
    // How many items to display
    $count = 1;
    
    // How many characters from each item
    // 0 (zero) will show them all.
    $char = 200;
       
       foreach ($xml->channel->item as $item) {
    	    if($char == 0) {
      	      $newstring = $item->description; 
      	    } else { 
      	      $newstring = substr($item->description, 0, $char); 
      	    } 
      	    
      	    if($count > 0) { ?>
      	      <h2> <a href="<?php echo $item->guid ?>"><?php echo $item->title ?></a></h2>
    		    <div class="entry">
    		    <?php echo $newstring ?>... <br />
    		    <a href="<?php echo $item->guid ?>">read more &raquo;</a>
    		    </div>
    	<?php }
    $count--;
    }
    ?>
    <!--/wordpress-->
    </div>
    I wish I could remember where I found this snippet of code so i could credit the author, but it works like a charm - pulls in the most recent post via the RSS feed and plops it right on the index page. Hope it helps someone else!

 

 

Similar Threads

  1. Using Wordpress in zc - Problem with index.php URL
    By fakeDecoy in forum General Questions
    Replies: 1
    Last Post: 29 Sep 2015, 07:59 PM
  2. Using Template and Having trouble with overlapping text
    By kdipaolo in forum Addon Templates
    Replies: 9
    Last Post: 2 Dec 2011, 09:25 PM
  3. Having trouble with pictures not showing up
    By tjturner in forum Customization from the Admin
    Replies: 3
    Last Post: 28 Jun 2011, 08:39 AM
  4. Purchasing with paypal and not having to register
    By PatrickF in forum General Questions
    Replies: 4
    Last Post: 17 Nov 2010, 12:11 PM
  5. Integration of zent cart with worpress-mu not wordpress
    By sachin1234 in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 21 Apr 2009, 02:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg