Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Upcoming Products modification


greree

Recommended Posts

I'm trying to change Upcoming Products from a line of text at the bottom of the default page to a box in either column right or left with a picture of the product. I took upcoming_products.php from /catalog/includes/modules, changed it around some, and put it in /boxes. The box itself looks and works ok in MSIE. It's pretty screwed up in Netscape and Mozilla. In MSIE the box works fine and everything before it works fine. Everthing after it is screwed up. If I put it as the last box in column left, everything in column left is ok, but the middle appears below column left and stretches all the way across the page. Column right appears below that and is on the left side of the page. You can look at it at http://www.blazondesign.com. No matter where I put it, everything below it screws up. This is the code for upcoming_products.php:

<?php

/*

 $Id: specials.php,v 1.30 2003/02/10 22:31:07 hpdl Exp $



 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com



 Copyright (c) 2003 osCommerce



 Released under the GNU General Public License

*/



 $expected_query = tep_db_query("select p.products_id, p.products_image, pd.products_name, products_date_available as date_expected from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where to_days(products_date_available) >= to_days(now()) and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' order by " . EXPECTED_PRODUCTS_FIELD . " " . EXPECTED_PRODUCTS_SORT . " limit " . MAX_DISPLAY_UPCOMING_PRODUCTS);

 if (tep_db_num_rows($expected_query) > 0) {

?>

<!-- upcoming_products //-->

         <tr>

           <td>

<?php

   $row = 0;

   while ($expected = tep_db_fetch_array($expected_query)) {

     $row++;

     if (($row / 2) == floor($row / 2)) {

       echo '<tr class="upcomingProducts-even">' . "n";

     } else {

       echo '<tr class="upcomingProducts-odd">' . "n";

     }

   $info_box_contents = array();

   $info_box_contents[] = array('text' => BOX_HEADING_UPCOMING_PRODUCTS);



   new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_UPCOMING_PRODUCTS));



   $info_box_contents = array();

   $info_box_contents[] = array('align' => 'center',

                                'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $expected['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $expected['products_image'], $expected['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $expected['products_id']) . '">' . $expected['products_name'] . '<br>' . tep_date_short($expected['date_expected']) . '</a>');

   }

   new infoBox($info_box_contents);

?>

           </td>

         </tr>

<!-- upcoming_products_eof //-->

<?php

 }

?>

Anyone see anything obvious? Thanks

Link to comment
Share on other sites

Gregg;

 

I'm kinda grasping at straws here and it's hard to tell if you might have a space around your php tags somewhere, cuz I think the forum paste adds spaces when pasting. Take a look at the end of your code

    new infoBox($info_box_contents); 

?> 

           </td> 

         </tr> 

<!-- upcoming_products_eof //--> 

<?php 

 } 

?>

and the end of some "what's new" code (similar box and info)

    new infoBox($info_box_contents);

 }

?>

           </td>

         </tr>

<!-- whats_new_eof //-->

I don't know if the closing brace being on the other side of your cell and row tags would make a difference or not.

 

You also might just take your entire code and an unmodified what's_new or something similar - run them through some file diff program and see if anything shows up that way.

 

HTH

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Link to comment
Share on other sites

I changed this:

    new infoBox($info_box_contents);

?>

           </td>

         </tr>

<!-- upcoming_products_eof //-->

<?php

 }

?>

to this:

    new infoBox($info_box_contents);

   }

?>

           </td>

         </tr>

<!-- upcoming_products_eof //-->

It didn't make any difference.

 

I'm not really sure what I'm doing. I don't know PHP at all. I just looked at some other boxes and changed the original upcoming_products.php to make it look like the other boxes. Apparently I did something wrong.

Link to comment
Share on other sites

On closer look, it appears that the code you're trying to put in a box is code that would normally fill an entire center section of a page (as in product listings).

 

Try opening the code for the 'what's new' or 'specials' box (or any other box that rotates a single item in one of the side columns) and use that code as a basis for format - just change the appropriate calls to pull from "expected" references instead of "new" or "special" references.

 

(BTW - I'm probably just as green with PHP as you, so if this isn't much help, my apologies :) )

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Link to comment
Share on other sites

The code I used normally writes two lines of text at the bottom of the page. One line is the headers, something like "Product Name" and "Date Expected". The next line is the product name and the date expected. I got that to fit in the box with no problem. I then eliminated the headers and put a picture in, with help from Raj20 in this thread: http://www.oscommerce.com/forums/viewtopic.php?t=35082 That's when the problems started. I've tried to change some things around, but I can't make it look like I want AND keep it from screwing up the rest of the page. I just don't know enough about php. I'll do some more experimenting, I guess. Thanks for the help.

Link to comment
Share on other sites

OK, I figured it out. I deleted this from the code I posted above:

        echo '<tr class="upcomingProducts-even">' . "n";

     } else {

Now it works in both MSIE and Netscape. I don't know why that did it. Now I have to figure out how to keep a Coming Soon!!! product from showing up in New Products For [month] section.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...