Jump to content
Strider

Credit Class/Gift Vouchers/Discount Coupons 5.10

Recommended Posts

tomed8

 

Your sort order problem is NOT within the code itself, it is done in the admin area where YOU can set it manually to how you would like it to look

 

admin>modules>order total>sort as needed!!!

 

Chris

Share this post


Link to post
Share on other sites
tomed8

 

Your sort order problem is NOT within the code itself, it is done in the admin area where YOU can set it manually to how you would like it to look

 

admin>modules>order total>sort as needed!!!

 

Chris

Kittmaster,

 

thanks but... Do you really think someone would be that stupid? Do you think that someone with a full production site wouldn't know i) how sort order works and that ii) sort order is NOT in "the code itself" and iii) where to find sort order?

 

Not meaning to be harsh here, but... come on

Edited by tomed8

Share this post


Link to post
Share on other sites
Kittmaster,

 

thanks but... Do you really think someone would be that stupid?

 

Yes

 

Do you think that someone with a full production site wouldn't know

 

i) how sort order works and that

 

Sometimes people just get lost within themselves........it happens even to the best of us

 

ii) sort order is NOT in "the code itself" and

 

Guess you haven't installed the sort order contrib for attributes yet...........hmm.......bet that would confuse some people or else that contrib wouldn't have been created.........so yeah......some just might thing that code could be a problem

 

take a GOOD look at the page count for THIS contrib.......156 pages.......hmmm......think people are having issues even with the simple items?

 

iii) where to find sort order?

 

Took me a bit to figure it out........and I have the same "full" production site with 20+ contribs and sometimes it does get confusing

 

Not meaning to be harsh here, but... come on

 

Hence why no one seems to be rushing to help you.......a simple "thanks but that's not it" would have been good instead of all the time you wasted trying to say what you just did.........

 

Good luck...... :rolleyes:

Share this post


Link to post
Share on other sites

Hey everyone,

 

I figured out what the problem with PayPal Website Payments Pro was.

I am using the contribution found at http://www.zenatdesign.com/payment, but I don't want to post my changed code here because my osc is heavily modded.

 

What I did was place the order_total calculations in checkout_process.php beforethe call for $payment_modules->before_process(); (Thanks bfcase for the hint!)

Is this something that can be done by default for future versions of CCGV?

 

Anyway, I tried to place an order that way, but PayPal gave me an error that the total did not match the items passed. So, I had to go into the Paypal payment module and mess with the XML code to set HandlingTotal to a negative number equal to the amount of the coupon. Whew!

 

I hope this makes sense and helps someone. Now thats that off my shoulders I can go celebrate thanksgiving like the rest of the normal people!

Share this post


Link to post
Share on other sites

did changing the order in checkout_process help in direct payment ?

cause bfcase's post said that changing order made direct payment work. but express gave error. so he commented some lines for express payments to work. did u try thay ?

Share this post


Link to post
Share on other sites
did changing the order in checkout_process help in direct payment ?

cause bfcase's post said that changing order made direct payment work. but express gave error. so he commented some lines for express payments to work. did u try thay ?

That post is about a different contribution that works completely differently from mine, but that's where I got the idea of the files I should be looking at. I got an error in both DD and EC. and had to fix them in a single file. Depending on what contribution you are using, you need to make appropriate changes.

Share this post


Link to post
Share on other sites
Hi guys

 

I've added the "bonus" info in the 5.14 mod and some minor issues with the check box.......see attached image ...........any ideas???

 

Thanks!!

 

damn.jpg

 

 

I figured out why the text box wasn't showing up, I forgot to SEND MYSELF a voucher that could be redeemed hence why the box never showed up. I kept trying to "redeem" a coupon and not a voucher so that is where my screw up was. Now I understand the difference between a coupon and voucher functionality.

 

Now its just a matter of trying to figure out why the text_edit won't display correctly, any ideas?

Share this post


Link to post
Share on other sites

fixed my problem, all is good, this is a great contrib..........everyone that has contributed to this thread, I just want to say thanks.......its all the data that helped me get this PITA install with the information within this thread.

 

Chris

Share this post


Link to post
Share on other sites
fixed my problem, all is good, this is a great contrib..........everyone that has contributed to this thread, I just want to say thanks.......its all the data that helped me get this PITA install with the information within this thread.

 

Chris

 

 

Chis,

 

Glad to see you are finaly sorted. Can you post a few short notes on here detailing the contributions that were clashing, the problems and how to go around finding fixing your problem. It may help others

 

Si.

Share this post


Link to post
Share on other sites

have a bit of an urgent problem.

 

We installed and tested and tested and tested this over and over again and it worked fine each time, even though a few bits and bobs needed tweaking.

 

However we set the changes live, after migrating it from the test stie and our first GV order has not shown up in the GV que nor has it been sent to the customer. We have it set to que vouchers.

 

I checked the DB and its not been inserted into the que table, where do i look for the code which inputs this into the table. I need to find this quickly because we cannot authorise GV at the moment EEK!

 

thnx


Feel free to ask me for help

beep... beep....My Pager

Share this post


Link to post
Share on other sites

I am experiencing something similar as the post above. A customer can purchase a voucher and pay for it with PayPal, but nothing shows up for the customer to use ie; email or code to type in.

 

It works well if the admin emails a voucher to a customer, but not when a customer purchases a voucher through PayPal.

Share this post


Link to post
Share on other sites

I have a very old version of Credit class. I only use the coupon part of this contribution. I noticed that in the admin/coupon_admin.php that you can view inactive coupons. I tried to delete these coupons but it doesnt work. Does anyone have a fix for this?

 

Thanks

Elizabeth

Share this post


Link to post
Share on other sites

i don't know if this has been asked or not, but here goes.

 

when in order confirmation, i used code to give free shipping, and this is what is displayed...

 

Sub-Total: $12.00

Flat Rate (Best Way): $5.00

Total: $17.00

Discount Coupons:9718ab: -$5.00

 

 

is there any way to get it to show this?

 

Sub-Total: $12.00

Flat Rate (Best Way): $5.00

Discount Coupons - Free Shipping: -$5.00

Total: $12.00

 

put the total at the bottom, and making it include the discounts (goes same with the vouchers), and instead of putting the coupon code, put the coupon title?

Share this post


Link to post
Share on other sites

Trustco,

 

First you need to change the order total modules sequences to ensure discounts appear before the total, to change the text look in \includes\modules\order_total\ot_coupon.php find the title beigng returned and change if the coupon type = ‘S’

 

 

Oldworldcharms,

 

Why do you want to delete them? They cannot be used in the shop etc if they are not live. You cannot delete them because otherwise you will need to delete the orders that use them otherwise your DB relationship will not work and you cannot do any analysis.

 

 

hotnuts21,

 

Sorry have you solved this yet? Best thing to do is to use a comparison program to find which bit you have missed, I find the best one is UltraCompare but thats cause I love UltraEdit for my PHP coding.

 

But alot of people sware by http://www.componentsoftware.com/Products/CSDiff/ and this allows you to compare folders so you could just compare the whole site quickly

 

 

 

 

HTH

 

Si.

Edited by scranmer

Share this post


Link to post
Share on other sites

Hi Simon

Ok I didnt know that these would remain part of the sales that makes sense but what about the coupons that were not used. I would like the ability to delete those. A good option is if the coupon is not used then the ability to delete and if used a warning / message that the coupon was used and part of the sales report.

 

Can you or someone add code for this.

 

Thanks

Elizabeth

Share this post


Link to post
Share on other sites
Hi Simon

Ok I didnt know that these would remain part of the sales that makes sense but what about the coupons that were not used. I would like the ability to delete those. A good option is if the coupon is not used then the ability to delete and if used a warning / message that the coupon was used and part of the sales report.

 

Can you or someone add code for this.

 

Thanks

Elizabeth

Any specific reason for this? Most people would be happy enough that they are dead and cannot be used, other may require them just for reference. Specific requests like this would normaly go through your computer dept / coder but if you dont have these then what you can do is run some SQL to remove them if you are SURE you dont want them.

 

try the following and if you look back at the contribution I will post a document containing allsorts of SQL that can be used.

 

in the following lines replace ..coup.. with a coupon_id NOT a coupon code

DELETE FROM coupons WHERE coupon_id= ..coup..;
DELETE FROM coupons_description WHERE coupon_id= ..coup..;
DELETE FROM coupon_email_track WHERE coupon_id= ..coup..;
DELETE FROM coupon_redeem_track WHERE coupon_id= ..coup..;
DELETE FROM coupon_email_track WHERE coupon_id= ..coup..;

 

HTH

 

Si.

Share this post


Link to post
Share on other sites

Hi all

 

I'm building a Swiss shop and tryed to include ccgv.

Everything works fine apart from if I give a customer 10% the amount is not rounded to 5

 

e.g.

 

Zwischensumme: CHF89.10

Pauschale Versandkosten (): CHF5.80

Gutscheine:123: -CHF8.91

Summe: CHF85.99

 

Here in Switzerland the smallest coin is 5 Rappen and therefore it should look like:

 

Zwischensumme: CHF89.10

Pauschale Versandkosten (): CHF5.80

Gutscheine:123: -CHF8.90

Summe: CHF86.00

 

Any help is greatly appreciated :)

 

Thanks,

Brigitte

 

PS: I'm using the following versions:

 

$Id: ot_gv.php,v 1.37.3 2004/01/01 12:52:59 Strider Exp $

$Id: ot_gv.php,v 1.4.2.12 2003/05/14 22:52:59 wilt Exp $

$Id: ot_coupon.php,v 1.1.2.37.3 2004/01/01 22:52:59 Strider Exp $

$Id: ot_coupon.php,v 1.1.2.37 2003/07/24 22:52:59 Strider-Cote Exp $

$Id: ot_coupon.php,v 1.1.2.36 2003/05/14 22:52:59 wilt Exp $

 

(Package ccgb-513c)

Share this post


Link to post
Share on other sites

:'( :angry: Dont think it will take care of that so you'll have to go into ot_coupon.php and add a rounding calculation into calculate_credit & calculate_tax_deduction.

 

HTH

 

Si.

Share this post


Link to post
Share on other sites
:'( :angry: Dont think it will take care of that so you'll have to go into ot_coupon.php and add a rounding calculation into calculate_credit & calculate_tax_deduction.

 

HTH

 

Si.

 

 

Hi Simon

 

I'm not quite sure how to do it. I tryed something, but it's not working and to be honest my coding skills are just too bad :(

 

Here's what I did

 

function calculate_credit($amount) {
global $customer_id, $order, $cc_id;
//$cc_id = $_SESSION['cc_id']; //Fred commented out, do not use $_SESSION[] due to backward comp. Reference the global var instead.
$od_amount = 0;
if (isset($cc_id) ) {
	$coupon_query = tep_db_query("select coupon_code from " . TABLE_COUPONS . " where coupon_id = '" . $cc_id . "'");
	if (tep_db_num_rows($coupon_query) !=0 ) {
		$coupon_result = tep_db_fetch_array($coupon_query);
		$this->coupon_code = $coupon_result['coupon_code'];
		$coupon_get = tep_db_query("select coupon_amount, coupon_minimum_order, restrict_to_products, restrict_to_categories, coupon_type from " . TABLE_COUPONS ." where coupon_code = '". $coupon_result['coupon_code'] . "'");
		$get_result = tep_db_fetch_array($coupon_get);
		$c_deduct = $get_result['coupon_amount'];
		if ($get_result['coupon_type']=='S') $c_deduct = $order->info['shipping_cost'];
		if ($get_result['coupon_minimum_order'] <= $this->get_order_total()) {
			if ($get_result['restrict_to_products'] || $get_result['restrict_to_categories']) {
				for ($i=0; $i<sizeof($order->products); $i++) {
					if ($get_result['restrict_to_products']) {
						$pr_ids = split("[,]", $get_result['restrict_to_products']);
						for ($ii = 0; $ii < count($pr_ids); $ii++) {
							if ($pr_ids[$ii] == tep_get_prid($order->products[$i]['id'])) {
								if ($get_result['coupon_type'] == 'P') {
										/* Fixes to Gift Voucher module 5.03
										=================================
										Submitted by Rob Cote, robc@traininghott.com

										original code: $od_amount = round($amount*10)/10*$c_deduct/100;
										$pr_c = $order->products[$i]['final_price']*$order->products[$i]['qty'];
										$pod_amount = round($pr_c*10)/10*$c_deduct/100;
										*/
										//$pr_c = $order->products[$i]['final_price']*$order->products[$i]['qty'];
										$pr_c = $this->product_price($pr_ids[$ii]); //Fred 2003-10-28, fix for the row above, otherwise the discount is calc based on price excl VAT!
										$pod_amount = round($pr_c*10)/10*$c_deduct/100;
										  $pod_amount_2 = round($pod_amount *1.2+0.05,1)-0.1;					  ////round
										$od_amount = $od_amount + $pod_amount_2;
									} else {
										$od_amount = $c_deduct;
									}
								}
							}
						} else {
							$cat_ids = split("[,]", $get_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]) {
											if ($get_result['coupon_type'] == 'P') {
												/* Category Restriction Fix to Gift Voucher module 5.04
												Date: August 3, 2003
												=================================
												Nick Stanko of UkiDev.com, nick@ukidev.com

												original code:
												$od_amount = round($amount*10)/10*$c_deduct/100;
												$pr_c = $order->products[$i]['final_price']*$order->products[$i]['qty'];
												$pod_amount = round($pr_c*10)/10*$c_deduct/100;
												*/
												//$od_amount = round($amount*10)/10*$c_deduct/100;
												//$pr_c = $order->products[$i]['final_price']*$order->products[$i]['qty'];
												$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!
												$pod_amount = round($pr_c*10)/10*$c_deduct/100;
												  $pod_amount_2 = round($pod_amount *1.2+0.05,1)-0.1;		 ////round
												$od_amount = $od_amount + $pod_amount_2;
											} else {
												$od_amount = $c_deduct;
											}
										}
									}
								}
							}
						}
					}
				} else {
					if ($get_result['coupon_type'] !='P') {
						$od_amount = $c_deduct;
					} else {
						$od_amount = $amount * $get_result['coupon_amount'] / 100;
					}
				}
			}
		}
	if ($od_amount>$amount) $od_amount = $amount;
	}
return $od_amount;
}

function calculate_tax_deduction($amount, $od_amount, $method) {
global $customer_id, $order, $cc_id, $cart;
//$cc_id = $_SESSION['cc_id']; //Fred commented out, do not use $_SESSION[] due to backward comp. Reference the global var instead.
$coupon_query = tep_db_query("select coupon_code from " . TABLE_COUPONS . " where coupon_id = '" . $cc_id . "'");
if (tep_db_num_rows($coupon_query) !=0 ) {
	$coupon_result = tep_db_fetch_array($coupon_query);
	$coupon_get = tep_db_query("select coupon_amount, coupon_minimum_order, restrict_to_products, restrict_to_categories, coupon_type from " . TABLE_COUPONS . " where coupon_code = '". $coupon_result['coupon_code'] . "'");
	$get_result = tep_db_fetch_array($coupon_get);
	if ($get_result['coupon_type'] != 'S') {

		//RESTRICTION--------------------------------
		if ($get_result['restrict_to_products'] || $get_result['restrict_to_categories']) {
			// What to do here.
			// Loop through all products and build a list of all product_ids, price, tax class
			// at the same time create total net amount.
			// then
			// for percentage discounts. simply reduce tax group per product by discount percentage
			// or
			// for fixed payment amount
			// calculate ratio based on total net
			// for each product reduce tax group per product by ratio amount.
			$products = $cart->get_products();
			$valid_product = false;
			for ($i=0; $i<sizeof($products); $i++) {
			$valid_product = false;
				$t_prid = tep_get_prid($products[$i]['id']);
				$cc_query = tep_db_query("select products_tax_class_id from " . TABLE_PRODUCTS . " where products_id = '" . $t_prid . "'");
				$cc_result = tep_db_fetch_array($cc_query);
				if ($get_result['restrict_to_products']) {
					$pr_ids = split("[,]", $get_result['restrict_to_products']);
					for ($p = 0; $p < sizeof($pr_ids); $p++) {
						if ($pr_ids[$p] == $t_prid) $valid_product = true;
					}
				}
				if ($get_result['restrict_to_categories']) {
					$cat_ids = split("[,]", $get_result['restrict_to_categories']);
					for ($c = 0; $c < sizeof($cat_ids); $c++) {
						$cat_query = tep_db_query("select products_id from products_to_categories where products_id = '" . $products_id . "' and categories_id = '" . $cat_ids[$i] . "'");
						if (tep_db_num_rows($cat_query) !=0 ) $valid_product = true;
					}
				}
				if ($valid_product) {
					$price_excl_vat = $products[$i]['final_price'] * $products[$i]['quantity']; //Fred - added
					$price_incl_vat = $this->product_price($t_prid); //Fred - added
					$valid_array[] = array('product_id' => $t_prid, 'products_price' => $price_excl_vat, 'products_tax_class' => $cc_result['products_tax_class_id']); //jason //Fred - changed from $products[$i]['final_price'] 'products_tax_class' => $cc_result['products_tax_class_id']);
//						$total_price += $price_incl_vat; //Fred - changed
					$total_price += $price_excl_vat; // changed
				}
			}
			if (sizeof($valid_array) > 0) { // if ($valid_product) {
				if ($get_result['coupon_type'] == 'P') {
					$ratio = $get_result['coupon_amount']/100;
				} else {
					$ratio = $od_amount / $total_price;
				}
				if ($get_result['coupon_type'] == 'S') $ratio = 1;
				if ($method=='Credit Note') {
					$tax_rate = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
					$tax_desc = tep_get_tax_description($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
					if ($get_result['coupon_type'] == 'P') {
						$tod_amount = $od_amount / (100 + $tax_rate)* $tax_rate;
						$tod_amount_2 = round($tod_amount *1.2+0.05,1)-0.1;   ////round
					} else {
						$tod_amount = $order->info['tax_groups'][$tax_desc] * $od_amount/100;
						$tod_amount_2 = round($tod_amount *1.2+0.05,1)-0.1;   ////round

					}
					$order->info['tax_groups'][$tax_desc] -= $tod_amount_2;
					$order->info['total'] -= $tod_amount_2; //  need to modify total ...OLD
					$order->info['tax'] -= $tod_amount_2; //Fred - added
				} else {
					for ($p=0; $p<sizeof($valid_array); $p++) {
						$tax_rate = tep_get_tax_rate($valid_array[$p]['products_tax_class'], $order->delivery['country']['id'], $order->delivery['zone_id']);
						$tax_desc = tep_get_tax_description($valid_array[$p]['products_tax_class'], $order->delivery['country']['id'], $order->delivery['zone_id']);
						if ($tax_rate > 0) {
							//Fred $tod_amount[$tax_desc] += ($valid_array[$p]['products_price'] * $tax_rate)/100 * $ratio; //OLD
							$tod_amount = ($valid_array[$p]['products_price'] * $tax_rate)/100 * $ratio; // calc total tax Fred - added
							$order->info['tax_groups'][$tax_desc] -= ($valid_array[$p]['products_price'] * $tax_rate)/100 * $ratio;
							$order->info['total'] -= ($valid_array[$p]['products_price'] * $tax_rate)/100 * $ratio; // adjust total
							$order->info['tax'] -= ($valid_array[$p]['products_price'] * $tax_rate)/100 * $ratio; // adjust tax -- Fred - added
						}
					}
				}
			}
			//NO RESTRICTION--------------------------------
		} else {
			if ($get_result['coupon_type'] =='F') {
				$tod_amount = 0;
				if ($method=='Credit Note') {
					$tax_rate = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
					$tax_desc = tep_get_tax_description($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
					$tod_amount = $od_amount / (100 + $tax_rate)* $tax_rate;
					  $tod_amount_2 = round($tod_amount *1.2+0.05,1)-0.1;  //////round
					$order->info['tax_groups'][$tax_desc] -= $tod_amount_2;
				} else {
//						$ratio1 = $od_amount/$amount;   // this produces the wrong ratipo on fixed amounts
					reset($order->info['tax_groups']);
					while (list($key, $value) = each($order->info['tax_groups'])) {
						$ratio1 = $od_amount/($amount-$order->info['tax_groups'][$key]); ////debug
						$tax_rate = tep_get_tax_rate_from_desc($key);
						$net = $tax_rate * $order->info['tax_groups'][$key];
						if ($net>0) {
							$god_amount = $order->info['tax_groups'][$key] * $ratio1;
							$tod_amount += $god_amount;
							$order->info['tax_groups'][$key] = $order->info['tax_groups'][$key] - $god_amount;
						}
					}
				}
				$order->info['total'] -= $tod_amount; //OLD
				$order->info['tax'] -= $tod_amount; //Fred - added
		}
		if ($get_result['coupon_type'] =='P') {
			$tod_amount=0;
			if ($method=='Credit Note') {
				$tax_desc = tep_get_tax_description($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
				$tod_amount = $order->info['tax_groups'][$tax_desc] * $od_amount/100;
 $tod_amount_2 = round($tod_amount *1.2+0.05,1)-0.1;  //////round
				$order->info['tax_groups'][$tax_desc] -= $tod_amount_2;  ////round
			} else {
				reset($order->info['tax_groups']);
				while (list($key, $value) = each($order->info['tax_groups'])) {
					$god_amount=0;
					$tax_rate = tep_get_tax_rate_from_desc($key);
					$net = $tax_rate * $order->info['tax_groups'][$key];
					if ($net>0) {
						$god_amount = $order->info['tax_groups'][$key] * $get_result['coupon_amount']/100;
						$tod_amount += $god_amount;
						$order->info['tax_groups'][$key] = $order->info['tax_groups'][$key] - $god_amount;
					}
				}
			}
			$order->info['total'] -= $tod_amount; // have to modify total also
			$order->info['tax'] -= $tod_amount;
		}
	}
}
}
return $tod_amount;
}

 

Thanks for any help :)

 

PS: Changes are marked with ////round

Share this post


Link to post
Share on other sites

knacknuss,

 

Not checked it thoroughly but at a guess you need to follow the old MATHS thing ?BODMAS. In short stick brackets around each calc to ensure it does the calc in the correct order

 

yours shows

$pod_amount_2 = round($pod_amount *1.2+0.05,1)-0.1; ////round

 

should be

$pod_amount_2 = round(($pod_amount *1.2)+0.05,1)-0.1; ////round

 

 

oliswiss,

at a guess checkout function use_credit_amount you have either go the code in there twice or you are somhow calling that function twice.

 

 

HTH

 

Si.

Share this post


Link to post
Share on other sites
knacknuss,

 

Not checked it thoroughly but at a guess you need to follow the old MATHS thing ?BODMAS. In short stick brackets around each calc to ensure it does the calc in the correct order

 

yours shows

$pod_amount_2 = round($pod_amount *1.2+0.05,1)-0.1; ////round

 

should be

$pod_amount_2 = round(($pod_amount *1.2)+0.05,1)-0.1; ////round

 

 

HI Simon

 

I worked it out :)

It was actually quite simple...just one line of code to add :)

 

For all Swiss people here it is:

function calculate_credit($amount) {
global $customer_id, $order, $cc_id;
//$cc_id = $_SESSION['cc_id']; //Fred commented out, do not use $_SESSION[] due to backward comp. Reference the global var instead.
$od_amount = 0;
if (isset($cc_id) ) {
	$coupon_query = tep_db_query("select coupon_code from " . TABLE_COUPONS . " where coupon_id = '" . $cc_id . "'");
	if (tep_db_num_rows($coupon_query) !=0 ) {
		$coupon_result = tep_db_fetch_array($coupon_query);
		$this->coupon_code = $coupon_result['coupon_code'];
		$coupon_get = tep_db_query("select coupon_amount, coupon_minimum_order, restrict_to_products, restrict_to_categories, coupon_type from " . TABLE_COUPONS ." where coupon_code = '". $coupon_result['coupon_code'] . "'");
		$get_result = tep_db_fetch_array($coupon_get);
		$c_deduct = $get_result['coupon_amount'];
		if ($get_result['coupon_type']=='S') $c_deduct = $order->info['shipping_cost'];
		if ($get_result['coupon_minimum_order'] <= $this->get_order_total()) {
			if ($get_result['restrict_to_products'] || $get_result['restrict_to_categories']) {
				for ($i=0; $i<sizeof($order->products); $i++) {
					if ($get_result['restrict_to_products']) {
						$pr_ids = split("[,]", $get_result['restrict_to_products']);
						for ($ii = 0; $ii < count($pr_ids); $ii++) {
							if ($pr_ids[$ii] == tep_get_prid($order->products[$i]['id'])) {
								if ($get_result['coupon_type'] == 'P') {
										/* Fixes to Gift Voucher module 5.03
										=================================
										Submitted by Rob Cote, robc@traininghott.com

										original code: $od_amount = round($amount*10)/10*$c_deduct/100;
										$pr_c = $order->products[$i]['final_price']*$order->products[$i]['qty'];
										$pod_amount = round($pr_c*10)/10*$c_deduct/100;
										*/
										//$pr_c = $order->products[$i]['final_price']*$order->products[$i]['qty'];
										$pr_c = $this->product_price($pr_ids[$ii]); //Fred 2003-10-28, fix for the row above, otherwise the discount is calc based on price excl VAT!
										$pod_amount = round($pr_c*10)/10*$c_deduct/100;
										  $od_amount = $od_amount + $pod_amount;
									} else {
										$od_amount = $c_deduct;
									}
								}
							}
						} else {
							$cat_ids = split("[,]", $get_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]) {
											if ($get_result['coupon_type'] == 'P') {
												/* Category Restriction Fix to Gift Voucher module 5.04
												Date: August 3, 2003
												=================================
												Nick Stanko of UkiDev.com, nick@ukidev.com

												original code:
												$od_amount = round($amount*10)/10*$c_deduct/100;
												$pr_c = $order->products[$i]['final_price']*$order->products[$i]['qty'];
												$pod_amount = round($pr_c*10)/10*$c_deduct/100;
												*/
												//$od_amount = round($amount*10)/10*$c_deduct/100;
												//$pr_c = $order->products[$i]['final_price']*$order->products[$i]['qty'];
												$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!
												$pod_amount = round($pr_c*10)/10*$c_deduct/100;
												  $od_amount = $od_amount + $pod_amount;
											} else {
												$od_amount = $c_deduct;
											}
										}
									}
								}
							}
						}
					}
				} else {
					if ($get_result['coupon_type'] !='P') {
						$od_amount = $c_deduct;
					} else {
						$od_amount = $amount * $get_result['coupon_amount'] / 100;
						$od_amount = round(($od_amount *1.002)+0.05,1)-0.1;		  /// rundet auf 5 Rappen					}
				}
			}
		}
	if ($od_amount>$amount) $od_amount = $amount;
	}
return $od_amount;
}

 

I hope this is correct coding and doesn't do anything bad to the rest :blush:

Share this post


Link to post
Share on other sites

Why doesnt CCGV inform the customer which categories a coupon are valid in? If a customer fills in his coupon code and click redeem but have not bought valid products it still says "You have redeemed" but he doesnt get the rebate.

 

1, Why doesnt the customer get an error and information about which categories the coupon are valid in?

 

2, Does he loose the copuon even if nothing really was redeemed? (due to non valid products in the cart)

 

Thanks you!

Share this post


Link to post
Share on other sites

can someone more familiar with these threads than i point me to the solution to the following problem...

 

CCGV isn't posting the discount coupon to PayPal IPN regardless of the order total sequence.

 

i'm pretty sure this issue has been raised and answered before but i can't find it anywhere. That's the PayPal IPN payment module i'm talking about. anyone have the answer readily available?


"remember sparky, you can never have too much sugar."

Share this post


Link to post
Share on other sites

ok, i have an odd issue.

 

i re-ordered the items in the order total module. i then proceeded with a test purchase of one item. i then went and did another test purchase, using the 2nd item in my store. here's where the issue is.

 

my test account has a balance of $96.00. however, i do not see the tickbox to apply discount to order total. i only see the redeem box/button.

 

any ideas?

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

×