Jump to content
Sign in to follow this  
Shane N

Credit Class/Gift Voucher Problems

Recommended Posts

I created a coupon that will take off 20% off a product in a category. The coupon works on 2 out of 3 items in the category. Why wouldn't it work on the 3rd? Bug?

 

Also, when I try the new update from today (May 18th), there are some new defined variables that aren't working. For example, I get "MODULE_ORDER_TOTAL_COUPON_TEXT_ERROR" instead of the actual error text. Also, it says that it successfully applied a coupon, but the text doesn't say which one. It says something along the lines of "You successfully redeemed the coupon ".... and it looks it like should say which coupon. Am I right? If so, what do I need to do to get that to work?

 

Another is more of a question... how much work would it be to modify (myself) the script to apply a coupon if there is X quantity (ie: 2 identical products)?

 

Thanks

 

:beer:

Share this post


Link to post
Share on other sites
Another is more of a question... how much work would it be to modify (myself) the script to apply a coupon if there is X quantity (ie: 2 identical products)?

 

Thanks

 

:beer:

 

 

That would be the quanity discount mod. Your talking about if you buy lets say 5 you get lets say 20% off etc.

Share this post


Link to post
Share on other sites
That would be the quanity discount mod. Your talking about if you buy lets say 5 you get lets say 20% off etc.

 

Correct, but I need it to be only if they provide a coupon. Or is there a contribution for that?

Share this post


Link to post
Share on other sites

MODULE_ORDER_TOTAL_COUPON_TEXT_ERROR

sounds to me like you have either not added the correct language file to your /includes/languages/english folder (or whatever language your using) or not added the relevant code, or perhaps the code doesnt exist and is missing from the contrib and you need to add it yourself.

Reading through the code where it says that should easily tell you where to add it.

 

For what its worth, I think its always better just to wait a week or 2 before installing the newest contribs because by that time hopefully any bugs/new bugs will have been killed and it will work correctly.

 

No idea on your 3rd item "bug" im afraid and afaik theres no contrib that exists that only provides quantity discount IF you use a voucher as far as I know...

 

Good luck.

Edited by Reesy

Share this post


Link to post
Share on other sites

I just noticed that the 3rd item that the coupon isn't working on has attributes. Why would that make the coupon not work??

 

I need help fast :(

Share this post


Link to post
Share on other sites

I think I fixed the bug...

 

On this line:

$pr_c = $this->product_price(tep_get_prid($order->products[$i]['id'])); //Fred 2003-10-28, fix for the row above, otherwise the discount is calc based on price excl VAT!

 

Shouldn't it be:

$pr_c = $this->product_price($order->products[$i]['id']); //Fred 2003-10-28, fix for the row above, otherwise the discount is calc based on price excl VAT!

 

Because product_price does a tep_get_prid() itself to strip the attributes away. That would explain why it wasn't working properly with attributes.

 

Am I right? (yay! if so :))

Share this post


Link to post
Share on other sites
I think I fixed the bug...

 

On this line:

$pr_c = $this->product_price(tep_get_prid($order->products[$i]['id'])); //Fred 2003-10-28, fix for the row above, otherwise the discount is calc based on price excl VAT!

 

Shouldn't it be:

$pr_c = $this->product_price($order->products[$i]['id']); //Fred 2003-10-28, fix for the row above, otherwise the discount is calc based on price excl VAT!

 

Because product_price does a tep_get_prid() itself to strip the attributes away. That would explain why it wasn't working properly with attributes.

 

Am I right? (yay! if so :))

 

THANK YOU.

GREAT JOB....VERY HELPFUL:)


I have to know...:)

Share this post


Link to post
Share on other sites
THANK YOU.

GREAT JOB....VERY HELPFUL:)

Agreed - good catch.

 

Whilst working through this, I also found that, where a product is in multiple category trees (I've got Brand, Age and Activity for toys), things fail if the selected category is not the first one found by tep_get_product_path in general.php.

 

This is cured by adding to general.php

 

  
function tep_get_product_full_path($products_id) {
   $cPath = '';

   $category_query = tep_db_query("select p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = '" . (int)$products_id . "' and p.products_status <> '0' and p.products_id = p2c.products_id");

   $categories = array();
   while ($category = tep_db_fetch_array($category_query))
   {
     tep_get_parent_categories($categories, $category['categories_id']);

     $categories = array_reverse($categories);
     $categories[] = $category['categories_id'];

   }
   $cPath = implode('_', $categories);

   return $cPath;
 }

 

and replacing the call to tep_get_product_path in ot_coupon.php with a call to this new function.

 

Hope this helps someone.

 

Quentin

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  

×