Forums / All Other Contributions/Addons / Contributions that would allow changes to Upcoming Products?

Contributions that would allow changes to Upcoming Products?

Views: 2,521

Results 1 to 10 of 10
24 Aug 2009, 8:35 PM
#1
kismetdesign avatar

kismetdesign

Zen Follower

Join Date:
May 2009
Location:
Junction City, Oregon
Posts:
315
Plugin Contributions:
0

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? :huh:

KismetDesign

25 Aug 2009, 4:15 AM
#2
toft avatar

toft

New Zenner

Join Date:
Dec 2008
Posts:
23
Plugin Contributions:
0

Re: Contributions that would allow changes to Upcoming Products?

KismetDesign:

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? :huh:

KismetDesign

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

<?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 > 0 && $_GET['filter_id'] == 0) || $_GET['music_genre_id'] > 0 || $_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 > 0 && $_GET['filter_id'] > 0) ? zen_get_generated_category_path_rev($_GET['filter_id']) : $cPath), false, true, 0, $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_products, 0, -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
/**
 * 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_WIDTH, IMAGE_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

25 Aug 2009, 4:33 AM
#3
toft avatar

toft

New Zenner

Join Date:
Dec 2008
Posts:
23
Plugin Contributions:
0

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

<th scope="col" id="upProductsHeading"><?php echo TABLE_HEADING_PRODUCTS; ?></th> ```

So the tpl_modules_upcoming_products.php file should be:

<?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_WIDTH, IMAGE_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 ......... :blush:

26 Aug 2009, 12:47 AM
#4
kismetdesign avatar

kismetdesign

Zen Follower

Join Date:
May 2009
Location:
Junction City, Oregon
Posts:
315
Plugin Contributions:
0

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! :smile:

KismetDesign

26 Aug 2009, 1:13 AM
#5
lankeeyankee avatar

lankeeyankee

Totally Zenned

Join Date:
Jan 2007
Posts:
1,514
Plugin Contributions:
1

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 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 tpl_modules_upcoming_products.php in includes/tmplates/YourTemplate/templates:

from:

 echo '    <td >'  . zen_image(DIR_WS_IMAGES . $expectedItems[$i]['products_image'], $expectedItems[$i]['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_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:

 echo '    <td >'  . zen_image(DIR_WS_IMAGES . $expectedItems[$i]['products_image'], $expectedItems[$i]['products_name'], 92, 110) . '</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.


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

26 Aug 2009, 5:59 AM
#6
toft avatar

toft

New Zenner

Join Date:
Dec 2008
Posts:
23
Plugin Contributions:
0

Re: Contributions that would allow changes to Upcoming Products?

KismetDesign:

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! :smile:

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
/**
 * 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

3 Apr 2010, 6:28 AM
#7
pathan avatar

pathan

New Zenner

Join Date:
Dec 2009
Posts:
19
Plugin Contributions:
0

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

1 Mar 2011, 12:08 AM
#8
baracudamax avatar

baracudamax

New Zenner

Join Date:
Jul 2010
Posts:
33
Plugin Contributions:
0

Re: Contributions that would allow changes to Upcoming Products?

Hello, check this out please http://www.e-matrix.gr/upcoming_products :smile:

18 Nov 2011, 2:55 PM
#9
jmsnyder23 avatar

jmsnyder23

Zen Follower

Join Date:
Jan 2010
Location:
Richmond, Virginia, United States
Posts:
122
Plugin Contributions:
0

Re: Contributions that would allow changes to Upcoming Products?

I can't get the upcoming products page to paginate. Any suggestions?

17 Apr 2013, 4:12 PM
#10
wutsanemu avatar

wutsanemu

New Zenner

Join Date:
Dec 2010
Posts:
21
Plugin Contributions:
0

Re: Contributions that would allow changes to Upcoming Products?

not sure if there's a newer thread about this, but i'm using 1.3.9d, and i was wondering if there's ALSO some way to display upcoming products in column format? I've found coding to do it for new products or all products, but for some reason upcoming products' code is totally different :/

Thanks if anyone catches this!