Jump to content
Latest News: (loading..)

Recommended Posts

@Tsimi    I just reinstalled the Held Orders addon (I have been editing it to fit to my needs). There  was some duplicated line  by mistake... now it is working 

Thank you
Omar

Share this post


Link to post
Share on other sites

Thank's for the add-ons, work perfectly.

I don't know if it's a bug or not, but I just realised that if I have these lines in my config :

  define('HTTP_COOKIE_DOMAIN', 'domain.com');
  define('HTTPS_COOKIE_DOMAIN', 'secure.domain.com');

The discount code show a red icon,  but the discount is still applied on the order. It's just that the icon is red, which may suggest to the customer that the code is not working.

So I deactivated the cookies in the config for now.

Can you confirm that ??


John

--------------------

osCommerce 2.3.4 Bootstrap Edge

Share this post


Link to post
Share on other sites

Is possible to set a discount code for a product with a specific attribute?

Thanks in advance :)

Share this post


Link to post
Share on other sites

Hello @Tsimi I'm using a old version of this addon, but the discount code is applying to shipping costs also, I was trying to look just to apply to subtotal. I've update the addon to the last version but at checkout I get this error:

Fatal error: Uncaught Error: Call to undefined method currencies::format_raw() in /home/xxx/public_html/includes/modules/order_total/ot_discount.php:160 Stack trace: #0 /home/xxx/public_html/includes/classes/order_total.php(42): ot_discount->process() #1 /home/xxx/public_html/checkout_confirmation.php(85): order_total->process() #2 /home/xxx/public_html/index.php(37): include('/home/xxx...') #3 {main} thrown in /home/xxx/public_html/includes/modules/order_total/ot_discount.php on line 160

At lest the version I found is "Discount Code 2.6", it's possible to apply the discount only to the subtotal of products?

 

Share this post


Link to post
Share on other sites

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

×