Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Display expected shipping time if out of stock


Guest

Recommended Posts

Hello all,

 

I've been configuring my osCommerce cart for a few weeks now and have managed to find contributions / edit code for everything else but I was just wondering if there was a fix for this:

 

I have a cart set up with 20 ish products in it. If the item is in stock I want the description page to show "in stock delivery 2-3 days". If the product is out of stock I want to display "delivery within 5-7 days".

 

Does anyone know of a contribution / fix for this?

 

Thanks

 

Sam

Link to comment
Share on other sites

Hello all,

 

I've been configuring my osCommerce cart for a few weeks now and have managed to find contributions / edit code for everything else but I was just wondering if there was a fix for this:

 

I have a cart set up with 20 ish products in it. If the item is in stock I want the description page to show "in stock delivery 2-3 days". If the product is out of stock I want to display "delivery within 5-7 days".

 

Does anyone know of a contribution / fix for this?

 

Thanks

 

Sam

 

Hi all,

 

Having written the above post it came to me that this is pretty easy to do.

 

I've used a contribution for adding the product quantity to the listing and modified it slightly....

 

The original contribution:

 

This contribution displays the actual product quantity you have in stock on the product_info.php page. 

Please note that the placement instructions below are merely a suggestion, and the code snippet

can be placed pretty much anywhere you'd like.

 

Enjoy!

 

 

On or around line 148 of product_info.php you'll find the follow code:

 

        <tr>

              <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>

              <td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>

            </tr>

<?php

      }

?>

          </table>

<?php

    }

?>

        </td>

      </tr>

      <tr>

        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

      </tr>

     

Immediately after this you'll add:

 

      <!-- Added quantity in stock display -->

            <tr>

      <td align="center" class="main">There are currently <b><?php echo tep_get_products_stock($product_info['products_id']); ?></b> available in stock.<p></td>

            </tr>

  <!-- End quantity in stock display -->

 

 

The next lines should be:

 

<?php

    $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");

    $reviews = tep_db_fetch_array($reviews_query);

    if ($reviews['count'] > 0) {

?>

 

Instead of adding the code suggested, just add:

 

  <!-- Added quantity in stock display -->

            <tr>

      <td align="center" class="main"><b>

    <?php 

    $quantity = tep_get_products_stock($product_info['products_id']);

    if ($quantity < "1") { echo "Order now for 5-7 day delivery"; }

    else if ($quantity < "3") { echo "There are only $quantity of these left in stock, order now for 2-3 day delivery"; }

    else { echo "In stock now ready for delivery"; };

    ?>

    </b></td>

            </tr>

  <!-- End quantity in stock display -->

 

Simple!

 

Hope this helps somone :D

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...