Jump to content
Latest News: (loading..)
swguy

[Contribution] Quantity Discounts by That Software Guy

Recommended Posts

I haven't heard of  Manual Order Maker - what Zen Cart folks do is login to the catalog as the customer for whom they want to place an order and run it through that way.  I can't really give you any guidance beyond that - maybe check with the people who created Manual Order Maker.


Contributions: Better Together and Quantity Discounts, for osCommerce 2.2, 2.3.x and 3.0. See my profile for more details.

Share this post


Link to post
Share on other sites

First thanks for this add on.  I started using QD a while ago, now I'm upgrading under osc2.3.4 BS. I have QD running and working with the product. What is not happening is that the QD is not subtracting from the item total so that the sales tax is calculated after the discount is take. The sales tax is calculated on the original amount. How can I correct this?
4.50 - .90 = 3.60 + ST = total, not 4.50 + st -.90 = total

I have tried changing the order of where the QD is located and that did not do anything.

 

Thanks
Dean

Share this post


Link to post
Share on other sites

Go to admin-modules-order total-quantity discount and try the other values of Re-calculate tax.


Contributions: Better Together and Quantity Discounts, for osCommerce 2.2, 2.3.x and 3.0. See my profile for more details.

Share this post


Link to post
Share on other sites

I haven't had any luck to get this to work.  Still charges tax on the full amount then tacks the discount.  Need to have the discount applied then sales tax added. 

Share this post


Link to post
Share on other sites

I've still have had no luck in getting this work.  I've tried all the options, mixed them up and still can not get the tax right.  I can not get the discount amount to subtract from the subtotal before tax is added on the new subtotal. 

 

I'm getting

subtotal  $4.50 taxable

QD            -.90

ship          2.82 taxable

tax              .62 (based on 4.50+2.82) @ .085

total         $7.04

 

Should get

subtotal $4.50 taxable

QD           -.90  (4.50 -.90 = 3.60)

ship         2.82 taxable

tax             .54  (3.60+2.82) @ .085

total       $6.96

 

How can I fix this?

Share this post


Link to post
Share on other sites

If you can't get the result you want from the available configurations, you will need to modify the software.  


Contributions: Better Together and Quantity Discounts, for osCommerce 2.2, 2.3.x and 3.0. See my profile for more details.

Share this post


Link to post
Share on other sites

I'm not a programer, have no idea where to start.

I guess that leaves me to just remove it.  Hate to do that.  But if it will not work that is not much else to do. :(

If you ever have a fix please let me know.

Share this post


Link to post
Share on other sites

You can hire me or any of the other freelancers who do osCommerce work to do this sort of customization. 


Contributions: Better Together and Quantity Discounts, for osCommerce 2.2, 2.3.x and 3.0. See my profile for more details.

Share this post


Link to post
Share on other sites

How much?  And I will need an exclusive rights, to this.  Or you can fix and have the rights.

Share this post


Link to post
Share on other sites

Installed your module worked fine until I made a mistake in adding another Tax class Zone.

Tax rate not calculated correctly  (Standard)

 

I have 2 Tax Rate Classes  and are in different zones.

 

By mistake or just lazy I gave them the same description.  After that the tax calculation (Standard) did not work correctly.  After reviewing the code I noticed that the sql retrieves tax rates based on the  descrition in the table .  So I fixed the descriptions (made them different) and now  get only one tax rate (for my needs) and  it works totally correct.

I did notice some others are having a similar problem and may be what I did wrong

 

Again thanks for a great module.

 

 

 

Share this post


Link to post
Share on other sites

You are correct @@rajm2275 - unfortunately, this is the only way to get this information, so it has this pitfall.  I have a detailed explanation of this for Zen Cart, but I forgot to link to it in my osCommerce documentation.  This has been fixed - thanks for the report. 

 

http://www.thatsoftwareguy.com/zencart_notes_on_taxes.html


Contributions: Better Together and Quantity Discounts, for osCommerce 2.2, 2.3.x and 3.0. See my profile for more details.

Share this post


Link to post
Share on other sites

Hello !

 

This is probably the easiest contribution to apply some dynamic discount option to order total and I love it for my heavy modified shop :D

 

So, I have made a little addon for it when using % rate discount with order total amount. Thought it would be nice to show a customer which level of discount he already achieved and of course he must also see how little gap there is to the next level if any. It may boost the order for a few € ;).

 

Please also note above post for TAX settings. I'm using SPPC and the way to set it is TAX inclusive and recalculate tax and select tax class, so also tax exclusions works fine.

 

The addon grabs the Discount level and Discount Amount from database as set in admin module, for all 5 levels.

Then we play with some ifs and css classes to display it dinamicaly in relation to order total amount ...

I placed it under the shopping cart box as its cool to be always visible where right column is visible also ..

 

It could probably be done in another, maybe simpler way, but these are my current coding skills, still learning, any suggestion appriciated :).

 

To avoid some additional code, please respect the following !:

- Dont skip levels. Levels NOT in use should be at the end. If you delete level 3 for example, than move level 4 to 3 and 5 to 4 and leave level 5 empty.

- Its kind of logical this way, but you never know.. If you skip levels, css breaks, no need for extra conditions, we have a rule now :D

This is a simple way for css to work fine as we have to move discount indicator up down within levels limits and stll watch for not activated levels.

Example: level 3 can also be the last level of course, it would not display properly if the order total is higher than the level 3 limits, but if we know its the last level to show, we also now that level 4 is null in this case ....so we add another check for if llevel = null and if yes, we can set behaviour as the last level ... I had a feeling that I have to explain this :/

 

Here's a short video of addon in action :

https://youtu.be/C6I8vlrDLxA

 

 

Hope that somebody finds it as useful as I do :D

 

Installation proceedure: oscommerce 2.3.4

 

1#

Install original contribution

 

2#

catalog/includes/modules/boxes/bm_shopping_cart.php

 

find:

$data = '<div class="ui-widget infoBoxContainer">' .
        '  <div class="ui-widget-header infoBoxHeading"><a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . MODULE_BOXES_SHOPPING_CART_BOX_TITLE . '</a></div>' .
        '  ' . $cart_contents_string .
        '</div>';

replace with:

$data = '<div class="ui-widget infoBoxContainer mj-shoppingcart">' .
              '  <div class="ui-widget-header infoBoxHeading"><a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . MODULE_BOXES_SHOPPING_CART_BOX_TITLE . '</a></div>' .
              '  ' . $cart_contents_string .
			  '';
/* suhi */	
$suhi_total_box = ($cart->show_total());
$popust_class = "popust_levl_met";
$suhi_query = tep_db_query("select 
(select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_LEVEL_1') AS popust_nivo_1,
(select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_LEVEL_2') AS popust_nivo_2,
(select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_LEVEL_3') AS popust_nivo_3,
(select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_LEVEL_4') AS popust_nivo_4,
(select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_LEVEL_5') AS popust_nivo_5,
(select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_AMOUNT_1') AS popust_nivo_proc1,
(select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_AMOUNT_2') AS popust_nivo_proc2,
(select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_AMOUNT_3') AS popust_nivo_proc3,
(select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_AMOUNT_4') AS popust_nivo_proc4,
(select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_AMOUNT_5') AS popust_nivo_proc5
");
    $suhi_popust = tep_db_fetch_array($suhi_query);
	
	$popust_nivo_1 = $suhi_popust['popust_nivo_1'];
	$popust_nivo_2 = $suhi_popust['popust_nivo_2'];
	$popust_nivo_3 = $suhi_popust['popust_nivo_3'];
	$popust_nivo_4 = $suhi_popust['popust_nivo_4'];
	$popust_nivo_5 = $suhi_popust['popust_nivo_5'];
	
	$popust_nivo_proc1 = $suhi_popust['popust_nivo_proc1'];
	$popust_nivo_proc2 = $suhi_popust['popust_nivo_proc2'];
	$popust_nivo_proc3 = $suhi_popust['popust_nivo_proc3'];
	$popust_nivo_proc4 = $suhi_popust['popust_nivo_proc4'];
	$popust_nivo_proc5 = $suhi_popust['popust_nivo_proc5'];
	

if ($popust_nivo_proc1 > 0) {	
	$data .= '<div class="shopping_cart_box_discount_note"><div class="popust_shop_box_heading"><div>'. SUHI_TEXT_SHOP_BOX_DISC_NOTE .'</div><a class="popust_info" href="#" data-tooltip data-tooltip-label="'. TEXT_TOOLTIP_DISCOUNT_INFO_HEADER .'" data-tooltip-message="'. TEXT_TOOLTIP_DISCOUNT_INFO_MESSAGE .'"><img src="images/icons/info_icon_blue.png" alt="popust za vaš nakup" /></a></div>';

if ($popust_nivo_proc1 > 0) {		
	if ((($suhi_total_box > $popust_nivo_1) & ($suhi_total_box < $popust_nivo_2)) || (($suhi_total_box > $popust_nivo_1) & ($popust_nivo_2 == null))) {	
	 	$data .= '<div class="'. $popust_class .'">'. $popust_nivo_proc1 .'% '. POPUSTI_BOX_NAD .' '. $popust_nivo_1 .' € <span class="tvoj_popust">'. BOX_POPUSTI_VAS_POPUST .'</span></div>';
	         } else {
		$data .= '<div class="popust_off">'. $popust_nivo_proc1 .'% '. POPUSTI_BOX_NAD .' '. $popust_nivo_1 .' €</div>'; 
			 }
}
			 
if ($popust_nivo_proc2 > 0) {		
	if ((($suhi_total_box > $popust_nivo_2) & ($suhi_total_box < $popust_nivo_3)) || (($suhi_total_box > $popust_nivo_2) & ($popust_nivo_3 == null))) {
	 	$data .= '<div class="'. $popust_class .'">'. $popust_nivo_proc2 .'% '. POPUSTI_BOX_NAD .' '. $popust_nivo_2 .' € <span class="tvoj_popust">'. BOX_POPUSTI_VAS_POPUST .'</span></div>';
	         } else {
		$data .= '<div class="popust_off">'. $popust_nivo_proc2 .'% '. POPUSTI_BOX_NAD .' '. $popust_nivo_2 .' €</div>'; 
			 }
}
			 
if ($popust_nivo_proc3 > 0) {	
	if ((($suhi_total_box > $popust_nivo_3) & ($suhi_total_box < $popust_nivo_4)) || (($suhi_total_box > $popust_nivo_3) & ($popust_nivo_4 == null))) {
	 	$data .= '<div class="'. $popust_class .'">'. $popust_nivo_proc3 .'% '. POPUSTI_BOX_NAD .' '. $popust_nivo_3 .' € <span class="tvoj_popust">'. BOX_POPUSTI_VAS_POPUST .'</span></div>';
	         } else {
		$data .= '<div class="popust_off">'. $popust_nivo_proc3 .'% '. POPUSTI_BOX_NAD .' '. $popust_nivo_3 .' €</div>'; 
			 }
}
			 
if ($popust_nivo_proc4 > 0) {
	if ((($suhi_total_box > $popust_nivo_4) & ($suhi_total_box < $popust_nivo_5)) || (($suhi_total_box > $popust_nivo_4) & ($popust_nivo_5 == null))) {
	 	$data .= '<div class="'. $popust_class .'">'. $popust_nivo_proc4 .'% '. POPUSTI_BOX_NAD .' '. $popust_nivo_4 .' € <span class="tvoj_popust">'. BOX_POPUSTI_VAS_POPUST .'</span></div>';
	         } else {
		$data .= '<div class="popust_off">'. $popust_nivo_proc4 .'% '. POPUSTI_BOX_NAD .' '. $popust_nivo_4 .' €</div>'; 
			 }
}
			 
if ($popust_nivo_proc5 > 0) {
	if ($suhi_total_box > $popust_nivo_5) {
	 	$data .= '<div class="'. $popust_class .'">'. $popust_nivo_proc5 .'% '. POPUSTI_BOX_NAD .' '. $popust_nivo_5 .' € <span class="tvoj_popust">'. BOX_POPUSTI_VAS_POPUST .'</span></div>';
	         } else {
		$data .= '<div class="popust_off">'. $popust_nivo_proc5 .'% '. POPUSTI_BOX_NAD .' '. $popust_nivo_5 .' €</div>'; 
			 }
}
			 
    $data .= '</div>';
}	

		
/* end suhi */

catalog/includes/languages/english.php

 

add atthe end, before last    ?>

/* ********************************* */

define('POPUSTI_BOX_NAD','over');
define('BOX_POPUSTI_VAS_POPUST','Your Discount');
define('SUHI_TEXT_SHOP_BOX_DISC_NOTE','YOUR DISCOUNT');
define('TEXT_TOOLTIP_DISCOUNT_INFO_MESSAGE','Take advantage of our Discount Ladder. You get more discount by spending more !');
define('TEXT_TOOLTIP_DISCOUNT_INFO_HEADER','DISCOUNT Info');

/* ********************************* */

add to your stylesheet:

/* discounts */
/* shopping cart box */
.popust_levl_met {
color:#DB2523;
font-weight:700;
background:#FEE9C5 url(../../images/icons/ok_icon_green_small.png) no-repeat left;
padding:2px 0 2px 30px;
}

div.shopping_cart_box_discount_note {
margin-bottom:20px;
border-bottom:1px solid #d8d8d8;
padding-bottom:5px;
}



.popust_off {
padding-left:30px;
}


.popust_shop_box_heading {
background-color:#9E0000;
font-weight:700;
padding:8px 0 8px 8px;
color:#ffffff;
border:4px solid #870000;
margin-bottom:10px;
}

.popust_shop_box_heading div {
width:175px;
float:left;
}

.popust_shop_box_heading img{
height:22px;
}

.tvoj_popust {
color:#212121;
font-weight:normal;
text-align:right;
font-size:12px;
margin-left:10px;
background-color:#FFCC6F;
padding:5px 4px 3px 4px;
}

/* tooltips */
a.popust_info {
  color: #5EC7F6;
  clear:both;
}


[data-tooltip] {
  position: relative;
}

[data-tooltip]:before,
[data-tooltip]:after {
  display: none;
  position: absolute;
  top: 0;
}

[data-tooltip]:before {
  border-bottom: .6em solid #09f;
  border-bottom: .6em solid rgba(0,153,255,0.8);
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  content: "";
  left: -20px;
  margin-top: 1em;
}

[data-tooltip]:after {
  background-color: #0099ff;
  background-color: rgba(0,153,255,0.8);
  border: 4px solid #0099ff;
  border: 4px solid rgba(0,153,255,0.8);
  border-radius: 7px;
  color: #ffffff;
  content: attr(data-tooltip-label) ":\A" attr(data-tooltip-message);
  left: -150px;
  margin-top: 1.5em;
  padding: 5px 15px;
  white-space: pre-wrap;
  width: 160px;
  font-weight:700;
}

[data-tooltip]:hover:after,
[data-tooltip]:hover:before {
  display: block;
}

There are also 2 new images:

images/icons/ok_icon_green_small.png  // 23x20 px (3px transparent on left to add some space on the left, )

images/icons/info_icon_blue.png  // defined in css to 22px height

 

And that's it. Change CSS and these 2 images to fit your look & feel ...

 

I'm almost sure I didn't forget anything :-

 

Have fun and cheers from Ljubljana,

Gregor

post-150417-0-95200700-1434107946.png

post-150417-0-58068000-1434108378.png

Edited by suhy

Share this post


Link to post
Share on other sites

Nice work, Gregor! 


Contributions: Better Together and Quantity Discounts, for osCommerce 2.2, 2.3.x and 3.0. See my profile for more details.

Share this post


Link to post
Share on other sites

Tnx. I didnt want to upload this small addon in contribution pack as this solution covers only one of the possible dscount combination, but I like to think its the most used combo.

 

The only thing it would be great for other users also is to include link to your forum post in the contribution area as lots of usefull info could be found here :D 

Share this post


Link to post
Share on other sites

Better late reply than none, I suppose ... as I've found one mistake when showing prices including VAT. The discount table that you input in Admin area behaves as w/o VAT and is not added in the front end shop. The discount break limits were off for VAT amount ...
 
Solution for having one tax rate:
includes/modules/boxes/shopping_cart.php
 
add to $suhi_query:
(SELECT tax_rate FROM " . TABLE_TAX_RATES ." WHERE tax_rates_id = '1' ) AS ddv_tax_rate

so it looks like:

$suhi_query = tep_db_query("select 
(select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_LEVEL_1') AS popust_nivo_1,
(select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_LEVEL_2') AS popust_nivo_2,
(select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_LEVEL_3') AS popust_nivo_3,
(select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_LEVEL_4') AS popust_nivo_4,
(select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_LEVEL_5') AS popust_nivo_5,
(select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_AMOUNT_1') AS popust_nivo_proc1,
(select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_AMOUNT_2') AS popust_nivo_proc2,
(select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_AMOUNT_3') AS popust_nivo_proc3,
(select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_AMOUNT_4') AS popust_nivo_proc4,
(select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_AMOUNT_5') AS popust_nivo_proc5,
(SELECT tax_rate FROM " . TABLE_TAX_RATES ." WHERE tax_rates_id = '1' ) AS ddv_tax_rate
");

find bellow it:

    $suhi_popust = tep_db_fetch_array($suhi_query);
	
	$popust_nivo_1 = $suhi_popust['popust_nivo_1'];
	$popust_nivo_2 = $suhi_popust['popust_nivo_2'];
	$popust_nivo_3 = $suhi_popust['popust_nivo_3'];
	$popust_nivo_4 = $suhi_popust['popust_nivo_4'];
	$popust_nivo_5 = $suhi_popust['popust_nivo_5'];

and REPLACE with:

$suhi_popust = tep_db_fetch_array($suhi_query);
	
	$ddv_tax_rate = ($suhi_popust['ddv_tax_rate'] / 100) + 1;
	
		
	$popust_nivo_1 = round($suhi_popust['popust_nivo_1'] * $ddv_tax_rate);
	$popust_nivo_2 = round($suhi_popust['popust_nivo_2'] * $ddv_tax_rate);
	$popust_nivo_3 = round($suhi_popust['popust_nivo_3'] * $ddv_tax_rate);
	$popust_nivo_4 = round($suhi_popust['popust_nivo_4'] * $ddv_tax_rate);
	$popust_nivo_5 = round($suhi_popust['popust_nivo_5'] * $ddv_tax_rate);

if you are using SPPC, you can do the following:

$suhi_popust = tep_db_fetch_array($suhi_query);
	
$suhi_customer_group_show_tax = $_SESSION['sppc_customer_group_show_tax'];
	$ddv_tax_rate = ($suhi_popust['ddv_tax_rate'] / 100) + 1;
	
		if (($suhi_customer_group_show_tax == '1') || ($suhi_customer_group_show_tax == null)) {
	$popust_nivo_1 = round($suhi_popust['popust_nivo_1'] * $ddv_tax_rate);
	$popust_nivo_2 = round($suhi_popust['popust_nivo_2'] * $ddv_tax_rate);
	$popust_nivo_3 = round($suhi_popust['popust_nivo_3'] * $ddv_tax_rate);
	$popust_nivo_4 = round($suhi_popust['popust_nivo_4'] * $ddv_tax_rate);
	$popust_nivo_5 = round($suhi_popust['popust_nivo_5'] * $ddv_tax_rate);
		} else {
	
	$popust_nivo_1 = $suhi_popust['popust_nivo_1'];
	$popust_nivo_2 = $suhi_popust['popust_nivo_2'];
	$popust_nivo_3 = $suhi_popust['popust_nivo_3'];
	$popust_nivo_4 = $suhi_popust['popust_nivo_4'];
	$popust_nivo_5 = $suhi_popust['popust_nivo_5'];
		}

Share this post


Link to post
Share on other sites

For example:
VAT: 22%
Discount level 1: 10% at 50€
Shopping cart value: 58€ (47,50€ + VAT)
The discount was showed as activated, but it was not deducted in shopping cart at checkout as the Shopping cart value was in fact 47,50€ + VAT ...

After update:
Discount level 1: 10% at 61€
Discount not triggered yet.

Discount table in ADMIN must be treated as w/o WAT now ...


Solution for having one tax rate:
includes/modules/boxes/shopping_cart.php

 

For SPPC when showing prices including VAT. We have to look in session for ...show_tax rule. If not logged in, prices includes VAT, so we have to add VAT to discount price table breaks. The same for normal user, where prices are including VAT.

if (($suhi_customer_group_show_tax == '1') || ($suhi_customer_group_show_tax == null))

For SPPC groups not showing VAT we skip this and continue as before ...

Hope someone finds this useful ..

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

×