Jump to content
Strider

Credit Class/Gift Vouchers/Discount Coupons 5.10

Recommended Posts

What do you mean by "using a payment module that checks the amounts => Ect Ect"?  Do you mean you created a payment module to act like a payment method?

I made a payment module that checks if the balance can pay the total. If yes, the module shows up like a normal payment module (see it herehere). If no, the module does not show up and the original checkbox appears so customer can choose or not to use his balance, but he must anyway choose a "normal" payment method. This way of doing does not require javascript, only one line in checkout_payment + 1 new payment module + ot_gv to replace.

 

You say you didn't see the "easier to understand" update-

First time I read the thread I didn't go that far backward, but then I found it. Thanks anyway for the informations

 

Doing all of these bug fixes will bring you up to speed...  or if you want to wait I will consolidate them some time soon and come up with an updated post of the base instructions.  I know it seems complicated, with all the bug fixes, so if you are intimidated by it wait and I will come out with... oops I'm being redundant...

I'm not intimidated but a bit lazy to make all these modifications :D

 

I also made the javascript logic like this: (through a mix of php code and javascript)

if voucher amount "that can be applied" = total -> when option selected, it disables other payment methods, and lets the person hit next

 

if voucher amount "that can be applied" < total -> when option selected, doesn't do anything special and user still has to click on another payment method before they can proceed

Your method and mine are doing same, but with different code and a bit different display. They are much better than the original one and are "easier to understand".

 

As it pertains to the current disscussion:  how easy would it be to integrate this update to make it into a payment module option, with all the special javascript as described above?  Popthetop came up with the idea initially to turn it into a payment module, but since my knowledge of payment modules is not very good, I figured it would be more work to get it to work like that since the way I have it coded is already working.  What are your thoughts Rigadin?

I made the payment module already (still few tests but sounds very good so far) with actually few modifications to the existing code. This new module is using ot_gv methods so we are sure that calculation in payment page and later in confirmation page are same (and less coding too).

=> I would prefer use my version of course. I can post it here when I've finalized it and we can discuss again.

 

- Rigadin


STS PLUS, a variation of STS, is now available.

ACA 2.0 is also out!

Share this post


Link to post
Share on other sites

the motox shop

 

Hello

 

I have installed the credit/gift con all is fine apart from when you go though check out you get to the checkout_payment.php page... at the top of the page I get this script listed below. I dont think that it is an error massage but part of a page where the script is not put/edited right. I have tryed to find the script in hand but had no luck, I was wondering if someone else has had the same prob.

 

' if (error == 1) {' . "\n" . ' alert(error_message);' . "\n" . ' return false;' . "\n" . ' } else {' . "\n" . ' return true;' . "\n" . ' }' . "\n" . '}' . "\n" . '//-->' . "\n"; } return $js; } function selection() { $selection_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) { $selection = $GLOBALS[$class]->selection(); if (is_array($selection)) $selection_array[] = $selection; } } } return $selection_array; } function pre_confirmation_check() { if (is_array($this->modules)) { if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) { $GLOBALS[$this->selected_module]->pre_confirmation_check(); } } } function confirmation() { if (is_array($this->modules)) { if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) { return $GLOBALS[$this->selected_module]->confirmation(); } } } function process_button() { if (is_array($this->modules)) { if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) { return $GLOBALS[$this->selected_module]->process_button(); } } } function before_process() { if (is_array($this->modules)) { if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) { return $GLOBALS[$this->selected_module]->before_process(); } } } function after_process() { if (is_array($this->modules)) { if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) { return $GLOBALS[$this->selected_module]->after_process(); } } } function get_error() { if (is_array($this->modules)) { if (is_object($GLOBALS[$this->selected_module]) && ($GLOBALS[$this->selected_module]->enabled) ) { return $GLOBALS[$this->selected_module]->get_error(); } } } } ?>

 

I think that is con is good and I would love to use it but cant have this script at the top of my check out pages

 

Thanks

Share this post


Link to post
Share on other sites
the motox shop

 

Hello

 

I have installed the credit/gift con all is fine apart from when you go though check out you get to the checkout_payment.php page... at the top of the page I get this script listed below. I dont think that it is an error massage but part of a page where the script is not put/edited right. I have tryed to find the script in hand but had no luck, I was wondering if someone else has had the same prob.

I think that is con is good and I would love to use it but cant have this script at the top of my check out pages

 

Thanks

1. Make sure you got the latest version.

2. try putting a <? in front of that code that is leaking, assuming it is not already inside of <? and ?>

3. if it is inside of <? ?> already, post a few of the lines before this code from that page.

Share this post


Link to post
Share on other sites
jonyo,

 

There are no "require" calls in the file (there are "include" calls but I could not find any duplicate call). I replaced the classes/order_total.php with the old order_total.php file but the error shows up still (Fatal error: Cannot redeclare class ot_coupon in /home/virtual/site21/fst/var/www/html/catalog/includes/modules/order_total/ot_coupon.php on line 15

) - which gave me the impression that the order_total.php is fine. Like I said, if both the ot_gv and the ot_coupon files are removed, the order_total page still loads (although, still shows error)  I could paste my order_total.php for you to take a look at may be you can spot what the problem is.

 

Many thanks in advance.

 

Rich

jonyo,

 

Anymore leads for me on my silly little hic up? OR has anyone an idea?

 

Thanks.

 

Rich

Share this post


Link to post
Share on other sites
the motox shop

 

Hello

 

I have installed the credit/gift con all is fine apart from when you go though check out you get to the checkout_payment.php page... at the top of the page I get this script listed below. I dont think that it is an error massage but part of a page where the script is not put/edited right. I have tryed to find the script in hand but had no luck, I was wondering if someone else has had the same prob.

I think that is con is good and I would love to use it but cant have this script at the top of my check out pages

 

Thanks

 

This is the code of a payment module. Error can be in checkout_payment or in a payment module. What payment have you installed from the admin?

I also recommend to use a good php editor (I use phpEdit) that put different colors for code/comments/strings and so on, it helps a lot to find the missing quotes and other small mistakes.

 

- Rigadin


STS PLUS, a variation of STS, is now available.

ACA 2.0 is also out!

Share this post


Link to post
Share on other sites
jonyo,

 

Anymore leads for me on my silly little hic up? OR has anyone an idea?

 

Thanks.

 

Rich

Rich,

 

If your server is running on *nix, try to "grep" (I think there's is a Win grep also) for other instances of the class,

 

$ grep -rn 'class ot_coupon' path-to-catalog/*

 

If the class is being defined elsewhere, this will show you where.

 

Good Luck

Rick Knight

Share this post


Link to post
Share on other sites

I have just posted a new release of this contribution:

 

Full package v5.13 with coupon and gift voucher modules.

 

In this release:

- Important security fix for those having magic_quotes off.

- Previous security fixes

- Bug fixes

 

Not in this release:

- "Show up discount ..." by Francisco on 22 Apr 2005. But you can do his modifications over this one if you want.

- "Easier to understand" modification by Jonyo available in the forum.

 

More informations and links to screenshots inside the package (file install.html).

 

- Rigadin


STS PLUS, a variation of STS, is now available.

ACA 2.0 is also out!

Share this post


Link to post
Share on other sites

Heyo all, :)

 

i think i have sort out my error in paypal shopping cart ipn,

by checkout_payment.

 

i miss the checkbox in checkout_payment.php, over the

redeem button.

 

Here a screenshot.

 

voucher.gif

 

Can anyone help me, to add the checkbox, that i can redeem

the vouchers ??

 

 

Thanks in advance

Hobbes

Share this post


Link to post
Share on other sites

Curious,...

 

no i have the checkbox, but paypal shopping cart ipn don?t use the

voucher.

 

Can anyone help ?

 

Thanks in advance

Hobbes

 

P.S.

The image in post below i delete, that error is fixed.

Share this post


Link to post
Share on other sites

I just noticed something. It is not a bug, but something that should be added and I just do not know how...

 

In COUPON ADMIN, it lists the coupons you added. When you click on REPORT, it shows the details of if it has been redeemed like the amount of Redemptions and who redeemed it.

 

This is what I found that needs to be added, if a customer redeems a coupon, then you delete the customer's account, it still shows all the info, but the customer's name is blank.

 

Is there any way to see if that customer still exists and if not, display something like deleted customer or something?

 

Even though the name is not there on deleted customers, the customer ID still is so can we save the customer's name in TABLE_COUPON_REDEEM_TRACK as a new column like the customer_id is and then display that by calling it from TABLE_COUPON_REDEEM_TRACK?

 

Understand?


L8r,

PopTheTop

 

Published osC Contributions:

- eCheck Payment Module v3.1

- Reviews in Product Display v2.0

- Fancier Invoice & Packingslip v6.1

- Admin Notes / Customer Notes v2.2

- Customer Zip & State Validation v2.2

- Search Box with Dropdown Category Menu v1.0

 

Pop your camper's top today!

It's a popup thing...

You wouldn't understand

Share this post


Link to post
Share on other sites

Hello PopTheTop, :)

 

not really ;)

 

I have now all working fine, but only the voucher will not add at checkout_payment.

I don?t use coupons, i only use the welcome vouchers at the moment.

 

Jonyo have say, that the ccgv works with paypal ipn, but he not know

that it work with the other ipn contrib i post below.

 

Now i search since any days a fix for my Problem.

 

If you like, let me know from what you need to see the code,

so i can post it here, and you help me to fix ??

 

Greets

Hobbes

Edited by Hobbes_TheReal

Share this post


Link to post
Share on other sites

Well, I thought that I had that same problem, but then I found it to be working and been working ever since. Do you have the new user vouchers set for a minimum order? If so, be certain that the minimum order (subtotal amount) is higher than that value.


L8r,

PopTheTop

 

Published osC Contributions:

- eCheck Payment Module v3.1

- Reviews in Product Display v2.0

- Fancier Invoice & Packingslip v6.1

- Admin Notes / Customer Notes v2.2

- Customer Zip & State Validation v2.2

- Search Box with Dropdown Category Menu v1.0

 

Pop your camper's top today!

It's a popup thing...

You wouldn't understand

Share this post


Link to post
Share on other sites

Hello PopTheTop, :)

 

thx for answer me :)

 

The minimum order is on 0.001 for use the voucher.

 

Don?t know, who the problem is :(

 

Or i must set it to 0.000, that a new user can use it on his/her first order ??

 

Greets

Hobbes

Share this post


Link to post
Share on other sites

Now i have set to 0.000 and nothing will work.

 

I have add all products, all categories, and nothing will work

 

I?m a bit frustrated now after any days to find a fix for :(

 

Greets

Hobbes

Share this post


Link to post
Share on other sites

This loop is from order_total.php, from the latest 5.13 install

 

        
115 while (list(, $value) = each($this->modules)) {
116          $class = substr($value, 0, strrpos($value, '.'));
117          if ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) {
118           $use_credit_string = $GLOBALS[$class]->use_credit_amount();
119            if ($selection_string =='') $selection_string = $GLOBALS[$class]->credit_selection();
120            if ( ($use_credit_string !='' ) || ($selection_string != '') ) {
121              $output_string .=  '<tr colspan="4"><td colspan="4" width="100%">' .  tep_draw_separator('pixel_trans.gif', '100%', '10') . '</td></tr>';
122             $output_string = ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" >' . "\n" .
123                               '   <td width="10">' .  tep_draw_separator('pixel_trans.gif', '10', '1') .'</td>' .
124                               '     <td class="main"><b>' . $GLOBALS[$class]->header . '</b></td>' . $use_credit_string;
125              $output_string .= '<td width="10">' . tep_draw_separator('pixel_trans.gif', '10', '1') . '</td>';
126              $output_string .= '  </tr>' . "\n";
127              $output_string .= $selection_string;
128            }
129
130          }
131        }

 

Now, is it me being dumb :blush: or should line 122 be ".=", not "="

 

I'd assume I was right, but the same code is in 5.12 (which I'm actually installing), and causes the Enter Voucher Code to over-ride the "Select Voucher amount" checkboxes - I'm sure that this must affect someone else!

 

Thanks

Share this post


Link to post
Share on other sites

... and another thing.

 

ot_coupon.php/credit_selection will output a 'Redeem Code' box unconditionally.

 

ot_gv.php/credit_selection outputs a 'Redeem Code' box if there are any active Gift Vouchers.

 

This means that if you have Discount Coupons and Gift Vouchers enabled, you get two identically named boxes!!?

 

Apologies if this has been covered before, but it seems strange that such a widely used contribution has two seemingly fundamental bugs - I'm happy to post my fixes, so long as I'm not undoing someone else's good work!

 

Thanks

 

Quentin

Share this post


Link to post
Share on other sites

Hello all,

 

now i have test in another testshop, that the other paypal ipn

works good with ccgv, dunno who the different is, im not a php profi ;)

 

Is it possible, that anyone have a fix, that paypal ipn 3.1.5 use the 2.50$

voucher that new user will have after register a account ?

 

In our testshop all work great, but not the paypal ipn 3.1.5 and ccgv 5.12 or 5.13.

 

When a user make his first order, he/she can not use the 2.50$ voucher.

Paypal IPN 3.1.5 don?t add that in the payment.

 

the ccgv checkbox is in checkout_confirmation, but paypal ipn add it not

in the process.

 

Sort order is all ok, i have all sorted out, with that, i think.

 

Netto=1

Account Ballance=2

Tax=3

Paypal fee=4

Discount Coupon=9

Voucher Coupon=740

Total=800

 

I hope anyone can help me ??

 

Thanks in advance

 

Regards

Hobbes

Share this post


Link to post
Share on other sites

hi everyone,

IMHO i believe that i have found a confusing behavior in the checkout_payment.php file.

when the users type an incorrect voucher coDe, an error message appears, which it is much more appeling since 5.13 than in the url. This also happens if no type of payment is selected.

however when the field is left empty and the user click on the redeem button nothing happens and the user goes to the checkout_confirmation.php page.

would it not be more appropIate to display an error message when the field is empty an d the user has clicked the redeem buttom? and if so, someone could point me how to do it?

thanks

regards,

unai


"Dream as if you'll live forever...

live as if you'll die today."

Share this post


Link to post
Share on other sites

Hey all, sorry to be away for a few days, but as Im sure you can understand, sometimes one has to walk away from this project for a few minutes to preserve sanity.

 

THANK YOU, Rigadin, for taking some initiative in fixing a big swathe of bugs! I think you missed my large bug though, where:

I put a $25 gift certificate in my cart

It incurrs shipping [$7.30]

I enter a discount coupon code [10%]

ERROR: osC subtracts the certificate value from the total (leaving $7.30 for shipping and no products price)

Discount of 10% is successfully taken from total [which is incorrectly now $7.30]

$7.30 - .73 = $6.57

 

WHY WHY WHY WHY WHY WHY!? ahem. sorry. ;)

ive described this in some more detail in previous posts, which anyone can get by searching for posts by me.

 

PLEASE ALLOW ME to reiterate that if someone chooses to use more than their FREE time to solve this, SOME CASH CAN BE FOUND FOR THE FIXER. Id be pleased if Rig would head a team of a couple of us, and thrilled to send some paypal cash to mister fearless leader when its done. Maybe this can jumpstart having this contrib airtight, even if just for MS2. I'm sure I'm not alone when I say that having the -newest- version of osC is much less enthralling than having a -working- version that does what i need!!

 

I can even provide a test site with logins for all the team members... whatever it takes, really. in fact id love it if anyone interested in my proposal emails me directly at alien -at- nettrip !dot! org. Go team!

 

I have fixed all what I found. But I did not read enough backward inside this thread and did not see your "easier to understand" solution, which makes quite much sense.

 

The problem I had with the checkbox not showing up was when the coupon modules has bigger sort order than the gift voucher module, so it overwrites the checkbox (I'm using v5.12 as a base).

 

I found a much complicated fix for the "unregister", which will work for all modules without modifying checkout_payment.php, but is there many modules coming? Probably not => I'll take your more simple solution into my next update.

 

For your "Anoter bug", I did not see it but will make some more tests tomorrow.

 

I'm now testing another solution for the "easier to understand" stuff by using a payment module that checks the amounts => behaves like a normal payment module => no need to make many modifications to the existing code.

 

Back tomorrow...

 

- Rigadin

Share this post


Link to post
Share on other sites
Hello Rigadin,  :)

 

great that you have fix any errors in that wonderful contrib.

 

Is that version now working with this contrib :

 

Paypal Shopping Cart IPN(1753)

 

In the old 5.12 it will not work together  :(

 

Now it does ??

 

Regards

Hobbes

 

I do not use Paypal IPN so I can't test with it. If it was not working with 5.12 it will most probably not work with 5.13 . If there is a fix to make it working with 5.12, ot will most probably work with 5.13 .

 

Curious,...

 

no i have the checkbox, but paypal shopping cart ipn don?t use the

voucher.

 

...

The checkbox appears only if the gift voucher module is enabled and has a higher sort order than the coupon module, and the customer must have a positive balance.

 

This loop is from order_total.php, from the latest 5.13 install

 

        
115 while (list(, $value) = each($this->modules)) {
116          $class = substr($value, 0, strrpos($value, '.'));
117          if ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) {
118           $use_credit_string = $GLOBALS[$class]->use_credit_amount();
119            if ($selection_string =='') $selection_string = $GLOBALS[$class]->credit_selection();
120            if ( ($use_credit_string !='' ) || ($selection_string != '') ) {
121              $output_string .=  '<tr colspan="4"><td colspan="4" width="100%">' .  tep_draw_separator('pixel_trans.gif', '100%', '10') . '</td></tr>';
122             $output_string = ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" >' . "\n" .
123                               '   <td width="10">' .  tep_draw_separator('pixel_trans.gif', '10', '1') .'</td>' .
124                               '     <td class="main"><b>' . $GLOBALS[$class]->header . '</b></td>' . $use_credit_string;
125              $output_string .= '<td width="10">' . tep_draw_separator('pixel_trans.gif', '10', '1') . '</td>';
126              $output_string .= '  </tr>' . "\n";
127              $output_string .= $selection_string;
128            }
129
130          }
131        }

 

Now, is it me being dumb  :blush: or should line 122 be ".=", not "="

 

I'd assume I was right, but the same code is in 5.12 (which I'm actually installing), and causes the Enter Voucher Code to over-ride the "Select Voucher amount" checkboxes - I'm sure that this must affect someone else!

 

Thanks

 

It has been like that before 5.12 already, I found it weird at first, but idea is to display the redeem-code box only once, even if you use coupon AND gift voucher modules. In fact only the module with highest sort order will be displayed, but as both modules are using the same box name, both modules will receive the box content (coupon code) and redeem it or not according to their own logic. The side effect is: if the coupon module is higher in sort order than the gift voucher module, there will be not be the gift voucher checkbox.

The idea of having one line to redeem both coupon and gift voucher code is, in my mind, to make the things more clear for the customer: only 1 box where to write a code, whatever it is.

 

... and another thing.

 

ot_coupon.php/credit_selection will output a 'Redeem Code' box unconditionally.

 

ot_gv.php/credit_selection outputs a 'Redeem Code' box if there are any active Gift Vouchers.

 

This means that if you have Discount Coupons and Gift Vouchers enabled, you get two identically named boxes!!?

Yes. See above. Using 2 different names would mean having 2 nearly identical lines, can be confusing for customers.

 

hi everyone,

IMHO i believe that i have found a confusing behavior in the checkout_payment.php file.

when the users type an incorrect voucher coDe, an error message appears, which it is much more appeling since 5.13 than in the url. This also happens if no type of payment is selected.

however when the field is left empty and the user click on the redeem button nothing happens and the user goes to the checkout_confirmation.php page.

would it not be more appropIate to display an error message when the field is empty an d the user has clicked the redeem buttom? and if so, someone could point me how to do it?

thanks

regards,

unai

You are right, an error should be displayed and in my opinion we should never go to checkout_confirmation when using the redeem button. This should be implemented in both the coupon and the gift voucher modules (in case only one is used). The errors are generated in function collect_posts(). Anybody to do this?

 

To alienation 2005:

No time right now to check your problem but I'll take contact soon.

 

- All right, I hope these answers help the general understanding of this popular but difficult contribution...

 

Rigadin


STS PLUS, a variation of STS, is now available.

ACA 2.0 is also out!

Share this post


Link to post
Share on other sites
It has been like that before 5.12 already, I found it weird at first, but idea is to display the redeem-code box only once, even if you use coupon AND gift voucher modules. In fact only the module with highest sort order will be displayed, but as both modules are using the same box name, both modules will receive the box content (coupon code) and redeem it or not according to their own logic. The side effect is: if the coupon module is higher in sort order than the gift voucher module, there will be not be the gift voucher checkbox.

The idea of having one line to redeem both coupon and gift voucher code is, in my mind, to make the things more clear for the customer: only 1 box where to write a code, whatever it is.

Yes. See above. Using 2 different names would mean having 2 nearly identical lines, can be confusing for customers.

 

 

Thanks for that - did I stuff up on reading the instructions?

 

Quentin

Share this post


Link to post
Share on other sites
hi everyone,

IMHO i believe that i have found a confusing behavior in the checkout_payment.php file.

when the users type an incorrect voucher coDe, an error message appears, which it is much more appeling since 5.13 than in the url. This also happens if no type of payment is selected.

however when the field is left empty and the user click on the redeem button nothing happens and the user goes to the checkout_confirmation.php page.

would it not be more appropIate to display an error message when the field is empty an d the user has clicked the redeem buttom? and if so, someone could point me how to do it?

thanks

regards,

unai

 

 

I agree, this button is acting as if it is the original CONTINUE button. Will it still work if we got rid of the original continue button and change the redeem button to button_continue.gif, then remove the box at the bottom with the original continue button and move the redeem box down there?


L8r,

PopTheTop

 

Published osC Contributions:

- eCheck Payment Module v3.1

- Reviews in Product Display v2.0

- Fancier Invoice & Packingslip v6.1

- Admin Notes / Customer Notes v2.2

- Customer Zip & State Validation v2.2

- Search Box with Dropdown Category Menu v1.0

 

Pop your camper's top today!

It's a popup thing...

You wouldn't understand

Share this post


Link to post
Share on other sites
I agree, this button is acting as if it is the original CONTINUE button. Will it still work if we got rid of the original continue button and change the redeem button to button_continue.gif, then remove the box at the bottom with the original continue button and move the redeem box down there?

 

I was thinking a bit different: having the redeem box and its button before the payment options, pressing the button will not go to checkout_confirmation but again to checkout_payment with a message like "coupon code redeemed" or "invalid coupon code" or whatever error. Once coupons are redeemed, customer can click on the "continue" button. It will not disturb if you use the "order total in payment page" contribution (is it a contribution or a mod found in the forum by the way?).

 

What about that?

 

- Rigadin


STS PLUS, a variation of STS, is now available.

ACA 2.0 is also out!

Share this post


Link to post
Share on other sites

Ok I got everything installed and for the most part everything is running great and smooth.

 

I am having only one issue.

 

When some is using the voucher balance and the amount is greater than thier voucher balance and say they choose Paypal to pay the balance remaining. It is subtracting shipping out.

 

Sub-Total: $4.50

Table Rate (Best Way): $2.00

FL TAX 6.5%: $0.29

Total: $6.79

Gift Vouchers: $5.00

 

Then continue into paypal and it shows a balance due of -.21 What setting do I need to change or line of code do I need to change to fix this?

 

I have all the module sort orders left at thier default number.

 

Thanks,

Carol

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

×