Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Easy Discount


boxtel

Recommended Posts

Well, I got mine working!! Woohooo!!!

 

Thanks for the help!!

 

I do have a big suggestion boxtel...I think you need to make a new release that includes the changes which are posted earlier in this thread. Like the change to the class, I missed that little bit in this thread and that's why I was getting zero discounts.

 

Other than the setup confusion...it's an awesome contribution and I'm very grateful to you for making it!

 

Thanks!!

Link to comment
Share on other sites

Well, I got mine working!! Woohooo!!!

 

Thanks for the help!!

 

I do have a big suggestion boxtel...I think you need to make a new release that includes the changes which are posted earlier in this thread. Like the change to the class, I missed that little bit in this thread and that's why I was getting zero discounts.

 

Other than the setup confusion...it's an awesome contribution and I'm very grateful to you for making it!

 

Thanks!!

 

done

Treasurer MFC

Link to comment
Share on other sites

I've updated the files and changed all the stuff over to the new way of doing it. I'm not getting double posting.. But I'm still not showing the discount reflected in the database..

 

The discount is showing up in the session vars and on the right hand side and stuff, but nothing on the checkout_confirmation.php page where the $order_totals is called.

Link to comment
Share on other sites

I've updated the files and changed all the stuff over to the new way of doing it. I'm not getting double posting.. But I'm still not showing the discount reflected in the database..

 

The discount is showing up in the session vars and on the right hand side and stuff, but nothing on the checkout_confirmation.php page where the $order_totals is called.

 

In the admin section for order_total modules, did you install the easy_discount module?

Link to comment
Share on other sites

Is there anyone here who could explain to me how to add this?

 

I uploaded the new files. Inserted the application_top code.

Now i am on Step 3 and i have no clue where to put any one of those codes. I installed the module.. Nothing is happening. Where do i add the global variable definition?

 

I would like to have things set up so when a new customer registers and places an order of any amount, they will receive a 10% discount. However, i only want this 10% to apply on their first order.

 

I'm just having a very hard time understanding this whole install, for some reason.

 

It's one of my last steps before opening my shop!

Link to comment
Share on other sites

^ Well, i finally got it working.

 

Except one problem. At Checkout Confirmation, it does not include the discount in the grand total.

 

I applied a discount of -$1.00, my order came to 8.50 (orginally 9.50). At the checkout confirmation page, it resorts back to 9.50.

 

What did I do wrong?

 

I am still interested webexceed's "First Customer" fix, also.

Link to comment
Share on other sites

an alternative to ccgv!! :D

 

i just read this entire thread and i'm absolutely baffled. could somebody make an instruction for dummies on how exactly to get the 'ccgv' effect?

 

i know there's a few posts detailing so, but i'm having a difficult time piecing them together

Link to comment
Share on other sites

Elli and you are having that same problem with checkout_confirmation and I don't know why. I never had that problem...at least not once everything else was working correctly.

 

This is the code I am now using in login.php, I have this just under the check password and check country routines:

 

$check_prevord_query = tep_db_query("SELECT COUNT(*) as prevnum from " . TABLE_ORDERS . " where customers_id = '" . (int)$check_customer['customers_id'] . "' AND DATE_SUB(CURDATE(),INTERVAL 30 DAY) < date_purchased");

$check_prevord = tep_db_fetch_array($check_prevord_query);

if ($check_prevord[prevnum] < 1) {

$first_time_customer = true;

} else {

$first_time_customer = false;

}

tep_session_register('first_time_customer');

 

My SQL there has more than you would want for first time only customers. Mine includes something the client wanted so that anyone who hasn't ordered within the last 30 days automatically gets the discount again.

 

In my shopping_cart.php I put this immediately after <!-- body //-->

 

<?php

include_once(DIR_WS_FUNCTIONS.'easy_discount.php');

$easy_discount->reset();

if($first_time_customer)

{

if ($cart->count_contents() > 0) {

$easy_discount->add('FREE','One Item FREE',5);

} else {

$easy_discount->remove_type('FREE');

}

}

?>

 

So that should be it (Aside from the code you would have added to application_top...and some other code for shopping_cart to make the discount show in the cart.....as long as the easy discount module is installed in the admin..and CHECK the SORT ORDER...I found if the sort order conflicts with anything else it wouldn't show up. Hope this helps!!!

 

 

^ Well, i finally got it working.

 

Except one problem. At Checkout Confirmation, it does not include the discount in the grand total.

 

I applied a discount of -$1.00, my order came to 8.50 (orginally 9.50). At the checkout confirmation page, it resorts back to 9.50.

 

What did I do wrong?

 

I am still interested webexceed's "First Customer" fix, also.

Link to comment
Share on other sites

Thank you,

I was able to get the discount shown/applied to the checkout confirmation. It was the sort order, heh.

 

This code you have.. Would it be possible to take out the part that it reapplies the discount after 30 days?

 

I am going to go attempt to make this one work now.

 

Thank you!

Link to comment
Share on other sites

^ I got it working. That's great.

 

Actually, now I am curious.. The part that allows the customer to receive the discount again within 30 days..

 

Does this mean that if a customer signs up and never places an order, they will receive the discount again after 30 days of never placing an order?

 

It's a bit early here, my brain isnt in "function" mode yet. :huh:

Link to comment
Share on other sites

OK - So, now that i have gotten everything to work, what do i have to do now to get the Easy Discount to discount in %.

Like i want 10% discount... how would that go?

i tried this $value*0.1

that i found in an earlier thread, but that just does nothing.

 

Thank you to anyone who can help me out!

Link to comment
Share on other sites

OK - So, now that i have gotten everything to work, what do i have to do now to get the Easy Discount to discount in %.

Like i want 10% discount... how would that go?

i tried this $value*0.1

that i found in an earlier thread, but that just does nothing.

 

Thank you to anyone who can help me out!

 

10% of what ?

Treasurer MFC

Link to comment
Share on other sites

10% discount off the order

 

I want to take off 10% of the sub-total.

 

if ($cart->count_contents() > 0) { // cart contents

$easy_discount->add('OST','10% discount of Sub Total',$cart->show_total()*0.1); // 10% of cart total

} else{

$easy_discount->remove_type('OST'); // remove discount if present and cart gets empty

}

 

you can put this in application_top.

 

you can also use the order object to calculate the discount but then you cannot set it before going to checkout because the object will not exist until then.

Treasurer MFC

Link to comment
Share on other sites

an alternative to ccgv!! :D

 

i just read this entire thread and i'm absolutely baffled. could somebody make an instruction for dummies on how exactly to get the 'ccgv' effect?

 

i know there's a few posts detailing so, but i'm having a difficult time piecing them together

The newest file has the instructions on how to install it.. But I'm still having issues with the other stuff.

Link to comment
Share on other sites

^ I got it working. That's great.

 

Actually, now I am curious.. The part that allows the customer to receive the discount again within 30 days..

 

Does this mean that if a customer signs up and never places an order, they will receive the discount again after 30 days of never placing an order?

 

It's a bit early here, my brain isnt in "function" mode yet. :huh:

 

Uh oh, you've created a logic loop in your question!! The universe is about to implode.

 

If a customer signs up and never places an order...then it will always be true that they have no order in the past 30 days and thus qualify for one free item. (It doesn't accumulate) No order in 10 years...one free item....no order in 6 months....one free item. An order 29 days ago..no free item.

 

:D

 

Does anyone know how to make it NOT calculate sales tax on a discounted item? It seems to be taking the pre-discount total, calculating the tax, then subtracting the discount. For now I've set the discount to include tax...but for accounting purposes it would be best if the tax amount was actually correct, and calculated on the POST-discount amount.

 

I will dig around to see if this was already answered..I didn't see it anywhere but I may have just missed it.

Link to comment
Share on other sites

if ($cart->count_contents() > 0) { // cart contents

$easy_discount->add('OST','10% discount of Sub Total',$cart->show_total()*0.1); // 10% of cart total

} else{

$easy_discount->remove_type('OST'); // remove discount if present and cart gets empty

}

 

you can put this in application_top.

 

you can also use the order object to calculate the discount but then you cannot set it before going to checkout because the object will not exist until then.

 

 

Thank you, that works great - I have it set up so when a new customer registers, they receive a 10% discount off their sub-total on their first order.

However, i tested it out. The discount works, but after i place an order, the discount remains inside the shopping cart box with a (- $0.35 - example) with no items inside the cart. If i go and place more items inside the cart, i am still able to purchase with the 10% discount until i manually log out (even after closing browser, cookie keeps me logged in). This is not good as i know many customers wont bother to log out.

Even after i log out, the negative discount still remains inside the shopping cart box, and after logging back in, the discount still shows in the shopping cart box until i visit the actual shopping cart and it realizes the discount does not apply since that customer already placed an order.

Link to comment
Share on other sites

Am I the only one with the tax problem?

 

I think the only solution may be to have the discount apply to a specific item in the cart to reduce it's pre-tax price, or have the discount appear as it's own special product in the cart with a negative price???

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...