Full service web hosting, great prices and support. Starts at $1.99/month!
Page 3 of 5 First 12345 LastLast
Results 21 to 30 of 45

Thread: New Products Project

  1. #21
    Chitman
    Guest


    Default Re: New Products Project

    Here's the code of the products_new.tpl that was already in my templates directory. Thanx a lot

    PHP Code:
     <table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
              <tr>
                <td class="pageHeading"><?php echo HEADING_TITLE?></td>
                <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES 'table_background_products_new.gif'HEADING_TITLEHEADING_IMAGE_WIDTHHEADING_IMAGE_HEIGHT); ?></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td><?php echo tep_draw_separator('pixel_trans.gif''100%''10'); ?></td>
          </tr>
    <?php
      $products_new_array 
    = array();

      
    $products_new_query_raw "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " TABLE_PRODUCTS " p left join " TABLE_MANUFACTURERS " m on (p.manufacturers_id = m.manufacturers_id), " TABLE_PRODUCTS_DESCRIPTION " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id "' and month(p.products_date_added) = month(now()) order by p.products_date_added DESC, pd.products_name";
      
    $products_new_split = new splitPageResults($products_new_query_rawMAX_DISPLAY_PRODUCTS_NEW);

      if ((
    $products_new_split->number_of_rows 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) {
    ?>
          <tr>
            <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
              <tr>
                <td class="smallText"><?php echo $products_new_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS_NEW); ?></td>
                <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE ' ' $products_new_split->display_links(MAX_DISPLAY_PAGE_LINKStep_get_all_get_params(array('page''info''x''y'))); ?></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td><?php echo tep_draw_separator('pixel_trans.gif''100%''10'); ?></td>
          </tr>
    <?php
      
    }
    ?>
          <tr>
            <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
    <?php
      
    if ($products_new_split->number_of_rows 0) {
    // BOF Separate Price Per Customer
    //  global variable (session): $sppc_customers_group_id -> local variable $customer_group_id

      
    if(!tep_session_is_registered('sppc_customer_group_id')) { 
      
    $customer_group_id '0';
      } else {
       
    $customer_group_id $sppc_customer_group_id;
      }
        
    $products_new_query tep_db_query($products_new_split->sql_query);
        
    $no_of_products_new tep_db_num_rows($products_new_query);
        while (
    $_products_new tep_db_fetch_array($products_new_query)) {
          
    $products_new[] = $_products_new;
        
    $list_of_prdct_ids[] = $_products_new['products_id'];  
        }
        
      
    $select_list_of_prdct_ids "products_id = '".$list_of_prdct_ids[0]."' ";
       if (
    $no_of_products_new 1) {
          for (
    $n $n count($list_of_prdct_ids) ; $n++) {
          
    $select_list_of_prdct_ids .= "or products_id = '".$list_of_prdct_ids[$n]."' ";   
          }
       }

    // get all customers_group_prices for products with the particular customer_group_id
    // however not necessary for customer_group_id
    if ($customer_group_id != '0') {
      
    $pg_query tep_db_query("select pg.products_id, customers_group_price as price from " TABLE_PRODUCTS_GROUPS " pg where (".$select_list_of_prdct_ids.") and pg.customers_group_id = '".$customer_group_id."'");
        while (
    $pg_array tep_db_fetch_array($pg_query)) {
        
    $new_prices[] = array ('products_id' => $pg_array['products_id'], 'products_price' => $pg_array['price'], 'specials_new_products_price' => '');
        }

       for (
    $x 0$x $no_of_products_new$x++) {
    // replace products prices with those from customers_group table
    // originally they would be obtained with an extra query for every new product:
    //   if ($new_price = tep_get_products_special_price($products_new['products_id'])) {
          
            
    if(!empty($new_prices)) {
            for (
    $i 0$i count($new_prices); $i++) {
                if( 
    $products_new[$x]['products_id'] == $new_prices[$i]['products_id'] ) {
                
    $products_new[$x]['products_price'] = $new_prices[$i]['products_price'];
                }
            }
        } 
    // end if(!empty($new_prices)
       
    // end for ($x = 0; $x < $no_of_products_new; $x++)
    // end if ($customer_group_id != '0')

    // an extra query is needed for all the specials

        
    $specials_query tep_db_query("select s.products_id, specials_new_products_price from " TABLE_SPECIALS " s  where (".$select_list_of_prdct_ids.") and status = '1' and s.customers_group_id = '" .$customer_group_id"'");
        while (
    $specials_array tep_db_fetch_array($specials_query)) {
        
    $new_prices[] = array ('products_id' => $specials_array['products_id'], 'products_price' => '''specials_new_products_price' => $specials_array['specials_new_products_price']);
        }

    // replace specials_new_products_price with those those for the customers_group_id
        
    for ($x 0$x $no_of_products_new$x++) {
          
            if(!empty(
    $new_prices)) {
            for (
    $i 0$i count($new_prices); $i++) {
                if( 
    $products_new[$x]['products_id'] == $new_prices[$i]['products_id'] ) {
                
    $products_new[$x]['specials_new_products_price'] = $new_prices[$i]['specials_new_products_price'];
                }
               }
           } 
    // end if(!empty($new_prices)
    //    } // end for ($x = 0; $x < $no_of_products_new; $x++)
            
        
    if (tep_not_null($products_new[$x]['specials_new_products_price'])) {
                
    $products_price '<s>' $currencies->display_price($products_new[$x]['products_price'], tep_get_tax_rate($products_new[$x]['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' $currencies->display_price($products_new[$x]['specials_new_products_price'], tep_get_tax_rate($products_new[$x]['products_tax_class_id'])) . '</span>';
        } else {
            
    $products_price $currencies->display_price($products_new[$x]['products_price'], tep_get_tax_rate($products_new[$x]['products_tax_class_id']));
        }
    ?>
              <tr>
                <td width="<?php echo SMALL_IMAGE_WIDTH 10?>" valign="top" class="main"><?php echo '<a href="' tep_href_link(FILENAME_PRODUCT_INFO'products_id=' $products_new[$x]['products_id']) . '">' tep_image(DIR_WS_IMAGES $products_new[$x]['products_image'], $products_new[$x]['products_name'], SMALL_IMAGE_WIDTHSMALL_IMAGE_HEIGHT) . '</a>'?></td>
                <td valign="top" class="main"><?php echo '<a href="' tep_href_link(FILENAME_PRODUCT_INFO'products_id=' $products_new[$x]['products_id']) . '"><b><u>' $products_new[$x]['products_name'] . '</u></b></a><br>' TEXT_DATE_ADDED ' ' tep_date_long($products_new[$x]['products_date_added']) . '<br>' TEXT_MANUFACTURER ' ' $products_new[$x]['manufacturers_name'] . '<br><br>' TEXT_PRICE ' ' $products_price?></td>
                <td align="right" valign="middle" class="main"><?php echo '<a href="' tep_href_link(FILENAME_PRODUCTS_NEWtep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' $products_new[$x]['products_id']) . '">' tep_image_button('button_in_cart.gif'IMAGE_BUTTON_IN_CART) . '</a>'?></td>
              </tr>
              <tr>
                <td colspan="3"><?php echo tep_draw_separator('pixel_trans.gif''100%''10'); ?></td>
              </tr>
    <?php // EOF Separate Pricing Per Customer
       
    // end for ($x = 0; $x < $products_new_split->number_of_rows; $x++)
     
    }  else { 
    ?>
              <tr>
                <td class="main"><?php echo TEXT_NO_NEW_PRODUCTS?></td>
              </tr>
              <tr>
                <td><?php echo tep_draw_separator('pixel_trans.gif''100%''10'); ?></td>
              </tr>
    <?php
      
    }
    ?>
            </table></td>
          </tr>
    <?php
      
    if (($products_new_split->number_of_rows 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {
    ?>
          <tr>
            <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
              <tr>
                <td class="smallText"><?php echo $products_new_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS_NEW); ?></td>
                <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE ' ' $products_new_split->display_links(MAX_DISPLAY_PAGE_LINKStep_get_all_get_params(array('page''info''x''y'))); ?></td>
              </tr>
            </table></td>
          </tr>
    <?php
      
    }
    ?>
        </table>

  2. #22
    osCMax Development Team

    New Products Project

    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    3,517
    Contribute If you enjoy reading the
    content here, click the below
    image to support our site.
    Click Here To Contribute To Our Site

    Total Contributions For

    pgmarshall     $ 35.00
    Rep Power
    81


    Default Re: New Products Project

    Okay

    Edit this line

    Code:
    $products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and month(p.products_date_added) = month(now()) order by p.products_date_added DESC, pd.products_name";
    as per my instructions to the following

    Code:
    $products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_featured = '1' 
     and order by p.products_date_added DESC, pd.products_name";
    and that should make it work!

    Post back if you have any other problems with the code.

    Regards,
    pgmarshall
    _______________________________

  3. #23
    Chitman
    Guest


    Default Re: New Products Project

    They're still showing up on the main page. I also found a new_products.php file. I dont know if this may have something to do with it. Thanx.
    PHP Code:
    <?php
    /*
    $Id: new_products.php 3 2006-05-27 04:59:07Z user $

      osCMax Power E-Commerce
      http://oscdox.com

      Copyright 2006 osCMax

      Released under the GNU General Public License
    */
    ?>
    <!-- new_products //-->
    <?php

    // BOF: MOD - Separate Pricing per Customer
    //  $info_box_contents = array();
      
    $box_content = array();
    //  $info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')));
      
    $box_content[] = array('align' => 'left''text' => '<a href="' tep_href_link(FILENAME_PRODUCTS_NEW) . '" class="headerNavigation">' sprintf(TABLE_HEADING_NEW_PRODUCTSstrftime('%B') . '</a>'));
    //  new contentBoxHeading($info_box_contents);
      
    new infoBoxHeading($box_contentfalsefalsetep_href_link(FILENAME_PRODUCTS_NEW));

      if ( (!isset(
    $new_products_category_id)) || ($new_products_category_id == '0') ) {
    //  $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
        
    $new_products_query tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, p.products_price as products_price from " TABLE_PRODUCTS " p where products_status = '1' and p.products_featured = '1' order by p.products_date_added desc limit " MAX_DISPLAY_NEW_PRODUCTS);
      } else {
    //  $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
        
    $new_products_query tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, p.products_price as products_price from " TABLE_PRODUCTS " p, " TABLE_PRODUCTS_TO_CATEGORIES " p2c, " TABLE_CATEGORIES " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id "' and p.products_status = '1' and p.products_featured = '1'  order by p.products_date_added desc limit "MAX_DISPLAY_NEW_PRODUCTS);
      }

    // global variable (session) $sppc_customer_group_id -> local variable customer_group_id
      
    if(!tep_session_is_registered('sppc_customer_group_id')) {
      
    $customer_group_id '0';
      } else {
       
    $customer_group_id $sppc_customer_group_id;
      }

      if ((
    $no_of_new_products tep_db_num_rows($new_products_query)) > 0) {
          while (
    $_new_products tep_db_fetch_array($new_products_query)) {
        
    $new_products[] = $_new_products;
        
    $list_of_prdct_ids[] = $_new_products['products_id'];
        }

    $select_list_of_prdct_ids "products_id = '".$list_of_prdct_ids[0]."' ";
      if (
    $no_of_new_products 1) {
       for (
    $n $n count($list_of_prdct_ids) ; $n++) {
       
    $select_list_of_prdct_ids .= "or products_id = '".$list_of_prdct_ids[$n]."' ";
       }
    }
    // get all customers_group_prices for products with the particular customer_group_id
    // however not necessary for customer_group_id = 0
    if ($customer_group_id != '0') {
      
    $pg_query tep_db_query("select pg.products_id, customers_group_price as price from " TABLE_PRODUCTS_GROUPS " pg where (".$select_list_of_prdct_ids.") and pg.customers_group_id = '".$customer_group_id."'");
        while (
    $pg_array tep_db_fetch_array($pg_query)) {
        
    $new_prices[] = array ('products_id' => $pg_array['products_id'], 'products_price' => $pg_array['price'], 'specials_new_products_price' => '');
        }

       for (
    $x 0$x $no_of_new_products$x++) {
    // replace products prices with those from customers_group table
            
    if(!empty($new_prices)) {
            for (
    $i 0$i count($new_prices); $i++) {
                if( 
    $new_products[$x]['products_id'] == $new_prices[$i]['products_id'] ) {
                
    $new_products[$x]['products_price'] = $new_prices[$i]['products_price'];
                }
            }
        } 
    // end if(!empty($new_prices)
       
    // end for ($x = 0; $x < $no_of_products_new; $x++)
    // end if ($customer_group_id != '0')

    // an extra query is needed for all the specials
        
    $specials_query tep_db_query("select products_id, specials_new_products_price from specials where (".$select_list_of_prdct_ids.") and status = '1' and customers_group_id = '" .$customer_group_id"' ");
        while (
    $specials_array tep_db_fetch_array($specials_query)) {
        
    $new_s_prices[] = array ('products_id' => $specials_array['products_id'], 'specials_new_products_price' => $specials_array['specials_new_products_price']);
        }

    // replace products_price with the correct specials_new_products_price
    if(!empty($new_s_prices)) {
        for (
    $x 0$x $no_of_new_products$x++) {
            for (
    $i 0$i count($new_s_prices); $i++) {
                if( 
    $new_products[$x]['products_id'] == $new_s_prices[$i]['products_id'] ) {
                
    $new_products[$x]['products_price'] = $new_s_prices[$i]['specials_new_products_price'];
                }
               }
           }
        } 
    // // end if(!empty($new_s_prices)

      
    $row 0;
      
    $col 0;
    //  $info_box_contents = array();
      
    $box_content = array();

    //  while ($new_products = tep_db_fetch_array($new_products_query)) {
        
    for ($x 0$x $no_of_new_products$x++) {
        
    $new_products[$x]['products_name'] = tep_get_products_name($new_products[$x]['products_id']);

        
    $box_content[$row][$col] = array('align' => 'center',
                                               
    'params' => 'class="smallText" width="33%" valign="top"',
                                               
    'text' => '<a href="' tep_href_link(FILENAME_PRODUCT_INFO'products_id=' $new_products[$x]['products_id']) . '">' tep_image(DIR_WS_IMAGES $new_products[$x]['products_image'], $new_products[$x]['products_name'], SMALL_IMAGE_WIDTHSMALL_IMAGE_HEIGHT) . '</a><br><a href="' tep_href_link(FILENAME_PRODUCT_INFO'products_id=' $new_products[$x]['products_id']) . '">' $new_products[$x]['products_name'] . '</a><br>' $currencies->display_price($new_products[$x]['products_price'], tep_get_tax_rate($new_products[$x]['products_tax_class_id'])));

        
    $col ++;
        if (
    $col 2) {
          
    $col 0;
          
    $row ++;
        }
       } 
    // end for ($x = 0; $x < $no_of_new_products; $x++)
     
    //  end if (($no_of_new_products = tep_db_num_rows($new_products_query)) > 0)
      
    new contentBox($box_content);
    // EOF: MOD - Separate Pricing per Customer
    ?>
    <!-- new_products_eof //-->

  4. #24
    osCMax Development Team

    New Products Project

    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    3,517
    Contribute If you enjoy reading the
    content here, click the below
    image to support our site.
    Click Here To Contribute To Our Site

    Total Contributions For

    pgmarshall     $ 35.00
    Rep Power
    81


    Default Re: New Products Project

    Chitman,

    This is the module code you editted in step 2. I can see the code correctly in there.

    Best to check your dbase - go to phpMyAdmin or similar and open the products table - is the column products_featured all set to 1s or 0s. If they are all set to 1s then they will all continue to appear in date order as before. You need to set them all to 0 to hide them.

    If this doesn't work I am slightly stumped as to what is wrong with your version.

    Regards,
    pgmarshall
    _______________________________

  5. #25
    Chitman
    Guest


    Default Re: New Products Project

    That was fine actually. I found out that they are pulling the new products from this file instead of product_new.php.tpl.

    PHP Code:
    <?php
    /*
      $Id: new_products.php,v 1.0 2004/01/09 22:49:58 hpdl Exp $

      AlgoZone, Inc
      http://www.algozone.com

      Copyright (c) 2004 Algozone, Inc

      Released under the GNU General Public License
    */
    ?>
    <!-- new_products //-->
    <?php
      $max_number_of_products 
    4;
      
    //Uncomment for osCommerce standard (admin setting);
      //$max_number_of_products = MAX_DISPLAY_NEW_PRODUCTS;

      
    if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
        
    $new_products_query tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " TABLE_PRODUCTS " p left join " TABLE_SPECIALS " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added desc limit " $max_number_of_products);
      } else {
        
    $new_products_query tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " TABLE_PRODUCTS " p left join " TABLE_SPECIALS " s on p.products_id = s.products_id, " TABLE_PRODUCTS_TO_CATEGORIES " p2c, " TABLE_CATEGORIES " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id "' and p.products_status = '1' order by p.products_date_added desc limit " $max_number_of_products);
      }

      
    $row 0;
      
    $col 0;
      
    $info_box_contents = array();
      while (
    $new_products tep_db_fetch_array($new_products_query)) {
        
    $product_query tep_db_query("select products_name, products_description from " TABLE_PRODUCTS_DESCRIPTION " where products_id = '" . (int)$new_products['products_id'] . "' and language_id = '" . (int)$languages_id "'");
        
    $product tep_db_fetch_array($product_query);
        
    #PR Build product information box
        
    $product_info_str '<table border="0" cellspacing="0" cellpadding="0" class="productBoxHeading_tb"><tr>';
        
    $product_info_str .= '<td class="productBoxHeadingLcorner"></td>';
        
    $product_info_str .= '<td class="productBoxHeading"><table width="100%" class="expender_tb"><tr><td></td></tr></table></td></td>';
        
    $product_info_str .= '<td class="productBoxHeadingRcorner"></td>';
        
    $product_info_str .= '</tr></table>';
        
    $product_info_str .= '<table border="0" width="210" cellspacing="0" cellpadding="0" class="productBoxOuter"><tr>';
        
    $product_info_str .= '<td class="productBoxLSide"> </td>';
        
    $product_info_str .= '<td height=100% valign="top" class="productBoxMSide">';
        
    $product_info_str .= '<table border="0" width="100%" cellspacing="0" cellpadding="3" class="productBox" valign="top"><tr><td>';
        
    $product_info_str .= '<a href="' tep_href_link(FILENAME_PRODUCT_INFO'products_id=' $new_products['products_id']) . '">' tep_image(DIR_WS_IMAGES $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTHSMALL_IMAGE_HEIGHT) . '</a>';
        
    $product_info_str .= '</td><td valign="top">';
        
    $product_info_str .= '<div class="productBox_prod_name"><a href="' tep_href_link(FILENAME_PRODUCT_INFO'products_id=' $new_products['products_id']) . '">' $product['products_name'] . '</a></div>';
        
    $product_info_str .= '<div class="productBox_prod_discr">'.substr($product['products_description'], 080).'</div>';
        
    $product_info_str .= '<table border="0" width="100%" cellspacing="0" cellpadding="0" class="productBox_prod_price"><tr><td>' $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id']));
        
    $product_info_str .= '</td><td><IMG SRC="'DIR_WS_TEMPLATE_IMAGES .'hl_1.gif">&nbsp;<IMG SRC="'DIR_WS_TEMPLATE_IMAGES .'az_icon_sm_cart.gif">&nbsp;';
        
    $product_info_str .= '</td><td><a href="' tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' $new_products['products_id']) . '">' IMAGE_BUTTON_BUY_NOW '</a>';
        
    $product_info_str .= '</td></tr></table>';
        
    $product_info_str .= '</td></tr></table>';
        
    $product_info_str .= '</td><td class="productBoxRSide"></td></tr></table>';
        
    $product_info_str .= '<table border="0" cellspacing="0" cellpadding="0" class="productBoxBottom_tb"><tr>';
        
    $product_info_str .= '<td class="productBoxLBottom">';
        
    $product_info_str .= '</td>';
        
    $product_info_str .= '<td class="productBoxMBottom"><table width="100%" class="expender_tb"><tr><td></td></tr></table></td>';
        
    $product_info_str .= '<td class="productBoxRBottom">';
        
    $product_info_str .= '</td></tr></table>';

        
    $info_box_contents[$row][$col] = array('align' => 'center',
                                               
    'params' => 'class="smallText" width="50%" valign="top"',
                                               
    'text' => $product_info_str);

        
    $col ++;
        if (
    $col 1) {
          
    $col 0;
          
    $row ++;
        }
      }

      new 
    contentBox($info_box_contentstrue"Center");
    ?>
    <!-- new_products_eof //-->

  6. #26
    ptt81
    Guest


    Default Re: New Products Project

    Hi Pgmarshall, I was wondering if it is possible to add an extra collumn in admin where you can tick it on/off without going into each product, i know there is several other "featured products" mod out there that does this.

  7. #27
    osCMax Development Team

    New Products Project

    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    3,517
    Contribute If you enjoy reading the
    content here, click the below
    image to support our site.
    Click Here To Contribute To Our Site

    Total Contributions For

    pgmarshall     $ 35.00
    Rep Power
    81


    Default Re: New Products Project

    If you want to update loads of products at once ... then you could add the column into Easypopulate - instructions to do this are elsewhere on this board.

    Or, simply go into phpMyAdmin and list your products table and change the flag there.

    Otherwise, I am not sure why you would want to make all of your products 'featured' ...

    Maybe I am missing the point - post back if this isn't the answer you were looking for.

    Regards,
    pgmarshall
    _______________________________

  8. #28
    ptt81
    Guest


    Default Re: New Products Project

    I have no idea what you meant with Easypopulate, I haven't a clue on how to use that.

    I just wanted an extra setting column within admin in the product listing with the red/green dot where you can just tick on/off the featured product.

    It would be it a lot easier than to go into each product to turn it off, scroll down, hit update, and going into another product turn it on, and so on, i just want to simplify down the process. I know its possible, just dont know how to do it.

  9. #29
    osCMax Development Team

    New Products Project

    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    3,517
    Contribute If you enjoy reading the
    content here, click the below
    image to support our site.
    Click Here To Contribute To Our Site

    Total Contributions For

    pgmarshall     $ 35.00
    Rep Power
    81


    Smile Re: New Products Project

    ptt81,

    I thought this was a good idea and have now implemented it on my site ...

    and I thought I would try and help you sort it out on yours.

    It is a bit involved but if you know your way round php I bit it is mainly copy and pasting.

    BACKUP BEFORE CHANGING ANYTHING

    1. Find the
    Code:
    $products_query=
    in the categories.php in admin. There are two queries within an IF statement. You need to add
    Code:
    products_featured
    just before the
    Code:
    from " . TABLE_PRODUCTS
    in both of the queries.

    2. Add this code
    Code:
    <?php
    //Added to try control featured products addon
     if ($products['products_featured'] == '1') {
            echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ICON_STATUS_GREEN, 10, 10) . '&nbsp;&nbsp;<a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=setfeaturedflag&flag=0&pID=' . $products['products_id'] . '&cPath=' . $cPath) . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', IMAGE_ICON_STATUS_RED_LIGHT, 10, 10) . '</a>';
          } else {
            echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=setfeaturedflag&flag=1&pID=' . $products['products_id'] . '&cPath=' . $cPath) . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', IMAGE_ICON_STATUS_GREEN_LIGHT, 10, 10) . '</a>&nbsp;&nbsp;' . tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_STATUS_RED, 10, 10);
          }
    ?>
    After this bit

    Code:
    <td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products['products_id'] . '&action=new_product_preview&read=only') . '">' . tep_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a>&nbsp;' . $products['products_name']; ?></td>
                    <td class="dataTableContent" align="center">
    3. At the top of the categories.php file you should find
    Code:
    case 'setflag':
            if ( ($HTTP_GET_VARS['flag'] == '0') || ($HTTP_GET_VARS['flag'] == '1') ) {
              if (isset($HTTP_GET_VARS['pID'])) {
                tep_set_product_status($HTTP_GET_VARS['pID'], $HTTP_GET_VARS['flag']);
              }
              if (USE_CACHE == 'true') {
                tep_reset_cache_block('categories');
                tep_reset_cache_block('also_purchased');
              }
            }
            tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $HTTP_GET_VARS['cPath'] . '&pID=' . $HTTP_GET_VARS['pID']));
            break;
    Add this afterwards:

    Code:
    case 'setfeaturedflag':
            if ( ($HTTP_GET_VARS['flag'] == '0') || ($HTTP_GET_VARS['flag'] == '1') ) {
              if (isset($HTTP_GET_VARS['pID'])) {
                tep_set_product_featured($HTTP_GET_VARS['pID'], $HTTP_GET_VARS['flag']);
              }
              if (USE_CACHE == 'true') {
                tep_reset_cache_block('categories');
                tep_reset_cache_block('also_purchased');
              }
            }
            tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $HTTP_GET_VARS['cPath'] . '&pID=' . $HTTP_GET_VARS['pID']));
            break;
    4. Then you need to open the admin/includes/functions/general.php and add the tep function. Find this:
    Code:
    ////
    // Sets the status of a product
      function tep_set_product_status($products_id, $status) {
        if ($status == '1') {
          return tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '1', products_last_modified = now() where products_id = '" . (int)$products_id . "'");
        } elseif ($status == '0') {
          return tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0', products_last_modified = now() where products_id = '" . (int)$products_id . "'");
        } else {
          return -1;
        }
      }
    and add this after it:

    Code:
    ////
    // Sets the featured status of a product
      function tep_set_product_featured($products_id, $status) {
        if ($status == '1') {
          return tep_db_query("update " . TABLE_PRODUCTS . " set products_featured = '1', products_last_modified = now() where products_id = '" . (int)$products_id . "'");
        } elseif ($status == '0') {
          return tep_db_query("update " . TABLE_PRODUCTS . " set products_featured = '0', products_last_modified = now() where products_id = '" . (int)$products_id . "'");
        } else {
          return -1;
        }
      }
    5. Thats it! I think ... now you should have a little green and red button that switches the featured status on and off.

    I have reused some of the code from another mod (product status on/off) - therefore, without knowing what mods you have installed there is no way for me to know if this will work for you. Although - it works for me and therefore is not impossible to achieve!

    Thanks for the idea.

    Regards,
    pgmarshall
    _______________________________

  10. #30
    ptt81
    Guest


    Default Re: New Products Project

    Good work, everything works fine. I want to mention in Step #2, I have to adjust one bit so it will actually make a new column and add some other bit to make looks better. So instead, you would add

    <td class="dataTableContent" align="center">
    <?php
    //Added to try control featured products addon
    if ($products['products_featured'] == '1') {
    echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ICON_STATUS_GREEN, 10, 10) . '&nbsp;&nbsp;<a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=setfeaturedflag&flag=0&pID=' . $products['products_id'] . '&cPath=' . $cPath) . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', IMAGE_ICON_STATUS_RED_LIGHT, 10, 10) . '</a>';
    } else {
    echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=setfeaturedflag&flag=1&pID=' . $products['products_id'] . '&cPath=' . $cPath) . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', IMAGE_ICON_STATUS_GREEN_LIGHT, 10, 10) . '</a>&nbsp;&nbsp;' . tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_STATUS_RED, 10, 10);
    }
    ?></td>
    after these codes:

    <td class="dataTableContent" align="center">
    <?php
    if ($products['products_status'] == '1') {
    echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ICON_STATUS_GREEN, 10, 10) . '&nbsp;&nbsp;<a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=setflag&flag=0&pID=' . $products['products_id'] . '&cPath=' . $cPath) . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', IMAGE_ICON_STATUS_RED_LIGHT, 10, 10) . '</a>';
    } else {
    echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=setflag&flag=1&pID=' . $products['products_id'] . '&cPath=' . $cPath) . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', IMAGE_ICON_STATUS_GREEN_LIGHT, 10, 10) . '</a>&nbsp;&nbsp;' . tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_STATUS_RED, 10, 10);
    }
    ?></td>
    <td class="dataTableContent" align="center">
    additionally add:

    <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_FEATURED; ?></td>
    after

    <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_STATUS; ?></td>
    in amdin/includes/language/english/categories.php

    after:

    define('TABLE_HEADING_STATUS', 'Status');
    add:

    define('TABLE_HEADING_FEATURED', 'Featured');
    That's it! Now you get a new "Featured" column just like the "Status" column.
    Last edited by ptt81; 06-06-2009 at 12:42 PM.

Page 3 of 5 First 12345 LastLast

Similar Threads

  1. Replies: 0
    Last Post: 09-22-2008, 11:00 AM
  2. Replies: 0
    Last Post: 09-21-2008, 01:53 AM
  3. need products to display on products.php not index.php, products not displaying below
    By libraschld in forum osCommerce 2.2 Modification Help
    Replies: 0
    Last Post: 09-20-2008, 02:40 AM
  4. "Define About Page" Project
    By allwebnow in forum osCMax v2 Features Discussion
    Replies: 1
    Last Post: 02-29-2008, 12:46 AM
  5. The josC! Project: osCommerce and Joomla CMS
    By michael_s in forum New osCommerce Contributions
    Replies: 0
    Last Post: 12-08-2007, 02:10 AM

Bookmarks

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
  •