• DivaVocals

    (@divavocals)


    I need help trying to get Zen Cart sideboxes to display within a WordPress widget. Though I think I am on the right path, I have officially hit a wall and was hoping that someone might be able to point me in the right direction on how to get unstuck..

    I am using a Zen Cart add-on called Sideboxes Anywhere..

    Following these instructions I was successfully able to display the new products sidebox by adding the following code to my template.

    <?php
      $zcSBmodule = 'whats_new.php';
      $zcSBlayout = 'left';
      require ("/path/to/zencart/single_sidebox.php");
    ?>

    This is great except I would like to display the sidebox inside a widget, and I have been unsuccessful thus far.

    I have tried using the Executable PHP widget with no luck. When I add the code above, all the widgets in the sidebar disappear along with the footer.

    I also tried creating my own custom widget with the following code:

    <?php
    /*
    Plugin Name: Zen Cart Whats New Sidebox
    Plugin URI: https://www.yoursite.com/
    Description: Display Zen Cart Whats New sidebox inside a WordPress widget. Requires the Zen Cart Sideboxes Anywhere add-on to work.
    Author: Me
    Version: 1.0
    Author URI: https://www.yoursite.com/
    */
    
    function zen_cat() {
      $zcSBmodule = 'whats_new.php';
      $zcSBlayout = 'left';
      require ("/path/to/zencart/single_sidebox.php");
    }
    function init_zen_cat(){
        register_sidebar_widget("ZC Whats New Sidebox", "zen_cat");
    }
    add_action("plugins_loaded", "init_zen_cat");
    ?>

    This too results in the all the widgets in the sidebar & the footer disappearing.

    I am hoping that the solution is something simple that I am overlooking.. Would sure appreciate some input on this from any kind soul who can help..

Viewing 15 replies - 31 through 45 (of 53 total)
  • Thanks for your help. Leaving the trailing / off of my base href was just a typo, that I caught after I posted the previous comment.

    My files only have what you said to put.

    zen_whats_new_sidebox.php has:

    <?php
      $zcSBmodule = 'whats_new.php';
      $zcSBlayout = 'right';
      $zcSBwidth = '170';
      require ("/home/tracibu/public_html/zen/single_sidebox.php");
    ?>

    Your example of what you did here has your wdith as:
    $zcSBwidth =200';
    I’m guessing not having a ‘ before the 200 was just a typo?

    bottom of my single_sidebox.php has:

    <base href="https://www.TraciBunkers.com/zen/" />
    <link rel="stylesheet" type="text/css" href="https://www.TraciBunkers.com/blog/wp-content/themes/minibox_wp_generic_black_sym/sidebox_stylesheet.css" />

    I tried both of your suggestions in the php wdiget, and had the same results as before–nothing after the php widget heading, no white background, and no posts.

    I installed a different them & previewed it to see if I had the same issue–to see if it’s my theme. With the new theme, it just didn’t show anything after the php widget heading, but it did show the posts and everything else was normal.

    Thread Starter DivaVocals

    (@divavocals)

    Your example of what you did here has your wdith as:
    $zcSBwidth =200′;
    I’m guessing not having a ‘ before the 200 was just a typo?

    The closing single quote is a typo.. Here is the original code from the Sideboxes Anywhere single_sidebox.php file

    /**
      *   module and layout determination
    	*/
      if (!isset($zcSBmodule)) $zcSBmodule = (isset($_GET['module'])) ? zen_db_input($_GET['module']) : 'whats_new.php';
      if (!isset($zcSBcolumn)) $zcSBcolumn = (isset($_GET['layout'])) ? zen_db_input($_GET['layout']) : 'left';
      if (!isset($zcSBwidth)) $zcSBwidth  = (isset($_GET['width'])) ? zen_db_input($_GET['width']) : 0;
      if (substr($zcSBmodule, -4) != '.php') $zcSBmodule .= '.php';
      $column_width = (int)$zcSBwidth;
      if ($column_width == 0) $column_width = ($zcSBcolumn == 'right') ? COLUMN_WIDTH_RIGHT : COLUMN_WIDTH_LEFT;
      $column_box_default = ($zcSBcolumn == 'right') ? 'tpl_box_default_right.php' : 'tpl_box_default_left.php';

    Which PHP widget plugin are you using??

    Also you need to clear your Zen Cart error logs, refresh your page and report what errors you get with the corrections in place..

    Ok, I just took out the ‘ ‘ around the width number, but that didn’t fix it. I’m using Executable PHP Code widget that you suggested.

    Thread Starter DivaVocals

    (@divavocals)

    I’m using Executable PHP Code widget that you suggested.

    Okay..

    Ok, I just took out the ‘ ‘ around the width number, but that didn’t fix it. I’m using Executable PHP Code widget that you suggested.

    All that width setting does is control the width of the sideboxes when called outside Zen Cart. It’s not going to fix other issues.. You would only change this IF your Zen Cart sidebox width is different than your WordPress sidebars/widgets. (In my implementations, the sidebars are wider than the Zen Cart column/sidebox settings)

    You need to clear your Zen Cart error logs, refresh your page and report what errors you get if you have all the corrections I suggested in place.. (in other words, all of the “extra stuff” you’ve tried needs to be removed) Hopefully it’s something obvious, but if it’s not, then it means that your setup requires some minor modifications to this code that I may not be able to troubleshoot over a forum (since I cannot see your code)..

    Yes, I had made all of the corrections. I’m not getting any zen cart errors. When I go to my cpanel to also check my overall site error logs, I still get the the robot.txt and the missing public_html/404.shtml errors.

    I’m not getting the error anymore that referred to zen_whats_new_sidebox.php.

    But I am getting this:
    [Mon Jan 02 16:48:34 2012] [error] [client 65.52.110.199] File does not exist: /home/tracibu/public_html/zen/XXXXX/backups/dump

    I checked, and I do have that backups folder. The only thing is in it is an index.php file.

    Thread Starter DivaVocals

    (@divavocals)

    Well I’m all out of ideas at this point.. ??

    That’s not what I wanted to hear! ??

    I don’t want to go back to the dreaded iFrame solution.

    But I don’t get what the problem is.

    Since going putting https://www.tracibunkers.com/zen_whats_new_sidebox.php directly into the browser works, it seems it’s all set up correctly. So, it’s something on the wordpress side it seems.

    You have your php file that calls the single_sidebox.php in your public folder, or in your blog folder? Mine is in the public folder. But my blog files are all in a blog folder. The instructions for the Sideboxes anywhere said to put the file that calls it in the public folder–so that’s where I put it.

    Thread Starter DivaVocals

    (@divavocals)

    All of my sidebox files are in my shop root folder. so the single_sidebox.php file and all the individual sidebox files I created are in the shop root..

    I moved the zen_whats_new_sidebox.php into my root shop folder & changed the URL in the PHP widget, but it didn’t help.

    Thread Starter DivaVocals

    (@divavocals)

    Yep.. at this point I am plum outta ideas.. Not sure why this doesn’t work for you.. I got it working in two different sites..

    Last night, I installed a new blog with a different theme to try it. With the theme I’ve been using, I had to make a lot of changes. So I thought maybe with those changes, I had done something that is causing the sidebox not to work for me. But, I had the same result on the test blog with no other plugins installed except the PHP code widget.

    So, I’m at a total loss. And pretty frustrated.

    Last night in working on this more, I found a plugin that uses widgets for zencart & also shortcode to show different things from your zen cart on your wordpress blog–categories, top sellers, featured items, manufacturers, and a search–oddly no new products even though it’s listed in the description. The site doesn’t look like it’s maintained. It has a forum with hardly any posts, with the 2 most recent being spam. I installed it on my test blog, and got the shortcode to work in a text widget–I tried both featured products & top sellers. You can state the size of the images, how many to show & how many columns.

    Oddly with it, what you put in the widget heading, shows up UNDER the products in the sidebar instead of on top. So if I can figure out how to fix that, I’ll probably go with that. I wonder if short code can be written for new products based on the other short code files? Here’s the link.
    You have to register on the site to download the plug-in, but it’s free. Let me know if you want me to send the zipped file to you to check out.

    Thread Starter DivaVocals

    (@divavocals)

    I’ll take a look at this site, but am cautiously optimistic as many of these Zen Cart plugins I found are not current, don’t work at all or are not maintained by the authors.. This one in particular only offers SOME offers the features I want, and leaves out others, but I’ll have a looksee to see what it might be useful for..

    I’m actually okay with the solution I am using and I will probably hire someone in the near future to help me tweak it to add some additional features that do not work correctly now.. (like the shopping cart and login sideboxes due to session/cookie issues)

    I know–I’m hesitant to use it for those reasons, but since I can’t get the single_sidebox to work in my sidebar, I’m not sure what else to do.

    Thread Starter DivaVocals

    (@divavocals)

    Well after a quick test of the WordPress Zen Cart Listing Pro I see that the widgets included do not work.. Shortcode listings only work with Specials and Featured Products (no New Product listings), and they don’t display correctly on my pages nor do they use the correct URIs from my SEO add-on..

    Soooooooo…. I’m not gonna waste anymore time testing out the rest of this plugin.. It’s really NOT what I want anyway.. So I’m done with this one..

    Gonna keep tweaking on my solution, and probably I will eventually pay a developer to finish the things I cannot.. (login and shopping cart sidebox widgets)

    Tonight I pasted this

    <?php
    include ("/home/tracibu/public_html/zen_whats_new_sidebox.php");
    ?>

    into the index.php file of my theme, and the new products showed up! Of course it wasn’t where I wanted it, but it was there. BUT, if I pasted it into any other php file for my theme, like the sidebar, it didn’t show up. Depending on where I put it, it either made no difference, or made the right sidebar content disappear (since that’s where I was trying to put it).

    Does that shine any light onto my single_sidebox mystery?

Viewing 15 replies - 31 through 45 (of 53 total)
  • The topic ‘Display Zen Cart Sidebox inside Widget’ is closed to new replies.