Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[CONTRIBUTION] CCGV (trad)


Vger

Recommended Posts

3) I note that when a customer tries to use a coupon that is not valid for that item (ie: you have set valid only options for this coupon and the user is trying to use it on something that it doesnt cover), whilst this works, there is no warning message that shows on the final confirmation page that lets the user know that the coupon wasnt valid - not a biggy but is probably a bit confusing for the end user.

 

 

I believe I have found the reason for this. It is because in includes/modules/ot_coupon.php errors are checked in the function

function collect_posts() {

 

In there there is no actual check for the coupon being valid for the category or product.

 

The fields are retrieved from the DB

 

// get some info from the coupon table

 

$coupon_query=tep_db_query("select coupon_id, coupon_amount, coupon_type, coupon_minimum_order,uses_per_coupon, uses_per_user, restrict_to_products,restrict_to_categories from " . TABLE_TRAD_COUPONS . " where coupon_code='".$HTTP_POST_VARS['gv_redeem_code']."' and coupon_active='Y'");

 

$coupon_result=tep_db_fetch_array($coupon_query);

 

But there are only checks for :

ERROR_NO_INVALID_REDEEM_COUPON

ERROR_INVALID_STARTDATE_COUPON

ERROR_INVALID_FINISDATE_COUPON

ERROR_INVALID_USES_COUPON

ERROR_INVALID_USES_USER_COUPON

 

Checking if the coupon is valid for the product or category happens further down, and there is no error string generated if the coupon cannot be used.

 

Even if redirect back to the checkout_payment.php page cannot be made (as is the case with the errors list above), it would be good to have an error or warning on the checkout_confirmation page that the coupon could not be used.

 

I added the following to ot_coupon.php in the collect_posts function. I am still testing it, on the surface it appears to be working

 

function collect_posts() {

 

global $HTTP_POST_VARS, $customer_id, $currencies, $cc_id, $order; //MB added $order in order to check for category and product validity

 

if ($HTTP_POST_VARS['gv_redeem_code']) {

 

 

 

// get some info from the coupon table

 

$coupon_query=tep_db_query("select coupon_id, coupon_amount, coupon_type, coupon_minimum_order,uses_per_coupon, uses_per_user, restrict_to_products,restrict_to_categories from " . TABLE_TRAD_COUPONS . " where coupon_code='".$HTTP_POST_VARS['gv_redeem_code']."' and coupon_active='Y'");

 

$coupon_result=tep_db_fetch_array($coupon_query);

 

//MB: Check if coupon is valid for products or categories

 

if ($coupon_result['restrict_to_products'] || $coupon_result['restrict_to_categories']) {

 

for ($i=0; $i<sizeof($order->products); $i++) {

 

if ($coupon_result['restrict_to_products']) {

 

$pr_ids = split("[,]", $coupon_result['restrict_to_products']);

 

for ($ii = 0; $ii < count($pr_ids); $ii++) {

 

if ($pr_ids[$ii] == tep_get_prid($order->products[$i]['id'])) {

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode('This coupon is not valid on this product'), 'SSL')); //MB:

 

}

 

}

 

} else {

 

$cat_ids = split("[,]", $coupon_result['restrict_to_categories']);

 

for ($i=0; $i<sizeof($order->products); $i++) {

 

$my_path = tep_get_product_path(tep_get_prid($order->products[$i]['id']));

 

$sub_cat_ids = split("[_]", $my_path);

 

for ($iii = 0; $iii < count($sub_cat_ids); $iii++) {

 

for ($ii = 0; $ii < count($cat_ids); $ii++) {

 

if ($sub_cat_ids[$iii] == $cat_ids[$ii]) {

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode('This coupon is not valid on this category'), 'SSL')); //MB:

}

 

}

 

}

 

}

 

} // end else

 

}// end for

}// end if

// MB end

Link to comment
Share on other sites

please note i have an older version of ccgv installed on my store.

 

This forum is for CCGV(trad) only and not for the original CCGV module. Please post in their support thread and stop making multiple posts here.

 

Vger

Link to comment
Share on other sites

Hi,

 

Just a quick question: Is there a way to delete the sent vouchers in the admin control panel?

 

While testing the system I sent several test vouchers out but realized that there isn't a delete button for that section. I would like to clear up the list before sending actual vouchers so that it would be easier to track them.

 

I'm not sure if this problem have already been addressed here. I tried reading through the past posts but there are just too many of them.

 

Would appreciate any help in this matter.

 

Apart from this little 'problem' the contribution has been working fine throughout the testing stage. Note of thanks to vger for taking the time and effort to put this together. :thumbsup:

 

cheers!

:)

Link to comment
Share on other sites

No, there isn't currently a way to delete Sent Gift Vouchers other than via phpMyAdmin.

 

Vger

 

 

Hmm.. I see.... is it tricky to delete it via phpMyAdmin? I'm not very familiar with it and I don't want to screw anything up on accident.

 

Thanks for your help.

 

 

:)

Link to comment
Share on other sites

Hmm.. I see.... is it tricky to delete it via phpMyAdmin? I'm not very familiar with it and I don't want to screw anything up on accident.

 

Thanks for your help.

:)

 

Wheneve you are working with data, BACKUP before proceeding!

 

If you have access to phpMyAdmin, it's simple.

1. If you have more than one database, choose the one you want to work on in the "Database" drop down menu in the left column (e.g. _osc1 (55). This will open all the tables in that database.

2. Scroll down until you see your "coupons" table listings. There should be six in total. Click the small box (browse) to the left of "coupon_email-track". This will open the data you are looking for.

3. If you want to erase ALL entrys, click "Empty" (it's red with a garbage can icon) at the top of the main window. DO NOT CLICK "DROP" as this will delete the table itself.

 

4. You can follow the same procedure for all the other coupon tables, if you want to erase ALL test data.

 

5. If you just want to delete a single row of data, in the left column, click the small box (browse) to the left of the table you want to work on, and in the main window, click the RED "X" (delete) at the left of the row of data you want to get rid of.

 

6. If you want to delete several (but not all) rows, put a check mark in the selection box to the far left of each unwanted row, and click the RED "X" at the BOTTOM of the row table.

 

Hope this helps.

Link to comment
Share on other sites

I have created a Welcome Discount Coupon in Coupon Admin for 10% off any order over $50. I added the code to the "My Store" Welcome Discount Coupon Code"

 

I created a new account, and was sent the code. I used it and it works. But I then logged in under an old user name, and used the same code, and was also able to get the 10% off. I thought this had functionality to be useable only to "new" customers.

 

Am I doing something wrong, or is the code open to be used by all registered customers?

 

I know you can restrict it to uses per customer, and total uses. But I wanted to off this discount as an incentive to bring new customers in, not to be used by all current customers. My current customer base is very networked, and I know they will share the code in an attempt to get a deal.

Link to comment
Share on other sites

ok so here is the deal... had this coupon up and running, was installing the option type attribute contrib messed up bad had to revert back to before the ccgv was installed. Sence then I have not been able to get this contrib to work. It works fine on the admin side (e-mail, create, edite etc.) but the redeem box does not show up. I have double and triple checked the install the only thing i'm not sure about would be the sql part. When I reinstalled the database entries were still there from the previous install, so I searched coupon in phpmyadmin and deleted all of them and re ran the sql file (no errors on reinstall). Still the redeem box is not seen, does anyone know if the sql side controlls the apperance of the reedeem box?

 

if the sql part is not the problem anyone know of any current conflicts between ccgv and option type attribute?

 

any suggestions where to check for overlooked errors would be great! thanks

Link to comment
Share on other sites

I added this contribution to my store (great contribution by the way!) And all seems fine to me, however when I had a customer go to Paypal to make payment they encountered an error. She said that a note popped up that the transaction could not be completed and to contact the website owner.

She had used a dicsount coupon (for 20% off the order total) that I sent out to my newsletter subscribers. I am using the Paypal IPN module by Terra.

I read in this thread that the CCGV (Trad) works with Paypal IPN up to terra contribution so I am not sure why the erroe occurred. Any thoughts or suggestions are welcome. I was not able to go to paypal to check this out myself because, of course, I have my own paypal account and it won't let me pay myself. Tried Paypal's sandbox but still can't figure out what the error might be, thought someone here may know more about what is causing the problem.

Oh, I did change the way the info is sent to paypal- as one item and not aggregate.

Thanks a bunch!

Pattie

Link to comment
Share on other sites

My computer hung up an when it came back up- this post appeared many times. Sorry for this...how to delete a post???

Edited by pattie1970
Link to comment
Share on other sites

nobody?? really?? i decided the sql install is correct and there are only a handfull of files that are altered by both contributions, neither seem to be even in the same areas in the code and I have double checked both for errors and found none. someone please give me a hand on this. the website is http://www.quadcover.com

Have you inserted the image file for the button? I know that I didn't get the block with the red x when I didn't have the image in the right place. Once I added the image and then clicked refresh on the browser, then the redeem box appeared.

Also, double check the checkout_payment.php page where the info for that page is called up. In the instructions it says that there were several changes to this file and to either upload what they supply or check the one supplied to see what changes were made so you can update your own file. I think there are three codes changes in the checkout_payment.php file.

I want to say that things finally looked okay after I sent a discount coupon to my test cart? I know I had the same concern as you did when I uploaded mine and one of the three things above is what fixed it. Sorry I can't give more specifics because I know I did all the above, just can't remember which one was the key to fixing it.

:blush:

Pattie

Link to comment
Share on other sites

You must use the 'Aggregate' setting when using the osCommerce Pay Pal IPN module with CCGV(trad), you can't use the 'Individual Items' setting.

 

Also the latest versions of the osCommerce Pay Pal IPN by Terra are not yet compatible with CCGV(trad). The early update to the osCommerce Pay Pal IPN module by Terra is.

 

Vger

Link to comment
Share on other sites

You must use the 'Aggregate' setting when using the osCommerce Pay Pal IPN module with CCGV(trad), you can't use the 'Individual Items' setting.

 

Also the latest versions of the osCommerce Pay Pal IPN by Terra are not yet compatible with CCGV(trad). The early update to the osCommerce Pay Pal IPN module by Terra is.

 

Vger

As always, you come to the rescue. I will get the earlier Paypal Ipn to fix this. I did get the Paypal Sandbox to work and the problem showed:

This invoice has already been paid. For more information, please contact the merchant.

But I had noticed when looking at the paypal_ipn.php file that the one I had didn't quite match the one from Terra's download & didn't have the exact code mentioned in the CCGV(trad) fix for it. Hmmmm, must be trying to work when I should be going to bed.

I did remember to change to aggregate. Thanks for the help and the fast reply- I love this contribution!

Pattie

Link to comment
Share on other sites

Okay, I did go back and change the version of the Paypal IPN to terra's earliest one (osCommerce PayPal IPN Module v1.0 For 2.2MS2 dated 21 May 2006 by Terra) . I have my conf. set to aggregate. When I use a coupon on Paypal's sandbox- works like a charm. Everything is okay.

When I DO NOT use a coupon I am still getting the message "Invoice already paid. Please contact merchant."

Any idea where the problem might be or is this something I should ask on the Paypal Ipn thread? Everything else about the vouchers and coupons seems to run smoothly. I can issue them, redeem them, etc.

Just gotta get Paypal to function right with it.

Thanks soooo much for you help!

Pattie

Link to comment
Share on other sites

Okay, I did go back and change the version of the Paypal IPN to terra's earliest one (osCommerce PayPal IPN Module v1.0 For 2.2MS2 dated 21 May 2006 by Terra) . I have my conf. set to aggregate. When I use a coupon on Paypal's sandbox- works like a charm. Everything is okay.

When I DO NOT use a coupon I am still getting the message "Invoice already paid. Please contact merchant."

Any idea where the problem might be or is this something I should ask on the Paypal Ipn thread? Everything else about the vouchers and coupons seems to run smoothly. I can issue them, redeem them, etc.

Just gotta get Paypal to function right with it.

Thanks soooo much for you help!

Pattie

I feel like saying Duh! I now see where Terra's version 1.3 does have install instructions to integrate with the CCGV(Trad). I will again change to that version. Boy, I feel real stupid for not reading the notes attached to them.... Thanks!

Pattie

Link to comment
Share on other sites

"Invoice already paid. Please contact merchant."

Just in case anyone else comes to this thread and sees this message- it is addressed in the Paypal IPN 1.3 version in the help files and the fix does work (this problem had nothing to do with the CCGV(Trad) contribution- it was a Paypal IPN problem).

Thanks!

Pattie

Link to comment
Share on other sites

Hi all,

 

I am trying to build a contrib that uses CCGV. It's a sponsorship contrib. Godfathers are rewarded when a godson make an order.

I would like to know how I can build a batch that create and send a coupon nightly.

 

what function have I to call, what are the arguments. A sample script would make me super happy.

 

Thanks in advance,

Link to comment
Share on other sites

This forum thread only deals with issues relating to installing and configuring CCGV(trad). From what I can see your post has nothing directly to do with that, so please post your topic somewhere more suitable.

 

Vger

Hi all,

 

I am trying to build a contrib that uses CCGV. It's a sponsorship contrib. Godfathers are rewarded when a godson make an order.

I would like to know how I can build a batch that create and send a coupon nightly.

 

what function have I to call, what are the arguments. A sample script would make me super happy.

 

Thanks in advance,

Link to comment
Share on other sites

Just loaded this contribution, ran into a few problems getting it right. I know thats because I dont know coding, but wanted to say thanks! It's a great contribution.

 

George

Link to comment
Share on other sites

Ok, so let me reformulate my question because maybe I wasn't clear (I use CCGV(trad) of course !).

What is the code to generate a coupon automatically ?

 

If it doesn't fit this thread, so please tell where to post, is there any CCGV(trad) dev thread ?

 

Thanks in advance,

 

This forum thread only deals with issues relating to installing and configuring CCGV(trad). From what I can see your post has nothing directly to do with that, so please post your topic somewhere more suitable.

 

Vger

Link to comment
Share on other sites

1. There is no code that generates a coupon "automatically" - they have to be set up manually from within your osCommerce admin panel.

 

2. There is no "dev" thread for CCGV(trad) because I do all of the development - which prevents it from getting into the mess that CCGV has become - where everyone and their auntie thinks they can improve that contribution.

 

3. What you want is a highly specialised offshoot of CCGV(trad), and that is never going to be part of the core code. You'd need to pay a professional developer to rewrite the codebase for you.

 

Vger

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.
Note: Your post will require moderator approval before it will be visible.

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