Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Discount Coupon Codes


kgt

Recommended Posts

The developer of this contribution was able to tell by the readouts on the debug messages where there was a problem. Some of them are obvious and can at least show you how far your script is getting before a problem happens so you know where in the code to look to try and find why that problem is happening.

 

I haven't used the debug through admin, I manually enter the php to print the results to see what they script is doing. Those print in the source code of whatever page you have the script on (typically at the very bottom of the source code).

 

For example, in my catalog/checkout_confirmation.php I can put

<?php 
echo '<!--DEBUG';
echo '<pre>Object order is: ';
print_r($order);
echo '</pre>';
echo'-->';
?>

 

Then you go through your site as a customer, place an order and when you get to the checkout confirmation page, view your source code to see what you have inside <!--DEBUG <pre> </pre>--> tags. It may help show you what is or is not functioning so you know what part of code to review.

 

If I remember correctly, DCC isn't supposed to function with debug turned on (I don't remember for positive though)so you might try with it turned off as well as on and see if you get different results.

 

Thanks, I'll try that.

 

Though I'd rather know WHY the problem exists, instead of just mindlessly fixing it. Can anyone explain the debugging messages and how to view them?

~Tracy
 

Link to comment
Share on other sites

Thanks VERY much, problem solved - as usual it was user error. I had some specials going on and there is a DCC option about excluding products with specials.

 

The IMPORTANT thing though is that I learned something, most importantly about debugging, and thanks for taking the time!

Link to comment
Share on other sites

The developer of this contribution was able to tell by the readouts on the debug messages where there was a problem. Some of them are obvious and can at least show you how far your script is getting before a problem happens so you know where in the code to look to try and find why that problem is happening.

 

I haven't used the debug through admin, I manually enter the php to print the results to see what they script is doing. Those print in the source code of whatever page you have the script on (typically at the very bottom of the source code).

 

For example, in my catalog/checkout_confirmation.php I can put

<?php 
echo '<!--DEBUG';
echo '<pre>Object order is: ';
print_r($order);
echo '</pre>';
echo'-->';
?>

 

Then you go through your site as a customer, place an order and when you get to the checkout confirmation page, view your source code to see what you have inside <!--DEBUG <pre> </pre>--> tags. It may help show you what is or is not functioning so you know what part of code to review.

 

If I remember correctly, DCC isn't supposed to function with debug turned on (I don't remember for positive though)so you might try with it turned off as well as on and see if you get different results.

 

Awesome Tracy..... Does it matter where this code is placed? I see that you mention the results will be near the

bottom, so should this debug code also go towards the bottome or does it not matter?

 

Thanks for taking the time to give advice on issues..... :thumbsup:

Link to comment
Share on other sites

I have it just after the closing html tag (</html>)

 

You can also put it on different pages based on where you are having difficulties and you can "print" different things based on what's giving you problems.

 

Awesome Tracy..... Does it matter where this code is placed? I see that you mention the results will be near the

bottom, so should this debug code also go towards the bottome or does it not matter?

 

Thanks for taking the time to give advice on issues..... :thumbsup:

~Tracy
 

Link to comment
Share on other sites

I have it just after the closing html tag (</html>)

 

You can also put it on different pages based on where you are having difficulties and you can "print" different things based on what's giving you problems.

 

Thanks for your time....Much appreciated.........

Link to comment
Share on other sites

A follow-up to my post above.

 

I have followed the uninstall proceedures and edited all my changed .php files and deleted all the new .php

 

I'm still getting the 404 error when I go to http://www.xxxx.com/store/admin

 

Any suggestions?

 

Thank you,

 

Brian

 

 

 

i had the same problem - turns out the some of admin include files dont have all the same constants they should have

in this case i found in /admin/include/filenames.php was missing some parameters so took an original file and copied the relevant constants from the contribution same file

then reuploaded and it worked

 

think the best thing to do is check filenames.php and database_tables.php and make sure they have all the constants

 

 

Thank you. I installed two new files (filenames.php and database_tables.php) and was able to login.

Link to comment
Share on other sites

Like others, I also had a problem with an extra cent being added to the total.

 

I solved it like this:

 

On includes/classes/discount_coupon.php i added the line on bold

 

function finalize_discount( $info ) {

 

...

 

foreach( $this->applied_discount as $discount ) {

$discount = ceil($discount * 100) / 100;

$info['total'] -= $discount;

if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG == 'true' ) $this->message( 'INFO: Discount of '.$discount.' applied to order total.', 'debug' );

}

...

 

I noticed that the amount being discounted had 3 decimal places, so it conflicted on the calculation of the final price.

 

Let me know what you think.

 

Regards and thanks for this great contribution,

 

floydax

Link to comment
Share on other sites

Did you install the Paypal addon ?

 

I have PayPal Express Checkout Version: 1.2, API Version: 60.0.

 

When I go to paypal the discount is not showing.

 

Has anyone got this addon working with the above version of paypal express.

~Tracy
 

Link to comment
Share on other sites

Hi I just installed this Contribution but when I wnt to the admin catalog there is no discount coupon listed, the only things that are in there are

Categories/Products

Products Attributes

Manufacturers

Reviews

Specials

Products Expected

 

No Discount coupon what do you this I didwrong and how shall I fix it

Cheers

Stan

Link to comment
Share on other sites

Hi I just installed this Contribution but when I wnt to the admin catalog there is no discount coupon listed, the only things that are in there are

Categories/Products

Products Attributes

Manufacturers

Reviews

Specials

Products Expected

 

No Discount coupon what do you this I didwrong and how shall I fix it

Cheers

Stan

 

Make sure you followed the instructions perfectly. Recheck and make sure all the

proper files are in your Admin/folder per instructions. If so, refresh your browser,

could be a cache issue.

Link to comment
Share on other sites

I pay have the papal payment module install but is there a paypal addon I need to install for this addon?

Cheer Stan

 

This mod can work with any type of payment process. No need to add more.....

Suggestion*** Make sure your payment module works prior to installing Coupons mod...

Link to comment
Share on other sites

Free shipping or discounted shipping for individually defined products and categories.

 

When adding a specific product for a discount on or free shipping, I found at check out that it gives the discount for all shipping even those items you did not want it for. Hense, the customer selects the item with free shipping and then another that is not discounted shipping but all shipping becomes discounted.

 

Is there a fix or is it a glitch?

 

Charles

Link to comment
Share on other sites

Hi,

 

Installed the Discount Coupons contribution http://www.oscommerc...y/contributions,4269

 

Ok this is what is happening, when coupon is set to unlimited all working fine

 

BUT when coupon Max use limit is set and the limit has has been used the checkout_paymant page redirects to login page (even if customer is logged in) instead of showing error

 

please help, any suggestions ?????

 

Cheers

Edited by Shadow2010
Link to comment
Share on other sites

Hey i use friendly pricing which kidna conflicts on checkout showing the wrong price.

 

ON catalog/includes/classes/order.php

 

i use this to calculate the price

 

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

 

which i have this

 

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'] * tep_friendly_pricing($this->products[$index]['fr_currencies_id']);

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

}

 

 

although it doesnt work obviously coz of this

 

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

 

using that custom function, i cant seem to get it to calculate this to the formula too * tep_friendly_pricing($this->products[$index]

 

any pointers please?

Link to comment
Share on other sites

ended up removing your function to calculate to this

 

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'];

$shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'] * tep_friendly_pricing($this->products[$index]['fr_currencies_id'])- ( $discount['applied_discount'] + $discount['discount_tax'] );

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

} else {

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

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

}

 

 

would this be bad for anything? seems to be working though

Link to comment
Share on other sites

Hi,

 

I've just installed this contribution, and enabled it from the admin area.

 

But there is no option for me to enter the voucher code and also there is a problem with the counting of items in the shopping cart.

 

I used a template from templatemonster to build my website and installed this contribution as a fresh install, did I do right?

Or should I have changed each file manually.

My website: www.themp4.com

 

Thanks

Link to comment
Share on other sites

Hello,

 

I've just restored the full website and DB.

 

 

 

Then I manually changed each file and uploaded and also updated DB.

 

But now after installed the module, its not showing in the catalog list.

 

Is the listing of the discount tab under catalog determined by the files updated or the database tables?

 

Thanks

Link to comment
Share on other sites

Anyway to add a note on check out confirmation page to indicate that a particular item did have the discount code applied to it.

In other words, when a shopper uses a code for an item that the coupon may be applied to AND purchases an item the coupon may NOT be applied to.

ALSO

When a shopper checkouts an item that the coupon does not work on, there is no note to them that they can not use that coupon on that item, just goes to check out and no discount applied.

 

Is there a different way to implement this say through the product info as for the notice on coupons? That would be to catalog management heavy.

 

 

coupon_changes.jpg.

Great Contribution!

Thanks,

Rick H...

Edited by rickharr
Link to comment
Share on other sites

Great contributition that I nearly have have fully working.

 

I'm using Discount Codes with Pay Pal and it seems to be processing all orders correctly but the orders are not being recorded in Number Used.

 

Does anyone know what the problem may be as I have checked all suggestions I can find and everything seems in order? the Number Used are recorded fine if I use a different payment provider.

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