Jump to content
kgt

[Contribution] Discount Coupon Codes

Recommended Posts

Has anyone been able to get DCC to work with Paypal IPN 2.3?

 

I tried the fix for 1.4 and it does not work for my version still only passes the full amount. Works fine with my Authorize.net AIM module.

 

Or has anyone tried to get DCC to work with Paypal EC?

 

Please any help would be appreciated.

 

 

Bruce

Share this post


Link to post
Share on other sites
Please, help...

 

I got this error

 

Parse error: syntax error, unexpected T_VARIABLE in /home/***/public_html/***/oscommerce-2.2rc2a/catalog/admin/coupons_exclusions.php on line 167

 

Lines 160-170 included

 

USING( geo_zone_id )

// WHERE dc2z.coupons_id="'.$coupons_id.'"';

// $sql_all = 'SELECT gz.geo_zone_id AS id'.$display_fields.'

// FROM '.TABLE_GEO_ZONES.' gz

// %s';

// $where = 'WHERE gz.geo_zone_id NOT IN(%s) ';

 

$sql_selected = 'SELECT dc2z.geo_zone_id AS id'.$display_fields.'

FROM '.TABLE_DISCOUNT_COUPONS_TO_ZONES.' dc2z

LEFT JOIN '.TABLE_GEO

_ZONES.' gz

USING( geo_zone_id )

 

 

 

Anyone, please help...

Edited by Eowyn

Share this post


Link to post
Share on other sites

hi. thanxs for your help. anyone knows how to fix this problem?. i need to solve the same trouble

 

wenak_tenan post:

Recently i have download discount coupon module at http://www.oscommerce.com/community/contributions,4269, and install to my site successfully. Hm..it's so great , but then the problem come. I have set my discount amount to 125000. But when i check to my site, the discount amount just only 1000, what?? Then i check again to my admin control panel and edit the discount amount. I see the default max. amount is 999.999999, . I think this module has been set to USD currency default only. So i try to find to change it. But i didn't find how to change this limited amount . Any one can help me?? Because my site didn't use USD, EUR, GBP. But i use asian currencies.

Share this post


Link to post
Share on other sites

Well, I have posted all i can for some help with DCC 3.3 and IPN 1.4-2.3.4.7.

 

I have tried every combination and item and aggregate and nothing works. reviewed every post and contribution list saying anything about these two packages and can not get the discount to pass to the fields for IPN.

 

HELP Please.

 

Bruce

Share this post


Link to post
Share on other sites
Well, I have posted all i can for some help with DCC 3.3 and IPN 1.4-2.3.4.7.

 

I have tried every combination and item and aggregate and nothing works. reviewed every post and contribution list saying anything about these two packages and can not get the discount to pass to the fields for IPN.

 

HELP Please.

 

Bruce

 

From the install file:

You must edit one additional file to get discount coupon codes working with the latest versions of PayPal IPN. The following instructions are for version 2.2 of this contribution: http://www.oscommerce.com/community/contributions,2679. The exact instructions below may not work for other versions, but the changes needed are similar.

 

Otherwise I'd email/pm the author.

Share this post


Link to post
Share on other sites

Hello,

 

I love the product works great. I have a question though. I have issues when I only add in digital products to purchase. The coupon dosen't work. It works everwhere else. I searched the forums and found someone else that had the problem and tehre was a minor fix. I tried the fix, which was :

 

        //shipping zone exclusions
       $check_user_query = tep_db_query($sql = 'SELECT dc2z.geo_zone_id
                                                 FROM '.TABLE_DISCOUNT_COUPONS_TO_ZONES.' dc2z
                                                 LEFT JOIN '.TABLE_ZONES_TO_GEO_ZONES.' z2g
                                                   USING( geo_zone_id )
                                                 WHERE ( z2g.zone_id='.(int)$delivery['zone_id'].' or z2g.zone_id = 0 or z2g.zone_id IS NULL )
                                                   AND ( z2g.zone_country_id='.(int)$delivery['country_id'].' or z2g.zone_country_id = 0 )
                                                   AND dc2z.coupons_id="'.tep_db_input( $code ).'"' );

       if (tep_db_num_rows( $check_user_query ) > 0 ) {
         $this->message( ENTRY_DISCOUNT_COUPON_ERROR ); //display the error message
       //use this to debug exclusions:
         //$this->message( 'Shipping Zones exclusion check failed' );
       }
       //end shipping zone exclusions

 

But the coupon still is not working against only digital goods. If one tangible product is in the cart and a digital one, it works, but if it's just pure digital no go. Is there any advice you may give me please?

 

Thank you very much.

Share this post


Link to post
Share on other sites

Please IGNORE top post. For some reason i added another digital product and it worked. Not sure what the deal is but great stuff once again.

 

I've got one other question. In the account history information page,

 

It gets displayed like this.

 

Discount Coupon admin applied: -

$20,000.00

 

How would I go about fixing that?

 

Thank you.

Share this post


Link to post
Share on other sites
From the install file:

You must edit one additional file to get discount coupon codes working with the latest versions of PayPal IPN. The following instructions are for version 2.2 of this contribution: http://www.oscommerce.com/community/contributions,2679. The exact instructions below may not work for other versions, but the changes needed are similar.

 

Otherwise I'd email/pm the author.

 

And if you read my post, i tried version 1.4- 2.3.4.7 with the edits given in 3.33 DCC and the post about using aggregate. I did everything and tried 3 Versions of IPN and tried mimicking the checkout_process.php mods for DCC in IPN and still no go.

 

 

I need help from anyone who has successfully go these two packages to work together.

 

And i tried emailing the IPN author with no go and which do i do with DCC since it has morphed over the years?????

 

 

Bruce

Share this post


Link to post
Share on other sites

Hi all,

I have just installed version 3.3 and have worked out a few issues myself and everything seem to be working or so i thought, i did a test purchase with my free shipping code and bank deposit and all seem to work until i went to confirm checkout link and this appeared

 

Parse error: syntax error, unexpected $end in /xxxxx/xxxxxx/x/x/clothznstuff.au.com/www/checkout_confirmation.php on line 426

 

i dont have a line 426 and i dont have any spaces or blank lines after 425. i have searched through this thread and just cant find anyone with same problem.. try what i could think of but nothing has worked and have gone to most of advice links given and still nothing

 

 

please help

 

Cheers to all

Share this post


Link to post
Share on other sites

This is a great add-on..

 

What would be even better though would be to add one more discount coupon "type". Currently there is Fixed Amount, Percent Discount and Shipping Discount. I propose adding "Giftcard Amount". This would be similar to Fixed Amount, with the specifics of unlimited usage times, long code number (26 characters in my case), tracking of Gift Card "balance". It would still use the other features of Discount Coupons such as Exclusions, apply or not apply to taxes and/or shipping, start/end dates, min order amount, etc..

 

It would require code such as check_giftcard_balance > 0 and decrement balance in checkout_process

 

If anyone would like to work on this, I could help.

Share this post


Link to post
Share on other sites

Hi Folks,

 

im a facing a weird problem with this contribution. I've installed everything as described and it seems to work so far.

 

The problem is that the discount doesn't show up on the checkout_confirmation page at all. No matter what i adjust the settings to. The Order Total Modules have unique sort ids. So that shouldn't be the problem. I don't get an error message or anything, the discount just doesn't show up and isn't even calculated into the subtotal.

 

I am using RC 2.2 with the zones shipping module. My free shipping value is set to 60 Euros.

 

Coupon Codes that aren't registered get rejected with "invalid code", the way it is supposed to be. I just can't track the error down. Even if I put the module into debug mode, there's no debug code in the HTML output as it is supposed to be. The Coupon Code String is available in checkout_confirmation though.

 

Any ideas? Thanks a lot in advance.

 

Best Regards

 

Oliver

Share this post


Link to post
Share on other sites

OK. I have coded in changes to support a Gift Card type of discount, complete with balance tracking and validation.

I just need some help for the final stage which is to update the balance for the Gift Card on the checkout_process page.

 

I was figuring on adding to the end (before the closing bracket) of

 

if( tep_session_is_registered( 'coupon' ) && is_object( $order->coupon ) ) {

$sql_data_array = array( 'coupons_id' => $order->coupon->coupon['coupons_id'],

'orders_id' => $insert_id );

tep_db_perform( TABLE_DISCOUNT_COUPONS_TO_ORDERS, $sql_data_array );

}

 

section. But not sure what variables are available at this stage. I am also very new to php and the functions defined within oscommerce.

 

What needs to be done is

If entire balance was used as a discount, set new balance to 0, otherwise, if there is a balance remaning after purchase (such as total was $5 but the balance beforehand was $10), then the balance needs to be set to the difference. So the balance needs to be the previous balance-applied discount.

 

Any suggestions? Once complete, I will upload the changes necessary to the Add-Ons feed for this item.

Share this post


Link to post
Share on other sites

Quick question for KGT, or another knowledgeable DCC maven:

 

I have modded my base install of OScommerce a bit, and so followed the 'update files' instructions rather than simply replacing files. My question involves this instruction:

 

OPEN catalog/includes/classes/order.php

 

...

FIND on line 244:

 

$shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];

$this->info['subtotal'] += $shown_price;

 

REPLACE with this code:

 

//kgt - discount coupons

if( is_object( $this->coupon ) ) {

$applied_discount = 0;

$discount = $this->coupon->calculate_discount( $this->products[$index], $valid_products_count );

if( $discount['applied_discount'] > 0 ) $valid_products_count++;

$shown_price = $this->coupon->calculate_shown_price( $discount, $this->products[$index] );

$this->info['subtotal'] += $shown_price['shown_price'];

$shown_price = $shown_price['actual_shown_price'];

} else {

$shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];

$this->info['subtotal'] += $shown_price;

}

/**************

$shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];

$this->info['subtotal'] += $shown_price;

**************/

//end kgt - discount coupons

 

BUT, in my install of OScomm, the calculation for $shown_price doesn't appear until line 312, and looks like THIS instead:

 

$shown_price = $currencies->calculate_price($this->products[$index]['final_price'], $this->products[$index]['tax'], $this->products[$index]['qty']);

$this->info['subtotal'] += $shown_price;

 

...different enough that I'm VERY hesitant to replace it with the code snippet as instructed. Any guidance / have you encountered this before?

Share this post


Link to post
Share on other sites
Quick question for KGT, or another knowledgeable DCC maven:

 

I have modded my base install of OScommerce a bit, and so followed the 'update files' instructions rather than simply replacing files. My question involves this instruction:

 

OPEN catalog/includes/classes/order.php

 

...

FIND on line 244:

 

$shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];

$this->info['subtotal'] += $shown_price;

 

REPLACE with this code:

 

//kgt - discount coupons

if( is_object( $this->coupon ) ) {

$applied_discount = 0;

$discount = $this->coupon->calculate_discount( $this->products[$index], $valid_products_count );

if( $discount['applied_discount'] > 0 ) $valid_products_count++;

$shown_price = $this->coupon->calculate_shown_price( $discount, $this->products[$index] );

$this->info['subtotal'] += $shown_price['shown_price'];

$shown_price = $shown_price['actual_shown_price'];

} else {

$shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];

$this->info['subtotal'] += $shown_price;

}

/**************

$shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];

$this->info['subtotal'] += $shown_price;

**************/

//end kgt - discount coupons

 

BUT, in my install of OScomm, the calculation for $shown_price doesn't appear until line 312, and looks like THIS instead:

 

$shown_price = $currencies->calculate_price($this->products[$index]['final_price'], $this->products[$index]['tax'], $this->products[$index]['qty']);

$this->info['subtotal'] += $shown_price;

 

...different enough that I'm VERY hesitant to replace it with the code snippet as instructed. Any guidance / have you encountered this before?

 

Mine had the same code. I replaced it as with the new code and it works fine. Just be sure to back up your site before making the change.

Share this post


Link to post
Share on other sites

I have a problem, I'm far from a code expert so please be gentle. :-)

 

I have been running OSCommerce for a while on my shop without problem.

 

I only take payment through PayPal using the Standard Paypal Website Payments.

 

I have today installed Discount Coupon Codes, there doesn't seem to be any errors and I've checked the config' and I'm pretty certain it's right, it has a unique order number, is set to on (true) and I've created a discount code.

 

However, and here's the problem, I'm not getting a box appearing anywhere to put the code into on teh checkout.

 

I'm sure it's a simple problem and I'm just being an idiot, but if anyone can shed some light on it I'd be very, very grateful.

 

The site isn't particularly busy, I use it to sell a few T-shirts and fleeces: http://www.trafficgraffic.co.uk/

 

Any help much appreciated

 

Tim :(

Edited by TT Tim

Share this post


Link to post
Share on other sites
Please, help...

 

I got this error

 

Parse error: syntax error, unexpected T_VARIABLE in /home/***/public_html/***/oscommerce-2.2rc2a/catalog/admin/coupons_exclusions.php on line 167

 

 

Lines 160-170 included

 

USING( geo_zone_id )

// WHERE dc2z.coupons_id="'.$coupons_id.'"';

// $sql_all = 'SELECT gz.geo_zone_id AS id'.$display_fields.'

// FROM '.TABLE_GEO_ZONES.' gz

// %s';

// $where = 'WHERE gz.geo_zone_id NOT IN(%s) ';

 

$sql_selected = 'SELECT dc2z.geo_zone_id AS id'.$display_fields.'

FROM '.TABLE_DISCOUNT_COUPONS_TO_ZONES.' dc2z

LEFT JOIN '.TABLE_GEO

_ZONES.' gz

USING( geo_zone_id )

 

 

Anyone, please help... <_<

Edited by Eowyn

Share this post


Link to post
Share on other sites

Hello,

 

Sorry my english (I'm spanish, I use a automatic translator, sorry)

 

I want to exclude all products least 3 of them.

But If I exclude all products and click "save" does not record ... and stay on the same screen excluded products back to the window not excluded.

If I add a little and the recording is going well ... until a number of products, which does the same as what I said, just add 349 products excluded.

Any idea, please?

Share this post


Link to post
Share on other sites

hi,

 

this contribution was working great for me until i installed Onepagechekout Contribution.

 

The onepagecheckout contribution is designed to work with Credit Class and Gift Voucher Contribution but I really like the discount contribution i already installed.

 

Can anyone please help me combine the onepagecheckout with this disount coupon codes contribution?

 

any help will be great.

 

thanks

Share this post


Link to post
Share on other sites
hi,

 

this contribution was working great for me until i installed Onepagechekout Contribution.

 

The onepagecheckout contribution is designed to work with Credit Class and Gift Voucher Contribution but I really like the discount contribution i already installed.

 

Can anyone please help me combine the onepagecheckout with this disount coupon codes contribution?

 

any help will be great.

 

thanks

 

Hi Sophia, sorry I can't help, but I wanted to say thanks for raising the issue because I was about to install 1pagech myself.

 

I hope you can sort it and when you do, please advise here so we can all benefit.

Good luck.

Edited by ssnb

Share this post


Link to post
Share on other sites
I have a problem, I'm far from a code expert so please be gentle. :-)

 

I have been running OSCommerce for a while on my shop without problem.

 

I only take payment through PayPal using the Standard Paypal Website Payments.

 

I have today installed Discount Coupon Codes, there doesn't seem to be any errors and I've checked the config' and I'm pretty certain it's right, it has a unique order number, is set to on (true) and I've created a discount code.

 

However, and here's the problem, I'm not getting a box appearing anywhere to put the code into on teh checkout.

 

I'm sure it's a simple problem and I'm just being an idiot, but if anyone can shed some light on it I'd be very, very grateful.

 

The site isn't particularly busy, I use it to sell a few T-shirts and fleeces: http://www.trafficgraffic.co.uk/

 

Any help much appreciated

 

Tim :(

 

 

 

Hi Tim

 

1) Have you installed the " kgt - discount coupons" code in the checkout_payment.php file?

 

2) Which version of discount code contribution are you using?

 

3) There might also be a conflict if you have installed any other contributions on checkout_payment.php page, so let us know if you have.

 

Sol

Share this post


Link to post
Share on other sites

had a fully functional contribution now when we try the coupon admin we get the following error Fatal error: Cannot redeclare class currencies in /home/hsphere/local/home/doorstep/********.co.uk/admin/includes/classes/currencies.php on line 16 Can some one point me in the right direction please

Share this post


Link to post
Share on other sites

Hi great mod but when i went to uninstall this is has now messed up the moduls page in admin Order Total

 

MODULE_ORDER_TOTAL_DISCOUNT_COUPON_TITLE

 

is this there i reuploaded my orig file but its still there i get error

 

Warning: include/includes/languages/english/modules/order_total/ot_discount_coupon.php) [function.include]: failed to open stream: No such file or directory in admin/modules.php on line 128

 

Warning: include() [function.include]: Failed opening /includes/languages/english/modules/order_total/ot_discount_coupon.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php:/usr/local/lib/php/Zend:/usr/local/src/ZendFramework-1.0.3/library') in /home/thedat24/public_html/admin/modules.php on line 128

 

at the top how can i get rid of all this please ?

 

Thank you

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

×