Jump to content
Latest News: (loading..)

Recommended Posts

The error probably is that I'm missing that functions at classes/currencies.php. But does this version fix the issue about shipping costs?

Share this post


Link to post
Share on other sites
Posted (edited)
3 minutes ago, sinopia said:

The error probably is that I'm missing that functions at classes/currencies.php. But does this version fix the issue about shipping costs?

Yes, please update your currency class to the latest version of the current 2.3.4.1 BS EDGE. This function has been added there some time ago.

order subtotal and shipping discount is both supported in the last versions as separate options.

Current version is Discount Codes 4.3. BS

Edited by raiwa

Share this post


Link to post
Share on other sites

Hello @raiwa should I use this one -> https://raw.githubusercontent.com/BrockleyJohn/Responsive-osCommerce/master/includes/classes/currencies.php ?

Should I just add those functions into mine class? Here are mine:

<?php
/*
  $Id$

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

  Copyright (c) 2008 osCommerce

  Released under the GNU General Public License
*/

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

// class constructor
    function __construct() {
      $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' => (int)$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'];
      } 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'];
      }

      return $format_string;
    }

    function calculate_price($products_price, $products_tax, $quantity = 1) {
      global $currency;

      return tep_round(tep_add_tax($products_price, $products_tax), $this->currencies[$currency]['decimal_places']) * $quantity;
    }

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

    function get_symbol() {
        global $currency;

          $currency_type = $currency;

          if (trim($this->currencies[$currency_type]['symbol_left'])!='') {
              return $this->currencies[$currency_type]['symbol_left'];
          } else return $this->currencies[$currency_type]['symbol_right'];
        }
    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($this->calculate_price($products_price, $products_tax, $quantity));
    }
		
    function display_sale_percent($products_price, $products_tax, $special_price) {	
			if ($this->calculate_price($special_price, $products_tax, 1) != 100)	{
				if ($products_price != 0)	{
     			$sale_percent = 100 - $this->calculate_price($special_price, $products_tax, 1)/$products_price*100;
				}
			}
	  return tep_round($sale_percent, 1);
		
    }		
    function format_short($number) {
        if ($calculate_currency_value) {
          $rate = ($currency_value) ? $currency_value : $this->currencies[$currency_type]['value'];
          $format_string = $this->currencies[$currency_type]['symbol_left'] . number_format($number * $rate, $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($number, $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right'];
        }

        $format_string = number_format($number, $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']);
        $format_string = str_replace(',','',$format_string);

        return $format_string;
      }
  }
	echo $special_price;
?>

 

Share this post


Link to post
Share on other sites

Also some classes/function are using old PHP code.. For example:

        reset($this->modules);
        while (list(, $value) = each($this->modules)) {

which should become the following:

foreach($this->modules as $value) {

Can this cause some kind of errors?

Share this post


Link to post
Share on other sites
10 minutes ago, sinopia said:

Also some classes/function are using old PHP code.. For example:


        reset($this->modules);
        while (list(, $value) = each($this->modules)) {

which should become the following:


foreach($this->modules as $value) {

Can this cause some kind of errors?

 these are updates for php7.2 compatibility. For lower versions they are no required.

Share this post


Link to post
Share on other sites
Posted (edited)

Struggling with Paypal and this add on.  I had this working with earlier Paypal versions but since a recent Paypal update I must have lost a change along the way...

The discount itself works when paying with paypal, but I cannot get the customers_to_discount_codes to update.  If I have the code in the paypal_standard file to do this I get an SQL error that there is no value for discount code, so the discount code id is being dropped somwhere along the way.  

1366 - Incorrect integer value: '' for column 'discount_codes_id' at row 1

insert into customers_to_discount_codes (customers_id, discount_codes_id) values ('116812', '')

I quickly parsed through the thread to see if I could find anyone else with this issue but didn't come up with much.

 

C

Edited by cdetdi

Share this post


Link to post
Share on other sites

Hello @raiwa

I'm busy working to update my entire site to PHP7.2

On my live shop everything works well (not PHP7)  but on my xampp testing server PHP7 the discount code displays twice

I have only one instance of this code checkout_payment.php file, I have uninstalled/reinstalled the module, cleared database cache and browser cache :

  <hr>

  <div class="contentText">
    <div class="form-group">

Also; when entering a valid discount coupon code I get the red circle - not valid icon but the coupon is showing discount at checkout_confirmation.php

Let me know if there is anything to check on

code.jpg


Thanks to all source contributors, 2.3.4 Edge just works fine

https://github.com/gburton/Responsive-osCommerce/archive/master.zip

Share this post


Link to post
Share on other sites

Hello Pierre @Peper,

I just checked on a new 2.3.4.1 CE Frozen installation under PHP 7.2 and all works as it should.

- Please check in your database if you have the header tag module correct installed. Check if you have no duplicated entries.

- Search in your database in configuration table for " MODULE_HEADER_TAGS_INSTALLED " and check if you have the discount header tag duplicated in the list.

- Try to uninstall the header tag module and reinstall.

 

rgds

Rainer

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×