Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

EZier New Fields


nrlatsha

Recommended Posts

Flyer5 - I didn't test it, but give this a shot:

 

catalog/includes/modules/ezier_new_fields.php

 

Look For:

// Uncomment the line that you want below, and comment our the default option if you like, description is to the right ?

 

Under that you'll see the options for the different display setup, replace all the variables of

$save2

with

$currencies->display_price($save2, '')

 

Give that a shot and let me know if it works...

 

 

Hi noel

Heres what I did -

// Uncomment the line that you want below, and comment our the default option if you like, description is to the right

// echo TEXT_PRODUCTS_SAVE_INFO . $currencies->display_price($save2, '') . '</font>'; //This line is price shown

// echo TEXT_PRODUCTS_SAVE_INFO . $save . '%</font>'; //This line is % shown

echo TEXT_PRODUCTS_SAVE_INFO . $currencies->display_price($save2, '') . ' (' . $save . '%)</font>'; //This line is % and price together

//above line has $save2 replaced by $currencies->display_price($save2, '')

 

 

 

and heres what I get!

Retail Price: ?200.00

Your Price: ?100.00

You Save: ?0.00 (50%)

Link to comment
Share on other sites

  • Replies 303
  • Created
  • Last Reply

Top Posters In This Topic

Hi noel

Heres what I did -

// Uncomment the line that you want below, and comment our the default option if you like, description is to the right 

  // echo TEXT_PRODUCTS_SAVE_INFO . $currencies->display_price($save2, '') . '</font>';        //This line is price shown

  // echo TEXT_PRODUCTS_SAVE_INFO . $save . '%</font>';        //This line is % shown

  echo TEXT_PRODUCTS_SAVE_INFO . $currencies->display_price($save2, '') . ' (' . $save . '%)</font>';    //This line is % and price together

    //above line has $save2 replaced by $currencies->display_price($save2, '')

and heres what I get!

Retail Price: ?200.00

Your Price: ?100.00

You Save: ?0.00 (50%)

 

Flyer5 - I think I may have your solution, I think I was overthinking the problem, but give this a shot:

 

Open your catalog/includes/modules/ezier_new_fields.php and replace the entire file with this:

 

<?php
/*
*  $Id: ezier_new_fields.php,v 5.00 2004/07/01 14:34:54 hpdl Exp $
*  osCommerce, Open Source E-Commerce Solutions
*  Released under the GNU General Public License
*  Noel Latsha ([email protected])
*  www.nabcomdiamonds.com
*  www.devosc.com
*  Begin EZier new fields contrib 5.0 (Noel Latsha)
*/
?>
     <table>
    <tr>
      <td>
<? 
if ($product_info['products_retail_price'] != 0)
{ 
 // Get the retail price & clean up the decimal places
 $retail = osc_ez(($currencies->display_price($product_info['products_retail_price'],tep_get_tax_rate($product_info['products_tax_class_id']))));
 $special_flag = false;
 $cust_flag = false;
   
	 if ($new_price = tep_get_products_special_price($product_info['products_id'])) 
   {  // If there is a special ... Special Overrides customer discount...
  	 $our = osc_ez(($currencies->display_price($product_info['products_price'],tep_get_tax_rate($product_info['products_tax_class_id']))));
  	 $special_price = osc_ez(($currencies->display_price((tep_get_products_special_price($product_info['products_id'])),tep_get_tax_rate($product_info['products_tax_class_id']))),0,$strlen);
  	 $save2 = tep_add_tax($product_info['products_retail_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) - tep_add_tax(tep_get_products_special_price($product_info['products_id']), tep_get_tax_rate($product_info['products_tax_class_id']));
  	 $save2 = osc_ez($currencies->display_price($save2, ''));
  	 $save = (((tep_get_products_special_price($product_info['products_id'])) / ($product_info['products_retail_price'])) * 100);
  	 $special_flag = true;
   }
	 
   if (((strstr($customer_discount, "-") != 0) && ((tep_get_products_special_price($product_info['products_id'])) == null))) 
   { // If there isn't a special, but still a customer discount... We'll need those decimals....
  	 $retail = osc_ez(($currencies->display_price_nodiscount($product_info['products_retail_price'],tep_get_tax_rate($product_info['products_tax_class_id']))));
  	 $our = ($product_info['products_price']);
  	 $our = $our - $our * abs($customer_discount) / 100;
  	 $save2 = tep_add_tax($product_info['products_retail_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) - tep_add_tax($our, tep_get_tax_rate($product_info['products_tax_class_id']));
  	 $save2 = osc_ez($currencies->display_price_nodiscount($save2, ''));
  	 $save = (($our / ($product_info['products_retail_price'])) * 100); 
  	 $our = osc_ez($currencies->display_price_nodiscount($product_info['products_price'], ''));
  	 $cust = osc_ez($currencies->display_price($product_info['products_price'], ''));
  	 $cust_flag = true;
   } // End cust discount
   
   if ((strstr($customer_discount, "-") == 0) && ((tep_get_products_special_price($product_info['products_id'])) == null))  
   { // Just a regular price
  	 $our = osc_ez(($currencies->display_price($product_info['products_price'],tep_get_tax_rate($product_info['products_tax_class_id']))));
  	 $save = (($product_info['products_price'] / ($product_info['products_retail_price'])) * 100);
  	 
  	 $save2 = tep_add_tax($product_info['products_retail_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) - tep_add_tax($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
  	 $save2 = osc_ez($currencies->display_price($save2, ''));
   
   } // End of regular price
   
 $save = (100 - $save);
 $save = round($save); ?>
   </td>
     </tr>
    </table>
 <?php  
	 echo TEXT_PRODUCTS_RETAIL_PRICE_INFO . '<s>' . $retail . '</s>'; 
	 
	 if ($special_flag == true) 
   {
   echo TEXT_PRODUCTS_PRICE_INFO . '<s>' .  $our . '</s>'; 
   echo TEXT_PRODUCTS_PRICE_SPECIAL_INFO . $special_price . '</font>';
   } else if ($cust_flag == true) { 
   echo TEXT_PRODUCTS_PRICE_INFO_REGULAR . '<s>' .  $our . '</s>'; 
   echo TEXT_PRODUCTS_PRICE_SPECIAL_CUST . $cust . '</font>';
   } else {
   echo TEXT_PRODUCTS_PRICE_INFO . $our; 
   }

// Uncomment the line that you want below, and comment our the default option if you like, description is to the right  
	 // echo TEXT_PRODUCTS_SAVE_INFO . $save2 . '</font>';        //This line is price shown
	 // echo TEXT_PRODUCTS_SAVE_INFO . $save . '%</font>';       	 //This line is % shown
	 echo TEXT_PRODUCTS_SAVE_INFO . $save2 . ' (' . $save . '%)</font>';    //This line is % and price together
   
  	 } else { ?>
             </td>
           </tr> 
         </table>
   <?php 

   }

// End EZier new fields contrib (Noel Latsha)
?>

 

Give that a go and let me know...

9 times out of 10 its a PEBCAK Error (Problem exists between chair and keyboard)

 

Replace that and you're fine...

Link to comment
Share on other sites

Noel that works fine!

 

however there is one more "bit" that needs tweaking :D

In the admin section, when adding a new product there are now 3 fields, the original 2 from osc and the one extra Ezier field. When you add a new product you can put the gross price in the "products price gross" input box and osc calculates the net price and populates the "products price net" field as you know, however, you then have to manually calculate the net retail price because if you enter the gross retail price osc adds the tax to it. Not a major issue I know but if you are adding a large quantity of products and don't have the net retail price it becomes a chore to have to calculate every one.

 

However, thanks for the fix its much appreciated. You can see it in action - i've mailed you the link.

 

regards

 

F5

 

 

 

Flyer5 - I think I may have your solution, I think I was overthinking the problem, but give this a shot:

 

Open your catalog/includes/modules/ezier_new_fields.php and replace the entire file with this:

 

<?php
/*
* ?$Id: ezier_new_fields.php,v 5.00 2004/07/01 14:34:54 hpdl Exp $
* ?osCommerce, Open Source E-Commerce Solutions
* ?Released under the GNU General Public License
* ?Noel Latsha ([email protected])
* ?www.nabcomdiamonds.com
* ?www.devosc.com
* ?Begin EZier new fields contrib 5.0 (Noel Latsha)
*/
?>
? ? ?<table>
? ? <tr>
? ? ? <td>
<? 
if ($product_info['products_retail_price'] != 0)
{ 
?// Get the retail price & clean up the decimal places
?$retail = osc_ez(($currencies->display_price($product_info['products_retail_price'],tep_get_tax_rate($product_info['products_tax_class_id']))));
?$special_flag = false;
?$cust_flag = false;
? ?
?	if ($new_price = tep_get_products_special_price($product_info['products_id'])) 
? ?{ ?// If there is a special ... Special Overrides customer discount...
? ?	$our = osc_ez(($currencies->display_price($product_info['products_price'],tep_get_tax_rate($product_info['products_tax_class_id']))));
? ?	$special_price = osc_ez(($currencies->display_price((tep_get_products_special_price($product_info['products_id'])),tep_get_tax_rate($product_info['products_tax_class_id']))),0,$strlen);
? ?	$save2 = tep_add_tax($product_info['products_retail_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) - tep_add_tax(tep_get_products_special_price($product_info['products_id']), tep_get_tax_rate($product_info['products_tax_class_id']));
? ?	$save2 = osc_ez($currencies->display_price($save2, ''));
? ?	$save = (((tep_get_products_special_price($product_info['products_id'])) / ($product_info['products_retail_price'])) * 100);
? ?	$special_flag = true;
? ?}
?	
? ?if (((strstr($customer_discount, "-") != 0) && ((tep_get_products_special_price($product_info['products_id'])) == null))) 
? ?{ // If there isn't a special, but still a customer discount... We'll need those decimals....
? ?	$retail = osc_ez(($currencies->display_price_nodiscount($product_info['products_retail_price'],tep_get_tax_rate($product_info['products_tax_class_id']))));
? ?	$our = ($product_info['products_price']);
? ?	$our = $our - $our * abs($customer_discount) / 100;
? ?	$save2 = tep_add_tax($product_info['products_retail_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) - tep_add_tax($our, tep_get_tax_rate($product_info['products_tax_class_id']));
? ?	$save2 = osc_ez($currencies->display_price_nodiscount($save2, ''));
? ?	$save = (($our / ($product_info['products_retail_price'])) * 100); 
? ?	$our = osc_ez($currencies->display_price_nodiscount($product_info['products_price'], ''));
? ?	$cust = osc_ez($currencies->display_price($product_info['products_price'], ''));
? ?	$cust_flag = true;
? ?} // End cust discount
? ?
? ?if ((strstr($customer_discount, "-") == 0) && ((tep_get_products_special_price($product_info['products_id'])) == null)) ?
? ?{ // Just a regular price
? ?	$our = osc_ez(($currencies->display_price($product_info['products_price'],tep_get_tax_rate($product_info['products_tax_class_id']))));
? ?	$save = (($product_info['products_price'] / ($product_info['products_retail_price'])) * 100);
? ?	
? ?	$save2 = tep_add_tax($product_info['products_retail_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) - tep_add_tax($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
? ?	$save2 = osc_ez($currencies->display_price($save2, ''));
? ?
? ?} // End of regular price
? ?
?$save = (100 - $save);
?$save = round($save); ?>
? ?</td>
? ? ?</tr>
? ? </table>
?<?php ?
?	echo TEXT_PRODUCTS_RETAIL_PRICE_INFO . '<s>' . $retail . '</s>'; 
?	
?	if ($special_flag == true) 
? ?{
? ?echo TEXT_PRODUCTS_PRICE_INFO . '<s>' . ?$our . '</s>'; 
? ?echo TEXT_PRODUCTS_PRICE_SPECIAL_INFO . $special_price . '</font>';
? ?} else if ($cust_flag == true) { 
? ?echo TEXT_PRODUCTS_PRICE_INFO_REGULAR . '<s>' . ?$our . '</s>'; 
? ?echo TEXT_PRODUCTS_PRICE_SPECIAL_CUST . $cust . '</font>';
? ?} else {
? ?echo TEXT_PRODUCTS_PRICE_INFO . $our; 
? ?}

// Uncomment the line that you want below, and comment our the default option if you like, description is to the right ?
?	// echo TEXT_PRODUCTS_SAVE_INFO . $save2 . '</font>'; ? ? ? ?//This line is price shown
?	// echo TEXT_PRODUCTS_SAVE_INFO . $save . '%</font>'; ? ? ? ?	//This line is % shown
?	echo TEXT_PRODUCTS_SAVE_INFO . $save2 . ' (' . $save . '%)</font>'; ? ?//This line is % and price together
? ?
? ?	} else { ?>
? ? ? ? ? ? ?</td>
? ? ? ? ? ?</tr> 
? ? ? ? ?</table>
? ?<?php 

? ?}

// End EZier new fields contrib (Noel Latsha)
?>

 

Give that a go and let me know...

Link to comment
Share on other sites

Noel that works fine!

 

however there is one more "bit" that needs tweaking  :D

In the admin section, when adding a new product there are now 3 fields, the original 2 from osc and the one extra Ezier field.  When you add a new product you can put the gross price in the "products price gross" input box and osc calculates the net price and populates the "products price net" field as you know, however, you then have to manually calculate the net retail price because if you enter the gross retail price osc adds the tax to it.  Not a major issue I know but if you are adding  a large quantity of products and don't have the net retail price it becomes a chore to have to calculate every one.

 

However, thanks for the fix its much appreciated. You can see it in action - i've mailed you the link.

 

regards

 

F5

 

Glad it works refresh(F5) That one will replace the one I have now, I just need to test a bit more before I release it.

 

I'll add that to my list of upcoming features.

 

Is there anything else anybody would like to see? write it here...

9 times out of 10 its a PEBCAK Error (Problem exists between chair and keyboard)

 

Replace that and you're fine...

Link to comment
Share on other sites

Glad it works refresh(F5) That one will replace the one I have now, I just need to test a bit more before I release it.

 

I'll add that to my list of upcoming features.

 

Is there anything else anybody would like to see? write it here...

 

I actually did some modification of the script where the savings won't show up on the products_info or products_listing if you sell for any amount >= list price, only if its discounted.

 

if anyone needs me to dig out the code to share, let me know..

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...
I'm trying to find out how I can rename Your Price to Sale Price on product pages and New Products for (month) pages.

 

Thanks,

Paulie

 

Did you get this sorted Paulie, or still looking for direction?

9 times out of 10 its a PEBCAK Error (Problem exists between chair and keyboard)

 

Replace that and you're fine...

Link to comment
Share on other sites

  • 2 weeks later...
Glad it works refresh(F5) That one will replace the one I have now, I just need to test a bit more before I release it.

 

I'll add that to my list of upcoming features.

 

Is there anything else anybody would like to see? write it here...

 

 

This is a very nice contrib, credit due.....

Seen that there has been a mention about tax being added to the retail price and that its been added to the 'to do' list but is there currently any way to remove this? (without calculating individual retail prices ;) )

I just want the retail price with no tax added.

 

Also there is some white space above where the prices are displayed and i cant seem to find where its coming from. i do have STS installed but couldn't find anything on the HUGH contrib thread.

I have removed the code for the popup window and have this instead:

<tr>
? ? ? ?<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
? ? ? ? ?<tr>
? ? ? ? ? ?<td class="pageHeading" valign="top"><?php echo $products_name; ?></td>
? ? ? ? ? ?<td class="pageHeading" align="right" valign="top"><?php include(DIR_WS_MODULES . 'ezier_new_fields.php'); ?></td>
? ? ? ? ?</tr>
? ? ? ?</table></td>
? ? ?</tr>
? ? ?<tr>
? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
? ? ?</tr>
? ? ?<tr>
? ? ? ?<td class="main">
<?php
? ?if (tep_not_null($product_info['products_image'])) {
?>
? ? ? ? ?<table border="0" cellspacing="0" cellpadding="2" align="right">
? ? ? ? ? ?<tr>
? ? ? ? ? ? ?<td align="center" class="smallText"><?php echo tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name']); ?>
? ? ? ? ? ? ?</td>
? ? ? ? ? ?</tr>
? ? ? ? ?</table>

 

not sure if that would affect it

any ideas?

Edited by Bobajob
Link to comment
Share on other sites

  • 2 weeks later...
Post your EZier New Fields comments, suggestions and problems here. I receive lots of email on this contrib and thought it would be best to start answering publicly.

 

Get it here: http://www.oscommerce.com/community/contributions,1310

 

Basically it does this:

 

Retail Price : $ 79.99

Our Price : $ 39.99

You Save: 50%

 

I'll get around to the questions ASAP.  :D

 

Noel

 

Hi Noel,

 

Hi Everyone,

 

I just installed EZier New Fields v5.0 and it works great. You are a God send for developing this.

 

I have 2 questions.

 

1. I can't seem to find where you set the option for the savings. Specifically if you want to only show percentage or dollar amount or both.

 

2. I seem to have duplicate entries in the Admin section under Configuration/My Store for the new field. And in the Product Listing section for the 2 new fields there.

 

EZier New Fields Display false

EZier New Fields Display true

 

Display Retail Price (EZier New Fields)

Display Retail Price (EZier New Fields)

 

Display Savings (EZier New Fields)

Display Savings (EZier New Fields)

 

Can you please help me with this?

 

Thanks in advance,

Al

Link to comment
Share on other sites

Hi Noel,

 

Hi Everyone,

 

I just installed EZier New Fields v5.0 and it works great. You are a God send for developing this.

 

I have 2 questions.

 

1. I can't seem to find where you set the option for the savings. Specifically if you want to only show percentage or dollar amount or both.

 

2. I seem to have duplicate entries in the Admin section under Configuration/My Store for the new field. And in the Product Listing section for the 2 new fields there.

 

EZier New Fields Display false

EZier New Fields Display true

 

Display Retail Price (EZier New Fields)

Display Retail Price (EZier New Fields)

 

Display Savings (EZier New Fields)

Display Savings (EZier New Fields)

 

Can you please help me with this?

 

Thanks in advance,

Al

 

Q1. In /catalog/includes/modules/ezier_new_fields.php around line 75 uncomment as instructed in the file itself to get the display you need,

 

Q2. Sounds like you may have completed part of the installation twice. i would go back through the installation and make sure you have only completed each step once.

 

Im sure Noel can advise better tho' hes a clever chap :D

 

see this super contribution in action! http://www.bandland.co.uk/catalog

Link to comment
Share on other sites

Q1. In /catalog/includes/modules/ezier_new_fields.php around line 75 uncomment as instructed in the file itself to get the display you need,

 

Q2. Sounds like you may have completed part of the installation twice. i would go back through the installation and make sure you have only completed each step once.

 

Im sure Noel can advise better tho' hes a clever chap  :D

 

see this super contribution in action! http://www.bandland.co.uk/catalog

 

Thank you Flyer5. First problem solved, I guess I missed that in the instructions.

Link to comment
Share on other sites

heres how my product_listing looks like :

 

image.JPG

 

For some reason all the names are on the right side instead of next to the prices

 

here is the code for my product_listing.php

 

<?php
/*
 $Id: product_listing.php,v 1.44 2003/06/09 22:49:43 hpdl Exp $
*/

 $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');

 if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>
   <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
   <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
 </tr>
</table>
<?php
 }

 $list_box_contents = array();

 for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
   switch ($column_list[$col]) {
     case 'PRODUCT_LIST_MODEL':
       $lc_text = TABLE_HEADING_MODEL;
       $lc_align = '';
       break;
     case 'PRODUCT_LIST_NAME':
       $lc_text = TABLE_HEADING_PRODUCTS;
       $lc_align = '';
       break;
     case 'PRODUCT_LIST_MANUFACTURER':
$lc_text = TABLE_HEADING_MANUFACTURER;
$lc_align = '';
break;
// EZier New Fields added
case 'PRODUCT_LIST_RETAIL_PRICE':
$lc_text = TABLE_HEADING_RETAIL_PRICE;
$lc_align = 'right';
break;
// End EZier New Fields added
case 'PRODUCT_LIST_PRICE':
$lc_text = TABLE_HEADING_PRICE;
$lc_align = 'right';
break;
// EZier New Fields added
case 'PRODUCT_LIST_SAVE':
$lc_text = TABLE_HEADING_SAVE;
$lc_align = 'right';
break;
// End EZier New Fields added
case 'PRODUCT_LIST_QUANTITY':
$lc_text = TABLE_HEADING_QUANTITY;
$lc_align = 'right';
break;
     case 'PRODUCT_LIST_WEIGHT':
       $lc_text = TABLE_HEADING_WEIGHT;
       $lc_align = 'right';
       break;
     case 'PRODUCT_LIST_IMAGE':
       $lc_text = TABLE_HEADING_IMAGE;
       $lc_align = 'center';
       break;
     case 'PRODUCT_LIST_BUY_NOW':
       $lc_text = TABLE_HEADING_BUY_NOW;
       $lc_align = 'center';
       break;
   }

   if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') && ($column_list[$col] != 'PRODUCT_LIST_SAVE') ) {
     $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text);
   }

   $list_box_contents[0][] = array('align' => $lc_align,
                                   'params' => 'class="productListing-heading"',
                                   'text' => ' ' . $lc_text . ' ');
 }

 if ($listing_split->number_of_rows > 0) {
   $listing_query = tep_db_query($listing_split->sql_query);

   $row = 0;
   $column = 0;
   while ($listing = tep_db_fetch_array($listing_query)) {

     $product_contents = array();

     for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
       $lc_align = '';

       switch ($column_list[$col]) {
         case 'PRODUCT_LIST_MODEL':
           $lc_align = '';
           $lc_text = ' ' . $listing['products_model'] . ' ';
           break;
         case 'PRODUCT_LIST_NAME':
           $lc_align = '';
           if (isset($HTTP_GET_VARS['manufacturers_id'])) {
             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>';
           } else {
             $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> ';
           }
           break;
         case 'PRODUCT_LIST_MANUFACTURER':
           $lc_align = '';
           $lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a> ';
           break;
// EZier New Fields added
case 'PRODUCT_LIST_RETAIL_PRICE':
$lc_align = 'right';
if ((tep_not_null($listing['products_retail_price'])) && ($listing['products_retail_price']) > 0) {
$lc_text = '<font color="#55508a">' . $currencies->display_price($listing['products_retail_price'], tep_get_tax_rate($listing['products_tax_class_id'])); 
} else {
$lc_text = ' ';
}
break;
// End EZier New Fields added
         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;
// EZier New Fields added
case 'PRODUCT_LIST_SAVE':
$lc_align = 'right';
if ((tep_not_null($listing['products_retail_price'])) && ($listing['products_retail_price']) > 0) {
$lc_save = round(100 - (( $listing['products_price'] / $listing['products_retail_price'] ) * 100 ));
$lc_text = '<font color="red"> ' . $lc_save . '% </font>';
} else {
$lc_text = ' ';
}
break;
// End EZier New Fields added
         case 'PRODUCT_LIST_QUANTITY':
           $lc_align = 'right';
           $lc_text = ' ' . $listing['products_quantity'] . ' ';
           break;
         case 'PRODUCT_LIST_WEIGHT':
           $lc_align = 'right';
           $lc_text = ' ' . $listing['products_weight'] . ' ';
           break;
         case 'PRODUCT_LIST_IMAGE':
           $lc_align = 'center';
           if (isset($HTTP_GET_VARS['manufacturers_id'])) {
             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
           } else {
             $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';
           }
           break;
         case 'PRODUCT_LIST_BUY_NOW':
           $lc_align = 'center';
           $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
           break;
       }
       $product_contents[] = $lc_text;

     }
     $lc_text = implode('<br>', $product_contents);
     $list_box_contents[$row][$column] = array('align' => 'center',
                                               'params' => 'class="productListing-data"',
                                               'text'  => $lc_text);
     $column ++;
     if ($column >= 3) {
       $row ++;
       $column = 0;
     }
   }

   new productListingBox($list_box_contents);
 } else {
   $list_box_contents = array();

   $list_box_contents[0] = array('params' => 'class="productListing-odd"');
   $list_box_contents[0][] = array('params' => 'class="productListing-data"',
                                  'text' => TEXT_NO_PRODUCTS);

   new productListingBox($list_box_contents);
 }

 if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>
   <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
   <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
 </tr>
</table>
<?php
 }
?>

 

thankx

Link to comment
Share on other sites

Hi,

 

Great contrib and equally great contributions.

I have one problem:

 

I have 2 currencies enabled (USD and CAD)

 

On my New Products page , I get the following error:

Warning: Missing argument 2 for display_price() in catalog/includes/classes/currencies.php on line 77

 

This entry shows up for each product.

 

My currency.php is as follows:

<?php
/*
$Id: currencies.php,v 1.16 2003/06/05 23:16:46 hpdl Exp $

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

Copyright (c) 2003 osCommerce

Released under the GNU General Public License
*/

////
// Class to handle currencies
// TABLES: currencies
class currencies {
  var $currencies;

// class constructor
  function currencies() {
    $this->currencies = array();
    $currencies_query = tep_db_query("select code, title, symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, value from " . TABLE_CURRENCIES);
    while ($currencies = tep_db_fetch_array($currencies_query)) {
      $this->currencies[$currencies['code']] = array('title' => $currencies['title'],
                                                     'symbol_left' => $currencies['symbol_left'],
                                                     'symbol_right' => $currencies['symbol_right'],
                                                     'decimal_point' => $currencies['decimal_point'],
                                                     'thousands_point' => $currencies['thousands_point'],
                                                     'decimal_places' => $currencies['decimal_places'],
                                                     'value' => $currencies['value']);
    }
  }

// class methods
  function format($number, $calculate_currency_value = true, $currency_type = '', $currency_value = '') {
    global $currency;

    if (empty($currency_type)) $currency_type = $currency;

    if ($calculate_currency_value == true) {
      $rate = (tep_not_null($currency_value)) ? $currency_value : $this->currencies[$currency_type]['value'];
      $format_string = $this->currencies[$currency_type]['symbol_left'] . number_format(tep_round($number * $rate, $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right'];
// if the selected currency is in the european euro-conversion and the default currency is euro,
// the currency will displayed in the national currency and euro currency
      if ( (DEFAULT_CURRENCY == 'EUR') && ($currency_type == 'DEM' || $currency_type == 'BEF' || $currency_type == 'LUF' || $currency_type == 'ESP' || $currency_type == 'FRF' || $currency_type == 'IEP' || $currency_type == 'ITL' || $currency_type == 'NLG' || $currency_type == 'ATS' || $currency_type == 'PTE' || $currency_type == 'FIM' || $currency_type == 'GRD') ) {
        $format_string .= ' <small>[' . $this->format($number, true, 'EUR') . ']</small>';
      }
    } else {
      $format_string = $this->currencies[$currency_type]['symbol_left'] . number_format(tep_round($number, $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right'];
    }

   // BOF: WebMakers.com Added: Down for Maintenance
      if (DOWN_FOR_MAINTENANCE=='true' and DOWN_FOR_MAINTENANCE_PRICES_OFF=='true') {
        $format_string= '';
      }
// BOF: WebMakers.com Added: Down for Maintenance

      return $format_string;
  }

  function is_set($code) {
    if (isset($this->currencies[$code]) && tep_not_null($this->currencies[$code])) {
      return true;
    } else {
      return false;
    }
  }

  function get_value($code) {
    return $this->currencies[$code]['value'];
  }

  function get_decimal_places($code) {
    return $this->currencies[$code]['decimal_places'];
  }

  function display_price($products_price, $products_tax, $quantity = 1) {
    return $this->format(tep_add_tax($products_price, $products_tax) * $quantity);
  }
}
?>

Line 77 is

function display_price($products_price, $products_tax, $quantity = 1) {

It only shows up in the New Products for {month} section, elsewhere it's ok. I have a heavily modified code, so it's possible I messed up somewhere. Any help would be greatly appreciated.

 

Thanks

Ray

Link to comment
Share on other sites

  • 3 weeks later...

I am having problems with the Customers Discount and percentages showing up.. this is what I get when a Customers Discount is enabled:

 

List Price: $0.95
Your Price: $0.90
You Save: 5%

 

When i should get:

 

List Price: $1.00
Our Price: $0.95
Your Discounted Price: $0.90
You Save: 5% (which I think should really be 10% off of the retail price)

Link to comment
Share on other sites

First off, thanks for writing this mod. It's great. I am sure it has helped out a lot of people.

 

I have just finished the installation and have run into, so far, only one problem. On the product listings all the table_headings show up fine, but the data that gets put on the Retail Price column is always the same value of the column that comes before it. I know this because I have moved the field around in the admin Product Listing section.

 

What have I done wrong?

 

I tried searching for the answer through this post, but I'm not finding it. This sucker is huge!!!

 

I have also tried to figure out in what file this gets called, but my brain is FRIED!

 

Please help.

 

Thanks!

Link to comment
Share on other sites

  • 4 weeks later...

I've successfully installed Ezier fields 5 contribution (which is an excellent contribution by the way). It's working perfectly except for one thing which is VERY bizarre.

 

If the retail price has a number ' 8 ' in it, it gets replaced with a ' 0 '. So if the retail price is ?88.88, then it gets replaced by ?00.00, or if its ?98.98 you see ?90.90. Apart from number '8' all other numbers from 0 - 9 are fine.

 

Any ideas what it could be? The problem only appears to be with this contribution.

 

Any help will be appreciated.

 

Thanks

Link to comment
Share on other sites

Are you displaying the prices with a strikeout?

I suspect the 0 is actually an 8 with a strikeout.

 

 

F5

I've successfully installed Ezier fields 5 contribution (which is an excellent contribution by the way). It's working perfectly except for one thing which is VERY bizarre.

 

If the retail price has a number ' 8 ' in it, it gets replaced with a ' 0 '. So if the retail price is ?88.88, then it gets replaced by ?00.00, or if its ?98.98 you see ?90.90. Apart from number '8' all other numbers from 0 - 9 are fine.

 

Any ideas what it could be? The problem only appears to be with this contribution.

 

Any help will be appreciated.

 

Thanks

Link to comment
Share on other sites

Thanks for the reply, I really appreciate it.

 

Yes, I am displaying prices with a strike out.

 

Your absolutely right, the strike out line would make the 8 look like a 0 - duh, It didn't even occur to me. I'll change the font to address the problem.

 

Thanks for your help.

 

Abdul

Link to comment
Share on other sites

Yeah it had me thinking for a while! I removed the strikeout rather than change the font!

 

Regards

F5

 

Thanks for the reply, I really appreciate it.

 

Yes, I am displaying prices with a strike out.

 

Your absolutely right, the strike out line would make the 8 look like a 0 -  duh, It didn't even occur to me. I'll change the font to address the problem.

 

Thanks for your help.

 

Abdul

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...