Jump to content
Vger

[CONTRIBUTION] CCGV (trad)

Recommended Posts

oh I am sorryl.l.. I had to come and sing again..... you should see me... a real lunatic... I am dancing and jumping all over my dining room.... ha haha

 

Rhea... you are the queen!!!!

 

its always nice to see 'shining happy people' :-" :-"

in the forums :)

Edited by tec

Share this post


Link to post
Share on other sites
its always nice to see 'shining happy people' :-" :-"

in the forums :)

 

oh and I can be sooooo dark and gloomy... it's fun for me too I assure you... :'(

 

but now it's working and after I think at this point I am well over 100 hours in the last 7 days... I finally am understanding partly what I am doing... hihi

 

I hope it goes well for you too... I do know how horrendous this can be... :D :D

Share this post


Link to post
Share on other sites

ok I have what may be a stupid question...

 

I am at present installing a new contrib... not related to this... but I found some mistakes in the language... I know cause I am fluent in both french and english and some of the wordings in the english files are still in french.

 

Since I Have no clue as to how to make the contrib... what is preferable... one of you sweet souls take a risk and show me how to do it... or I give you the info and you go do it for me???

Share this post


Link to post
Share on other sites
ok I have what may be a stupid question...

 

I am at present installing a new contrib... not related to this... but I found some mistakes in the language... I know cause I am fluent in both french and english and some of the wordings in the english files are still in french.

 

Since I Have no clue as to how to make the contrib... what is preferable... one of you sweet souls take a risk and show me how to do it... or I give you the info and you go do it for me???

 

 

so correct me if i am wrong, but you need some words changed in the language files correct?

if so, just drop me a pm with your email addy, i will contact you.

Share this post


Link to post
Share on other sites
When I create a flat rate coupon (say, $20 off), everything works great. However, if I then try to create a percentage based coupon (say, 10% off) - the totals do not add up, as per my prior example.

 

Hi betagirl,

you are not alone with your problem. I've had the same.

I solved it by using a solution given by a member on the contrib CCGV 5.16.

Try this :

file catalog\includes\modules\order_total\ot_coupon.php

replace :

function process() {
global $PHP_SELF, $order, $currencies;

$order_total=$this->get_order_total();
$od_amount = $this->calculate_credit($order_total);
$tod_amount = 0.0; //Fred
$this->deduction = $od_amount;
if ($this->calculate_tax != 'None') { //Fred - changed from 'none' to 'None'!
	$tod_amount = $this->calculate_tax_deduction($order_total, $this->deduction, $this->calculate_tax);
}

if ($od_amount > 0) {
	$order->info['total'] = $order->info['total'] - $od_amount;

		$this->output[] = array('title' => $this->title . ' : (' . $this->coupon_code .')','text' => '<b>-' . $currencies->format($od_amount) . '</b>', 'value' => $od_amount); //Fred added hyphen


}
}

with

function process() {
global $PHP_SELF, $order, $currencies;

$coupon_amount_absolute = $this->calculate_coupon_amount();
if ($coupon_amount_absolute > 0){
 //  if ($this->$calculate_tax != 'None') {
	if ($calculate_tax != 'None') { // Re-Calculate Tax
		// TODO: This doesnt works if there is more than one tax-group
		while (list($key, $value) = each($order->info['tax_groups'])) {
			$tax_factor = tep_get_tax_rate_from_desc($key)/100 + 1;
			$order->info['tax_groups'][$key] -= ($coupon_amount_absolute-($coupon_amount_absolute/$tax_factor));
		}
		$order->info['tax'] -= ($coupon_amount_absolute-($coupon_amount_absolute/$tax_factor));
		// End TODO
	}
	$order->info['total'] = $order->info['total'] - $coupon_amount_absolute;
	$this->output[] = array('title' => $this->title . ' ' . $this->coupon_code .':','text' => '<b>-' . $currencies->format($coupon_amount_absolute) . '</b>', 'value' => $coupon_amount_absolute);
}
}

function calculate_coupon_amount() {
global $customer_id, $order, $cc_id, $get_result;
$coupon_amout_absolute = 0.0;

$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);

	$valid_products_amount = $this->calculate_valid_products_amount();
	if ($valid_products_amount >= $get_result['coupon_minimum_order']){
		if ($get_result['coupon_type'] == 'F'){ // fix amount (i.e. 5.00 Euro)
			$coupon_amount_absolute = $get_result['coupon_amount'];
		} else if ($get_result['coupon_type'] == 'P'){ // percentage amount (i.e. 5.00%)
			$coupon_amount_absolute = ($get_result['coupon_amount'] / 100) * $valid_products_amount;
		} else if ($get_result['coupon_type'] == 'S'){ // free shipping
			$coupon_amount_absolute = $order->info['shipping'];
		}
	}
}

return $coupon_amount_absolute;
}

function calculate_valid_products_amount(){
global $order, $get_result, $PHP_SELF;
$valid_products_amount = 0.0;

if (!$get_result['restrict_to_products'] && !$get_result['restrict_to_categories']) { // No Restriction
   $valid_products_amount = $order->info['subtotal'];
} else { // Restrict to Products/Categories
	for ($i=0; $i<sizeof($order->products); $i++) {
		if ($get_result['restrict_to_products']) { // 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'])) {
					$pr_c += $this->get_product_price($order->products[$i]['id']);
				}
			}
		} else { // Restrict to Categories
			$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]) {
							$pr_c += $this->get_product_price($order->products[$i]['id']);
						}
					}
				}
			}
		}
	}
	$valid_products_amount = $pr_c;
}
if ($include_shipping == true){ // When include_shipping is true add ALL additional Costs, so there ist also included COD-fee (Nachnahmegeb?hren)!
   $valid_products_amount += $order->info['total'] - $order->info['subtotal'];
}

return $valid_products_amount;
}

 

In the admin side, Discount Coupons configured as :

Display Total : true

include shipping : false

include tax : true

re-calculate tax : standard

tax class: none

 

Works for me !

 

Hi Vger, as you are the author of this nice CCGV trad, would you test and confirm it's ok from your side ? If so it could be useful to amend your contrib.

I've had another problem with adding twice product with different attributes. I confirm to use the shopping-cart class from CCGV 5.16 too to solve it.

 

Have a nice day.

Seb


Osc 2.2 MS2

Share this post


Link to post
Share on other sites

Quick Question:

 

On the paymt information page, If I first enter the credir card info, and the discount/gift coupon, when I click on redeem it applies the discount but erases the credit card info.

 

If I first put in the discount and click redeem, it applies the discount but an error message comes up asking for a credit card number. Then you put in the credit card info and proceed.

 

Is there a way around this? A fix for this bug?

Share this post


Link to post
Share on other sites
I've had another problem with adding twice product with different attributes. I confirm to use the shopping-cart class from CCGV 5.16 too to solve it.

 

CCGV(trad) was written to work with the updated osCommerce 2.2 MS2 (November 2005). It says in the Install instructions that if you haven't upgraded then to do it before you install CCGV(trad). On sites that have upgraded and use the last version of CCGV(trad) the problem you mention does not exist.

 

Vger

Share this post


Link to post
Share on other sites
so correct me if i am wrong, but you need some words changed in the language files correct?

if so, just drop me a pm with your email addy, i will contact you.

 

 

what I am saying is that myself I can correct it because I know both languages and made my own corrections... but what of others who don't know both languages... how do I make it so that the correction is available to others??

Share this post


Link to post
Share on other sites

This is the CCGV thread, and I receive a notice about each post in this thread and check them out - so if you wish to talk about other things not related to CCGV then please post elsewhere. Thanks.

 

Vger

what I am saying is that myself I can correct it because I know both languages and made my own corrections... but what of others who don't know both languages... how do I make it so that the correction is available to others??

Share this post


Link to post
Share on other sites

I have a few basic questions about this contribution.

I need something for gift cards. Each card has a serial number (so to speak), along with the amount (varies). Can I use this contribution to accept/redeem cards? I would need to track remaining balance too. Can this contribution be installed on a modified site... mostly basic but cosmetic changes and such have been made.

I'm still reading through all this, patience please :rolleyes:

Share this post


Link to post
Share on other sites
This is the CCGV thread, and I receive a notice about each post in this thread and check them out - so if you wish to talk about other things not related to CCGV then please post elsewhere. Thanks.

 

Vger

 

 

actually... the question does apply to this contrib as well as others... the question came up to my mind while I was doing something else and mentionned it because I didn't want you to think I was saying there was a mistake in YOUR contrib... I don't know how to do most of what you do here... but I do know another language... if I can be of help to add to your contrib by doing so and give back a little, I thought it might be appreciated... I was wanting to know how to do it without messing it up. I asked specifically on YOUR thread because I thought I was going to get the best answer and do it properly the first time.

 

My mistake... won't happen again, I will go and start another thread on the subject and see if I get an answer.

Share this post


Link to post
Share on other sites
I have a few basic questions about this contribution.

I need something for gift cards. Each card has a serial number (so to speak), along with the amount (varies). Can I use this contribution to accept/redeem cards? I would need to track remaining balance too. Can this contribution be installed on a modified site... mostly basic but cosmetic changes and such have been made.

I'm still reading through all this, patience please :rolleyes:

 

 

From what I have been doing for the last few days... Yes you could. You would I think have to use the Voucher option and kind of give it the serial number of your choice in the subject line or something of the kind and send it to your customer. That balance would show up in your voucher balance. Changing the name "voucher" to the term you prefer using would be easy enough. You'd just have to be thorough that you actually change the term on the FAQ pages as well to keep an homogenous (sorry spelling) content.

 

If you'd like me to test this with you by creating a false one on my site, I don't mind... just PM me.

Share this post


Link to post
Share on other sites
CCGV(trad) was written to work with the updated osCommerce 2.2 MS2 (November 2005). It says in the Install instructions that if you haven't upgraded then to do it before you install CCGV(trad). On sites that have upgraded and use the last version of CCGV(trad) the problem you mention does not exist.

Vger

Hi Vger, I don't read the Manual closely enough. Please apologies. Seb

Osc 2.2 MS2

Share this post


Link to post
Share on other sites

First off this contribution looks great. I have everything installed but I'm having an issue I didn't expect. Everything shows up fine and looks good but when I try to make a payment through authorize.net_AIM or the stock Paypal module the discount for the coupon is not subtracted from the total. Does anyone know what might be causing this. I?m not getting any error messages and everything else looks fine.

 

Thank you in advance.

Share this post


Link to post
Share on other sites
Thanx.. I have enabled it, and it works great exept for hven a custumer use the Gift Vocher to pay.. it goes through right, but they still have the same aount in theyre account..

I will try the things you mentient and will se how it works out..

 

Apologies in advance if this was ever answered, but I started getting a headache around page 15. I think I'm having this same problem. In the admin panel, in Configuration -> My Store, I set a $5 welcome voucher. Tonight I got an e-mail from a customer that said:

 

"I'm a new member here at your store and believe it somehow just gave me a $5 voucher I don't think I was suppose to get.

I'd already used my new member one but when I made my second purchase here it again discounted the price 5 bucks as well as still more importantly showing I still have a $5 dollar voucher balance. So anyways to keep this brief I believe I owe you'll five dollars still and thought I'd best mention this happening to me while shopping here."

 

I haven't had any other problems with the contribution. Everything else works great, and is totally appreciated. Any ideas on why it doesn't want to cancel out the welcome voucher after it's been used? I don't see anywhere in the admin panel to edit it like you can with a regular voucher other than to edit the price.

Share this post


Link to post
Share on other sites

Important issue with QTPro;

 

When reading the readme it is suggested updating to osCommerce 051113. In includes/classes/shopping_cart.php the code should be like this;

 

if ($this->in_cart($products_id_string)) {
$this->update_quantity($products_id_string, $qty, $attributes);
} else {
$this->contents[$products_id_string] = array('qty' => $qty);

 

I suppose the code above has to do with issue "Adding Non-Existing Products To Cart" in the osCommerce update. However, that code will end up with no attributes in shopping cart, checkout, order confirmation email and admin when using QTPro.

 

When using the old code below it works;

 

if ($this->in_cart($products_id)) {
$this->update_quantity($products_id, $qty, $attributes);
} else {
$this->contents[$products_id] = array('qty' => $qty);

 

 

My question is, how important is this for CCGV(trad)? Could I just use the old code below or should I remove all updates that belongs to "Adding Non-Existing Products To Cart"?

Share this post


Link to post
Share on other sites
My question is, how important is this for CCGV(trad)? Could I just use the old code below or should I remove all updates that belongs to "Adding Non-Existing Products To Cart"?

 

This has already been covered (several times) in this thread - and was also addressed in the last update of CCGV(trad).

 

Vger

Share this post


Link to post
Share on other sites

Sorry and thanks Rhea! I will need to compare the osCommerce 051113 update and the includes/classes/shopping_cart.php and includes/functions/general.php in the latest CCGV(trad).

 

I assume the osCommerce 051113 update is included in the latest CCGV(trad) and then modified?

Share this post


Link to post
Share on other sites

Sorry, no need to answer the question above. I realized that the 051113 update was included and then modified.

Share this post


Link to post
Share on other sites

I just moved the OT modules around so that on the checkout_confirmation page the total shows including the coupon discount. However, It?s still transmitting at the pre coupon total. I?ve tried to look through the manual and install again but I didn?t find and missed steps. :sweating:

Share this post


Link to post
Share on other sites
However, It's still transmitting at the pre coupon total.

 

Transmitting to who? If it's to Pay Pal using the Pay Pal IPN module then use the link included in the install instructions to update your pay pal ipn files with the necessary changes.

 

Vger

Edited by Vger

Share this post


Link to post
Share on other sites

Hi,

 

Did anybody know the answer to this? Should I just lose the welcome voucher? Does it work correctly for everyone else? And does anyone know where I should look to figure out why it doesn't void itself out after the first use?

 

In the admin panel, in Configuration -> My Store, I set a $5 welcome voucher. Tonight I got an e-mail from a customer that said:

 

"I'm a new member here at your store and believe it somehow just gave me a $5 voucher I don't think I was suppose to get.

I'd already used my new member one but when I made my second purchase here it again discounted the price 5 bucks as well as still more importantly showing I still have a $5 dollar voucher balance. So anyways to keep this brief I believe I owe you'll five dollars still and thought I'd best mention this happening to me while shopping here."

 

I haven't had any other problems with the contribution. Everything else works great, and is totally appreciated. Any ideas on why it doesn't want to cancel out the welcome voucher after it's been used? I don't see anywhere in the admin panel to edit it like you can with a regular voucher other than to edit the price.

Share this post


Link to post
Share on other sites
Hi,

 

Did anybody know the answer to this? Should I just lose the welcome voucher? Does it work correctly for everyone else? And does anyone know where I should look to figure out why it doesn't void itself out after the first use?

I don't have this problem. Did you set the welcome voucher to Usage per Customer to 1 in the Admin?

Share this post


Link to post
Share on other sites
I don't have this problem. Did you set the welcome voucher to Usage per Customer to 1 in the Admin?

 

Apparently not. lol. Where do I do that? I can't find any way to change a welcome voucher (other than the amount) under Configuration -> My Store, and I can't find it at all other than as redeemed under the vouchers/coupons section.

 

Thank you for the response, btw. I've read through a bajillion pages of thread and search results, and I haven't been able to figure this out. :blush:

Share this post


Link to post
Share on other sites
Apparently not. lol. Where do I do that? I can't find any way to change a welcome voucher (other than the amount) under Configuration -> My Store, and I can't find it at all other than as redeemed under the vouchers/coupons section.

 

Thank you for the response, btw. I've read through a bajillion pages of thread and search results, and I haven't been able to figure this out. :blush:

Under Vouchers/Coupons should be a link named Coupon Admin. It's there where you would set up and edit the welcome voucher and the parameters of it.

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

×