[ PHPXref.com ] [ Generated: Sun Jul 20 19:13:40 2008 ] [ osCommRes 1.2.0 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/includes/functions/ -> webmakers_added_functions.php (source)

   1  <?php
   2  /*

   3    WebMakers.com Added: Additional Functions

   4    Written by Linda McGrath osCOMMERCE@WebMakers.com

   5    http://www.thewebmakerscorner.com

   6  

   7    osCommerce, Open Source E-Commerce Solutions

   8    http://www.oscommerce.com

   9  

  10    Copyright (c) 2002 osCommerce

  11  

  12    Released under the GNU General Public License

  13  */
  14  
  15  ////

  16  // Verify Free Shipping or Regular Shipping modules to show

  17    function tep_get_free_shipper($chk_shipper) {
  18    global $cart;
  19    $show_shipper =false;
  20      switch (true) {
  21        case ( ($chk_shipper =='freeshipper' and $cart->show_weight() == 0) ):
  22          $show_shipper=true;
  23          break;
  24        case ( ($chk_shipper !='freeshipper' and $cart->show_weight() == 0) ):
  25          $show_shipper=false;
  26          break;
  27  
  28        case ( ($chk_shipper =='freeshipper' and $cart->show_weight() != 0) ):
  29          $show_shipper=false;
  30          break;
  31        case ( ($chk_shipper !='freeshipper' and $cart->show_weight() != 0) ):
  32          $show_shipper=true;
  33          break;
  34        default:
  35          $show_shipper=false;
  36          break;
  37      }
  38  
  39    return $show_shipper;
  40    }
  41  
  42  
  43  ////

  44  // Verify Free Charge or Regular Payment methods to show

  45    function tep_get_free_charger($chk_module) {
  46    global $cart;
  47  
  48    $show_it =false;
  49      switch (true) {
  50        case ( ($chk_module =='freecharger' and ($cart->show_total()==0 and $cart->show_weight() == 0)) ):
  51          $show_it=true;
  52          break;
  53        case ( ($chk_module !='freecharger' and ($cart->show_total()==0 and $cart->show_weight() == 0)) ):
  54          $show_it=false;
  55          break;
  56  
  57        case ( ($chk_module =='freecharger' and ($cart->show_total()!=0 or $cart->show_weight() != 0)) ):
  58          $show_it=false;
  59          break;
  60        case ( ($chk_module !='freecharger' and ($cart->show_total()!=0 or $cart->show_weight() != 0)) ):
  61          $show_it=true;
  62          break;
  63      }
  64  
  65    return $show_it;
  66    }
  67  
  68  ////

  69  
  70  ////

  71  // Display Price Retail

  72  // Specials and Tax Included

  73    function tep_get_products_display_price($products_id, $prefix_tag=false, $value_price_only=false, $include_units=true) {
  74      global $currencies;
  75      $product_check_query = tep_db_query("select products_tax_class_id, products_price, products_priced_by_attribute, product_is_free, product_is_call, product_is_showroom_only from " . TABLE_PRODUCTS . " where products_id = '" . $products_id . "'" . " limit 1");
  76      $product_check = tep_db_fetch_array($product_check_query);
  77  
  78      $display_price='';
  79      $value_price=0;
  80      // Price is either normal or priced by attributes

  81        if ($product_check['products_priced_by_attribute']) {
  82          $attributes_priced=tep_get_products_base_price($products_id, $include_units);
  83          $display_price=$currencies->display_price( ($product_check['products_price'] + $attributes_priced + ($attributes_priced * ($product_check['products_price_markup']/100))),'',1);
  84          $value_price=($product_check['products_price'] + $attributes_priced + ($attributes_priced * ($product_check['products_price_markup']/100)));
  85        } else {
  86          if ($product_check['products_price'] !=0) {
  87            $display_price=$currencies->display_price($product_check['products_price'],tep_get_tax_rate($product_check['products_tax_class_id']),1,true);
  88          }
  89        }
  90  
  91        // If a Special, Show it

  92        if ($add_special=tep_get_products_special_price($products_id)) {
  93          //       $products_price = '<s>' . $currencies->display_price($product_info_values['products_price'], tep_get_tax_rate($product_info_values['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info_values['products_tax_class_id'])) . '</span>';

  94          $display_price = '<s>' . $display_price . '</s> <span class="productSpecialPrice"> ' . $currencies->display_price($add_special,tep_get_tax_rate($product_check['products_tax_class_id']),'1') .  '</span> ';
  95        }
  96  
  97        // If Free, Show it

  98        if ($product_check['product_is_free']) {
  99          if (PRODUCTS_PRICE_IS_FREE_IMAGE_ON=='0') {
 100            $free_tag= ' ' . PRODUCTS_PRICE_IS_FREE_TEXT;
 101          } else {
 102            $free_tag= ' ' . tep_image(DIR_WS_IMAGES . PRODUCTS_PRICE_IS_FREE_IMAGE,PRODUCTS_PRICE_IS_FREE_TEXT);
 103          }
 104  
 105          if ($product_check['products_price'] !=0) {
 106            $display_price='<s>' . $display_price . '</s>' . '<br><span class="ProductIsFree">' . $free_tag . '</span>';
 107          } else {
 108            $display_price='<span class="ProductIsFree">' . $free_tag . '</span>';
 109          }
 110        } // FREE

 111  
 112        // If Call for Price, Show it

 113        if ($product_check['product_is_call']) {
 114          if (PRODUCTS_PRICE_IS_FREE_IMAGE_ON=='0') {
 115            $call_tag=' ' . PRODUCTS_PRICE_IS_CALL_FOR_PRICE_TEXT;
 116          } else {
 117            $call_tag= ' ' . tep_image(DIR_WS_IMAGES . PRODUCTS_PRICE_IS_CALL_FOR_PRICE_IMAGE,PRODUCTS_PRICE_IS_CALL_FOR_PRICE_TEXT);
 118          }
 119  
 120          if ($product_check['products_price'] !=0) {
 121            $display_price='<s>' . $display_price . '</s> ' .  $call_tag;
 122          } else {
 123            $display_price=$call_tag;
 124          }
 125        } // CALL

 126  
 127        // If Showroom, Show it

 128        if ($product_check['product_is_showroom_only']) {
 129          if (PRODUCTS_PRICE_IS_SHOWROOM_IMAGE_ON=='0') {
 130            $showroom_only_tag= ' ' . PRODUCTS_PRICE_IS_SHOWROOM_ONLY_TEXT;
 131          } else {
 132            $showroom_only_tag= ' ' . tep_image(DIR_WS_IMAGES . PRODUCTS_PRICE_IS_SHOWROOM_ONLY_IMAGE,PRODUCTS_PRICE_IS_SHOWROOM_ONLY_TEXT);
 133          }
 134  
 135          if ($product_check['products_price'] !=0) {
 136  //          $display_price='<s>' . $display_price . '</s>' . '<br><span class="ProductIsShowroomOnly">' . $showroom_only_tag . '</span>';

 137            $display_price=$display_price . '<br><span class="ProductIsShowroomOnly">' . $showroom_only_tag . '</span>';
 138          } else {
 139            $display_price='<span class="ProductIsShowroomOnly">' . $showroom_only_tag . '</span>';
 140          }
 141        } // FREE

 142  
 143  
 144  
 145      if ($value_price_only) {
 146        return $value_price;
 147      } else {
 148        if ($display_price) {
 149          return ($prefix_tag ? $prefix_tag . ' ' : '') . $display_price;
 150        } else {
 151          return false;
 152        }
 153      }
 154    }
 155  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]