Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Easy Discount


boxtel

Recommended Posts

I finally revisted this contrib and THINK i fixed the order total problem. This change to the sphagetti patch fixes the order total pretty much the same way it fixed the tax total. Let me know if this works for you guys. If not hopefull it can be a starting point.

 

in catalog/includes/modules/order total/ot_easy_discount.php

 

1. if you applied the sphaghetti patch:

REPLACE:

// tax adjustment calculation to include discount

if ($order->info['tax'] > 0) {

// discount percentage as in discount divided by subtotal

$discount_percentage = $od_amount/$order->info['subtotal'];

// current tax * discount percentage

$tod_amount = $order->info['tax']*$discount_percentage;

// substract from current tax value

$order->info['tax'] = $order->info['tax'] - $tod_amount;

reset($order->info['tax_groups']);

while (list($key, $value) = each($order->info['tax_groups'])) {

// current tax group value * discount percentage

$god_amount = $value*$discount_percentage;

// substract from current tax group value

$order->info['tax_groups'][$key] = $order->info['tax_groups'][$key] - $god_amount;

}

}

// end tax calc

 

WITH:

 

// tax adjustment calculation to include discount

if ($order->info['tax'] > 0) {

// discount percentage as in discount divided by subtotal

$discount_percentage = $od_amount/$order->info['subtotal'];

// current tax * discount percentage

$tod_amount = $order->info['tax']*$discount_percentage;

// substract from current tax value

$order->info['tax'] = $order->info['tax'] - $tod_amount;

reset($order->info['tax_groups']);

while (list($key, $value) = each($order->info['tax_groups'])) {

// current tax group value * discount percentage

$god_amount = $value*$discount_percentage;

// substract from current tax group value

$order->info['tax_groups'][$key] = $order->info['tax_groups'][$key] - $god_amount;

}

// reset total amount

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

}

// end tax calc

2. If no sphaghetti patch was installed :

AFTER:

$this->deduction = $od_amount;

 

ADD:

 

// tax adjustment calculation to include discount

if ($order->info['tax'] > 0) {

// discount percentage as in discount divided by subtotal

$discount_percentage = $od_amount/$order->info['subtotal'];

// current tax * discount percentage

$tod_amount = $order->info['tax']*$discount_percentage;

// substract from current tax value

$order->info['tax'] = $order->info['tax'] - $tod_amount;

reset($order->info['tax_groups']);

while (list($key, $value) = each($order->info['tax_groups'])) {

// current tax group value * discount percentage

$god_amount = $value*$discount_percentage;

// substract from current tax group value

$order->info['tax_groups'][$key] = $order->info['tax_groups'][$key] - $god_amount;

}

// reset total amount

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

}

// end tax calc

 

The above appears to work great!

 

Thank you very much.

Link to comment
Share on other sites

  • 2 weeks later...

Please help. I have searched this thread but did not find a specific answer. In a similar earlier post with the same type of error, noone posted a response in the thread.

 

I have installed easy discount on 2.2 RC1 a have a little problem with checkout using the built in PayPal IPN. The checkout itself works fine but after payment is made on the PayPal site and the process returns to my site (https://my site name/my store name/checkout_process.php) I get a blank page with the message:

 

Fatal error: Call to a member function on a non-object in /home/..../public_html/..../includes/modules/payment/paypal_ipn.php on line 571

 

Line 571 of paypal_ipn.php is in the section that unregisters session variables used during checkout.

code:

// start easy discount change

$easy_discount->reset();

// end

 

I have been fighting this for days. Any help greatly appreciated.

 

Dave

albenitrader

Link to comment
Share on other sites

Please help. I have searched this thread but did not find a specific answer. In a similar earlier post with the same type of error, noone posted a response in the thread.

 

I have installed easy discount on 2.2 RC1 a have a little problem with checkout using the built in PayPal IPN. The checkout itself works fine but after payment is made on the PayPal site and the process returns to my site (https://my site name/my store name/checkout_process.php) I get a blank page with the message:

 

Fatal error: Call to a member function on a non-object in /home/..../public_html/..../includes/modules/payment/paypal_ipn.php on line 571

 

Line 571 of paypal_ipn.php is in the section that unregisters session variables used during checkout.

code:

// start easy discount change

$easy_discount->reset();

// end

 

I have been fighting this for days. Any help greatly appreciated.

 

Dave

albenitrader

 

Unfortunately, I do not know anything about the PayPal IPN but it does seem that the original contributor has abandoned both this thread and the Easy Coupons thread - which is a shame because they are both great contribs. - which I finally got working delightfully, to my satisfaction after a lot of head scratching and sleepless nights!

* * * * * * * * * * * * * * * * * * * * *

Porpoises are most happy when wet!

\ _ \ _ \ _ \ _ \ _ \ _ \ _ \ _ \ _ \ _ \ _ \ _

Link to comment
Share on other sites

  • 4 weeks later...
Forgot to say:

all this code should be placed at the end of application_top.php.

 

Also if you want to use category with all subcategories use this:

$top_category_id=10;
$result=tep_db_query("select categories_id from " . TABLE_CATEGORIES." where parent_id='".$top_category_id."'");
while ($cat = tep_db_fetch_array($result))	 $categories_list[]=$cat['categories_id'];-

 

instead of:

$categories_list=array('3', '4', '10');

Is there ANY way that selecting discounts / category could be done in admin panel and NOT by hardcoding them?

 

Example: have a tree menu with all categories/subcategories (already expanded) and a checkbox near each cat/subcat name.

Below have a dropdown list (or radio buttons) with type of discount (by quantity/by total value) and another dropdown list with discount method (fix value, percent) and maybe an input textbox for threshold needed to apply discount.

You get the idea... maybe is not the most ergonomic solution.

 

When you need to apply discount/category(ies) you simply tick checkboxes for cat/subcat name, then select all appropriate type/method/threshold and click a button "Apply". Used categories/subcategories checkboxes should go gray (disabled) after submission then you can select another discount.

 

Anyone?

Link to comment
Share on other sites

  • 2 weeks later...
Hello Everyone,

 

I need your help about this contrib, i want to give 10% discount for new customers.

And the discount will be applied for first month only. How i use this contrib for this case?

 

Thank You

John

I believe this (or similar) was asked somewhere in the first 10 pages of this forum).

Link to comment
Share on other sites

  • 2 weeks later...

I'm looking for help on where to install the install files for Easy Discount. It states in the install.txt "add the files to their respective directory and install the module in admin modules -> order totals". I get the first part but where is admin modules -> order totals? When i go to shop -> admin -> modules all I see is a newsletter folder with files in it. Shop -> includes -> modules does have an order_total folder. Is this the spot to put ot_easy_discount.php. I appreciate any help. Thank you.

Link to comment
Share on other sites

I'm looking for help on where to install the install files for Easy Discount. It states in the install.txt "add the files to their respective directory and install the module in admin modules -> order totals". I get the first part but where is admin modules -> order totals? When i go to shop -> admin -> modules all I see is a newsletter folder with files in it. Shop -> includes -> modules does have an order_total folder. Is this the spot to put ot_easy_discount.php. I appreciate any help. Thank you.

These refer not to folders but menu options from your admin panel.

Link to comment
Share on other sites

  • 2 months later...

Hi

 

Can I get this contridution so my coustomers can:

 

pick and mix 100 of any products in a Categorie and get the lowest prices?

 

IE

 

product a order 42

product b order 26

product c order 32

 

and as the total items add up to 100 then prices our £x.oo or 20% off (price £y.oo is the higher)

 

each product has a price for qty 100 mix

and a each price

 

can this be done?

Link to comment
Share on other sites

This is way too good of a contribution for it to die....

 

Here's a recent change I made to my site for discounts. I was giving discounts based on quantity of items that were ordered (since April 2006), but I added low priced items (accessories), so that type of discounting wouldn't work, as customers added low price and low margin items and got discounts they shouldn't have qualified.

 

This is the old code, discounts based on # of items in shopping cart:

 

$easy_discount->reset();
if ($cart->count_contents() > 0) { // cart contents
$cart_total = $cart->show_total();
if ($cart->count_contents() > 9) $easy_discount->set('BK1','Bulk Discount -10%',$cart_total*0.10); // 5% of cart total
if ($cart->count_contents() > 14) $easy_discount->set('BK1','Bulk Discount -15%',$cart_total*0.15); // 6% of cart total
if ($cart->count_contents() > 29) $easy_discount->set('BK1','Bulk Discount -20%',$cart_total*0.20); // 7% of cart total
} else{
$easy_discount->clear('BK1'); // remove discount if present and cart gets empty
}

 

I have since changed it to give discounts based on total $$ value of items in cart, so if they want to add 350 items of $1 cost to get a discount... go for it:

 

$easy_discount->reset();
if ($cart->count_contents() > 0) { // cart contents
$cart_total = $cart->show_total();
if ($cart->show_total() > 350) $easy_discount->set('BK1','Bulk Discount -10%',$cart_total*0.10); // 10% of cart total
if ($cart->show_total() > 500) $easy_discount->set('BK1','Bulk Discount -15%',$cart_total*0.15); // 15% of cart total
if ($cart->show_total() > 800) $easy_discount->set('BK1','Bulk Discount -20%',$cart_total*0.20); // 20% of cart total
} else{
$easy_discount->clear('BK1'); // remove discount if present and cart gets empty
}

 

The numbers after the greater than is the $$ amount (> 350, >500, etc.)

 

So flexible. You need to know a bit of coding, but man... nice.

 

Thanks Boxtel.

 

Others should share their coding for those that don't know how to code, can at least use what is out there and tweak....

Link to comment
Share on other sites

Hi!

This is really GREAT contrib! Thanks!

Only this contrib was solved my problem.

I want to share with you this solution.

 

Problem:

We have products in different categories. For example in cat1 and cat1.

 

Products in cat1 have a discount depended from amount.

(For example(amount/percentage): 300:10,1000:15, ... 4500:50)

 

Products in cat2 have a DIFFERENT discount depended from amount.

(For example(amount/percentage): 700:10,1500:15,3000:20,7000:25,9000:30,12000:35,15000:40,20000:45,25000:50)

Solution:

//Vlad b EZ discount
//Discount for given category:
//Id's of categories which has a products with discount
//$categories_list=array('25', '24');
$categories_list=array('3', '4', '10');
if (count($categories_list)>0) {
$query="select products_id, categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . "
				where categories_id='".$categories_list[0]."'";
for( $it=1;$it<count($categories_list);$it++)	 $query.=" OR categories_id='".$categories_list[$it]."'";

$result=tep_db_query($query);
$total4discount_prod=0;
$products_in_cart=$cart->get_products();

//Make an array with products id's from specials categories:
while ($pr2cat = tep_db_fetch_array($result))	 $discount_products_list[]=$pr2cat['products_id'];
//var_dump($discount_products_list);
foreach ($products_in_cart as $cart_item) {
	if (in_array($cart_item['id'], $discount_products_list)) {
		$total4discount_prod+=$cart_item['price']*$cart_item['quantity'];
	} else	$total4discount_prod2+=$cart_item['price']*$cart_item['quantity'];
	//=========================================================
	//Calculate discount1:
	if ($total4discount_prod<300)   $discount_percent=0;
	elseif ($total4discount_prod<1000)   $discount_percent=10;
	elseif ($total4discount_prod<1500)   $discount_percent=15;
	elseif ($total4discount_prod<2000)   $discount_percent=20;
	elseif ($total4discount_prod<2500)   $discount_percent=25;
	elseif ($total4discount_prod<3000)   $discount_percent=30;
	elseif ($total4discount_prod<3500)   $discount_percent=35;
	elseif ($total4discount_prod<4000)   $discount_percent=40;
	elseif ($total4discount_prod<4500)   $discount_percent=45;
	else $discount_percent=50;
	//Calculate discount for total price of selected products:
	$easy_discount->set('D4M', '<abbr title="'.DISCOUNT_FOR_MAGAZINES_TEXT.'">-' . $discount_percent . '%</abbr>', (($total4discount_prod*$discount_percent)/100) );
	//=========================================================
	//Calculate discount2:
	if ($total4discount_prod2>=700)   $discount_percent=10;
	elseif ($total4discount_prod2>=1500)   $discount_percent=15;
	elseif ($total4discount_prod2>=3000)   $discount_percent=20;
	elseif ($total4discount_prod2>=7000)   $discount_percent=25;
	elseif ($total4discount_prod2>=9000)   $discount_percent=30;
	elseif ($total4discount_prod2>=12000)   $discount_percent=35;
	elseif ($total4discount_prod2>=15000)   $discount_percent=40;
	elseif ($total4discount_prod2>=20000)   $discount_percent=45;
	elseif ($total4discount_prod2>=25000)   $discount_percent=50;
	else $discount_percent=0;
	//Calculate discount for total price of selected products:
	$easy_discount->set('D4E', '<abbr title="'.DISCOUNT_FOR_EDITIONS_TEXT.'">-' . $discount_percent . '%</abbr>', (($total4discount_prod2*$discount_percent)/100) );
}
}
//Vlad e EZ discount

 

God bless you.

 

can i use the code above in the Easy Discount contribution? I would like to give discount to a customer who buys 5 or more items within the same product category (can be a mix of different products but must be within the same product category). And a higher discount if a customer buys more than 10 items.

 

please advise.

 

thanks.

Link to comment
Share on other sites

can i use the code above in the Easy Discount contribution? I would like to give discount to a customer who buys 5 or more items within the same product category (can be a mix of different products but must be within the same product category). And a higher discount if a customer buys more than 10 items.

 

please advise.

 

thanks.

you can use a variation of the above... but the above coding is based on $$ value, not quantity of items within a category.

Link to comment
Share on other sites

you can use a variation of the above... but the above coding is based on $$ value, not quantity of items within a category.

 

hi,

 

i got this error message on the webpage "Warning: in_array() [function.in-array]: Wrong datatype for second argument" for catalog\includes\application_top.php on line 293.

 

here's the contents of my application_top.php from line 262 to 311 is:

 

// include currencies class and create an instance
 require(DIR_WS_CLASSES . 'currencies.php');
 $currencies = new currencies();

if (!tep_session_is_registered('easy_discount')) {
 tep_session_register('easy_discount');
 $easy_discount = new easy_discount();
}

//Vlad b EZ discount
//Discount for given category:
//Id's of categories which has a products with discount
//$categories_list=array('25', '24');
$categories_list=array('3', '4', '10');
if (count($categories_list)>0) {
   $query="select products_id, categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . "
                   where categories_id='".$categories_list[0]."'";
   for( $it=1;$it<count($categories_list);$it++)     $query.=" OR 

categories_id='".$categories_list[$it]."'";

   $result=tep_db_query($query);
   $total4discount_prod=0;
   $products_in_cart=$cart->get_products();

   //Make an array with products id's from specials categories:
   while ($pr2cat = tep_db_fetch_array($result))     

$discount_products_list[]=$pr2cat['products_id'];
   //var_dump($discount_products_list);
   foreach ($products_in_cart as $cart_item) {
       [color="#FF0000"]if (in_array($cart_item['id'], $discount_products_list)) {[/color]
           $total4discount_prod+=$cart_item['price']*$cart_item['quantity'];
       } else    $total4discount_prod2+=$cart_item['price']*$cart_item['quantity'];
       //=========================================================
       //Calculate discount1:
       if ($total4discount_prod<40)   $discount_percent=0;
       elseif ($total4discount_prod<200)   $discount_percent=10;
       else $discount_percent=20;
       //Calculate discount for total price of selected products:
       $easy_discount->set('D4BH', '<abbr title="'.DISCOUNT_FOR_BAGHOOKS_TEXT.'">-' . 

$discount_percent . '%</abbr>', (($total4discount_prod*$discount_percent)/100) );
       }
}
//Vlad e EZ discount

// include the mail classes
 require(DIR_WS_CLASSES . 'mime.php');
 require(DIR_WS_CLASSES . 'email.php');

 

Line 293 where the error is in red colour in the codebox.

 

please advise what I can do about the error?

 

thanks.

Link to comment
Share on other sites

  • 4 weeks later...

Have just installed ED, but a problem which highlights my lack of understanding!

 

Shopping Cart page is producing the correct output, but nothing is shown on checkout_shipping or checkout_confirmation. Reading the forum, I see no references to repeating the code.

 

Help.

 

PS FEC and STS installed.

Link to comment
Share on other sites

Have just installed ED, but a problem which highlights my lack of understanding!

 

Shopping Cart page is producing the correct output, but nothing is shown on checkout_shipping or checkout_confirmation. Reading the forum, I see no references to repeating the code.

 

Help.

 

PS FEC and STS installed.

 

OK, understanding has improved!

 

Fixed it. Great contribution. Thank you.

Link to comment
Share on other sites

  • 2 weeks later...

Hello everyone

 

Thanks for the really GREAT contrib.

 

I have installed the contreb now when i enter my website it shows me this message:

 

Fatal error: Cannot redeclare class easy_discount in /hsphere/local/home/ebug/bugs.com/includes/classes/easy_discount.php on line 2

 

its gone when i comment the this line in application_top.php

// include easy discount products class

require(DIR_WS_CLASSES . 'easy_discount.php');

 

I spend more then 20 hours trying to figure out the the problem but with no luck

 

can you guys help me please

 

thanks

Edited by Liquid Snake
Link to comment
Share on other sites

I can't get this to install.

 

I get to this step:

 

after:

 

 

 

// include currencies class and create an instance

 

require(DIR_WS_CLASSES . 'currencies.php');

 

$currencies = new currencies();

 

 

 

add:

 

 

 

if (!tep_session_is_registered('easy_discount')) {

 

tep_session_register('easy_discount');

 

$easy_discount = new easy_discount();

 

}

 

but the problem is, the code I'm supposed to add the new code doesn't exist in my file. Please don't tell me I have to install a different version of osCommerce to make this thing run...

Link to comment
Share on other sites

Many thanks for this great contribution. I have searched the forums and contributions and it seems that Easy Discount could meet my requirements but I would like your opinion.

 

I want the user to receive a discount when they purchase 4 or more different products from a range of products all of equal value. e.g.

 

All Products in a range cost $10 each

User adds products A, B, C and D to their cart which totals $40

User receives $10 discount

 

I implemented the get_1_free contribution but it only applies to a specific product and not a range e.g. User buys 3 of Product A and receives another Product free.

 

Is Easy Discount my solution or is there another contribution that is more suited?

Link to comment
Share on other sites

can you attach your application_top.php maybe i can help

 

Thank you so much for taking a look... here it is:

 

<?php

/*

$Id: application_top.php,v 1.162 2003/07/12 09:39:03 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

// Start the clock for the page parse time log

define('PAGE_PARSE_START_TIME', microtime());

 

// Set the level of error reporting

error_reporting(E_ALL & ~E_NOTICE);

 

// Check if register_globals is enabled.

// Since this is a temporary measure this message is hardcoded. The requirement will be removed before 2.2 is finalized.

if (function_exists('ini_get')) {

ini_get('register_globals') or exit('Server Requirement Error: register_globals is disabled in your PHP configuration. This can be enabled in your php.ini configuration file or in the .htaccess file in your catalog directory.');

}

 

// Set the local configuration parameters - mainly for developers

if (file_exists('includes/local/configure.php')) include('includes/local/configure.php');

 

// Include application configuration parameters

require('includes/configure.php');

 

// Define the project version

define('PROJECT_VERSION', 'osCommerce 2.2-MS2');

 

// set php_self in the local scope

$PHP_SELF = (isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME']);

 

// Used in the "Backup Manager" to compress backups

define('LOCAL_EXE_GZIP', '/usr/bin/gzip');

define('LOCAL_EXE_GUNZIP', '/usr/bin/gunzip');

define('LOCAL_EXE_ZIP', '/usr/local/bin/zip');

define('LOCAL_EXE_UNZIP', '/usr/local/bin/unzip');

 

// include the list of project filenames

require(DIR_WS_INCLUDES . 'filenames.php');

 

// include the list of project database tables

require(DIR_WS_INCLUDES . 'database_tables.php');

 

// customization for the design layout

define('BOX_WIDTH', 125); // how wide the boxes should be in pixels (default: 125)

 

// Define how do we update currency exchange rates

// Possible values are 'oanda' 'xe' or ''

define('CURRENCY_SERVER_PRIMARY', 'oanda');

define('CURRENCY_SERVER_BACKUP', 'xe');

 

// include the database functions

require(DIR_WS_FUNCTIONS . 'database.php');

 

// make a connection to the database... now

tep_db_connect() or die('Unable to connect to database server!');

 

// set application wide parameters

$configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);

while ($configuration = tep_db_fetch_array($configuration_query)) {

define($configuration['cfgKey'], $configuration['cfgValue']);

}

 

// define our general functions used application-wide

require(DIR_WS_FUNCTIONS . 'general.php');

require(DIR_WS_FUNCTIONS . 'html_output.php');

 

// initialize the logger class

require(DIR_WS_CLASSES . 'logger.php');

 

// include shopping cart class

require(DIR_WS_CLASSES . 'shopping_cart.php');

 

// include easy discount products class

 

require(DIR_WS_CLASSES . 'easy_discount.php');

 

// some code to solve compatibility issues

require(DIR_WS_FUNCTIONS . 'compatibility.php');

 

// check to see if php implemented session management functions - if not, include php3/php4 compatible session class

if (!function_exists('session_start')) {

define('PHP_SESSION_NAME', 'osCAdminID');

define('PHP_SESSION_PATH', '/');

define('PHP_SESSION_SAVE_PATH', SESSION_WRITE_DIRECTORY);

 

include(DIR_WS_CLASSES . 'sessions.php');

}

 

// define how the session functions will be used

require(DIR_WS_FUNCTIONS . 'sessions.php');

 

// set the session name and save path

tep_session_name('osCAdminID');

tep_session_save_path(SESSION_WRITE_DIRECTORY);

 

// set the session cookie parameters

if (function_exists('session_set_cookie_params')) {

session_set_cookie_params(0, DIR_WS_ADMIN);

} elseif (function_exists('ini_set')) {

ini_set('session.cookie_lifetime', '0');

ini_set('session.cookie_path', DIR_WS_ADMIN);

}

 

// lets start our session

tep_session_start();

 

// set the language

if (!tep_session_is_registered('language') || isset($HTTP_GET_VARS['language'])) {

if (!tep_session_is_registered('language')) {

tep_session_register('language');

tep_session_register('languages_id');

}

 

include(DIR_WS_CLASSES . 'language.php');

$lng = new language();

 

if (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) {

$lng->set_language($HTTP_GET_VARS['language']);

} else {

$lng->get_browser_language();

}

 

$language = $lng->language['directory'];

$languages_id = $lng->language['id'];

}

 

// include the language translations

require(DIR_WS_LANGUAGES . $language . '.php');

$current_page = basename($PHP_SELF);

if (file_exists(DIR_WS_LANGUAGES . $language . '/' . $current_page)) {

include(DIR_WS_LANGUAGES . $language . '/' . $current_page);

}

 

// define our localization functions

require(DIR_WS_FUNCTIONS . 'localization.php');

 

// Include validation functions (right now only email address)

require(DIR_WS_FUNCTIONS . 'validations.php');

 

// setup our boxes

require(DIR_WS_CLASSES . 'table_block.php');

require(DIR_WS_CLASSES . 'box.php');

 

// initialize the message stack for output messages

require(DIR_WS_CLASSES . 'message_stack.php');

$messageStack = new messageStack;

 

// split-page-results

require(DIR_WS_CLASSES . 'split_page_results.php');

 

// entry/item info classes

require(DIR_WS_CLASSES . 'object_info.php');

 

// email classes

require(DIR_WS_CLASSES . 'mime.php');

require(DIR_WS_CLASSES . 'email.php');

 

// file uploading class

require(DIR_WS_CLASSES . 'upload.php');

 

// calculate category path

if (isset($HTTP_GET_VARS['cPath'])) {

$cPath = $HTTP_GET_VARS['cPath'];

} else {

$cPath = '';

}

 

if (tep_not_null($cPath)) {

$cPath_array = tep_parse_category_path($cPath);

$cPath = implode('_', $cPath_array);

$current_category_id = $cPath_array[(sizeof($cPath_array)-1)];

} else {

$current_category_id = 0;

}

 

// default open navigation box

if (!tep_session_is_registered('selected_box')) {

tep_session_register('selected_box');

$selected_box = 'configuration';

}

 

if (isset($HTTP_GET_VARS['selected_box'])) {

$selected_box = $HTTP_GET_VARS['selected_box'];

}

 

// the following cache blocks are used in the Tools->Cache section

// ('language' in the filename is automatically replaced by available languages)

$cache_blocks = array(array('title' => TEXT_CACHE_CATEGORIES, 'code' => 'categories', 'file' => 'categories_box-language.cache', 'multiple' => true),

array('title' => TEXT_CACHE_MANUFACTURERS, 'code' => 'manufacturers', 'file' => 'manufacturers_box-language.cache', 'multiple' => true),

array('title' => TEXT_CACHE_ALSO_PURCHASED, 'code' => 'also_purchased', 'file' => 'also_purchased-language.cache', 'multiple' => true)

);

 

// check if a default currency is set

if (!defined('DEFAULT_CURRENCY')) {

$messageStack->add(ERROR_NO_DEFAULT_CURRENCY_DEFINED, 'error');

}

 

// check if a default language is set

if (!defined('DEFAULT_LANGUAGE')) {

$messageStack->add(ERROR_NO_DEFAULT_LANGUAGE_DEFINED, 'error');

}

 

if (function_exists('ini_get') && ((bool)ini_get('file_uploads') == false) ) {

$messageStack->add(WARNING_FILE_UPLOADS_DISABLED, 'warning');

}

?>

Link to comment
Share on other sites

this one you have attached is under admin which is the wrong one.

 

The one that need to modify is under catalog/includes/application_top.php

 

Thanks so much - I started this a few weeks ago, then switched to other projects, and just came back - now I see I had it already correctly installed and just had to add the discounts. Too busy lately - thanks for answering my dumb question.

Link to comment
Share on other sites

Hello,

 

I have a need the Easy Discount appears to be able to fill. Rather than applying an arbitrary discount at anytime, I want to apply an arbitrary surcharge or service fee at any time.

 

Note that this is normal easy discount behavior:

$easy_discount->set('TCKT','service fee',2);

 

This applies a $2 dollar discount successfully.

 

But this also "mostly" works:

$easy_discount->set('TCKT','service fee',-2);

 

This applies a negative $2 discount.

 

I would use it just like this, but this value is displayed in red and with a negative sign on the page, and I haven't found where this formatting is stored yet.

 

Anyway .. two questions.

 

Anyone else using this module like this?

Can someone tell me where I might change or correct formatting?

 

I had considered modifying this so it performs the other direction and posting a contrib, but I don't see many other posts where someone needs something like this (mostly this kind of need relates to shipping or complicated ordering) and I wanted to run it by the author first in case this was something he had already considered.

 

Many thanks !!

 

Dustin

Link to comment
Share on other sites

  • 1 month later...

Hello,

 

I hope someone can help. I think I've read this whole thread and can't find an answer. I'm using osCommerce Online Merchant v2.2 RC1.

 

I have Easy Discount more or less working as needed, just doing a simple multi-tier discount based on the number of items in the cart. But the discount doesn't show up during the checkout process. Do I need to modify those pages to display the discount also, like I did with the others? However, will this cause the discounted total to actually be passed along to the PayPal gateway?

 

I'm not new to programming, but I am new to php and mysql, so if anyone can help, my way of learning is if I can understand how things work and why, then I get it. Simply saying "paste this code after that code" and so on, won't so well, since I am totally new to php.

 

Anyhow, I guess I could rephrase it this way: Does the Easy Discount module change anything in the database (I'm assuming that's where the order info is kept). Or does the discount go away every time there is a new page displayed, or every time the cart contents and total are displayed? I know some of this has been covered before, but after working 12 hours a day, there's not much left of me to work on this.

 

And of course, I'd like to find out why the discount is not reflected in the checkout or final order total.

 

Thank you one and all

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...