Jump to content
boxtel

Easy Discount

Recommended Posts

While waiting for any replies, I started reading through the thread again, and I found the answer where I missed it previously. Anyhow, here it is.

 

If your php files are properly modified according to the instructions (application_top.php, shopping_cart.php, etc.) and your Easy Discount order total module is installed and activated, and the discount still isn't showing up in the checkout or order confirmation screens, then check the sort order of the order total modules. If Easy Discount shares the same sort order number as another module, then it won't work - it won't pass the discount into the database and along to the checkout process. You'll need to renumber all of the modules' sort order numbers so each module has its own unique number, according to the order you want them to be processed during checkout.

 

It works for me so far. I am only using the PayPal IPN sandbox gateway, but I assume their live gateway will work the same.

Share this post


Link to post
Share on other sites

i have two items which i want to be discounted $10 if bought together at the moment i have:

 

<?php

//offer

include_once(DIR_WS_FUNCTIONS.'easy_discount.php');

$easy_discount->reset();

if ($cart->count_contents() >= 2)

{

if($products_id == 13)

{

$easy_discount->add('myoffer','$10 Off',10);

}

}

else

{

$easy_discount->remove_type('myoffer');

}

?>

 

But i dont want it just for $products_id of 13,,,it needs to only execute

$easy_discount->add('myoffer','$10 Off',10);

if BOTH product id 13 and 17 are in the basket, if BOTH are not in the basket then it should not offer the discount, how do i do this?

Share this post


Link to post
Share on other sites

Hi @all,

 

first of all - everything works perfectly :-)

 

I´ve used that code in login.php and shopping_cart.php

 


//firsttime user
if ($check_prevord[0] < 1) {
$first_time_customer = true;
} else {
$first_time_customer = false;
}
tep_session_register('first_time_customer');


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


//erste Bestellung
if($first_time_customer)
{
if ($cart->count_contents() > 0) {
$easy_discount->add('NEW','10% Off New Customer',$cart->show_total()*0.10);
} else {
$easy_discount->remove_type('NEW');
}
}

 

My question now is if it is possible to give the discount to the net price (price without tax)?

 

Thanks a lot and regards from Germany

Gerd

Edited by chefsache

Regards

Gerd

Share this post


Link to post
Share on other sites

Hi...

 

not everything is perfectly... :rolleyes:

 

In login.php i set as follows:

 

 $error = false;
 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process')) {
   $email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']);
   $password = tep_db_prepare_input($HTTP_POST_VARS['password']);


//firsttime user
if ($check_prevord[0] < 1) {
$first_time_customer = true;
} else {
$first_time_customer = false;
}
tep_session_register('first_time_customer');



// Check if email exists
   $check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
   if (!tep_db_num_rows($check_customer_query)) {

 

and in shopping_cart.php

 

 $any_out_of_stock = 0;
   $products = $cart->get_products();


//first order
if($first_time_customer)
{
if ($check_prevord[0] < 1) {
$easy_discount->set('CQTY','5,00 Euro Eröffnungrabatt',5);
} else {
$easy_discount->remove_type('CQTY');
}
}


   for ($i=0, $n=sizeof($products); $i<$n; $i++) {

 

The problem is, that the customer get the discount everytime, also when he is logged out and came back....

 

Where is the mistake, could you help me please?

 

Regards

Gerd


Regards

Gerd

Share this post


Link to post
Share on other sites

SOLUTION to those who want to use the normal free shipping together with easy discount, but has run into the problem that free shipping does not take the discount into account.

 

in freeamount.php

Change

// class methods
function quote($method = '') {
  global $order, $cart, $shipping_weight;

  $dest_country = $order->delivery['country']['id'];
  $currency = $order->info['currency'];
  $get_total = false;
  $get_weight = false;
  $cart_total = $cart->show_total();

	if (MODULE_SHIPPING_FREEAMOUNT_HIDE_SPECIALS == 'True') {
	  // 28-9-2005 Check for articles on special which should not get free shipment
	  // Adjust the cart total price for this
	  $total_specials = 0;
	  if ($cart->count_contents() > 0) {
		 $products = $cart->get_products();
		 for ($i=0, $n=sizeof($products); $i<$n; $i++) {
			if ($special_price = tep_get_products_special_price($products[$i]['id'])) {
			   $products_price = $special_price;
			   $total_specials += $products_price;
			}
		 }
	  }

	  $cart_total = $cart_total - $total_specials;
	}

  if ($cart_total < MODULE_SHIPPING_FREEAMOUNT_AMOUNT)

to

// class methods
function quote($method = '') {
  global $order, $cart, $shipping_weight, $easy_discount;

  $dest_country = $order->delivery['country']['id'];
  $currency = $order->info['currency'];
  $get_total = false;
  $get_weight = false;
  $cart_total = $cart->show_total();
  $easy_discount_total = $easy_discount->total();

	if (MODULE_SHIPPING_FREEAMOUNT_HIDE_SPECIALS == 'True') {
	  // 28-9-2005 Check for articles on special which should not get free shipment
	  // Adjust the cart total price for this
	  $total_specials = 0;
	  if ($cart->count_contents() > 0) {
		 $products = $cart->get_products();
		 for ($i=0, $n=sizeof($products); $i<$n; $i++) {
			if ($special_price = tep_get_products_special_price($products[$i]['id'])) {
			   $products_price = $special_price;
			   $total_specials += $products_price;
			}
		 }
	  }

	  $cart_total = $cart_total - $total_specials;
	}

  if ($cart_total < (MODULE_SHIPPING_FREEAMOUNT_AMOUNT + $easy_discount_total))

Share this post


Link to post
Share on other sites

Hi @all,

 

l looked again at the code but i saw no mistakes.....

 

Any solutions?

 

Thanks!

 

 

Hi...

 

not everything is perfectly... :rolleyes:

 

In login.php i set as follows:

 

 $error = false;
 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process')) {
   $email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']);
   $password = tep_db_prepare_input($HTTP_POST_VARS['password']);


//firsttime user
if ($check_prevord[0] < 1) {
$first_time_customer = true;
} else {
$first_time_customer = false;
}
tep_session_register('first_time_customer');



// Check if email exists
   $check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
   if (!tep_db_num_rows($check_customer_query)) {

 

and in shopping_cart.php

 

 $any_out_of_stock = 0;
   $products = $cart->get_products();


//first order
if($first_time_customer)
{
if ($check_prevord[0] < 1) {
$easy_discount->set('CQTY','5,00 Euro Eröffnungrabatt',5);
} else {
$easy_discount->remove_type('CQTY');
}
}


   for ($i=0, $n=sizeof($products); $i<$n; $i++) {

 

The problem is, that the customer get the discount everytime, also when he is logged out and came back....

 

Where is the mistake, could you help me please?

 

Regards

Gerd


Regards

Gerd

Share this post


Link to post
Share on other sites
Hi @all,

 

l looked again at the code but i saw no mistakes.....

 

Any solutions?

 

Thanks!

 

The problem is that the discount session is not unregistered

 

In checkout_process.php

 

after:
$cart->reset(true);

add:
$easy_discount->reset();

 

And in logoff.php

add:

tep_session_unregister('CQTY');

 

Hope that helped

Share this post


Link to post
Share on other sites

Ups...

 

I made a mistake. This is what to do instead:

 

The problem is that the discount is not reset

 

In checkout_process.php and in logoff.php

after:
$cart->reset(true);   or:  $cart->reset();

add:
$easy_discount->reset();

Share this post


Link to post
Share on other sites

Hi christoffer,

 

i put it in checkout and logoff and nothing changed.....when i logged in again i get also the discount again....

 

hmmm...... :blush:

 

Tanks a lot...:-)


Regards

Gerd

Share this post


Link to post
Share on other sites

...i think that this part is the problem:

 

//first order
if($first_time_customer)
{
[b]if ($check_prevord[0] < 1) {[/b]
$easy_discount->set('CQTY','5,00 Euro Eröffnungrabatt',5);
} else {
$easy_discount->remove_type('CQTY');
}
}

 

when the user logged in, OSC checked if he is a first time customer....

and in the shopping_cart.php in the second line OSC checked again

the same part with if ($check_prevord[0] < 1) {

like in login.php is this right?

Edited by chefsache

Regards

Gerd

Share this post


Link to post
Share on other sites

Hi @ all,

 

really no ideas?

 

Our shop starts at the 1st of September and it would be fine, when we could use this contribution :wub: ;)

 

Thanks you....

Edited by chefsache

Regards

Gerd

Share this post


Link to post
Share on other sites
when the user logged in, OSC checked if he is a first time customer....

and in the shopping_cart.php in the second line OSC checked again

the same part with if ($check_prevord[0] < 1) {

like in login.php is this right?

 

I don't really know but maybe try this if you have not already

 

Change to

//first order
if($first_time_customer=true)
{

$easy_discount->set('CQTY','5,00 Euro Eröffnungrabatt',5);
} else {
$easy_discount->remove_type('CQTY');

}

Edited by itsjust

Share this post


Link to post
Share on other sites

Hi christoffer,

 

still 5,00 EUR for everybody and everytime....

 

But thanks for your answer.......i´am really :wacko: in the moment.....

I think i will look for another contribution at the weekend, or is there anybody out there with other idea´s ? :-)

 

regards

Gerd


Regards

Gerd

Share this post


Link to post
Share on other sites

;) HI, I have downloaded coupon code.

 

But how do I configure to able only certain amt of purchase then the coupon can be used? I was told "A very simple way to do this would be to only show the input box if the cart_total is greater than 150".

 

But I am clueless on how to access which path to search to amend or configure the cart total.

 

I need it for eg: $150 above your entitled to 40% discount

and $400 above entitled to 50% discount.

 

Please help. Thank you very much for your time.

Share this post


Link to post
Share on other sites

Hi All

 

I'm having a problem with discounts applied to categories where there are attributes within any category,

I am using Discount for given category post 540.

 

All the categories set in Cat1 that have products with attributes have Cat2 discounts applied to them.

 

Can anbyody help.

 

Thanks

 

Mick.

Share this post


Link to post
Share on other sites

Hi... excellent work, but i thought i would add this simple comment.

As it is not clear in the download of the contribution.

 

If you cant see the discount applied in the checkout confirmation page.

 

Check the sort order of the 'Order Total Modules' via your admin panel.

;)

Share this post


Link to post
Share on other sites

Hello,

 

Firstly I would like to thank all those who have helped out with this contribution.

 

WARNING I AM STILL ON MY LEARNERS IN HERE, I apologise for my lack of PHP knowledge.

 

I have read and tried to understand what I have to do to get the results I need but I am buggered if I can work it all out.

 

I have installed the easy discount contribution and all the updates and have no idea on how to get it working on my site.

 

1. I would like to add a 10% discount for every $100 AUD spent in my shop eg $100=10% $200=20% etc.

 

2. I would like to add the discount before the shipping and tax is added.

 

3. If possible I also would like the discount to be shown in the shopping cart prior to confirmation.

 

4. If possible can the discount be added to selected customers only?

 

I know it's a big ask but how hard would it be to have this setup controlled from Admin? Or is there already another contribution available to do this.

 

I would be very greatfull of any advise...many thanks in advance

 

Bruce

Share this post


Link to post
Share on other sites
Simplfy this. Here you are saying;

 

if they spend $100, they get $10 off

if they spend $200, they get $40 off

 

Should this be;

 

if they spend $100, they get $10 off

if they spend $200, they get $20 off

 

Hi Burt,

 

Sorry for my confusion, if a customer

 

spends $100 they get $10 off

spends $200 they get $40 off

spends $300 they get $90 off

before tax and shipping

Share this post


Link to post
Share on other sites

Hi!

 

Can I use this contrib just to give 20% discount on all orders for some special users (which I would set manually by using their 'customer id')?

 

What would the code look like? (I'm using osCommerce 2.2-MS2)

 

I would like to show the discount in the shopping cart (no box) and checkout!

 

thx & greets!

Share this post


Link to post
Share on other sites

My client wants to apply a discount to shipping only. We currently have Individual Product shipping rate contribution. That contribution sets a shipping rate per item based on quantity. For example - purchase one at $10, each additional (of same product) is $8. So, the module adds th $10 for the 1st one, PLUS the rate for each additional based on that product.

 

My clients wants to apply a SHIPPING discount if they purchase a quantity of 4 or more. He does not want the discount to be applied to the product, subtotal or tax, JUST SHIPPING.

 

Can this contribution do that? And if so, PLEASE provide example of how I would do that. And also which php file would I put it in?

Share this post


Link to post
Share on other sites

Hi,

 

I really need some help from you. I installed Easy discounts add on from Aug 2009.

 

I can see that the discount is applied in subtotal

 

Sub-Total: 2.772,00€

Cart Quantity Discount: - 500,00€

Total: 2.272,00€

 

hoever when I go to confirmation I can not see the discount anymore and the normal price is used.

 

Could you please help me with this.

 

Many thanks and BR,

 

Cole

Share this post


Link to post
Share on other sites

Hi again,

 

I have also checked the order in wich I have in order total

 

Modules Sort Order Action

Easy Discount 2

Low Order Fee 5 Info

Shipping 3 Info

Sub-Total 1 Info

Tax 4 Info

Total 6 Info

An it doesn't look bad.

 

Does anyone know what is the funtionality of:

 

1- catalogue/include/shopping_car.php

 

2- catalogue/include/bxes/shopping_car.php

 

Because in addon "Easy Discount" whatever I changed in catalogue/include/bxes/shopping_car.php does not have any inpact.

 

Still I can not see the discount in Confirm order step.

 

Any clue to fix it pleaseeeee!!!!

 

Thanks,

 

BR,

 

Cole

Share this post


Link to post
Share on other sites

I just managed tog et Easy Discount working, but I can't see the discount being applied in the admin side. Any tips?

Share this post


Link to post
Share on other sites

Hi Everybody!

 

I found your contrib after a long search and I think this is the module I need. I must "configure" the code for my shop but I`m no php-crack. So I hope, that anybody can help me.

 

I have different categorys in my shop. So there is for example Rubbers and Blades. Also I want to have different discounts.

 

1.) Anybody takes 3 or more SAME rubbers, we call it rubber A, into the shopping card => 25% discount.

2.) Anybody takes 2 rubber A and 1 rubber B into the shopping card => 0% discount.

3.) Anybody takes 3 rubber A and 1 or 2 rubber B into the shopping card => 25% discount on rubber A, 0% on rubber B

4.) Anybody takes 10 different rubbers into shopping card => 30% discount

5.) same as 4.) but there are 3 or more same rubber A => 30% discount

6.) The price in the shopping card is over 50EUR => 5%, over 75EUR => 10%, over 150EUR => 15%

7.) If 1.) or 3.) or 4.) or 5.) but there is also 6.) then the discount for the products from 1.), 3.), 4.), 5.) is 25%/30% and for the rest of the products is 5%/10%/15% (6.))

 

I hope, that you understand what I mean!

 

Is this possible with this contrib? Or is there an other contrib which I can use?

 

Best regards

 

Daniel

Share this post


Link to post
Share on other sites

I've had a problem with this contribution which I have now (hopefully) resolved - sounds like the same problem as posted above.

 

If I applied discounts in checkout_confirmation.php they showed in the order total. If the customer checked out using paypal all was fine, if they used an alternative method (in my case Sage Pay Server) the discount was lost - weird.

 

If I applied discounts elsewhere they applied (I know because ai put a bit of code in the footer) but were lost by the tme the shopper got to the checkout_confirmation.php page.

 

ANyway I tracked the problem down I was using the 18 Aug 2009 version by yesudo that fixes a session error. I've searched and couldn't find any mention in the thread of this error. I followed the original install insructions and this fixed everything.

 

In short

 

In application_top.php the code I used is...

 

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

 

not...

 

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

 

 

Well it worked for me - hope this saves someone some time...can't find any problems with doing this either - fingers crossed..

Rob

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

×