Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Free shipping & featured products


Guest
 Share

Recommended Posts

Hi, I have just installed featured products and individual boxes and I’m trying to figure out how to add the Free shipping icon to display with appropriate products. Can someone help? Here is the code for featured products module on the homepage where I think the free shipping code needs to go (somewhere) and the free shipping code is below it:

 

 

$sql = 'SELECT `products_description` FROM `products_description` WHERE products_id ='.$featured_products['products_id'].' && language_id='.(int)$languages_id;
$description_query = tep_db_query($sql);
$description = mysql_fetch_array($description_query, MYSQL_ASSOC);		
$description['products_description'] = substr($description['products_description'], 0, 150);
$desc_len = strlen($description['products_description']);
$description['products_description'][$desc_len-1] = '.';
$description['products_description'][$desc_len-2] = '.';
$description['products_description'][$desc_len-3] = '.';

$description['products_description'] = ereg_replace("(Array)", "", $description['products_description']);

  $info_box_contents[$row][$col] = array('align' => 'center',
									   'params' => 'class="smallText" cellspacing="0" width="50%" valign="top"',
									   'text' => '<table width="99%" border="0" cellspacing="0" cellpadding="0">
 <tr>
<td align="right" valign="bottom" bordercolor="0"><img src="images/infobox_module/upper_left.gif" width="14" height="33" /></td>	
<td colspan="2" background="images/infobox_module/top.gif" class=smallText><b><a class=productTitle href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . substr($featured_products['products_name'], 0, 100) . '</a></b></td>
<td align="left" valign="bottom"><img src="images/infobox_module/upper_right.gif" width="14" height="33" /></td>
 </tr>
 <tr>
<td background="images/infobox_module/left.gif" width="14"> </td>
<td align="center" class=mws_boxCenter_module>' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><br> ' . tep_image(DIR_WS_LANGUAGES . $language . '/images/buttons/featured.gif', Featured_Product). '</a> </td>
<td class=smallText>'. strip_tags($description['products_description']) . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, "products_id=" . $featured_products["products_id"]). '"><b>' . DESCR_READ_MORE . '</b></a><br><br>       <s>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</s><br>' . tep_image_button('cart_buy.gif', IMAGE_BUTTON_IN_CART) . '</a> <span class="productSpecialPrice">' . $currencies->display_price($featured_products['specials_new_products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</span></td>
<td background="images/infobox_module/right.gif" class="smallText" width="14"><img src="images/infobox_module/right.gif" width="14" height="149" /></td>
 </tr>
 <tr>
<td align="right" valign="top"><img src="images/infobox_module/lower_left.gif" width="14" height="12" /></td>
<td colspan="2" background="images/infobox_module/bot.gif"><img src="images/infobox_module/bot.gif" width="2" height="12" /></td>
<td align="left" valign="top" class="smallText"><img src="images/infobox_module/lower_right.gif" width="14" height="12" /></td>
 </tr>
</table><br>');
} else {

$sql = 'SELECT `products_description` FROM `products_description` WHERE products_id ='.$featured_products['products_id'].' && language_id='.(int)$languages_id;
$description_query = tep_db_query($sql);
$description = mysql_fetch_array($description_query, MYSQL_ASSOC);		
$description['products_description'] = substr($description['products_description'], 0, 150);
$desc_len = strlen($description['products_description']);
$description['products_description'][$desc_len-1] = '.';
$description['products_description'][$desc_len-2] = '.';
$description['products_description'][$desc_len-3] = '.';

$description['products_description'] = ereg_replace("(Array)", "", $description['products_description']);

  $info_box_contents[$row][$col] = array('align' => 'center',
									   'params' => 'class="smallText" cellspacing="0" width="50%" valign="top"',
									   'text' => '<table width="99%" border="0" cellspacing="0" cellpadding="0">
 <tr>
<td align="right" valign="bottom" bordercolor="0"><img src="images/infobox_module/upper_left.gif" width="14" height="33" /></td>	
<td colspan="2" background="images/infobox_module/top.gif" class=smallText><b><a class=productTitle href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . substr($featured_products['products_name'], 0, 100) . '</a></b></td>
<td align="left" valign="bottom"><img src="images/infobox_module/upper_right.gif" width="14" height="33" /></td>
 </tr>
 <tr>
<td background="images/infobox_module/left.gif" width="14"> </td>
<td align="center" class=mws_boxCenter_module>' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><br> ' . tep_image(DIR_WS_LANGUAGES . $language . '/images/buttons/featured.gif', Featured_Product). '</a> </td>
<td class=mws_boxCenter_module2>'. strip_tags($description['products_description']) . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, "products_id=" . $featured_products["products_id"]). '"><b>' . DESCR_READ_MORE . '</b></a><br><br>' . tep_image_button('cart_buy.gif', IMAGE_BUTTON_IN_CART) . '</a> ' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . ' </td>
<td background="images/infobox_module/right.gif" class="smallText" width="14"><img src="images/infobox_module/right.gif" width="14" height="149" /></td>
 </tr>
 <tr>
<td align="right" valign="top"><img src="images/infobox_module/lower_left.gif" width="14" height="12" /></td>
<td colspan="2" background="images/infobox_module/bot.gif"><img src="images/infobox_module/bot.gif" width="2" height="12" /></td>
<td align="left" valign="top" class="smallText"><img src="images/infobox_module/lower_right.gif" width="14" height="12" /></td>
 </tr>
</table><br>');
}	
$col ++;
if ($col > 1) {
  $col = 0;
  $row ++;
}
 }
 if($num) {

  new noborderbox($info_box_contents);
 }
} else // If it's disabled, then include the original New Products box
{
  // include (DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); // disable for dont show if desactive the feature module
}
?>
<!-- featured_products_eof //-->

 

and here is the free shipping code that I have taken from product_listing.php:

 

 

if ($listing['products_free_shipping'] == true) {			 
$lc_text  = '<input type="text" STYLE="text-align:center" name="add_id['.$number_of_products.']" value="0" size="1"> ' . FREE_SHIPPING_FOR_THIS_PRODUCT . '';
		$lc_text .= '<input type="hidden" name="products_id['.$number_of_products.']" value="'.$listing['products_id'].'">';

} else {
$lc_text  = '<input type="text" name="add_id['.$number_of_products.']" value="0" size="1">';
		$lc_text .= '<input type="hidden" name="products_id['.$number_of_products.']" value="'.$listing['products_id'].'">';
	   }

 

I can get the free shipping icon to appear on all products (regardless whether the product has free shipping or not) but can’t master the; if product free shipping = true, then display, else do not. If someone could help me merge the two I would be very grateful.

Link to comment
Share on other sites

With individual shipping if You place 0 its as good as free shipping.

 

So in product info page run a query to chak the shipping if free apply an if condition and display image.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

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.

 Share

×
×
  • Create New...