Jump to content
Sign in to follow this  
Ian

[Contribution] Credit Class/Gift voucher/Discount Coupon v5

Recommended Posts

Hi Ian,

you have done a great job!

 

One suggestion:

to make the installation/upgrade easier, it would be easier to find GV-files if you prefix them with "gv_". For example instead of "add_application_top.php" name the file "gv_add_application_top.php".

 

My 2-cents.

 

/Fred

Share this post


Link to post
Share on other sites

Fred,

 

The idea about ading the gv to the files is good. Especially for add_application_top and add_english. I have a number of contributions and it would be better to distinguish them.


Trust me, I'm an Accountant.

Share this post


Link to post
Share on other sites

Everyone,

 

There's some weird **** going on here. I'm sure it's php 4.3. related. On my test site when I go to checkout for some reason I get a 9 in the comments box.

 

My brain is turning to mush. Is this just my installation. Is anyone else with php 4.3.x getting the same effect.

 

Help?


Trust me, I'm an Accountant.

Share this post


Link to post
Share on other sites
Everyone,

 

There's some weird **** going on here. I'm sure it's php 4.3. related. On my test site when I go to checkout for some reason I get a 9 in the comments box.

 

My brain is turning to mush. Is this just my installation. Is anyone else with php 4.3.x getting the same effect.

 

Help?

 

I have 4.3.1 and I get a 1 -Maybe its a ghost?

 

Warren

Share this post


Link to post
Share on other sites

Hey Ian!

 

Hopefully you can help ne out here

 

 

whenever a customer enters a coupon code...ithey get this on checkout...

 

Sub-Total: $64.00

Sales Tax: $5.28

United Parcel Service (1 x 13lbs) (Standard Ground): $8.31

Discount Coupon:M03-2003: $5.00

Total: $71.98

 

 

how the HECK does that add up?

 

Can someone please help?

Share this post


Link to post
Share on other sites

Shouldn't the discount coupon be applied before the tax?

 

The math is definitely wrong though.


"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Share this post


Link to post
Share on other sites

Ian,

I am not sure if I am doing something wrong here .....

 

I want reward new customers with a d.c. worth say $10, I have added a "New customer discount coupon" in coupon admin. The d.c. configured with "Uses per Coupon = 0" (actually I left it blank) and "Uses per Customer = 1". This means that a customer may use the coupon 1 time and the coupon itself may be used unlimited times. Wright?

 

Everything is working OK but when a customer is trying to use the coupon a second time this message is displayed "You have used the coupon the maximum number of times allowed per customer. times." in red. The text is somewhat wrong.

 

In file "ot_coupon.php" you are using $coupon_result['uses_coupon'] to check number of times the coupon have been used etc and since $coupon_result['uses_coupon'] is 0 displayed as the empty string.

 

I can change this myself but I just want to let you know that the error message is malformated.

 

/Fred

Share this post


Link to post
Share on other sites

I just want to add that to fix the error message:

 

in "ot_coupon.php"

change:

...

if (tep_db_num_rows($coupon_count_customer)>=$coupon_result['uses_per_user'] && $coupon_result['uses_per_user'] > 0) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_INVALID_USES_USER_COUPON . $coupon_result['uses_coupon'] . TIMES ), 'SSL'));

}

...to:

...

if (tep_db_num_rows($coupon_count_customer)>=$coupon_result['uses_per_user'] && $coupon_result['uses_per_user'] > 0) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_INVALID_USES_USER_COUPON . $coupon_result['uses_per_user'] . TIMES ), 'SSL'));

}

...

 

-> use field 'uses_per_user' instead of 'uses_coupon'.

 

/Fred

Share this post


Link to post
Share on other sites

I just noticed that after a user logs off, the gift voucer or discount coupon is still "available" in the shopping cart box.

 

You may have a reason for this. I added thses lines in "logoff.php":

 

//ICW - logout -> unregister GIFT VOUCHER sessions

tep_session_unregister('gv_id');

tep_session_unregister('cc_id');

//ICW - logout -> unregister GIFT VOUCHER sessions

 

to unregister the gift voucher/d.c. session vars at log out.

 

 

Another thing, in shopping_cart.php I had to change "java script:couponpopupWindow" to "java script:popupWindow" and to add a java script function "function popupWindow(url)" in order to get the popup to work. The popup function "function popupWindow(url)" is defined in some pages but not all -> do popup is not working everywhere (checkout_payment.php and checkout_confirmation.php)

 

/Fred

Share this post


Link to post
Share on other sites

Hi Fred,

 

I have been testing the discount coupon contribution and have been getting strange result. Would mind telling the following regarding your test:

 

1. Are the orders purchased with the discount coupon showing up in the admin/ orders section and does the amount reflect the discount amount.

 

2. Does the reports show the correct times the discount coupon was used.

 

Your feedback would be most appreciated.

 

Regards

Share this post


Link to post
Share on other sites

Hi George,

 

1) yes, the orders are showing up in the admin/orders section with the correct order total (i.e discount included). I just tried to buy a product $25, shipping $5, then I had coupon for $15 -> a total of $15, that's exactly what admin/orders is showing.

 

2) if you mean Coupon Admin/Voucher Report, yes it's showing a record for each time a coupon has been used and the summary (redemtions) for a selected coupon is showing correct.

 

I've installed GV 5.02 on a MS1 release of OCS.

 

/Fred

Share this post


Link to post
Share on other sites

Hi Ian,

a quick question for you. During the checkout process (checkout_payment) in the redemption box just beneath payment selection box I have only one input box and one title even though I have switched both Discount Coupon and Gift Vouchers on in the admin/modules/order total. Does it matter which one you turn on?

 

The title of the input box is from either the Gift Voucher module or the Discount module, depending on the sort order. If you have both GV and DC -> you need to choose "general" title otherwise the customer may be confused. The customer have a Discount Coupon code to be entered but the title in the redemtion box says "Gift Voucher", that may be confusing?

 

I may be missing something here? Probably!? ;)

 

/Fred

Share this post


Link to post
Share on other sites

Hi Guys, it took me a while to scan through this long thread, I have the MS1 shop and the 5.02 version installed from freshh (First time) However, for some reason, I do not get the option to spend the voucher, even though I have redeemed it and its showing in the shopping cart info box.

 

I just do not see anything about gift vouchers etc in the payment screen, does any one have a site with it installed where I can see this?

 

 

Thanks in advance

 

AO

Share this post


Link to post
Share on other sites

I think maybe the install file is missing something or it does not work with MS1? I have reinstalled this 4 times now, even on a fresh shop install downloaded today.

 

Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help - Help :)

Share this post


Link to post
Share on other sites

i'm still getting the problem where it skips past my shipping options page after i install this contrib.

 

the only other addon i have installed is the paypal ipn contrib.


<< threeOHsix(dot)org

Share this post


Link to post
Share on other sites

i?ve got the same problem.

normally after adding products to my shoppingcard, an click on checkout have to bring me to checkout_shipping.php.

but checkout_payment.php is shown.

 

also on checkout_confirmation.php are no information about shipping.

 

who can help??

Share this post


Link to post
Share on other sites
Hi Guys, it took me a while to scan through this long thread, I have the MS1 shop and the 5.02 version installed from freshh (First time) However, for some reason, I do not get the option to spend the voucher, even though I have redeemed it and its showing in the shopping cart info box.  

 

I just do not see anything about gift vouchers etc in the payment screen, does any one have a site with it installed where I can see this?

 

Maybe a silly suggestion but is the GV module turn on? Please make sure that the GV module is activated in admin/modules/order total.

 

/Fred

Share this post


Link to post
Share on other sites
i'm still getting the problem where it skips past my shipping options page after i install this contrib.  

 

the only other addon i have installed is the paypal ipn contrib.

 

Which contribution did you install first? Paypal IPN or GV? I am using MS1 and GV with success. Right now I am not using Paypal IPN but I will install it soon (today I think), I will let you know how things are progressing.

 

BTW, I tried to use MS1 and GV module with the Paypal module which is included with MS1, then everything is working smooth. All pages in the checkout process are shown correctly (shipping -> payment -> confirmation -> paypal).

 

/Fred

Share this post


Link to post
Share on other sites

The problem with skipping past the shipping page is caused by a modification to the get_content_type code to stop shipping being charged on GV.

 

To fix

 

In checkout_shipping.php around line 55 change the code as per the

details below

 

 if (($order->content_type == 'virtual') || ($order->content_type == 'virtual_weight') ) {

   if (!tep_session_is_registered('shipping')) tep_session_register('shipping');

   $shipping = false;

// ICW CREDIT CLASS GV AMENDED LINE BELOW

//    $sendto = false;

   if ($order->content_type != 'virtual_weight') $sendto = false;

   tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

 }


Trust me, I'm an Accountant.

Share this post


Link to post
Share on other sites

Fred,

 

Thanks for all of the feedback. You are right, only one redeem box appears even if you have both systems enabled.

 

I did this to save space and hopefully be less confusing. Although you are right that the text that appears needs to be the same for both systems.


Trust me, I'm an Accountant.

Share this post


Link to post
Share on other sites
The problem with skipping past the shipping page is caused by a modification to the get_content_type  code to stop shipping being charged  on GV.

 

To fix

 

In checkout_shipping.php around line 55 change the code as per the  

details below  

 

 if (($order->content_type == 'virtual') || ($order->content_type == 'virtual_weight') ) {

   if (!tep_session_is_registered('shipping')) tep_session_register('shipping');

   $shipping = false;

// ICW CREDIT CLASS GV AMENDED LINE BELOW

//    $sendto = false;

   if ($order->content_type != 'virtual_weight') $sendto = false;

   tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

 }

 

I think, I?ve found the problem.

it is the definition of "virtual" in the modifikation to the get_content_type code.

If in the products-details are no weight, the get_content_type code interpret the product as a virtual product and checkout_shipping.php will skip and you will be forwarded to checkout_payment.pfp.

so, weight for products is a must!!!

 

hope, everbody understands my bad english :oops:

if not, ask me, then i will try to explain it in an other way.

 

@ Ian, thanx for this great contribution and your fast support!!!!

Share this post


Link to post
Share on other sites

Ian, are you working on any other fixes for this contribution (e.g. final price calculation, etc.) for items mentioned in this forum and that you have found in testing?

 

If so, do you have an idea on when the changes will be completed and uploaded?


"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Share this post


Link to post
Share on other sites

A minor item that also needs to be corrected, is in the admin/includes/languages/[language]/coupon_admin.php file, the definition for Free Ship Help needs to be changed to:

define('COUPON_FREE_SHIP_HELP', 'The coupon gives free shipping on an order. Note. This overrides the coupon_amount figure but respects the minimum order value');

the difference is that shipping and overrides are spelled correctly.


"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Share this post


Link to post
Share on other sites

In addition to the above, a definition for No Free Shipping needs to be added.

define('TEXT_NO_FREE_SHIPPING', 'No free shipping');


"Great spirits have always found violent opposition from mediocre minds. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - A. Einstein

Share this post


Link to post
Share on other sites

First,

 

Ignore my fix above, fingers in action before brain :oops:

 

Jim,.

 

yes, almost all fixes are in place now. The get_order_total bug is what I'm working on now.

I'm also making the install/use instructions a bit 'meatier'.

 

Hopefully, have everything done by tommorrow.


Trust me, I'm an Accountant.

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
Sign in to follow this  

×