Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Show Sold Out Items & UltraPics - MS2 Image Addon Pack!


MAD King

Recommended Posts

Hi,

 

I need a little, little help with an integration of the two contib.

 

I already got the UltraPics - MS2 Image Addon Pack! installed (http://www.oscommerce.com/community/contributions,1642) and trying to install the Show Sold Out Items (http://www.oscommerce.com/community/contributions,4884)

 

I need now someone who can make just one line of code working for both contrib.

 

In the Show Sold Out Items readme it shows the replacement code:

 

$product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

This line is already modified for the UltraPics - MS2 Image Addon Pack!

 

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, p.products_image_med, p.products_image_lrg, p.products_image_sm_1, p.products_image_xl_1, p.products_image_sm_2, p.products_image_xl_2, p.products_image_sm_3, p.products_image_xl_3, p.products_image_sm_4, p.products_image_xl_4, p.products_image_sm_5, p.products_image_xl_5, p.products_image_sm_6, p.products_image_xl_6, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

The original code of the original OsCommerce was:

 

  
$product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

The file is product_info.php

 

Could please someone put the code from the UltraPics - MS2 Image Addon Pack! and the Show Sold Out Items together?

 

Thank you very much.

Link to comment
Share on other sites

I am so sorry, I put the wrong line in. Once again:

 

In the Show Sold Out Items readme it shows the replacement code:

 

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id, p.products_status from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

This line is already modified for the UltraPics - MS2 Image Addon Pack!

 

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, p.products_image_med, p.products_image_lrg, p.products_image_sm_1, p.products_image_xl_1, p.products_image_sm_2, p.products_image_xl_2, p.products_image_sm_3, p.products_image_xl_3, p.products_image_sm_4, p.products_image_xl_4, p.products_image_sm_5, p.products_image_xl_5, p.products_image_sm_6, p.products_image_xl_6, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

The original code of the original OsCommerce was:

 

  
$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

Link to comment
Share on other sites

Someone who can modify following too?

 

I need the Show Sold Out Items contrib integrated on this code too:

 

New File catalog/includes/modules/new_products.php

 

Code:

 

<?php
/*
 $Id: new_products.php,v 2.0 2006/11/13 10:42:00 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
?>
<!-- new_products //-->
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')));
// new noborderBox($info_box_contents);
if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
	 $sql = "select distinct p.products_id, p.products_image, p.products_model, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price, mnf.manufacturers_name, rvw.reviews_rating from " . TABLE_PRODUCTS . " p left join ".TABLE_SPECIALS." s on p.products_id = s.products_id left join ".TABLE_MANUFACTURERS." mnf on p.manufacturers_id = mnf.manufacturers_id left join ".TABLE_REVIEWS." rvw on p.products_id = rvw.products_id where p.products_status = '1' order by rand() desc limit ".MAX_DISPLAY_NEW_PRODUCTS;
	 $new_products_query = tep_db_query($sql); 
 } else {
$sql = "select distinct p.products_id, p.products_image, p.products_model, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price, mnf.manufacturers_name, rvw.reviews_rating from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on (p.products_id = s.products_id) left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on (p.products_id = p2c.products_id) left join " . TABLE_CATEGORIES . " c on (p2c.categories_id = c.categories_id) left join ".TABLE_MANUFACTURERS." mnf on (p.manufacturers_id = mnf.manufacturers_id) left join ".TABLE_REVIEWS." rvw on (p.products_id = rvw.products_id) where c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by rand() desc limit " . MAX_DISPLAY_NEW_PRODUCTS;
$new_products_query = tep_db_query($sql); 
}
 $row = 0;
 $col = 0;
 $info_box_contents = array();
 echo '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>';
 while ($new_products = tep_db_fetch_array($new_products_query)) {
 $new_products['products_name'] = tep_get_products_name($new_products['products_id']);
$reviews_rating = $new_products['reviews_rating'];
$manufacturers_name = $new_products['manufacturers_name'];

if(!$manufacturers_name==null){
	  $manufacturers_name = '<b>' . TABLE_HEADING_MANUFACTURER . ': </b> ' . $manufacturers_name;
} else {
  $manufacturers_name = '';
}
if(!$reviews_rating==null){
$reviews_rating = '<img src="images/stars_'. $new_products['reviews_rating'].'.gif" alt="'.$new_products['reviews_rating'] . TABLE_HEADING_TEXT_OF_5_STARS . ' ('.$new_products['products_name'].')" border="0" align="absmiddle">';
}else {
$reviews_rating = '<img src="images/stars_0.gif" alt="Not Rated" border="0" align="absmiddle"><br><span class="smallText"><a href="product_reviews_write.php?products_id='.$new_products['products_id'].'">' . TABLE_HEADING_FIRST_TO_RATE . '</a></span>';
}
$info_box_contents[$row][$col] = array('align' => 'center', 
'params' => 'class="smallText" width="20%" valign="top"',
									   'text' => ' <!-- one TBL Product -->
	<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
	  <tr>
		<td bgcolor="#FFFFFF" class="main" height="37"><img src="images/lk_blue.gif" width="15" height="15" align="absmiddle" alt="'.$new_products['products_name'] .'"> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a></td>
	  </tr>
	  <tr>
		  <td bgcolor="#FFFFFF">
		  <table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
			  <td align="center" style="padding:3px;"><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_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>
			  <td height="125%" valign="top">
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
				  <tr>
					<td height="17" class="smallText"><br>' . $manufacturers_name . '</td>
				  </tr>					
				  <tr>
					<td height="17" class="smallText"><b><br>' . TABLE_HEADING_PRICE . ': <font color="#FF5C02">' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])). '</font></b></td>
				  </tr>					   
				  <tr>
					<td height="17" class="smallText"><b><br>' . TABLE_HEADING_RATING . ': </b>'.$reviews_rating.'</td>
				  </tr>
				</table>
			  </td>
			</tr>
			<tr>
			  <td height="30"><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>
			</tr>
		  </table>
		</td>
	  </tr>
	</table>
	<!-- one TBL Product -->');
$col ++;
if ($col > 2) {
  $col = 0;
  $row ++;
}
 }
 new contentBox($info_box_contents);
 //echo $info_box_contents[0][0]['text'];
?>
<!-- new_products_eof //-->

 

 

I need this integrated:

 

Change 1

========

Around line 56

Look for:

$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 . "' order by p.products_date_added DESC, pd.products_name";

 

Replace with:

$products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_quantity, p.products_status, 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_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name";

 

Change 2

========

Around line 90 (before previous change)

 

Look for:

<td align="right" valign="middle" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?></td>

 

Replace with:

<td align="right" valign="middle" class="main"><?php

if($products_new['products_quantity'] <= 0 || $products_new['products_status']==0)

echo tep_image_button('button_sold_out.gif', IMAGE_BUTTON_SOLD_OUT);

else

echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>';?>

</td>

 

What it does:

 

It is showing a sold out button instead the buy now button if the quantity is 0.

 

 

Thank you very much and I really hope I get some help.

Edited by MAD King
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...