Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Credit Class/Gift Vouchers/Discount Coupons 5.10


Strider

Recommended Posts

  • Replies 4.8k
  • Created
  • Last Reply

Top Posters In This Topic

I could have sworn that had been fixed in the last release.

Note on things to fix:

1) fix emails added text

2) a more accessible coupon and gift voucher codes for email

3) look into language in email

4) fred's changes for sessions/globals to make it play with all php's(yuck)

 

yes these are notes for me .. I have to keep them somewhere

 

Are there any bugs/new ideas people have?

Hi,

I may have an odd case here but I am mainly using the discount part of this contribution and I am having a hard time to get it to calculate things right. I am basically using a this setup in the order total.

 

Sub-Total

Discount coupon

Tax

Shipping

Total

 

And I need to show all prices INCL VAT, but I can not simple get it to work OK for all cases (fixed amount, precentage, fixed amount with restriction, precentage with restriction, etc).

 

So I have been busy with testing and analyzing the coupon part lately and I have found some major bugs for some cases. I have not only found the bugs but also changed some of vital function in "modules/order_total/ot_coupon.php" and now I got everything working great!

 

I have searched the forum of GV/DC-threads and noticed that some people had this kind of problem before. I am not sure if they ever got it fixed or just stopped using GV/DC for these cases? Please, let me know if you got it fixed?

 

I would like someone with a similar case to test my changes.

 

/Fred

Link to comment
Share on other sites

*chuckles* ok to anthony : When I get the error your talking about I have duplicated a class somehow. Such as copying ot_coupons.php to ot_whatever.php and not renaming the class ot_whatever

 

to fred: I have been wondering the same thing about if they are they using this? I would love to see what you did on your code. I have found some of the same bugs. maybe we should compare the list. There was another question I wanted to ask someone and that is does anyone actually use credit notes on discount coupons? or more to the point how are credit notes suppose to be applied to discount coupons, for some reason this just totally escapes me. I can see credit notes on the gv's but not on dc's

 

to missed code.. it is in the code you added to your shopping cart class ... you did add the code to your shopping cart class didn't you? it is located with the other classes you are suppose to modify in catalog->includes->classes

(my knowledge is so small you would think that an ant was a genius in comparison)

Link to comment
Share on other sites

Hello Strider, You were right about where the prob. was. I had a typo. :( I didnt get my nick for nothing ....... LOL

Fixed now,

 

I really appreciate your help. Thanks :D

 

I am sure you will be glad when I get this working good.....LOL

 

 

OK, my next error, I can check out just fine if I dont select a coupon.

 

If I enter a coupon code at check out I get the following error:

Fatal error: Call to undefined function: tep_get_tax_rate_from_desc() in /home/ocx74/public_html/shop/catalog/includes/modules/order_total/ot_coupon.php on line 315

 

Also it changes 2 lines in my payment.php causing check out to not work at all with out above error. As long as no coupon is entered, all is fine, but once any one enters a coupon, no more check outs for anyone. The red areas start out as && but change to below &&amp after I try to check out with a coupon.

 

 

$js .= "\n" . ' if (payment_value == null [color=red]&&amp[/color]; submitter != 1) {' . "\n" . // ICW CREDIT CLASS Gift Voucher System

' error_message = error_message + "' . JS_ERROR_NO_PAYMENT_MODULE_SELECTED . '";' . "\n" .

' error = 1;' . "\n" .

' }' . "\n\n" .

// Gift Voucher System Line below amended

' if (error == 1 [color=red]&&[/color] submitter != 1) {' . "\n" .

' alert(error_message);' . "\n" .

' return false;' . "\n" .

' } else {' . "\n" .

' return true;' . "\n" .

' }' . "\n" .

'}' . "\n" .

'//--></script>' . "\n";

}

 

 

 

Thank,

Michael

Link to comment
Share on other sites

missed-code .....

did you not add your add_ccgvdc_application_top.php to application_top.. oh by the way before you get to the admin side .. it is over there too

 

You know missed-code I bet if you read the install.htm and follow the directions step by step you wouldn't have been wasting so much time in trying to get a simple piece of code to work...

(my knowledge is so small you would think that an ant was a genius in comparison)

Link to comment
Share on other sites

Hello Strider,

I want to thank you very much for your help! It is extremly appreciated! :D

 

Well for starters, I am new to OSC, had this store for only a month.

And have had a nuke site for about 3 months. I am learning as I go.

I have html experience from past sites, but php in really new to me with the extra functions, and OSC for some reason seemed extremly hard for me to grasp at first.

 

I did read the install.html several times, tried to follow it exactly and missed a couple things. Then I had that first problem, couldnt figure it out so I restored my store, then in my haste to hurry and get it back up, I made a couple typos in re doing everything. The install.html is really straight forward, my mistakes were mainly from not understanding what I was doing...........Once It started clicking in my head exactly what it is I am typing, it is a lot more clear.

 

I am probably to new to even try a contribution like this, But I liked it and am determined. LOL I also have made several mods to the site before this contribution so that didnt help me any......lol

 

This contribution has actually helped me learn a lot more about the functions of OSC, so I have learned a LOT. It is all making sense to me know. It just takes a while to click as I have a habit of making things harder than they are sometimes.

 

It is a GREAT contribution, and it is working great it seems now :) I have completed three check outs with out any probs.

 

Thank you VERY Much for your time!!

Link to comment
Share on other sites

strider,

 

I have the same payment gateway amount problem that luder1 had with authorize.net - but I'm using the TrustCommerce payment module. The cart shows the correct Order Total after discounts or GV, but the amount sent to the payment gateway does not reflect any discounts.

 

Does the GV module require any changes to the payment module to support the new checkout process?

 

I'm using osC 2.2 MS2 (snapshot 9-15-03) and GVDC 5.04.

 

My sort order settings:

 

Sub-Total 1

Shipping 2

Gift Certificates 3

Discount Coupons 4

Tax 5

Total 6

 

Thanks for the great contribution.

 

Kind regards,

EricK

Link to comment
Share on other sites

Thanks for your reply Strider.

 

When I change DC or GV sort order to come after Total, then the GV or DC is not reflected in Total. Is this what you mean?

 

Sub-Total 1

Shipping 2

Low Order Fee

Tax 3

Total 6

Discount Coupons 740

Gift Vouchers 760

 

The order I'd like to calculate things is first apply GV to the Sub Total, next apply DC, then calculate sales tax on that amount, and finally add Shipping.

 

thanks again,

EricK

Link to comment
Share on other sites

Did you have to add a line in checkout_process to use the payment gateway that you used? If so in what order did you place that and where did you place the line to call the before process statement

(my knowledge is so small you would think that an ant was a genius in comparison)

Link to comment
Share on other sites

No changes to checkout_process.php are needed to use the TrustCommerce payment module. Here is their feedback when I asked why the sub-total amount is being processed and not the Order Total:

 

"I believe our payment module's use of $order->['total'] is the correct

value for the final amount of the transaction (rather than the

subtotal), as this $order->['total'] is also used by all the other

payment modules as well. There is an $order->['subtotal'] value in

osCommerce, but we don't use that anywhere within the TrustCommerce

payment module."

 

"So my best guess is that something is going wrong within the GV module,

possibly in terms of sort order of the discount calculation."

 

So, I sent them a copy of these two files to look at:

 

catalog/checkout_confirmation.php

catalog/classes/order_total.php

 

and the reply was:

 

"I can't immediately see anything in the gv code that is causing the

problem, although I'm not that familiar with the osc checkout process

beyond the payment module portion, so I could be missing something. You

might want to try contacting the gv module developers and seeing if they

expect any particular changes made to the payment modules to support

their new checkout process."

 

Thanks,

EricK

Link to comment
Share on other sites

This mod rocks, but is there a way that you can set a minimum order for the new customer signup gift voucher?

 

Here is an example:

 

When a customer signs up they receive a $10 credit, but I want their minimum spend to be $50 before they can use their $10 credit.

 

If possible where can this be defined?

 

Thanks

 

James

Don't forget to check out http://wiki.oscommerce.com/Top for OsCommerce support documentation

Link to comment
Share on other sites

This mod rocks, but is there a way that you can set a minimum order for the new customer signup gift voucher?

 

Here is an example:

 

When a customer signs up they receive a $10 credit, but I want their minimum spend to be $50 before they can use their $10 credit.

 

If possible where can this be defined?

 

Thanks

 

James

Hi James,

I am only using the DC part but there you can define "the minimum order value before the coupon is valid" for a DC. I am not sure if you can do the same thing for a GV?

 

Probably not, since you only define the GV amount at signup and not the GV-id as for DC:

"

// Set the amount of a Gift Voucher that the new signup will receive, set to 0 for none

define('NEW_SIGNUP_GIFT_VOUCHER_AMOUNT', '10');

"

 

/Fred

Link to comment
Share on other sites

Here is one way.

 

add anywhere in add_ccgvdc_application_top.php

 

define('NEW_SIGNUP_GIFT_VOUCHER_MINIMUM','50');

 

in create_account.php and create_account_process.php add this

 

$insert_query = tep_db_query("insert into " . TABLE_COUPONS . " (coupon_code, coupon_type, coupon_amount, coupon_minimum_amount, date_created) values ('" . $coupon_code . "', 'G', '" . NEW_SIGNUP_GIFT_VOUCHER_AMOUNT . NEW_SIGNUP_GIFT_VOUCHER_MINIMUM . "', now())");

while (!succeed) {try()};

 

GMT -6:00

Link to comment
Share on other sites

Strider,

 

In terms of which variable the TrustCommerce payment module is using, it's looking at $order->info['total'] just like the other payment modules. It does this within the before_process() function.

 

If you could provide information on where to get the new totals the GV/DC module is generating, that would be very helpful.

 

Many thanks,

Eric

Link to comment
Share on other sites

There have been several posts about the payment processor being called even when the order total is zero (i.e. the order is fully covered by a gift voucher).

 

I have had the same problem, and managed finally to fix it tonight. I suspect that the error is different depending on how many payment modules you have installed - I have only one module installed (2checkout), and none of the aforementioned solutions worked for me at all.

 

The steps I eventually took were:

 

1. The line:

 

if ($credit_covers) $payment=''; //ICW added for CREDIT CLASS

 

in checkout_confirmation.php appeared to be in the wrong place?

In my experience, $credit_covers is always empty because this line appears before the line:

 

$order_total_modules->pre_confirmation_check();

in which $credit_covers is actually set.

 

I therefore re-ordered the relevant bits of code in checkout_confirmation.php, that section in my checkout_confirmation.php now looks like this:

 

  require(DIR_WS_CLASSES . 'payment.php');
 require(DIR_WS_CLASSES . 'order.php');
//ICW ADDED FOR CREDIT CLASS SYSTEM
 require(DIR_WS_CLASSES . 'order_total.php');

 $order = new order;

//ICW ADDED FOR CREDIT CLASS SYSTEM
 $order_total_modules = new order_total;
//ICW ADDED FOR CREDIT CLASS SYSTEM
 $order_total_modules->collect_posts();
//ICW ADDED FOR CREDIT CLASS SYSTEM
 $order_total_modules->pre_confirmation_check();

 if ($credit_covers) $payment=''; //ICW added for CREDIT CLASS
 $payment_modules = new payment($payment);

 $payment_modules->update_status();

 

2. In /includes/classes/payment.php, there is a section of code as follows:

 

// if there is only one payment method, select it as default because in
// checkout_confirmation.php the $payment variable is being assigned the
// $HTTP_POST_VARS['payment'] value which will be empty (no radio button selection possible)
       if ( (tep_count_payment_modules() == 1) && (!isset($GLOBALS[$payment]) || (isset($GLOBALS[$payment]) && !is_object($GLOBALS[$payment]))) ) {
         $payment = $include_modules[0]['class'];
       }

 

What this does is if you only have one payment module, and the $payment variable has been set to '' in checkout_confirmation.php because your order is covered by credit, this line goes and sets it back again to your default payment module .... grrrr! So I changed it to this:

 

// if there is only one payment method, select it as default because in
// checkout_confirmation.php the $payment variable is being assigned the
// $HTTP_POST_VARS['payment'] value which will be empty (no radio button selection possible)
       if ( (!$credit_covers) && (tep_count_payment_modules() == 1) && (!isset($GLOBALS[$payment]) || (isset($GLOBALS[$payment]) && !is_object($GLOBALS[$payment]))) ) {
         $payment = $include_modules[0]['class'];
       }

 

I hope this helps somebody in the same predicament :)

Link to comment
Share on other sites

Julia,

 

Thank you very much for your post. Your ideas seems to work fine, however tax no longer gets calculated and my payment gateway still ignores GV and DC amounts.

 

What payment sort order do you have set in Admin?

 

Do you have any ideas why my payment gateway is ignoring the GV or DC amounts?

 

Should the payment gateway look at something other than $order->info['total'] for the correct Order Total?

 

Thank you,

EricK

Link to comment
Share on other sites

Here is one way.

 

add anywhere in add_ccgvdc_application_top.php

 

define('NEW_SIGNUP_GIFT_VOUCHER_MINIMUM','50');

 

in create_account.php and create_account_process.php add this

 

$insert_query = tep_db_query("insert into " . TABLE_COUPONS . " (coupon_code, coupon_type, coupon_amount, coupon_minimum_amount, date_created) values ('" . $coupon_code . "', 'G', '" . NEW_SIGNUP_GIFT_VOUCHER_AMOUNT . NEW_SIGNUP_GIFT_VOUCHER_MINIMUM . "', now())");

Hi, Thanks for your advice.

I have implemented the code you suggested which does work, however there are 2 discount codes in the confirmation email. One does not provide the minimum order and the second one will work with the $50 minimum purchase.

 

Do you know why this is?

 

Any help is appreciated.

 

James

Don't forget to check out http://wiki.oscommerce.com/Top for OsCommerce support documentation

Link to comment
Share on other sites

such a long list .. if only I would be notified of when people post to the forums I am trying to listen to .. well anyway ...

 

let's see

eric: we actually modify total not subtotal. if your sending subtotal.tax,shipping then that might be the reason your having a problem with the values being off ..(I think this is right)...lol

 

james: no the gv doesn't work on a you can get this gift voucher if you spend 50.00 you should use discount coupons of 10.00$ with a 50.00 minumum. The gv shouldn't work with a minumum because it is just that a gift voucher whereas that is exactly one of the things the discount coupon should be used for. As far as the rules of the email, no it doesn't list the rules of the discount coupon you would have to modify that yourself. Possibly in a new release we will incorporate that into it, but at present it doesn't take care of that scenario. The easiest hack on that scenario is to modify the language file that is setting that up.

 

julia: the problem actually isn't in the gv code. It is actually in the discount code. This will be fixed in the next release. One thing I have found that works and don't get me to lieing is if after I have everything installed I uninstall/remove it and the install it back. This doesn't always work but does sometimes. It also depends on how you have your shipping and tax declared in your dc modules information.

What happens is within the dc code it doesn't look at nor modify correctly .. (thinking here) well it is either tax or shipping ... and it doesn't leave a true zero balance such that it doesn't allow credit covers to be set to true which always causes the payment to try to go to the gateway. In doing it the way you have suggessed it will cause errors on the total.

 

Just for updates: We have someone that is doing the german language translation, I believe. At present it appears(I should have looked) that the only german file that is translated from english is create_account_process.php which should have been rolled into create_account.php. I apologize for not looking at this in more depth.

If anyone would like to volunteer translating other languages for the next release it would be appreciated.

When is the next release .. well I am trying .. I am trying ...

(my knowledge is so small you would think that an ant was a genius in comparison)

Link to comment
Share on other sites

HI

 

Severl questions about Gift voucher.

 

We have a comapny that is giving away 500 iPods. They want us to supply these customers with iPod cases

 

What we want to do is generate 500 unique vouchure codes. The unique code will sent with the iPod so that the people who receive the free iPods can come to our store to get their free case.

 

 

 

Can the Credit Class & Gift Voucher create 500 unique vouchure codes and can this be limited to a single item

 

Thanks for your help

 

 

Joe

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

Long Island, New York

Link to comment
Share on other sites

strider,

 

Please :rolleyes: tell me in what file, and on approx. what line is the final Order Total amount defined that should be passed to my cc payment gateway?

 

thanks again for you help,

EricK

Link to comment
Share on other sites

Eric,

 

I am using this sort order:

 

Sub-Total 1

Shipping 2

Tax 3

Total 6

Discount Coupons 740

Gift Vouchers 760

 

The module does modify $order->info['total'], as it should. Your payment module should have a function called process_button(), you can check in there that it is sending $order->info['total'] through.

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