Jump to content

Recommended Posts

@sinopia, just to be sure, you are using the latest version 4.4.0 BS?

Share this post


Link to post
Share on other sites

Hello @raiwa yes I'm using Discount Code BS 4.4.0, but my osCommerce stills 2.3.4 (Don't know if that can be related - but it's almost up to date as https://github.com/gburton/Responsive-osCommerce because I've made a few core modifications...).

The discounts works fine just can get the "Number of products" working.. I tried like 1 product but 3 quantity but also 3 different products from categories but didn't work.

Check the attachments

checkout.png

discounts.png

admin.png

Share this post


Link to post
Share on other sites

Also I've one main category.. subcategories also selected didn't work.. I've been trying everything but can't work. Any discount normal for one customer or for all working fine.

Share this post


Link to post
Share on other sites

Sorry, it works for me, I can't give you advice other than continue trying.

You could check in the database if the categories are correct registered.

And please, it would be helpful to see the complete checkout confirmation page with products listed.

Share this post


Link to post
Share on other sites

Running into an issue with currencies where the discount percentage is only working correctly if applied to the default currency. One of my stores default currency is in Thai Baht, but when customers try and use the code in their local currency (JPN, EU, USD, etc) then the discount isn't calculating correctly. "Discount Codes 4.1 BS" is the code that's currently being used on the store, but all the changes between there and the current "4.4.0 BS" drop doesn't seem to have addressed anything currency related, mostly tax based changes it looks like.

Seems to be related to % discount codes, as that's the only reproducible case that the store has been able to find a consistent reproducible case for thus far.

discount_code-4.jpg

discount_code-3.jpg

discount_code-2.jpg

discount_code-1.jpg

Edited by mattsc

Share this post


Link to post
Share on other sites

Hello Matt @mattsc,

I just checked on my test store and all works as it should.
Discount code shouldn't interfere at all in currency conversion as this is done independant in each ot module via currency class on the output. All discount calculations are done in the default currency.

I cant see the discount amounts in your screenshot.
Can you post it bigger, maybe only the order totals and please post a screenshot of your currency setup in admin.

rgds

Rainer

Share this post


Link to post
Share on other sites
11 hours ago, raiwa said:

Hello Matt @mattsc,

I just checked on my test store and all works as it should.
Discount code shouldn't interfere at all in currency conversion as this is done independant in each ot module via currency class on the output. All discount calculations are done in the default currency.

I cant see the discount amounts in your screenshot.
Can you post it bigger, maybe only the order totals and please post a screenshot of your currency setup in admin.

rgds

Rainer

OK, more details! I was able to experiment some, and have determined it's only happening in the following situation:

1) Other than default currency
2) Only for a specific SKU / Product(s)

The discount % is working fine in the default currency, which in this case is Thai Baht.

The problem is when the customer has used an other than default currency, such as USD or Euro, as demonstrated below.

The discount amounts in the screenshots in Thai Baht are the correct amount, which is setup for the SKU for part number BPCF-5102. The Baht price is ฿3,876. The 25% coupon works and is calculating a discount of ฿969. All is working fine.

image.thumb.png.7eba504617e647698078c6316f52f78f.png

Then, change the currency to USD. The USD price is $121.50. The coupon is calculating a discount of $0.95. Wrong answer.

image.thumb.png.c7bb3cee35e188f7ddbeb60078da1060.png

It SHOULD be coming up with a discount of $30.38. I'm not sure how it's coming up with $0.95, but that's clearly not 25% of $121.50.

It's not limited to just USD, as it's coming up with the wrong answer for the additional "other than default" currency. Here we can see it's getting the wrong answer for EURO as well:

image.thumb.png.425666edca8cae2f7426bf6f2a2c4e39.png

...where a €106.36EURO part price is getting a -€0.73EURO discounted amount, so it's seems to only be working correctly for the default currency.

The stores default currency is in Thai Baht / THB with a value of 1.00. The USD currency exchange rate is  0.03134758.

Currencies.thumb.png.bf51ffd00f21f1179520c53b5c0b4c00.png 

So it's specific to an Other than Default currency, and only when the discount is limited to a specific product.

The discount is being applied to a specific product vs an order sub-total:

Doesn't work:

image.png.bd60e2f4d51cfde04e9a742381e17e0b.png

Works, but isn't limited to a specific product(s) vs using Order Sub-Total:

image.png.e7dfc9e41266437667be14de4c97f8d8.png

Which is showing the correctly calculated currency discount amount:

image.thumb.png.957bef32d5771149852730e7bc2c22e5.png

 

image.png

Share this post


Link to post
Share on other sites

Hello Matt @mattsc,

I could reproduce the problem now for product discounts. Thank you! This seems to be a inherit problem since the older discount code versions on which this version is based on.

Please try the following updated Order Total (ot_discount.php) version 4.4.1. BS:

ot_discount.php

I checked with:

- display price with tax: false
- display price with tax: true
- order subtotal discount
- product discount
- category discount

Please try and let me know. I'll then upload the update

@Tsimi, can you please also give it a try if you find some time.

 

Best regards
Rainer

Share this post


Link to post
Share on other sites
On 1/16/2019 at 4:58 AM, raiwa said:

Hello Matt @mattsc,

I could reproduce the problem now for product discounts. Thank you! This seems to be a inherit problem since the older discount code versions on which this version is based on.

Please try the following updated Order Total (ot_discount.php) version 4.4.1. BS:

ot_discount.php

I checked with:
- display price with tax: false
- display price with tax: true
- order subtotal discount
- product discount
- category discount

I've verified the fix works for me. I have verified verified as working when an "other than default" currency is used:
Expected discount to be applied:
- Product discount with %
- Product discount with set amount
- Category discount with %
- Order Sub-Total with %
- Order Sub-Total with set amount

As well as the Null conditions of where no discount should be applied:
- Discount code which is expired
- Discount code which does not apply to Order Total
- Discount code for Category which does not apply to cart contents

I basically dropped the proposed 4.4.1 variant over my 4.1.0 version, and all seems to be working well. It's not exactly a rigorous set of tests, but a diff between the versions looked like it would have been safe to drop over in place, and seems to be good. I say push the change. :)

image.thumb.png.655dde5bd89a98f46dfb1d9848c9f2db.png

 

Share this post


Link to post
Share on other sites

New version uploaded:

Discount Codes 4.4.2 BS

Version 4.4.2 BS:
                  Fixed support for paypal standard discount order count. Thanks to @sinopia for the report and testing.
                  Added support for paypal standard ipn discount order count
                  Fixed error for order total discount if "Base discount tax on prices excl." was set to "true" and "Display prices with tax" was set to "true".
Version 4.4.1 BS: (unreleased version)
                  Fix for discount formatting if other than default currency is used. Thanks to @mattsc for the report and testing.

 

Share this post


Link to post
Share on other sites

Hi There

 

Using 4.4.2 with 2.3.4.1 CE BS4

Also have Modular shopping cart installed

Only just noticed but  the discount is doubled when client has logged in

reinstalled everything incase i missed something but still the same, any clues as to whet the issue might be?

 

kindest regards

 


David

Share this post


Link to post
Share on other sites

Slight update on this issue

if the client is outside UK and does not pay tax then it works fine

one would have to assume the problem is related some how to the Tax module adding the discount code again but have not found it yet

I am using 

Possibility A
Modules       Sort Order
Discount Code 2
Shipping      3
Sub-Total     1
Tax           4
Total         5

but would not have thought this would make any difference to it


David

Share this post


Link to post
Share on other sites

As i detest it when people ask questions but do not post what the result was then here is the answer

 

I was looking far to deeply in admin>modules>discount code there is a sub section

"Base discount tax on prices excl.
Shall discount tax be calculated by portions based on product prices excl tax?
Only affects stores showing prices incl. tax and mixed orders including products with different tax rates."

When i set this to false the issue went away, i wouldn't have thought this was right as it is adding the discount twice so maybe there is a conflict, but its working and i can look further another time when less stressed


David

Share this post


Link to post
Share on other sites
3 minutes ago, DAVID3733 said:

As i detest it when people ask questions but do not post what the result was then here is the answer

 

I was looking far to deeply in admin>modules>discount code there is a sub section

"Base discount tax on prices excl.
Shall discount tax be calculated by portions based on product prices excl tax?
Only affects stores showing prices incl. tax and mixed orders including products with different tax rates."

When i set this to false the issue went away, i wouldn't have thought this was right as it is adding the discount twice so maybe there is a conflict, but its working and i can look further another time when less stressed

Sounds to me that unless you sell new & used items or adult & children's clothes, it's probably SEP (someone else's problem)


For a new install or if your store isn't mobile-friendly, get the community-supported responsive osCommerce (Phoenix).

here: on the official osc download page

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Share this post


Link to post
Share on other sites

hello everyone,  what comes to discount coupon: shopping_cart using paypal express don't have  a place to input the coupon code, i am building a ajax so with paypal express from the shopping_cart will work also.

 

 

1. codes gets erased when i go thru the checkout again

2. code Discount Coupon ???? applied: doesn't show in shopping_cart.php

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

 

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

  if (!tep_session_unregister('coupon')) tep_session_register('coupon');
  $coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);

  if (is_array($payment_modules->modules)) {
    $payment_modules->pre_confirmation_check();
  }

  if( tep_not_null( $coupon ) && is_object( $order->coupon ) ) { 
    $order->coupon->verify_code();
    if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG != 'true' ) {
          if( !$order->coupon->is_errors() ) { //if we have passed all tests (no error message), make sure we still meet free shipping requirements, if any
              if( $order->coupon->is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); 
          } else {
              if( tep_session_unregister('coupon') ) tep_session_unregister('coupon');
              tep_redirect( tep_href_link( FILENAME_SHOPPING_CART1, 'error_message=' . urlencode( implode( ' ', $order->coupon->get_messages() ) ), 'SSL' ) );
          }
    }
    } else {
        if( tep_session_unregister('coupon') ) { 
      tep_session_unregister('coupon');
      require_once( DIR_WS_CLASSES.'discount_coupon.php' );
      if( discount_coupon::is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_SHOPPING_CART1, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); 
    }
}

 

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

<?php
    if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS == 'false' ) {
?>

<div class="shippingcoupon container">

<div class="text-left shipsmday"><?php echo ENTRY_SHIPSAMEDAY;?></div>

<div class="shipcouon">
<span><?php echo ENTRY_DISCOUNT_COUPON;?></span>
<?php echo tep_draw_input_fieldclear('coupon', 'if(this.value == &#39;Enter Promo Code Here&#39;) { this.value = &#39;&#39;; }','if(this.value == &#39;Enter Promo Code Here&#39;) { this.value = &#39;&#39;; }', ''.ENTRY_COUPONS.'', $coupon); ?>
<?php echo tep_draw_couponcode(IMAGE_BUTTON_APPLY, 'submit', null, 'primary', null, ''); ?>
</div>


<?php
    }
?>


<br>
<div class="container">
<div class="text-rights">

<?php echo tep_draw_button(IMAGE_BUTTON_CHECKOUTS, 'triangle-1-e', null, 'primary'); ?>
</div>


<?php
    $initialize_checkout_methods = $payment_modules->checkout_initialization_method();

    if (!empty($initialize_checkout_methods)) {
?>
<div class="text-rights"><?php echo TEXT_ALTERNATIVE_CHECKOUT_METHODS; ?></div>

<?php
      reset($initialize_checkout_methods);
      while (list(, $value) = each($initialize_checkout_methods)) {
?>

  <p class="text-right"><?php echo $value; ?></p>

<?php
      }
    }
?>

----------------------------------------------------------------html------------------------------------------------------

////
// Output COUPON
  function tep_draw_couponcode($title = null, $icon = null, $link = null, $priority = null, $params = null, $style = null) {
    static $button_counter = 1;

    $types = array('coupon', 'button', 'reset');

    if ( !isset($params['type']) ) {
      $params['name'] = 'coupon';
    }

    if ( !in_array($params['name'], $types) ) {
      $params['name'] = 'coupon';
    }

    if ( ($params['name'] == 'coupon') && isset($link) ) {
      $params['name'] = 'button';
    }

    if (!isset($priority)) {
      $priority = 'secondary';
    }

    $button = NULL;

    if ( ($params['name'] == 'button') && isset($link) ) {
      $button .= '<a href="' . $link . '"';

      if ( isset($params['newwindow']) ) {
        $button .= '';
      }
    } else {
      $button .= '<button';
      $button .= ' name="' . tep_output_string($params['name']) . '"';
    }

    if ( isset($params['params']) ) {
      $button .= ' ' . $params['params'];
    }

    $button .= 'type="button" onclick="ajaxFunction()" id="couponapplyajax" class="couponapply"';


    $button .= 'value="apply">';


    $button .= $title;

    if ( ($params['name'] == 'button') && isset($link) ) {
      $button .= '</a>';
    } else {
      $button .= '</button>';
    }

    $button_counter++;

    return $button;
  }

// Rewview Button
  function tep_draw_reviews($title = null, $icon = null, $link = null, $priority = null, $params = null, $style = null) {
    static $button_counter = 1;

    $types = array('submit', 'button', 'reset');

    if ( !isset($params['type']) ) {
      $params['type'] = 'submit';
    }

    if ( !in_array($params['type'], $types) ) {
      $params['type'] = 'submit';
    }

    if ( ($params['type'] == 'submit') && isset($link) ) {
      $params['type'] = 'button';
    }

    if (!isset($priority)) {
      $priority = 'secondary';
    }

    $button = NULL;

    if ( ($params['type'] == 'button') && isset($link) ) {
      $button .= '<a href="' . $link . '"';

      if ( isset($params['newwindow']) ) {
        $button .= ' target="_blank"';
      }
    } else {
      $button .= '<button ';
      $button .= ' type="' . tep_output_string($params['type']) . '"';
    }

    if ( isset($params['params']) ) {
      $button .= ' ' . $params['params'];
    }

    $button .= ' class="btn ';

    $button .= (isset($style)) ? $style : 'btn-default';

    $button .= '">';

    if (isset($icon) && tep_not_null($icon)) {
      $button .= ' <span class="' . $icon . '"></span> ';
    }

    $button .= $title;

    if ( ($params['type'] == 'button') && isset($link) ) {
      $button .= '</a>';
    } else {
      $button .= '</button>';
    }

    $button_counter++;

    return $button;
  }

 

Share this post


Link to post
Share on other sites

Hello Kevin @Kevin.Dallas,

It sounds pretty much that you are referring to another or older discount code version.

This thread is for Discount Code BS which already does include a content module for shopping_cart.php where to enter the discount code. It works perfectly with PayPal express checkout.

If your solution is for another version, please post it in the appropriate support thread.

Best regards

Rainer

 

Share this post


Link to post
Share on other sites

Hello Raiwa,

thank you for getting back to me, however paypal express only work you have to go thru the full checkout meaning discount coupon can only apply in the checkout_payment, if i am in the shopping cart upon clicking paypal the code hasn't been implemented, not only that if you add another product you have to type the code again.

Share this post


Link to post
Share on other sites

Hello Kevin,

Please re-read this part of my answer:

1 hour ago, raiwa said:

This thread is for Discount Code BS which already does include a content module for shopping_cart.php where to enter the discount code. It works perfectly with PayPal express checkout.

Of course, you need to install the content module and you need the BS version. Please believe me, I made this module.

Share this post


Link to post
Share on other sites

Mr.Raiwa

I know it doesn't have it, i am building a ajax if you would like i can send you the code so you can improve the coupon code, that is if you would like.

Share this post


Link to post
Share on other sites
Posted (edited)

Kevin, it seems there is a misunderstood. please tell us your exact coupon code version and store version. The coupon code Bs this thread is for DOES include the content module for shopping cart and does not require any additional coding.

I just had a look on your code and it is for a very outdated oscommerce version. It uses filaname and path constants which the BS community version has removed since time.

Edited by raiwa

Share this post


Link to post
Share on other sites

Then please have again a look, there is a content module available. I’m traveling right now and can’t check. See also the modular shopping cart add on.

Share this post


Link to post
Share on other sites

Mr.Raiwa 

I do apologize I didn't know you were traveling,  have a wonderful time and we'll touch base when you come back.

Share this post


Link to post
Share on other sites
Posted (edited)

Hello Kevin @Kevin.Dallas,

Thank You! I'm back and had a look into the package.

You'll find the shopping cart content module in:
catalog/includes/modules/content/shopping_cart/

Please see instructions:
Discount_Codes_4.2_for_BS_install:


1. Copy the new files to your osCommerce shop, preserving the directory structure.

...


*OPTIONAL
catalog/includes/modules/content/shopping_cart/cm_sc_discount_code.php
catalog/includes/modules/content/shopping_cart/templates/discount_code.php
catalog/includes/languages/english/modules/content/shopping_cart/cm_sc_discount_code.php

...

*OPTIONAL
   Install the Content module under Administration -> Modules -> Content -> Install Module -> Discount Code -> Install Module.

 

To be able to use the shopping cart content module you need to have one of the following conditions fullfilled:

- use a newer BS version which have the content module call already included in shopping_cart.php
( edge 2.3.4 is not a clear reference, there are hundreds of versions. Important in this case is to have the content module call included in shopping_cart.php)
- use modular shopping cart
- add manually the content module call to your shopping_cart.php:

<div class="clearfix"></div>
<div class="row">
  <?php echo $oscTemplate->getContent('shopping_cart'); ?>
</div>

 

You may consider to use ship in cart which will show shipping costs and real order totals (including discount) already on the shopping cart page. On that way your customers know what they will have to pay before using the PayPal express checkout button:
Ship In Cart BS reloaded

Best regards
Rainer

PS: Next time, before starting to work on an addition, just ask here in the forum, there may already exist a solution 😉.

Edited by raiwa

Share this post


Link to post
Share on other sites

Hi,

Installed the 4.2.2 BS version to my 2.3.4.1.CE shop and seems to work fine.

Except for the code mentioned in previous post that verifies if the customer entering the write or wrong code. No error message is displayed. Do i miss something.

 Liked the way its done in the normal 2.3.x version.27645053_inputfield.png.5e0269225fdffb73e4bdd7e2a640f849.png

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

×