Jump to content

Archived

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

desidil4ever

simple add-ons

Recommended Posts

hey,

 

I hope this one helps someone. I had looked through a lot of forum articles, googled, and other sources but could't find a solution. So since I did stumble on it finally I am putting this down for someone who might find it useful.

Many of us have used the contribution http://www.oscommerce.com/community/contributions,1501/

in case if you want to add a 0-9 listing by building a range...you could just add this piece of code. Nice n easy trick:)

 

<a href="' . tep_href_link("allprods.php", 'fl>=0andfl<=9', 'NONSSL') . '">#</A>

 

I am starting this thread so that people can add just small small things which can be useful to a lot of other people:)

 

Time to give back to Oscommerce Team for all they have done for us:)


Simple Add-ons Please add simple plain tips here for others.

Share this post


Link to post
Share on other sites

Another quick add-on is to display savings in amount and percentage value. You could use the MSRP contribution or if you want a quick way out you could just play a bit with listing code and do it without adding another query and burdening your server!!!

 

You just have to update the specials table...run a query or add individual specials for various items. I actually made a 5% reduction on all my products_price. So now we have two prices for all products....the regular price and specials price. The specials is also listed by default in almost all oscommerce pages which display prices. So only thing you need to do is add another line to display the SAVINGS

 

EXAMPLE

<span class="productSpecialPrice">You Save: </span></td><td class="smalltext"><span class="productSpecialPrice">' . $currencies->display_price(($listing['products_price'] - $listing['specials_new_products_price']), tep_get_tax_rate($listing['products_tax_class_id'])) . ' (' . ceil((($listing['products_price'] - $listing['specials_new_products_price']) / $listing['products_price']) * 100) . '%)

 

I am posting just a example. This is from product_listing in includes/modules.....please do remember different files have different queries so you have to make sure you match these.

 

case 'PRODUCT_LIST_PRICE':

$lc_align = 'right';

if (tep_not_null($listing['specials_new_products_price'])) {

$lc_text = '?<s>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>??<span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>?';

} else {

$lc_text = '?' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '?';

}

break;

 

see and compare:

 

case 'PRODUCT_LIST_PRICE':

$lc_align = 'right';

if (tep_not_null($listing['specials_new_products_price'])) {

/* $lc_text = '?<s>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>??<span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>?'; */

 

$lc_text = '<table border="0" width="100%" cellspacing="0" cellpadding="0"><tr><td class="smalltext">Wholesale Price:</td><td class="smalltext"><s>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s></td></tr><tr><td class="smalltext">Our Special Price:</td><td class="smalltext">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</td></tr><tr><td class="smalltext"><span class="productSpecialPrice">You Save: </span></td><td class="smalltext"><span class="productSpecialPrice">' . $currencies->display_price(($listing['products_price'] - $listing['specials_new_products_price']), tep_get_tax_rate($listing['products_tax_class_id'])) . ' (' . ceil((($listing['products_price'] - $listing['specials_new_products_price']) / $listing['products_price']) * 100) . '%)</span></td></tr></table>';

} else {

$lc_text = '?' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '?';

}

break;

 

Just use a bit of commonsense and this should be easy to implement wherever it can be and wherever you want it to be:)


Simple Add-ons Please add simple plain tips here for others.

Share this post


Link to post
Share on other sites

Changing the way breadcrumbs look:

 

In the header file search for

<td class="headerNavigation">  <?php echo $breadcrumb->trail(' » '); ?></td>

change it to

<td class="headerNavigation">  <?php echo $breadcrumb->trail(' : '); ?></td>
if you want dots instead of >> also....u could change the color by adding Font properties inside the brackets or in the <td> tag whichever way works for you.

 

Since we are talking about breadcrumbs, here is another cool thing you could do...some of you who would wanna move it around somewhere out of the header.php...that piece of line is what you can delete from header.php and add wherever you would prefer it

 

 

 

****would prefer if others also add any lil bit of neat tricks to help new users or people looking for simpler but effective add-ons for their sites***


Simple Add-ons Please add simple plain tips here for others.

Share this post


Link to post
Share on other sites
Another quick add-on is to display savings in amount and percentage value. You could use the MSRP contribution or if you want a quick way out you could just play a bit with listing code and do it without adding another query and burdening your server!!!

 

You just have to update the specials table...run a query or add individual specials for various items. I actually made a 5% reduction on all my products_price. So now we have two prices for all products....the regular price and specials price. The specials is also listed by default in almost all oscommerce pages which display prices. So only thing you need to do is add another line to display the SAVINGS

 

EXAMPLE

I am posting just a example. This is from product_listing in includes/modules.....please do remember different files have different queries so you have to make sure you match these.

see and compare:

Just use a bit of commonsense and this should be easy to implement wherever it can be and wherever you want it to be:)

 

Nice tip!

 

Thanks for that

 

Dave

Share this post


Link to post
Share on other sites
hey,

 

I hope this one helps someone. I had looked through a lot of forum articles, googled, and other sources but could't find a solution. So since I did stumble on it finally I am putting this down for someone who might find it useful.

Many of us have used the contribution http://www.oscommerce.com/community/contributions,1501/

in case if you want to add a 0-9 listing by building a range...you could just add this piece of code. Nice n easy trick:)

I am starting this thread so that people can add just small small things which can be useful to a lot of other people:)

 

Time to give back to Oscommerce Team for all they have done for us:)

 

I have this for product_info.php:

 

$products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '<br><span class="productSpecialPrice">Risparmi il </span></td><td class="smalltext"><span class="productSpecialPrice">' . $currencies->display_price(($product_info['products_price'] - $product_info['new_price']), tep_get_tax_rate($product_info['products_tax_class_id'])) . ' (' . ceil((($product_info['products_price'] - $product_info['new_price']) / $product_info['products_price']) * 100) . '%) . '</span>';

 

You can tall me why Not working ???? :(

 

Thanks

Share this post


Link to post
Share on other sites
Another quick add-on is to display savings in amount and percentage value. You could use the MSRP contribution or if you want a quick way out you could just play a bit with listing code and do it without adding another query and burdening your server!!!

 

You just have to update the specials table...run a query or add individual specials for various items. I actually made a 5% reduction on all my products_price. So now we have two prices for all products....the regular price and specials price. The specials is also listed by default in almost all oscommerce pages which display prices. So only thing you need to do is add another line to display the SAVINGS

 

EXAMPLE

 

 

I am posting just a example. This is from product_listing in includes/modules.....please do remember different files have different queries so you have to make sure you match these.

 

 

 

see and compare:

 

 

 

Just use a bit of commonsense and this should be easy to implement wherever it can be and wherever you want it to be:)

 

Dear friend, i'm trying to apply this tip to the modules/new_prodcuts.php file, that i've modified to show the special price, could you lend me a hand? this is my code

<?php
/*
 $Id: new_products.php,v 1.34 2003/06/09 22:49:58 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 contentBoxHeading($info_box_contents);

 if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
	$new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, s.specials_new_products_price, p.products_price as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by rand() DESC limit " . MAX_DISPLAY_NEW_PRODUCTS);
  } else {
	$new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, s.specials_new_products_price, p.products_price as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . $new_products_category_id . "' and p.products_status = '1' order by rand() DESC limit " . MAX_DISPLAY_NEW_PRODUCTS);
  }

  $row = 0;
  $col = 0;
 $info_box_contents = array();
 while ($new_products = tep_db_fetch_array($new_products_query)) {


$new_products['products_name'] = tep_get_products_name($new_products['products_id']);

// ----------	
//$product_query = tep_db_query("select products_description, products_id from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$new_products['products_id'] . "' and language_id = '" . (int)$languages_id . "'");
//$product = tep_db_fetch_array($product_query);
//$p_desc = substr($product['products_description'], 0, 225);
$product_query = tep_db_query("select products_description  from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$new_products['products_id'] . "' and language_id = '" . (int)3 . "'");
   $product = tep_db_fetch_array($product_query);
   $new_products['products_description'] = $product['products_description'];
   if ($new_price = tep_get_products_special_price($new_products['products_id'])) {
	  $products_price = '<s style="color:#777777; font-size:17px">' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</s><br><span>' . $currencies->display_price($new_price, tep_get_tax_rate($new_products['products_tax_class_id'])) . '</span>';
	} else {
	  $products_price = $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id']));
	}
$p_id = $product['products_id'];

$p_pic = '<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>';

$p_name = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . substr($new_products['products_name'],0,200) . '</a>';
//$p_price = '<span class="price_txt">'.$currencies->display_price($specials['specials_new_products_price'],'').'</span> <span class="price_txt_strice">'.$currencies->display_price($specials['products_price'], tep_get_tax_rate($specials['products_tax_class_id'])).'</span>';

//$p_price = $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id']));
// ----------	

$info_box_contents[$row][$col] = array('align' => 'center',
									   'params' => ' width="50%"',
									   'text' => '

		'.$tep_draw_heading_top_prod_type1.'


					   <table cellspacing="0" cellpadding="0" border="0">
						<tr>
						 <td> '.tep_draw_separator('spacer.gif', '1', '6').'<br>
						  <table cellspacing="0" cellpadding="0" border="0">
						   <tr>
							<td style="background:#F2F2F2;">
							 <table cellspacing="0" cellpadding="0" border="0" style="background:url(images/ltc1.gif) no-repeat left top;">
							  <tr>
							   <td style="background:url(images/lbc1.gif) no-repeat left bottom;">
								<table cellspacing="0" cellpadding="0" border="0" style="background:url(images/rtc1.gif) no-repeat right top; height:35px;">
								 <tr>
								  <td style="background:url(images/rbc1.gif) no-repeat right bottom; padding:0 0 0 21px; vertical-align:middle;" class="title2_txt">'.$p_name.'<br>
								  </td>
								 </tr>
								</table>
							   </td>
							  </tr>
							 </table>
							</td>
						   </tr>
						  </table>
						  <table cellspacing="0" cellpadding="0" border="0" style="margin-top:14px; height:154px;">
						   <tr>
							<td style="width:180px; height:140px; text-align:center;">
									  '.$p_pic.'<br>
							</td>

							<td style="width:33%; height:140px; padding-left:21px;" class="txt5 link2"><center><b>OUTLET<br>Todo tipo de regalos<hr></b></center>
									  '.preg_replace('/\s\S*$/i', '', substr($new_products['products_description'], 0, 200)).' ...<br>
							</td>

							<td style="width:33%; height:100%;" class="txt5 link2">
							 <table cellspacing="0" cellpadding="0" border="0">
							  <tr>
							   <td width="4">'.tep_draw_separator('spacer.gif', '4', '1').'<br>
							   </td>
							   <td style="width:100%; background:url(images/side.gif) repeat-x top;">
								<table cellspacing="0" cellpadding="0" border="0" style="background:url(images/side.gif) repeat-x bottom;">
								 <tr>
								  <td style="background:url(images/side.gif) repeat-y left;">
								   <table cellspacing="0" cellpadding="0" border="0" style="background:url(images/side.gif) repeat-y right;">
									<tr>
									 <td style="background:url(images/ltc2.gif) no-repeat left top;">
									  <table cellspacing="0" cellpadding="0" border="0" style="background:url(images/lbc2.gif) no-repeat left bottom;">
									   <tr>
										<td style="background:url(images/rtc2.gif) no-repeat right top;">
										 <table cellspacing="0" cellpadding="0" border="0" style="background:url(images/rbc2.gif) no-repeat right bottom;height:59px;">
										  <tr>
										   <td width="120" class="price_txt" style=" text-align:center; vertical-align:middle;">'.$products_price.'<br>
										   </td>
										   <td style="width:auto;">
														  '.tep_draw_separator('spacer.gif', '1', '14').'<br>
											<a href="'.tep_href_link("products_new.php","action=buy_now&products_id=".$p_id).'">'.tep_image_button('button_add_to_cart.gif').'</a><br>
											'.tep_draw_separator('spacer.gif', '1', '4').'<br>
											 <a href="' . tep_href_link('product_info.php?products_id='.$p_id) . '">'.tep_image_button("button_details1.gif").'</a><br>
										   </td>
										  </tr>
										 </table>
										</td>
									   </tr>
									  </table>
									 </td>
									</tr>
								   </table>
								  </td>
								 </tr>
								</table>
							   </td>
							   <td>'.tep_draw_separator('spacer.gif', '5', '1').'<br>
							   </td>
							  </tr>
							 </table>
							 '.tep_draw_separator('spacer.gif', '1', '10').'<br>
							</td>
						   </tr>
						  </table>
						 </td>
						</tr>
						<tr>
						 <td> </td>
						</tr>
					   </table>


		'.$tep_draw_heading_bottom_prod_type1);

$col ++;
if ($col > 0) {
  $col = 0;
  $row ++;
}
 }

new contentBox($info_box_contents);
?>
<!-- new_products_eof //-->

Share this post


Link to post
Share on other sites

×