Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    May 2009
    Location
    Junction City, Oregon
    Posts
    315
    Plugin Contributions
    0

    Default Contributions that would allow changes to Upcoming Products?

    I'm having a heck of a time trying to figure out how to show a thumbnail image of the books we're selling in the Upcoming Products list that shows up in each category.

    Is there a contribution that would allow for more customization of this?

    KismetDesign

  2. #2
    Join Date
    Dec 2008
    Posts
    23
    Plugin Contributions
    0

    Default Re: Contributions that would allow changes to Upcoming Products?

    Quote Originally Posted by KismetDesign View Post
    I'm having a heck of a time trying to figure out how to show a thumbnail image of the books we're selling in the Upcoming Products list that shows up in each category.

    Is there a contribution that would allow for more customization of this?

    KismetDesign
    Place this upcoming_products.php in includes/modules/YOUR_templatename/

    PHP Code:
    <?php

    /**

     * upcoming_products module

     *

     * @package modules

     * @copyright Copyright 2003-2007 Zen Cart Development Team

     * @copyright Portions Copyright 2003 osCommerce

     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0

     * @version $Id: upcoming_products.php 6424 2007-05-31 05:59:21Z ajeh $

     */

    if (!defined('IS_ADMIN_FLAG')) {

      die(
    'Illegal Access');

    }



    // initialize vars

    $categories_products_id_list '';

    $list_of_products '';

    $expected_query '';



    $display_limit zen_get_upcoming_date_range();

    $limit_clause "  order by " EXPECTED_PRODUCTS_FIELD " " EXPECTED_PRODUCTS_SORT "

                       limit " 
    MAX_DISPLAY_UPCOMING_PRODUCTS;



    if ( ((
    $manufacturers_id && $_GET['filter_id'] == 0) || $_GET['music_genre_id'] > || $_GET['record_company_id'] > 0) || (!isset($new_products_category_id) || $new_products_category_id == '0') ) {

      
    $expected_query "select p.products_id, pd.products_name, p.products_image, products_date_available as date_expected, p.master_categories_id

                         from " 
    TABLE_PRODUCTS " p, " TABLE_PRODUCTS_DESCRIPTION " pd

                         where p.products_id = pd.products_id

                         and p.products_status = 1

                         and pd.language_id = '" 
    . (int)$_SESSION['languages_id'] . "'" .

                         
    $display_limit .

                         
    $limit_clause;

    } else {

      
    // get all products and cPaths in this subcat tree

      
    $productsInCategory zen_get_categories_products_list( (($manufacturers_id && $_GET['filter_id'] > 0) ? zen_get_generated_category_path_rev($_GET['filter_id']) : $cPath), falsetrue0$display_limit);



      if (
    is_array($productsInCategory) && sizeof($productsInCategory) > 0) {

        
    // build products-list string to insert into SQL query

        
    foreach($productsInCategory as $key => $value) {

          
    $list_of_products .= $key ', ';

        }

        
    $list_of_products substr($list_of_products0, -2); // remove trailing comma



        
    $expected_query "select p.products_id, pd.products_name, p.products_image, products_date_available as date_expected, p.master_categories_id

                           from " 
    TABLE_PRODUCTS " p, " TABLE_PRODUCTS_DESCRIPTION " pd

                           where p.products_id = pd.products_id

                           and p.products_id in (" 
    $list_of_products ")

                           and pd.language_id = '" 
    . (int)$_SESSION['languages_id'] . "' " .

                           
    $display_limit .

                           
    $limit_clause;

      }

    }



    if (
    $expected_query != ''$expected $db->Execute($expected_query);

    if (
    $expected_query != '' && $expected->RecordCount() > 0) {

      while (!
    $expected->EOF) {

        if (!isset(
    $productsInCategory[$expected->fields['products_id']])) $productsInCategory[$expected->fields['products_id']] = zen_get_generated_category_path_rev($expected->fields['master_categories_id']);

        
    $expectedItems[] = $expected->fields;

        
    $expected->MoveNext();

      }

      require(
    $template->get_template_dir('tpl_modules_upcoming_products.php'DIR_WS_TEMPLATE$current_page_base,'templates'). '/' 'tpl_modules_upcoming_products.php');

    }

    ?>
    Then place this tpl_modules_upcoming_products.php in includes/tmplates/YourTemplate/templates

    PHP Code:
    <?php
    /**
     * Module Template
     *
     * @package templateSystem
     * @copyright Copyright 2003-2007 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: tpl_modules_upcoming_products.php 6422 2007-05-31 00:51:40Z ajeh $
     */
    ?>
    <!-- bof: upcoming_products -->
    <fieldset>
    <legend><?php echo TABLE_HEADING_UPCOMING_PRODUCTS?></legend>
    <table border="0" width="100%" cellspacing="0" cellpadding="2" id="upcomingProductsTable" summary="<?php echo SUMMARY_TABLE_UPCOMING_PRODUCTS?>">
    <caption><?php echo CAPTION_UPCOMING_PRODUCTS?></caption>
      <tr>
        <th scope="col" id="upProductsHeading"><?php echo TABLE_HEADING_PRODUCTS?></th>
        <th scope="col" id="upDateHeading"><?php echo TABLE_HEADING_DATE_EXPECTED?></th>
      </tr>
    <?php

        
    for($i=0$row=0$i sizeof($expectedItems); $i++, $row++) {
          
    $rowClass = (($row 2) == floor($row 2)) ? "rowEven" "rowOdd";
          echo 
    '  <tr class="' $rowClass '">' "\n";
          echo 
    '    <td >'  zen_image(DIR_WS_IMAGES $expectedItems[$i]['products_image'], $expectedItems[$i]['products_name'], IMAGE_PRODUCT_NEW_WIDTHIMAGE_PRODUCT_NEW_HEIGHT) . '</td><td><a href="' zen_href_link(zen_get_info_page($expectedItems[$i]['products_id']), 'cPath=' $productsInCategory[$expectedItems[$i]['products_id']] . '&products_id=' $expectedItems[$i]['products_id']) . '">' $expectedItems[$i]['products_name'] . '</a></td>' "\n";
          echo 
    '    <td align="right" >' zen_date_short($expectedItems[$i]['date_expected']) . '</td>' "\n";
          echo 
    '  </tr>' "\n";
        }
    ?>
    </table>
    </fieldset>
    <!-- eof: upcoming_products -->
    The size of the image will be the same as for new products set in admin configuration/images, but if you want somthing diferent it is easy to change by using for excample
    $image_width = "your choise";
    $image_height = "your choise";
    and change IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT, into $image_width, $image_height

    Good luck

  3. #3
    Join Date
    Dec 2008
    Posts
    23
    Plugin Contributions
    0

    Default Re: Contributions that would allow changes to Upcoming Products?

    ......... and to make it looks better, put in a <td></td> in tpl_modules_upcoming_products.php - just before:
    PHP Code:
    <th scope="col"  id="upProductsHeading"><?php echo TABLE_HEADING_PRODUCTS?></th>
    So the tpl_modules_upcoming_products.php file should be:
    PHP Code:
    <?php
    /**
     * Module Template
     *
     * @package templateSystem
     * @copyright Copyright 2003-2007 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: tpl_modules_upcoming_products.php 6422 2007-05-31 00:51:40Z ajeh $
     */
    ?>
    <!-- bof: upcoming_products -->
    <fieldset>
    <legend><?php echo TABLE_HEADING_UPCOMING_PRODUCTS?></legend>
    <table border="0" width="100%" cellspacing="0" cellpadding="2" id="upcomingProductsTable" summary="<?php echo SUMMARY_TABLE_UPCOMING_PRODUCTS?>">
    <caption><?php echo CAPTION_UPCOMING_PRODUCTS?></caption>
      <tr>
      <td></td>
        <th scope="col"  id="upProductsHeading"><?php echo TABLE_HEADING_PRODUCTS?></th>
        <th scope="col" id="upDateHeading"><?php echo TABLE_HEADING_DATE_EXPECTED?></th>
      </tr>
    <?php

        
    for($i=0$row=0$i sizeof($expectedItems); $i++, $row++) {
          
    $rowClass = (($row 2) == floor($row 2)) ? "rowEven" "rowOdd";
          echo 
    '  <tr class="' $rowClass '">' "\n";
          echo 
    '    <td >'  zen_image(DIR_WS_IMAGES $expectedItems[$i]['products_image'], $expectedItems[$i]['products_name'], IMAGE_PRODUCT_NEW_WIDTHIMAGE_PRODUCT_NEW_HEIGHT) . '</td><td><a href="' zen_href_link(zen_get_info_page($expectedItems[$i]['products_id']), 'cPath=' $productsInCategory[$expectedItems[$i]['products_id']] . '&products_id=' $expectedItems[$i]['products_id']) . '">' $expectedItems[$i]['products_name'] . '</a></td>' "\n";
          echo 
    '    <td align="right" >' zen_date_short($expectedItems[$i]['date_expected']) . '</td>' "\n";
          echo 
    '  </tr>' "\n";
        }
    ?>
    </table>
    </fieldset>
    <!-- eof: upcoming_products -->
    I forgott a cell in the table .........

  4. #4
    Join Date
    May 2009
    Location
    Junction City, Oregon
    Posts
    315
    Plugin Contributions
    0

    Default Re: Contributions that would allow changes to Upcoming Products?

    Wow that looks so much better.... thank you. The only I couldn't figure out was the new width and height. If I want the images to show up as 92 x 110 px, how would I write that in? Looking at the other code, it was a little confusing.

    Thank you very much for getting this working for me!

    KismetDesign

  5. #5
    Join Date
    Jan 2007
    Posts
    1,483
    Plugin Contributions
    10

    Default Re: Contributions that would allow changes to Upcoming Products?

    in the admin panel, go to configuration>images and change image-new product width and image-new product height to the settings you want. This affects all images that are called by zen_image using the[FONT=Verdana][FONT=monospace] IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT constants. So if you don't want all of those images to be the size of the upcoming products image size you want, simply change this line in [/FONT][/FONT]tpl_modules_upcoming_products.php in includes/tmplates/YourTemplate/templates:

    from:
    PHP Code:
     echo '    <td >'  zen_image(DIR_WS_IMAGES $expectedItems[$i]['products_image'], $expectedItems[$i]['products_name'], IMAGE_PRODUCT_NEW_WIDTHIMAGE_PRODUCT_NEW_HEIGHT) . '</td><td><a href="' zen_href_link(zen_get_info_page($expectedItems[$i]['products_id']), 'cPath=' $productsInCategory[$expectedItems[$i]['products_id']] . '&products_id=' $expectedItems[$i]['products_id']) . '">' $expectedItems[$i]['products_name'] . '</a></td>' "\n"
    to:

    PHP Code:
     echo '    <td >'  zen_image(DIR_WS_IMAGES $expectedItems[$i]['products_image'], $expectedItems[$i]['products_name'], 92110) . '</td><td><a href="' zen_href_link(zen_get_info_page($expectedItems[$i]['products_id']), 'cPath=' $productsInCategory[$expectedItems[$i]['products_id']] . '&products_id=' $expectedItems[$i]['products_id']) . '">' $expectedItems[$i]['products_name'] . '</a></td>' "\n"
    And you are done.
    [FONT=Verdana][FONT=monospace] [/FONT][/FONT]

    Zen Cart and it's community are the best!!

  6. #6
    Join Date
    Dec 2008
    Posts
    23
    Plugin Contributions
    0

    Default Re: Contributions that would allow changes to Upcoming Products?

    Quote Originally Posted by KismetDesign View Post
    Wow that looks so much better.... thank you. The only I couldn't figure out was the new width and height. If I want the images to show up as 92 x 110 px, how would I write that in? Looking at the other code, it was a little confusing.

    Thank you very much for getting this working for me!

    KismetDesign
    If you want to use a image size in upcoming prods that is different from and dont effect any other module in zencart, the easiest way to do it is like this in the tpl_modules_upcoming_products.php:

    PHP Code:
    <?php
    /**
     * Module Template
     *
     * @package templateSystem
     * @copyright Copyright 2003-2007 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: tpl_modules_upcoming_products.php 6422 2007-05-31 00:51:40Z ajeh $
     */
    ?>
    <!-- bof: upcoming_products -->
    <fieldset>
    <legend><?php echo TABLE_HEADING_UPCOMING_PRODUCTS?></legend>
    <table border="0" width="100%" cellspacing="0" cellpadding="2" id="upcomingProductsTable" summary="<?php echo SUMMARY_TABLE_UPCOMING_PRODUCTS?>">
    <caption><?php echo CAPTION_UPCOMING_PRODUCTS?></caption>
      <tr>
      <td></td>
        <th scope="col"  id="upProductsHeading"><?php echo TABLE_HEADING_PRODUCTS?></th>
        <th scope="col" id="upDateHeading"><?php echo TABLE_HEADING_DATE_EXPECTED?></th>
      </tr>
    <?php
            $image_width 
    =       "92";
           
    $image_height =       "110";
           
        for(
    $i=0$row=0$i sizeof($expectedItems); $i++, $row++) {
          
    $rowClass = (($row 2) == floor($row 2)) ? "rowEven" "rowOdd";
          echo 
    '  <tr class="' $rowClass '">' "\n";
          echo 
    '    <td >'  zen_image(DIR_WS_IMAGES $expectedItems[$i]['products_image'], $expectedItems[$i]['products_name'], $image_width$image_height) . '</td><td><a href="' zen_href_link(zen_get_info_page($expectedItems[$i]['products_id']), 'cPath=' $productsInCategory[$expectedItems[$i]['products_id']] . '&products_id=' $expectedItems[$i]['products_id']) . '">' $expectedItems[$i]['products_name'] . '</a></td>' "\n";
          echo 
    '    <td align="right" >' zen_date_short($expectedItems[$i]['date_expected']) . '</td>' "\n";
          echo 
    '  </tr>' "\n";
        }
    ?>
    </table>
    </fieldset>
    <!-- eof: upcoming_products -->
    It should work. I have used a similar way in featured products, because i have changed it so one of the products come randomly up on frontpage on top of the other columns with a larger image and more of the descrtiption.
    You can see it here if you update the site a few times:
    http://www.webtorget.no

    ....... anyway, good luck

  7. #7
    Join Date
    Dec 2009
    Posts
    19
    Plugin Contributions
    0

    Default Re: Contributions that would allow changes to Upcoming Products?

    I have all set as per above code, but my upcoming product prices are not coming correctly. Live: www.gsmnation.com

 

 

Similar Threads

  1. v139h I Need An Addon That Will Allow Me To Only Sell Certain Products With Other Products
    By CaptainFacePalm in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 14 Feb 2014, 08:29 AM
  2. Replies: 3
    Last Post: 16 Sep 2010, 03:53 AM
  3. How to make changes? EZ Pages Doesn't seem to allow
    By Axile in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 15 Mar 2010, 08:35 PM
  4. Replies: 0
    Last Post: 28 Jan 2010, 10:45 AM
  5. Contributions/Modules that affect (required) attributes?
    By fepb in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 29 Jun 2007, 09:01 PM

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