Page 63 of 65 FirstFirst ... 13536162636465 LastLast
Results 621 to 630 of 647
  1. #621
    Join Date
    May 2010
    Posts
    7
    Plugin Contributions
    0

    Default Re: Product Type Book (by moku)

    Hey everyone, I've seen a few questions in this forum regarding custom pages that contain lists (and links) of book subjects/genres etc, and not many solutions.

    With some tinkering, I've finally got something working, so figured I'd share. The code below is based off the manufacturer list sidebox by Kuroi. It displays the list of genres that are used in your products. It also displays the number of those books etc that contain that genre/subject.

    I'm currently using v1.3.9g of Zen Cart and v4 (jph) of Moku's Book mod and it appears to work fine.

    To make a list of something else (like Authors..which I might try next) all you have to do (i think) is point the SQL in the code to the relevant database fields.

    Hope this helps some people.

    Code:
    <?php
    /**
     * genre list page - displays a list of book genres/subjects so the customer can choose to filter on books with those genres only
     * edited by Tim Ryan based on the manufacturer list sidebox by Kuroi 
     * @package templateSystem
     * @copyright Portions Copyright 2007-2009 Kuroi Web Design
     * @copyright Portions 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
     */
    
    // set to true to display a count of the number of products for each genre
    define('DISPLAY_GENRES_COUNTS', false);
    
    // debug switch
    define('DEBUG_GENRES_SIDEBOX', false);
    
    // test if genres should show
    $show_genres = true;
    
    if (DEBUG_GENRES_SIDEBOX) {
      echo "Entering genres module ...<br/>\n";
      echo '- Images: ' . (DISPLAY_GENRES_IMAGES ? 'TRUE' : 'FALSE') . "<br/>\n";
      echo '- Man. Status: ' . PRODUCTS_GENRES_STATUS . "<br/>\n";
      echo '- Counts: ' . (DISPLAY_GENRES_COUNTS ? 'TRUE' : 'FALSE') . "<br/>\n";
      echo '- Show: ' . ($show_genres ? 'TRUE' : 'FALSE') . "<br/><br/>\n";
    }
    
    if ($show_genres) {
    
    
        // pull counts from the database
        $genre_counts_query = "SELECT book_genre_id, COUNT( products_id ) AS number FROM " . TABLE_BOOKS_TO_GENRES . " WHERE book_genre_id IS NOT NULL AND book_genre_id > 0 GROUP BY book_genre_id";
        $genre_counts_result = $db->Execute($genre_counts_query);
    
        // prepare counts for use later
        $genre_counts_list = array();
        while (!$genre_counts_result->EOF) {
          $genre_counts_list[$genre_counts_result->fields['book_genre_id']] = $genre_counts_result->fields['number'];
    	  $genre_counts_result->MoveNext();
    	}
    	
    	if (DEBUG_GENRES_SIDEBOX) {
    	  echo '<h4>List of Counts</h4>';
          echo '<pre>' . "\n";
    	  var_dump($genre_counts_list);
    	  echo '</pre>' . "\n";
        }
    
    
      // now let's get the genres
      $genre_sidebox_query = "SELECT g.book_genre_id, gd.book_genre_name
                                      FROM " . TABLE_BOOK_GENRE . " g, " . TABLE_BOOK_GENRE_DESCRIPTION . " gd
    WHERE g.book_genre_id = gd.book_genre_id
                                      ORDER BY gd.book_genre_name";
      $genre_sidebox_result = $db->Execute($genre_sidebox_query);
    
      if ($genre_sidebox_result->RecordCount() > 0) {
    
        $genre_sidebox_list = array();
    
        while (!$genre_sidebox_result->EOF) {
    
    	// prepare data
    	  $genre_id = $genre_sidebox_result->fields['book_genre_id'];
          $genre_name = $genre_sidebox_result->fields['book_genre_name'];
    	  
          $genre_count = isset($genre_counts_list[$genre_id]) ? (int)$genre_counts_list[$genre_id] : 0;
    
    	if (DEBUG_GENRES_SIDEBOX) {
          echo 'Processing ' . $genre_name . "<br/>\n";
        }
    	  
          // add to list only if we are showing all genres, or this one has products
    	  if ($genre_count > 0) {
            $genre_sidebox_list[] = array(
              'id' => $genre_id,
              'text' => $genre_name,
              'count' => $genre_count);
          }
    
          // advance to next result
    	  $genre_sidebox_result->MoveNext();
        }
    
    	if (DEBUG_GENRES_SIDEBOX) {
          echo '<br/><h4>Final List</h4>';
          echo '<pre>' . "\n";
    	  var_dump($genre_sidebox_list);
    	  echo '</pre>' . "\n";
        }
    	
    	if (sizeof($genre_sidebox_list) > 0 ) {
            $content = '';
      $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="">' . "\n";
      $content .= '<ul>' . "\n";
      foreach ($genre_sidebox_list as $genre) {
        if ($genre['text']!=''){
          $content .= '<li><a class="manufacturerName" href="' . zen_href_link(FILENAME_DEFAULT, 'typefilter=book_genre&book_genre_id=' . $genre['id']) . '">';
          $content .= $genre['text'];
          $content .= '</a>';
          
            $content .= '&nbsp;&nbsp;(' . $genre['count'] . ')';
          
          $content .= '</li>' . "\n";
        }
      }
      $content .= "</ul>\n</div>\n";
    
          echo $content;
        }
      }
    }

  2. #622
    Join Date
    Sep 2008
    Location
    DownUnder, overlooking South Pole.
    Posts
    978
    Plugin Contributions
    6

    Default Re: Product Type Book (by moku)

    Hi Tim

    Where should your code be inserted?

    Thanks

  3. #623
    Join Date
    May 2010
    Posts
    7
    Plugin Contributions
    0

    Default Re: Product Type Book (by moku)

    Quote Originally Posted by dw08gm View Post
    Hi Tim

    Where should your code be inserted?

    Thanks
    I created a new custom page, following this guide

    http://www.zen-cart.com/wiki/index.p...ting_new_pages

    The code pastes into the includes/templates/template_default/templates/tpl_myNewPage_default.php page

    Cheers,

    Tim

  4. #624
    Join Date
    Feb 2009
    Posts
    27
    Plugin Contributions
    0

    Default Re: Product Type Book (by moku)

    I have zencart v. 1.3.9h installed.

    I am not sure if the current version of Product book type works properly on this version of zencart.

    I did install product book type, however when adding a new product I choose "product-book" and click "new product" but I get a 404 page not found error.

    I am not well versed in php and I am wondering if there is a problem with the way I installed the mod, or if it simply won't work on my zen cart version.

    Any help would be appreciated as I don't even know where to start to trouble shoot this problem.

  5. #625
    Join Date
    Apr 2009
    Posts
    5
    Plugin Contributions
    0

    Default Re: Product Type Book (by moku)

    I am still using 1.3.8a (with all the security patches). I know I should migrate to 1.3.9h, but my site works fine with one exception: zc search on my site is a pain. But, please don't get me wrong. ZC search is excellent, but I think the problem is my host because search works perfectly on my desktop server( (MAMP).

    So why am I writing this?

    1. I think I will need to switch hosts (although I have been with the present guys for years) that works well with ZC. I would appreciate any recommendation. Even better, if there is one that will allow me to test my site on it for a short period before I commit.

    2. Is there anyway I can limit ZC keyword search to book titles and authors only. Searching description only gives me a whole lot of results my customers don't need.

    Now, a declaration. I am a geezer who learnt programming in the days of Fortran 4, which would give you an indication of my age. I am not totally out of touch with code; I can more or less make out what it is trying to say by looking at it. Still, it is only a hobby and I envy all the young energy at forums like this.

    Enough self-pity.

    So I will be happy if someone could respond or at least point me to threads or postings that can help me. (Oh, BTW, I have been searching ZC forums, FAQs and tutorials for answers for several weeks now. The closest I have got is this: http://www.zen-cart.com/forum/showthread.php?t=131747 -- Improving search results.)

  6. #626
    Join Date
    Aug 2009
    Posts
    25
    Plugin Contributions
    0

    Default Re: Product Type Book (by moku)

    I am suggesting we are who using this Product Type Book contribute together some money to hire a developer to make a clean module, or to improve the latest one. I am not sure how much is the cost, But I think we hire someone in this forum who can do this job.

  7. #627
    Join Date
    Apr 2009
    Posts
    5
    Plugin Contributions
    0

    Default Re: Product Type Book (by moku)

    Yes, good idea, I will support that.

  8. #628
    Join Date
    Jan 2011
    Posts
    1
    Plugin Contributions
    0

    Default Re: Product Type Book (by moku)

    Quote Originally Posted by pcontente View Post
    Hey Flashy!

    It is working with latest LAMPP on UBUNTU 10.10. Latest Zencart either.

    I followed exactly the same steps as I've followed with XAMPP on Windows and It worked! Even multi-language! I can insert books in English and some other language and it seems to work quite fine.

    The only difference between windows and linux was that I replaced file owners and permissions in linux, i.e, the original owner of the files was pcontente (user with which I decompressed the zip file to my Downloads folder) and I changed it to root. In Windows I did nothing regarding permissions as you know in Windows we're all admins!! :)

    I am going to play around with a bit!

    Cheers,

    Pedro Contente

    Hey Flashy / Pedro

    I have the same error too (blank page when adding products).

    syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in ***\admin\includes\modules\product_book\collect_info.php on line 1766

    I'm using WAMP.
    It seems us 'windows' users are having this issue.
    Can any Windows users confirm they have this working?


    Cheers,

    Ian

  9. #629
    Join Date
    Aug 2009
    Posts
    25
    Plugin Contributions
    0

    Default Re: Product Type Book (by moku)

    Quote Originally Posted by ikanperak View Post
    Yes, good idea, I will support that.
    Is there someone else want to join this?
    I am not sure if this allowed to discuss in this forum.

  10. #630
    Join Date
    Feb 2011
    Posts
    14
    Plugin Contributions
    0

    red flag Re: Product Type Book (by moku)

    Hi all I am sure I am missing something but I downloaded book product from post above seem to have gotten only part of the files, the file book_main_file will not let me access it. also in the read me file it says to apply the patch RUN_THIS_FULL_INSTALL_SQL_PATCH_FOR_DATABASE. That file is not in the download. Any help would be great. thanks in advance.
    Rick

 

 

Similar Threads

  1. Using Book Product Type Extra fields (Book DD2)
    By Beau91324 in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 15 Nov 2009, 08:07 PM
  2. Help Product Type Books (by Moku) broken
    By cshart in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 31 Mar 2007, 03:19 AM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR