Latest News: (loading..)
swguy

[Contribution] Quantity Discounts by That Software Guy

192 posts in this topic

My Quantity Discounts contribution permits you to offer discounts that are structured many different ways:

 

* By total number of items purchased

* By number of items purchased, counting per item

* By number of items purchased, counting per category

* Counting by items or by number of dollars spent, in any of the ways above

* Specifying the discount as a percentage, a flat dollar figure or dollars per item

 

The contribution is here:

http://addons.oscommerce.com/info/6751

sgarza112 likes this

Share this post


Link to post
Share on other sites
You can see this contribution live on my test cart at http://www.thissoftwareguy.com/osc_2_2/

 

I downloaded your contrib and have one little issue with it. After I installed it and went to edit the options, when I move my curser over any of the options on the right to edit them, everything is underlined as a link to your site (but the site is spelled wrong and i get an address not found error). Is there something I'm missing here? This is a free contrib isn't it? I wouldn't want to try using something that I was supposed to pay for. (If that is the case please accept my apologies and let me know how much and who and where to pay.):blink:

 

Thanks for the help,

Cheri

Share this post


Link to post
Share on other sites

You've done something wrong - perhaps the file has been damaged. The links to my site are for help and donations if this software helps you make money. Try downloading it again and reinstalling.

Share this post


Link to post
Share on other sites
You've done something wrong - perhaps the file has been damaged. The links to my site are for help and donations if this software helps you make money. Try downloading it again and reinstalling.

Thanks for the fast reply! I'll try that and if/when I make some money on this I'll certainly make a donation. :)

Thanks,

Cheri

Share this post


Link to post
Share on other sites
Thanks for the fast reply! I'll try that and if/when I make some money on this I'll certainly make a donation. :)

Thanks,

Cheri

 

Nope, I uninstalled it and removed the files then redownloaded it and uploaded the files here:

 

includes/modules/order-total and includes/languages/english/modules/order-total

 

I am still getting the links when I try to edit it in the admin.

 

I'm perplexed as to what to do, geez the whole thing is just one file, it shouldn't be this difficult to get it to work. Now I don't mean to simplify your work on this contrib, it is much appreciated. I just can't seem to get it to work in my environment.

 

Thanks for any help you can afford me,

Cheri

Share this post


Link to post
Share on other sites

Hi,

 

Is there a way to take the discount out BEFORE subtotal on the order confirmation page? I see how you can do it in the display order, but I need to display the discount in the actual subtotal dollar amount before shipping is applied. For example:

 

Product: $10

Quantity Discount: -$2

Subtotal: $8

Shipping: $1

Total: $9

 

Thanks!

Share this post


Link to post
Share on other sites
Is there a way to take the discount out BEFORE subtotal on the order confirmation page?

 

There's no way to do this without writing additional software.

 

Scott

Share this post


Link to post
Share on other sites
I am still getting the links when I try to edit it in the admin.

 

This seems to be an issue in 2.2-MS2 (but not in 2.2rc2a). I will post a fix shortly.

Share this post


Link to post
Share on other sites

i have OSC 2.2 RC2A . i applied your nice moudule . and when it go to checkout_payment.php . i find this error .

 

Fatal error: Call to undefined method ot_quantity_discount::use_credit_amount() in /home2/nikeshop/public_html/NL/includes/classes/order_total.php on line 150

 

Hope can get your kindly reply :)

yuan

Share this post


Link to post
Share on other sites

You have a bad copy of includes/classes/order_total.php. This file only has 80 lines.

Share this post


Link to post
Share on other sites

Quantity Discounts 1.0.1 has been released. It provides compatibility with the Order Editor contribution.

Share this post


Link to post
Share on other sites
Quantity Discounts 1.0.1 has been released. It provides compatibility with the Order Editor contribution.

 

 

 

 

Hi all!

 

I just try it!...it work fine for me!

 

 

 

Thank That Software Guy!

asbestos0

Share this post


Link to post
Share on other sites

Just installed your contribution. It was easy. Works great. One question. Is it possible to have the first 2 levels at percentage and total by item then the third level change to currency and total items in cart?

Thanks

Guy

Share this post


Link to post
Share on other sites
Is it possible to have the first 2 levels at percentage and total by item then the third level change to currency and total items in cart?

 

You'd have to write software; nothing like that is built in.

Share this post


Link to post
Share on other sites

I have a similar problem as is discussed above:

 

"Fatal error: Call to undefined method ot_quantity_discount::use_credit_amount() in /var/............./httpdocs/includes/classes/order_total.php on line 118"

 

 

I dont consider that my classes/order_total.php file is bad but there is obviously something wrong with it or needed in order to accomodate this nice contribution.

Clearly I dont know the answer but would be really grateful if anyone else does?

 

Thanks

 

L

Share this post


Link to post
Share on other sites
I dont consider that my classes/order_total.php file is bad but there is obviously something wrong with it ...

 

If you download a vanilla copy of osCommerce rc2.2 you'll see your copy of includes/classes/order_total.php is quite different from the one in the download, which only has 80 lines. I have no idea what changes you've made or why, but they are not compatible with this mod. You can use a default copy of this file, but that will probably break something else in your cart.

Share this post


Link to post
Share on other sites

Can anyone see how I can adjust my code to accomodate this module? The line 118 below is bold underlined. That is where the error seems to kick in.

 

<?php

/*

$Id: order_total.php,v 1.2 2004/03/09 18:56:37 ccwjr Exp $

orig : order_total.php,v 1.4 2003/02/11 00:04:53 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

class order_total {

var $modules;

 

// class constructor

function order_total() {

global $language;

 

if (defined('MODULE_ORDER_TOTAL_INSTALLED') && tep_not_null(MODULE_ORDER_TOTAL_INSTALLED)) {

$this->modules = explode(';', MODULE_ORDER_TOTAL_INSTALLED);

 

reset($this->modules);

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

include(DIR_WS_LANGUAGES . $language . '/modules/order_total/' . $value);

include(DIR_WS_MODULES . 'order_total/' . $value);

 

$class = substr($value, 0, strrpos($value, '.'));

$GLOBALS[$class] = new $class;

}

}

}

 

function process() {

$order_total_array = array();

if (is_array($this->modules)) {

reset($this->modules);

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

$class = substr($value, 0, strrpos($value, '.'));

if ($GLOBALS[$class]->enabled) {

$GLOBALS[$class]->process();

 

for ($i=0, $n=sizeof($GLOBALS[$class]->output); $i<$n; $i++) {

if (tep_not_null($GLOBALS[$class]->output[$i]['title']) && tep_not_null($GLOBALS[$class]->output[$i]['text'])) {

$order_total_array[] = array('code' => $GLOBALS[$class]->code,

'title' => $GLOBALS[$class]->output[$i]['title'],

'text' => $GLOBALS[$class]->output[$i]['text'],

'value' => $GLOBALS[$class]->output[$i]['value'],

'sort_order' => $GLOBALS[$class]->sort_order);

}

}

}

}

}

 

return $order_total_array;

}

 

function output() {

$output_string = '';

if (is_array($this->modules)) {

reset($this->modules);

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

$class = substr($value, 0, strrpos($value, '.'));

if ($GLOBALS[$class]->enabled) {

$size = sizeof($GLOBALS[$class]->output);

for ($i=0; $i<$size; $i++) {

$output_string .= ' <tr>' . "\n" .

' <td align="right" class="main">' . $GLOBALS[$class]->output[$i]['title'] . '</td>' . "\n" .

' <td align="right" class="main">' . $GLOBALS[$class]->output[$i]['text'] . '</td>' . "\n" .

' </tr>';

}

}

}

}

 

return $output_string;

}

// ICW ORDER TOTAL CREDIT CLASS/GV SYSTEM - START ADDITION

//

// This function is called in checkout payment after display of payment methods. It actually calls

// two credit class functions.

//

// use_credit_amount() is normally a checkbox used to decide whether the credit amount should be applied to reduce

// the order total. Whether this is a Gift Voucher, or discount coupon or reward points etc.

//

// The second function called is credit_selection(). This in the credit classes already made is usually a redeem box.

// for entering a Gift Voucher number. Note credit classes can decide whether this part is displayed depending on

// E.g. a setting in the admin section.

//

function credit_selection() {

$selection_string = '';

$close_string = '';

$credit_class_string = '' ;

if (MODULE_ORDER_TOTAL_INSTALLED) {

$header_string = '<tr>' . "\n";

$header_string .= ' <td><table border="0" width="100%" cellspacing="0" cellpadding="2">' . "\n";

$header_string .= ' <tr>' . "\n";

$header_string .= ' <td class="main"><b>' . TABLE_HEADING_CREDIT . '</b></td>' . "\n";

$header_string .= ' </tr>' . "\n";

$header_string .= ' </table></td>' . "\n";

$header_string .= ' </tr>' . "\n";

$header_string .= '<tr>' . "\n";

$header_string .= ' <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">' . "\n";

$header_string .= ' <tr class="infoBoxContents"><td><table border="0" width="100%" cellspacing="0" cellpadding="2">' ."\n";

$header_string .= ' <tr><td width="10">' . tep_draw_separator('pixel_trans.gif', '10', '1') .'</td>' . "\n";

$header_string .= ' <td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2">' . "\n";

$close_string = ' </table></td>';

$close_string .= '<td width="10">' . tep_draw_separator('pixel_trans.gif', '10', '1') . '</td>';

$close_string .= '</tr></table></td></tr></table></td>';

$close_string .= '<tr><td width="100%">' . tep_draw_separator('pixel_trans.gif', '100%', '10') . '</td></tr>';

reset($this->modules);

$output_string = '';

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

$class = substr($value, 0, strrpos($value, '.'));

if ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) {

$use_credit_string = $GLOBALS[$class]->use_credit_amount();

// if ($selection_string =='') $selection_string = $GLOBALS[$class]->credit_selection();

$selection_string = $GLOBALS[$class]->credit_selection();

if ( ($use_credit_string !='' ) || ($selection_string != '') ) {

$output_string .= '<tr><td colspan="4">' . tep_draw_separator('pixel_trans.gif', '100%', '10') . '</td></tr>' . "\n";

$output_string .= ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" >' . "\n" .

' <td class="main"><b>' . $GLOBALS[$class]->title . '</b></td>' . "\n" . $use_credit_string;

$output_string .= ' </tr>' . "\n";

$output_string .= $selection_string;

}

 

}

}

if ($output_string != '') {

$return_string = $header_string . $output_string . $close_string;

} else {

$return_string = '';

}

}

return $return_string;

}

 

 

// if ($selection_string !='') {

// $output_string .= '</td>' . "\n";

// $output_string .= $selection_string;

// }

 

 

 

 

// update_credit_account is called in checkout process on a per product basis. It's purpose

// is to decide whether each product in the cart should add something to a credit account.

// e.g. for the Gift Voucher it checks whether the product is a Gift voucher and then adds the amount

// to the Gift Voucher account.

// Another use would be to check if the product would give reward points and add these to the points/reward account.

//

function update_credit_account($i) {

if (MODULE_ORDER_TOTAL_INSTALLED) {

reset($this->modules);

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

$class = substr($value, 0, strrpos($value, '.'));

if ( ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) ) {

$GLOBALS[$class]->update_credit_account($i);

}

}

}

}

// This function is called in checkout confirmation.

// It's main use is for credit classes that use the credit_selection() method. This is usually for

// entering redeem codes(Gift Vouchers/Discount Coupons). This function is used to validate these codes.

// If they are valid then the necessary actions are taken, if not valid we are returned to checkout payment

// with an error

//

function collect_posts() {

global $HTTP_POST_VARS,$HTTP_SESSION_VARS;

if (MODULE_ORDER_TOTAL_INSTALLED) {

reset($this->modules);

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

$class = substr($value, 0, strrpos($value, '.'));

if ( ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) ) {

$post_var = 'c' . $GLOBALS[$class]->code;

if ($HTTP_POST_VARS[$post_var]) {

if (!tep_session_is_registered($post_var)) tep_session_register($post_var);

$post_var = $HTTP_POST_VARS[$post_var];

}

$GLOBALS[$class]->collect_posts();

}

}

}

}

// pre_confirmation_check is called on checkout confirmation. It's function is to decide whether the

// credits available are greater than the order total. If they are then a variable (credit_covers) is set to

// true. This is used to bypass the payment method. In other words if the Gift Voucher is more than the order

// total, we don't want to go to paypal etc.

//

function pre_confirmation_check() {

global $payment, $order, $credit_covers;

if (MODULE_ORDER_TOTAL_INSTALLED) {

$total_deductions = 0;

reset($this->modules);

$order_total = $order->info['total'];

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

$class = substr($value, 0, strrpos($value, '.'));

$order_total = $this->get_order_total_main($class,$order_total);

if ( ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) ) {

$total_deductions = $total_deductions + $GLOBALS[$class]->pre_confirmation_check($order_total);

$order_total = $order_total - $GLOBALS[$class]->pre_confirmation_check($order_total);

}

}

if ($order->info['total'] - $total_deductions <= 0 ) {

if(!tep_session_is_registered('credit_covers')) tep_session_register('credit_covers');

$credit_covers = true;

}

else{ // belts and suspenders to get rid of credit_covers variable if it gets set once and they put something else in the cart

if(tep_session_is_registered('credit_covers')) tep_session_unregister('credit_covers');

}

}

}

// this function is called in checkout process. it tests whether a decision was made at checkout payment to use

// the credit amount be applied aginst the order. If so some action is taken. E.g. for a Gift voucher the account

// is reduced the order total amount.

//

function apply_credit() {

if (MODULE_ORDER_TOTAL_INSTALLED) {

reset($this->modules);

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

$class = substr($value, 0, strrpos($value, '.'));

if ( ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) ) {

$GLOBALS[$class]->apply_credit();

}

}

}

}

// Called in checkout process to clear session variables created by each credit class module.

//

function clear_posts() {

global $HTTP_POST_VARS,$HTTP_SESSION_VARS;

if (MODULE_ORDER_TOTAL_INSTALLED) {

reset($this->modules);

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

$class = substr($value, 0, strrpos($value, '.'));

if ( ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) ) {

$post_var = 'c' . $GLOBALS[$class]->code;

if (tep_session_is_registered($post_var)) tep_session_unregister($post_var);

}

}

}

}

// Called at various times. This function calulates the total value of the order that the

// credit will be appled aginst. This varies depending on whether the credit class applies

// to shipping & tax

//

function get_order_total_main($class, $order_total) {

global $credit, $order;

// if ($GLOBALS[$class]->include_tax == 'false') $order_total=$order_total-$order->info['tax'];

// if ($GLOBALS[$class]->include_shipping == 'false') $order_total=$order_total-$order->info['shipping_cost'];

return $order_total;

}

// ICW ORDER TOTAL CREDIT CLASS/GV SYSTEM - END ADDITION

}

?>

Share this post


Link to post
Share on other sites
My Quantity Discounts contribution permits you to offer discounts that are structured many different ways:

 

* By total number of items purchased

* By number of items purchased, counting per item

* By number of items purchased, counting per category

* Counting by items or by number of dollars spent, in any of the ways above

* Specifying the discount as a percentage, a flat dollar figure or dollars per item

 

The contribution is here:

http://addons.oscommerce.com/info/6751

 

 

 

Is it possible to discount different items.. example...

 

just to add to the explination, the site is going to be selling bumper stickers(yes most are pretty funny)

 

each sticker has a different saying If someone buys 1 my price is $3 however if someone buys 3 I need to discount it to $5... (but obviously no one is going to buy 3 of the same kind their goin to pick 3 different saying... I hope I explained that right...

 

Thanks

 

Rob

 

 

Thanks Rob

Share this post


Link to post
Share on other sites

Yes, there are many ways to "count" (by item, category or total number of items in the cart). Download it and read the documentation and you'll see.

Share this post


Link to post
Share on other sites
Yes, there are many ways to "count" (by item, category or total number of items in the cart). Download it and read the documentation and you'll see.

 

 

I appriciate your response and yes I should have downloaded it before asking for support however I've downloaded about 6 different cart software in the past week trying to find something with support so I figured it good to ask first this time...

 

I'll be better able to upload it when I get home from work and Ill check it out. Appriciate the contribution...

 

 

Rob Slippey

Share this post


Link to post
Share on other sites
I appriciate your response and yes I should have downloaded it before asking for support however I've downloaded about 6 different cart software in the past week trying to find something with support so I figured it good to ask first this time...

 

I'll be better able to upload it when I get home from work and Ill check it out. Appriciate the contribution...

 

 

Rob Slippey

 

 

quick question.. just checked out your instructions here... am I to copy the entire folder or catlog by it self and is to be pasted in what directory?

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