Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Upcoming Products


Tetsuo74

Recommended Posts

I'm trying to make an upcoming products page, but so far it's not going to good.

 

I was a bit suprised not to find a contribution doing this, so I set off to make my own.

 

What I'd like to make is a new page containg a list of the upcoming products, like the one on the bottom of the main page. But I'd like it to show all upcoming products, thus it may span over several pages.

 

If possible, I'd also like to seperate it by manufacturer. So that at the top of the page you choose which manufacturer you want to display upcoming products from.

 

I would guess that this is something that someone has made before. It would seem like a nice thing to have on any big online store. Thats why I'm posting here. Do any of you people out there have a php file that does this?

 

In advance thank you for any help.

 

Have a nice weekend all!

 

Fredrik

Link to comment
Share on other sites

hi,

 

If I were you, i'd take the all products contribution and add 2 switches

http://www.oscommerce.com/community/contri...all+products%22

 

one for upcoming, so you just make a link like:

http://yoursite/all_products.php?filter=upcoming

 

plus a dropdown filter that would add &manufacturer=XX to the link

 

Am I making enough sense here for you ?

 

Alternatively, you can do something similar like I did on keukenlust.com

I've copied the upcoming products module, and made an instore_module that I call just after the product_listing module to show the items that we additionally carry in the shop, but that have not get been configured for online selling (some missing images, some missing descriptions, but more importantly, not having any weight maintained for shipping yet). This is shown on each category listing, and not on the main page at all.

 

Carine

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

Thanks for the help so far!

 

I have installed the contrib, and it works great.

 

Now I just have to modify it to fit my needs. I'm pretty new to php, so this won't be easy. I totally understand what you think I should do. Just not how to do it.

 

I have looked at the upcoming_products.php file to see if I can use any of that code to sort out the upcoming products. As the all products contribution obviously shows all the products, regardless of release dates.

 

It's still a long way to go. But at least I'm going in the right direction, I think.

 

 

Fredrik

Link to comment
Share on other sites

if ( (isset($_GET['filter'])) && ($_GET['filter'] == 'upcoming')) {
?$filter = " and products.date_available <>'' " // note, 2x single quote, space, double quote
} else {
$filter = " " // empty string
}

 

now, find the sql construction in the all products page, and add $filter to it, ... where blabla = 'X' " . $filter . " ...

 

I don't have the details of this contribution, but that's essentially what to do to make it filter on upcoming products only.

 

for a manufacturers filter, you can find example in the index.php for this.

 

HTH

 

BTW, I'm not around tomorrow, but suggest you post the complete code (with the code tags) as you have it, that way it'll be easier to help you to get this coded.

 

Good luck, off to bed now :)

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

Ok, I ended up doing it different to what you suggested. I'll keep the all products mod as it may be a nice feature for my customers.

 

But now I made a new page, with links to a copy of the upcoming_products.php file. I did a small modification to the new file, so that it is not limited to a few lines like the original file. I'll keep the original file, since it's nice to display some upcoming products on the front page aswell.

 

But now I'm left with making a sort mechanism for displaying upcoming products from a specific manufacturer. Either by a drop down box, or by a filter which I could link some buttons to.

 

So, what would be the easiest way of implementing this feature? For convenience I'll post my upcoming_products.php file below. But it is almost 100% like the original file.

 

If anyone can post a code to how to do this, it would probably save me many hours of trial end error :thumbsup:

 

Fredrik

 

 

<?php
/*
 $Id: upcoming_products.php,v 1.24 2003/06/09 22:49:59 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, 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 = '" . (int)$languages_id . "' order by " . EXPECTED_PRODUCTS_FIELD . " " . EXPECTED_PRODUCTS_SORT . " limit " . 1000);
 if (tep_db_num_rows($expected_query) > 0) {
?>
<!-- upcoming_products //-->
         <tr>
           <td><br><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td class="tableHeading"> <?php echo TABLE_HEADING_UPCOMING_PRODUCTS; ?> </td>
               <td align="right" class="tableHeading"> <?php echo TABLE_HEADING_DATE_EXPECTED; ?> </td>
             </tr>
             <tr>
               <td colspan="2"><?php echo tep_draw_separator(); ?></td>
             </tr>
             <tr>
<?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";
     }

     echo '                <td class="smallText"> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $expected['products_id']) . '">' . $expected['products_name'] . '</a> </td>' . "\n" .
          '                <td align="right" class="smallText"> ' . tep_date_short($expected['date_expected']) . ' </td>' . "\n" .
          '              </tr>' . "\n";
   }
?>
             <tr>
               <td colspan="2"><?php echo tep_draw_separator(); ?></td>
             </tr>
           </table></td>
         </tr>
<!-- upcoming_products_eof //-->
<?php
 }
?>

Link to comment
Share on other sites

Why didn't you just add the products to the catalog, and made them available from a certain date in the future - then they would have appeared on your homepage as 'Upcoming Products'. Saved all this hassle.

 

Vger

Link to comment
Share on other sites

Why didn't you just add the products to the catalog, and made them available from a certain date in the future - then they would have appeared on your homepage as 'Upcoming Products'.  Saved all this hassle.

 

Vger

 

I have allready done that.

 

What I wanted was a page displaying all my upcoming products. As this list will consist of 100-200 products at any given time, I thougt it would be to much to display on my front page.

 

Hence I wanted a seperate page for the complete upcoming product list. Just thought it would look nicer, and be more functional.

 

So now I have a upcoming products list on my front page with 10 titles. And a seperate page for all upcoming titles.

Link to comment
Share on other sites

This piece of code is included in the root level index.php:

 

<td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>

 

and this piece of code is included in includes/languages/english/index.php

 

define('TABLE_HEADING_NEW_PRODUCTS', 'New Products For %s');

 

I'm guessing that if you set up a new page, add it to includes/filenames.php, and add a link to it in your nav - then add the first piece of code to your new root level file, and the second piece of code to your new file in includes/languages/english/ then the list of new products should be added to the new page.

 

The trick will be getting the index page to display a limited number of entries and the new page to display them all.

 

Vger

Link to comment
Share on other sites

This piece of code is included in the root level index.php:

 

<td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>

 

and this piece of code is included in includes/languages/english/index.php

 

define('TABLE_HEADING_NEW_PRODUCTS', 'New Products For %s');

 

I'm guessing that if you set up a new page, add it to includes/filenames.php, and add a link to it in your nav - then add the first piece of code to your new root level file, and the second piece of code to your new file in includes/languages/english/ then the list of new products should be added to the new page.

 

The trick will be getting the index page to display a limited number of entries and the new page to display them all.

 

Vger

 

Yeah, I did that and it works. Thanks for suggesting it though Vger!

 

I have allready made a page with my upcoming products, that works. To manage to display different amount of upcoming products, I made a copy of the upcoming_products.php file. I then made a small change to it so that it lists more products, than the original that I use for my index page. I have posted the edited upcoming_products.php file a bit further up in this thread.

 

What I need now is to:

 

1. - Edit this upcoming.php file to filter out products from different manufacturers. I want a drop down box or I'll just make a set of buttons, so that I can display the products from the different manufacturers independantly.

 

2. - I'd also like to inverse the sorting order, so that the items closest to release is listed first. Right now it is set to default listing which is the oposite way, displaying the products furthest to release.

 

If anyone can help me out whith any of these problems I'd be very happy :thumbsup:

 

 

Fredrik

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...