Jump to content
Vger

[CONTRIBUTION] CCGV (trad)

Recommended Posts

I'm sorry - but I can't install it for you on the forum - and the instructions for the install and the post-install User Guide are as clear as they can be.

 

Vger

Share this post


Link to post
Share on other sites

thank you, i placed the info into my engish.php and it worked

Edited by tec

Share this post


Link to post
Share on other sites

Hey there, have a question.

When the expiry date is set on a discount coupon, say from jne 1 2006 to june 30 2006, if you go into the coupon admin to edit the coupon amount or anything else, the expiry date gos back to june1 2007.

It never seems to keep the expiration date.

 

Now, i myself am not too worried about it, I am assuming the system knows what date it is to expire on and all works well. My client on the other hand seems to think that with it going back to the default dates all the time, the expire date he puts in wont work.

 

does anyone know why the dates keep going back to a default setting and not staying at what you put them at?

 

thanks in advance

Share this post


Link to post
Share on other sites

I don't mean to duplicate this post - but I think I first posted it in the general Contribution Support forum, and I meant to post it specifically here.... here it is (again)

 

Hello -

 

Thank you so much for the time and effort on this contrib - I was really dreading implementing the current CCGV until I found yours!

 

I am having a problem with the configuration however. I can get the discount coupons module working fine if the coupon is a flat amount (e.g. $25 off), but if I try to have a percentage off coupon (e.g. 25%) - the totals don't add up or calculate correctly. Now I can get the % coupons to work too, but when they work, a flat rate coupon won't calculate totals correctly. And I can imagine situations where my client would offer different coupons to different customers, etc., and I assume they should work together anyway.

 

The difference, in making each type of coupon work, is in how the coupon module is configured.

 

Note, I do not have Gift Vouchers installed in the admin modules order totals section, as this won't be used by my client. I do not think this is causing the problem or is related, but please advise if it does, for some reason, need to be installed whether it is utilized or not.

 

The store is setup so that shipping & handling charges are taxed, without any discounts being applied. Sales tax is set at 7.75%. The sort order (the only one that works for both flat rate coupons and percentage based coupons) is:

 

Subtotal (1)

Coupons (2)

Shipping (3)

Tax (800)

Total (900)

 

The coupons module configurations are below, where the only changes are with whether or not the Include Tax option is set to "True" or "False". The Recalculate Tax is always set to "Standard".

 

###########

FALSE Shipping / TRUE Tax: Flat Rate Coupon *Correct Amounts*

Sub-Total: $399.99

Discount Coupons:Test123: -$25.00

Flat Rate S&H (Shipping to California, United States ): $23.95

California sales tax: $30.92

COD (Cash on Delivery) Fee: $14.00

Total: $443.86

 

FALSE Shipping / TRUE Tax: Percentage Coupon *Incorrect*

Sub-Total: $399.99

Discount Coupons:Test223: -$107.75 //Incorrect - s/b just 100.00 - 25% of 399.99

Flat Rate S&H (Shipping to California, United States ): $23.95

California sales tax: $25.11

COD (Cash on Delivery) Fee: $14.00

Total: $355.30

 

##############

 

FALSE shipping / FALSE Tax: Flat Rate Coupon *Incorrect*

Sub-Total: $399.99

Discount Coupons:Test123: -$25.00

Flat Rate S&H (Shipping to California, United States ): $23.95

California sales tax: $30.76 //Incorrect Tax Amount s/b $30.92

COD (Cash on Delivery) Fee: $14.00

Total: $443.70

 

FALSE shipping / FALSE Tax: Percentage Coupon *Correct Amounts*

Sub-Total: $399.99

Discount Coupons:Test223: -$100.00

Flat Rate S&H (Shipping to California, United States ): $23.95

California sales tax: $25.11

COD (Cash on Delivery) Fee: $14.00

Total: $363.05

###########

 

Does anyone have any tips on how to set this up so that I don't have to change the module configuration each time a different type of coupon is created; and so that we can use multiple coupons concurrently (some percentage based, some flat rate). I have spent more than about 5 hours trying to sort this out to no avail - trying all manner of combinations of configuration and sort orders. I appreciate any tips.

Share this post


Link to post
Share on other sites
Those lines should read like this:

 

$js .= "\n" . '  if (payment_value == null && submitter != 1) {' . "\n" . // This line edited for CCGV
		   '	error_message = error_message + "' . JS_ERROR_NO_PAYMENT_MODULE_SELECTED . '";' . "\n" .
		   '	error = 1;' . "\n" .
		   '  }' . "\n\n" .
		   '  if (error == 1 && submitter != 1) {' . "\n" . // This line edited for CCGV

 

Vger

 

Vger, Good Day

 

Where exactly do I place this code? Is it a replacement of a line or an additional one?

 

Below is what I have on my file for the relevent script.

 

/

/ #################### Begin Added CGV JONYO ######################
// function javascript_validation() {
function javascript_validation($coversAll) {
//added the $coversAll to be able to pass whether or not the voucher will cover the whole
//price or not. If it does, then let checkout proceed when just it is passed.
$js = '';
if (is_array($this->modules)) {
if ($coversAll) {
$addThis='if (document.checkout_payment.cot_gv.checked) {
payment_value=cot_gv; alert (\'hey yo\');
} else ';
} else {
$addThis='';
}
$js = '<script language="javascript"><!-- ' . "\n" .
'function check_form() {' . "\n" .
' var error = 0;' . "\n" .
' var error_message = "' . JS_ERROR . '";' . "\n" .
' var payment_value = null;' . "\n" .$addThis . //added by jonyo, yo
' if (document.checkout_payment.payment.length) {' . "\n" .
' for (var i=0; i<document.checkout_payment.payment.length; i++) {' . "\n" .
' if (document.checkout_payment.payment[i].checked) {' . "\n" .
' payment_value = document.checkout_payment.payment[i].value;' . "\n" .
' }' . "\n" .
' }' . "\n" .
' } else if (document.checkout_payment.payment.checked) {' . "\n" .
' payment_value = document.checkout_payment.payment.value;' . "\n" .
' } else if (document.checkout_payment.payment.value) {' . "\n" .
' payment_value = document.checkout_payment.payment.value;' . "\n" .
' }' . "\n\n";

 

Thank you for the help.

Share this post


Link to post
Share on other sites

Hello,

 

I just did install this contribution in clean oscommerce and everything is working until the checkout process, there is no check box or any box where you an put your voucher id. What could be the problem?

Share this post


Link to post
Share on other sites

That's not CCGV (trad) and only CCGV (trad) is supported here.

 

Vger

Vger, Good Day

 

Where exactly do I place this code? Is it a replacement of a line or an additional one?

 

Below is what I have on my file for the relevent script.

 

/

/ #################### Begin Added CGV JONYO ######################
// function javascript_validation() {
function javascript_validation($coversAll) {
//added the $coversAll to be able to pass whether or not the voucher will cover the whole
//price or not. If it does, then let checkout proceed when just it is passed.
$js = '';
if (is_array($this->modules)) {
if ($coversAll) {
$addThis='if (document.checkout_payment.cot_gv.checked) {
payment_value=cot_gv; alert (\'hey yo\');
} else ';
} else {
$addThis='';
}
$js = '<script language="javascript"><!-- ' . "\n" .
'function check_form() {' . "\n" .
' var error = 0;' . "\n" .
' var error_message = "' . JS_ERROR . '";' . "\n" .
' var payment_value = null;' . "\n" .$addThis . //added by jonyo, yo
' if (document.checkout_payment.payment.length) {' . "\n" .
' for (var i=0; i<document.checkout_payment.payment.length; i++) {' . "\n" .
' if (document.checkout_payment.payment[i].checked) {' . "\n" .
' payment_value = document.checkout_payment.payment[i].value;' . "\n" .
' }' . "\n" .
' }' . "\n" .
' } else if (document.checkout_payment.payment.checked) {' . "\n" .
' payment_value = document.checkout_payment.payment.value;' . "\n" .
' } else if (document.checkout_payment.payment.value) {' . "\n" .
' payment_value = document.checkout_payment.payment.value;' . "\n" .
' }' . "\n\n";

 

Thank you for the help.

Share this post


Link to post
Share on other sites

Did you make sure that you began Model Number with the word GIFT for a new Gift Voucher?

 

Vger

Hello,

 

I just did install this contribution in clean oscommerce and everything is working until the checkout process, there is no check box or any box where you an put your voucher id. What could be the problem?

Share this post


Link to post
Share on other sites

I don't know what you mean by not being able to use percentage and flat rate coupons together. You set up different coupons - some flat rate some percentage - they are separate coupons. If you are having problems getting the order to total correctly then please read the User Guide that comes with the download.

 

Vger

I don't mean to duplicate this post - but I think I first posted it in the general Contribution Support forum, and I meant to post it specifically here.... here it is (again)

 

Hello -

 

Thank you so much for the time and effort on this contrib - I was really dreading implementing the current CCGV until I found yours!

 

I am having a problem with the configuration however. I can get the discount coupons module working fine if the coupon is a flat amount (e.g. $25 off), but if I try to have a percentage off coupon (e.g. 25%) - the totals don't add up or calculate correctly. Now I can get the % coupons to work too, but when they work, a flat rate coupon won't calculate totals correctly. And I can imagine situations where my client would offer different coupons to different customers, etc., and I assume they should work together anyway.

 

The difference, in making each type of coupon work, is in how the coupon module is configured.

 

Note, I do not have Gift Vouchers installed in the admin modules order totals section, as this won't be used by my client. I do not think this is causing the problem or is related, but please advise if it does, for some reason, need to be installed whether it is utilized or not.

 

The store is setup so that shipping & handling charges are taxed, without any discounts being applied. Sales tax is set at 7.75%. The sort order (the only one that works for both flat rate coupons and percentage based coupons) is:

 

Subtotal (1)

Coupons (2)

Shipping (3)

Tax (800)

Total (900)

 

The coupons module configurations are below, where the only changes are with whether or not the Include Tax option is set to "True" or "False". The Recalculate Tax is always set to "Standard".

 

###########

FALSE Shipping / TRUE Tax: Flat Rate Coupon *Correct Amounts*

Sub-Total: $399.99

Discount Coupons:Test123: -$25.00

Flat Rate S&H (Shipping to California, United States ): $23.95

California sales tax: $30.92

COD (Cash on Delivery) Fee: $14.00

Total: $443.86

 

FALSE Shipping / TRUE Tax: Percentage Coupon *Incorrect*

Sub-Total: $399.99

Discount Coupons:Test223: -$107.75 //Incorrect - s/b just 100.00 - 25% of 399.99

Flat Rate S&H (Shipping to California, United States ): $23.95

California sales tax: $25.11

COD (Cash on Delivery) Fee: $14.00

Total: $355.30

 

##############

 

FALSE shipping / FALSE Tax: Flat Rate Coupon *Incorrect*

Sub-Total: $399.99

Discount Coupons:Test123: -$25.00

Flat Rate S&H (Shipping to California, United States ): $23.95

California sales tax: $30.76 //Incorrect Tax Amount s/b $30.92

COD (Cash on Delivery) Fee: $14.00

Total: $443.70

 

FALSE shipping / FALSE Tax: Percentage Coupon *Correct Amounts*

Sub-Total: $399.99

Discount Coupons:Test223: -$100.00

Flat Rate S&H (Shipping to California, United States ): $23.95

California sales tax: $25.11

COD (Cash on Delivery) Fee: $14.00

Total: $363.05

###########

 

Does anyone have any tips on how to set this up so that I don't have to change the module configuration each time a different type of coupon is created; and so that we can use multiple coupons concurrently (some percentage based, some flat rate). I have spent more than about 5 hours trying to sort this out to no avail - trying all manner of combinations of configuration and sort orders. I appreciate any tips.

Share this post


Link to post
Share on other sites

Vger is on holiday for 1 week from today - so don't expect immediate (or any) answers during this period

 

Vger

Share this post


Link to post
Share on other sites

OK, found the problem, you are oblicated to create the Gift voucher in your products eventhough you dont want to use them, only want to use discount vouchers. This could be nice to mention in the user guide, because after reading the previous posts Im not the only one that had this "problem". And thanks for the great contribution.

Share this post


Link to post
Share on other sites
I don't know what you mean by not being able to use percentage and flat rate coupons together. You set up different coupons - some flat rate some percentage - they are separate coupons. If you are having problems getting the order to total correctly then please read the User Guide that comes with the download.

 

Vger

 

Hello Vger -

 

I am not trying to use two different types of coupons at the same time. I understand that they are separate. The problem I am encountering, is specifically, that one module configuration will not work for both types.

 

For example, if I have Modules-->Order Total-->Discount Coupons configured as:

 

Display Total

true

 

Sort Order

2

 

Include Shipping

false

 

Include Tax

true

 

Re-calculate Tax

Standard

 

Tax Class

Taxable Goods

 

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.

 

I am not trying to make both coupons work at the same time. I am trying to make separate coupons work under the same module configuration. And they don't seem to. For percentage based coupons to work, the configuration has to be this:

 

Display Total

true

 

Sort Order

2

 

Include Shipping

false

 

Include Tax

false

 

Re-calculate Tax

Standard

 

Tax Class

Taxable Goods

 

Arguably, my work around is to change the configuration each time the client creates a new coupon. However this also limits their ability to offer different types of coupons to different customers at the same time, as both will not work under one configuration.

 

I admit, it does not seem like most people encounter this problem, which is why I can't understand it myself. And I have thoroughly reviewed this board, the install and manual instructions, as well as searching the other CCGV forum in the event it has something to do not with your version, but with the original. Additionally, I have resorted and reconfigured for every possible combination of sort/configuration - to no avail. I'm not looking for a shortcut or for you to install and configure this for me, I always post as a last resort, once I've exhausted all my options. This is legitimately a problem I am encountering for which there is no clear solution in the install instructions or manual, or that I have otherwise been able to discern.

 

The only variable I see, and I'm not sure if it is related to what samppa65 was talking about, is that I do not have the Gift Voucher module installed in the Order Totals section, as my client does not intend to use it. Now I don't know why that would make a difference here, but I'm throwing it out there in case it makes some sort of sense to you. I will go ahead and install it and again resort/reconfigure and see if that does indeed solve the problem.

 

Thanks again for this contribution and any light you might be able to shed beyond the research I've already done.

Share this post


Link to post
Share on other sites
Vger is on holiday for 1 week from today - so don't expect immediate (or any) answers during this period

 

Vger

Have a good one :D


Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Share this post


Link to post
Share on other sites
OK, found the problem, you are oblicated to create the Gift voucher in your products eventhough you dont want to use them, only want to use discount vouchers. This could be nice to mention in the user guide, because after reading the previous posts Im not the only one that had this "problem". And thanks for the great contribution.

 

Samppa -

Thank you so much for this tip. You are correct - it seems Gift Voucher has to be installed whether is it utilized or not. I installed it, and now I'm able to use both types of coupons (flat rate and percentage based) under a single configuration, and the math works.

 

Vger - as suggested by Samppa, installing the Gift Voucher module should probably be specified as required in your installation documentation, in case others encounter similar problems.

 

Thanks again for the great contribution Vger, and for your help finding a solution to the problem I had with it Samppa!

Share this post


Link to post
Share on other sites
OK, found the problem, you are oblicated to create the Gift voucher in your products eventhough you dont want to use them, only want to use discount vouchers. This could be nice to mention in the user guide, because after reading the previous posts Im not the only one that had this "problem". And thanks for the great contribution.

 

 

Hi there, i think i am after the same thing you are, i only want to create a discount coupon that can be sent out to customers. Are you saying that to do this i still need to create a product starting with GIFT_ and set it to inactive in order to get the discount coupon to work?

the reason i am asking is, it seems that mine is not working.

 

Everytime i go back to the coupon, the coupon usage is back to 0 and the expiry date keeps going back to june 1 2007. I am trying to get the coupon usage to stay blank and the expiry date to stay at june 31 2006. I am assuming it still holds the expiry date of the coupon, just wondering if the reason it is not working is becuase i have not created a GIFT_ product

Share this post


Link to post
Share on other sites
Thanks Rhea,

 

I had the configure fine. I'm not sure why, but now the main site is fine, the shipping issue resolved and is working. still not sure why my test site wasn't right.

 

Could it be it wasn't in the root, but in a sub directory?

HI Rhea,

 

well, i'm back to it not queuing again. I know you're away for a week, i'm going to play with it and see what I can do. It was installed on a clean install, so there should be nothing affecting it. Everything else works. I can send a voucher, install a coupon. But if a voucher is purchased, it doesn't queue. The GIFT_25 is used, i've tried GIFT25 as well.

 

Thanks.

Share this post


Link to post
Share on other sites

arrgg, i cant seem to get my discount voucher to work. I put in the code during check out and it does not take off the 10%

Share this post


Link to post
Share on other sites
arrgg, i cant seem to get my discount voucher to work. I put in the code during check out and it does not take off the 10%

 

 

ok, i have read through the posts and tried what everyone is saying

I will only be using the discount coupon, i have the whole mod installed though

 

both are installed in my order totals

i created a prod with GIFT_ at the beginning, it was said you need to do this even if you are only using a discount coupon

i have created the coupon, though, it keeps going back to 0 for number of uses per coupon

 

thoughts?

i can put the coupon code in during checkout but on my checkout confirmation page, it does not show up, i checked to make sure the CCGV code was on the checkout_confirmation page and it is, this is a live site and my client is getting antsy, any thoughts?

Share this post


Link to post
Share on other sites

ok, well, i got something new.....now when i put in the coupon code, i hit redeem, i get this

ERROR_NO_INVALID_REDEEM_COUPON

at the top of the page

Share this post


Link to post
Share on other sites

it wont let me edit my post, i got it working, not quite sure what was wrong. I deleted all of the discount coupons, reuploaded my confirmation page, created a new coupon, and now it works. Man, its been one of those days

Share this post


Link to post
Share on other sites

hi again, ok, i have a mod installed that has this as part of the install in the checkout-confirmation.php

require('held_orders_process.php');

 

now, if i keep this in, i get duplicates on teh checkout-confirmation page, with 2 discount coupon prices etc, it doubles everything up, if i take this line of code out require('held_orders_process.php');

then it doesnt happen...here is the code to the held_orders_process.php can anyone see why it would double up?

 

 

<?php
/*
 $Id: checkout_process.php,v 1.6 2003/02/22 17:34:00 wilt Exp $
 orig : checkout_process.php,v 1.125 2003/02/16 13:21:43 thomasamoulton Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/


 $order_totals = $order_total_modules->process();

 $sql_data_array = array('customers_id' => $customer_id,
					  'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'],
					  'customers_company' => $order->customer['company'],
					  'customers_street_address' => $order->customer['street_address'],
					  'customers_suburb' => $order->customer['suburb'],
					  'customers_city' => $order->customer['city'],
					  'customers_postcode' => $order->customer['postcode'], 
					  'customers_state' => $order->customer['state'], 
					  'customers_country' => $order->customer['country']['title'], 
					  'customers_telephone' => $order->customer['telephone'], 
					  'customers_email_address' => $order->customer['email_address'],
					  'customers_address_format_id' => $order->customer['format_id'], 
					  'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'], 
					  'delivery_company' => $order->delivery['company'],
					  'delivery_street_address' => $order->delivery['street_address'], 
					  'delivery_suburb' => $order->delivery['suburb'], 
					  'delivery_city' => $order->delivery['city'], 
					  'delivery_postcode' => $order->delivery['postcode'], 
					  'delivery_state' => $order->delivery['state'], 
					  'delivery_country' => $order->delivery['country']['title'], 
					  'delivery_address_format_id' => $order->delivery['format_id'], 
					  'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'], 
					  'billing_company' => $order->billing['company'],
					  'billing_street_address' => $order->billing['street_address'], 
					  'billing_suburb' => $order->billing['suburb'], 
					  'billing_city' => $order->billing['city'], 
					  'billing_postcode' => $order->billing['postcode'], 
					  'billing_state' => $order->billing['state'], 
					  'billing_country' => $order->billing['country']['title'], 
					  'billing_address_format_id' => $order->billing['format_id'], 
					  'payment_method' => $order->info['payment_method'], 
					  'cc_type' => $order->info['cc_type'], 
					  'cc_owner' => $order->info['cc_owner'], 
					  'cc_number' => $order->info['cc_number'], 
					  'cc_expires' => $order->info['cc_expires'], 
					  'date_purchased' => 'now()', 
					  'orders_status' => $order->info['order_status'], 
					  'currency' => $order->info['currency'], 
					  'currency_value' => $order->info['currency_value'],
					  'ip_address' => $ip);
 tep_db_perform(TABLE_HOLDING_ORDERS, $sql_data_array);
 $insert_id = tep_db_insert_id();

 // register this order inthe customers session
 $held_order = $insert_id;
 tep_session_register('held_order');
 // this will come in useful later


 for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
$sql_data_array = array('orders_id' => $insert_id,
						'title' => $order_totals[$i]['title'],
						'text' => $order_totals[$i]['text'],
						'value' => $order_totals[$i]['value'], 
						'class' => $order_totals[$i]['code'], 
						'sort_order' => $order_totals[$i]['sort_order']);
tep_db_perform(TABLE_HOLDING_ORDERS_TOTAL, $sql_data_array);
 }

 $customer_notification = (SEND_EMAILS == 'true') ? '1' : '0';
 $sql_data_array = array('orders_id' => $insert_id, 
					  'orders_status_id' => $order->info['order_status'], 
					  'date_added' => 'now()', 
					  'customer_notified' => $customer_notification,
					  'comments' => $order->info['comments']);
 tep_db_perform(TABLE_HOLDING_ORDERS_STATUS_HISTORY, $sql_data_array);

// initialized for the email confirmation
 $products_ordered = '';
 $subtotal = 0;
 $total_tax = 0;

 for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
// Stock Update - Joao Correia
/*   if (STOCK_LIMITED == 'true') {
  if (DOWNLOAD_ENABLED == 'true') {
	$stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename 
						FROM " . TABLE_PRODUCTS . " p
						LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa
						 ON p.products_id=pa.products_id
						LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
						 ON pa.products_attributes_id=pad.products_attributes_id
						WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";
// Will work with only one option for downloadable products
// otherwise, we have to build the query dynamically with a loop
	$products_attributes = $order->products[$i]['attributes'];
	if (is_array($products_attributes)) {
	  $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";
	}
	$stock_query = tep_db_query($stock_query_raw);
  } else {
	$stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
  }
  if (tep_db_num_rows($stock_query) > 0) {
	$stock_values = tep_db_fetch_array($stock_query);
// do not decrement quantities if products_attributes_filename exists
	if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) {
	  $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
	} else {
	  $stock_left = $stock_values['products_quantity'];
	}
	tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
	if ($stock_left < 1) {
	  tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
	}
  }
}

// Update products_ordered (for bestsellers list)
tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
  */
$sql_data_array = array('orders_id' => $insert_id, 
						'products_id' => tep_get_prid($order->products[$i]['id']), 
						'products_model' => $order->products[$i]['model'], 
						'products_name' => $order->products[$i]['name'], 
						'products_price' => $order->products[$i]['price'], 
						'final_price' => $order->products[$i]['final_price'], 
						'products_tax' => $order->products[$i]['tax'], 
						'products_quantity' => $order->products[$i]['qty']);
tep_db_perform(TABLE_HOLDING_ORDERS_PRODUCTS, $sql_data_array);
$order_products_id = tep_db_insert_id();
//	$order_total_modules->update_credit_account($i);//ICW ADDED FOR ORDER_TOTAL CREDIT SYSTEM
//------insert customer choosen option to order--------
$attributes_exist = '0';
$products_ordered_attributes = '';
if (isset($order->products[$i]['attributes'])) {
  $attributes_exist = '1';
  for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
	if (DOWNLOAD_ENABLED == 'true') {
	  $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename 
						   from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa 
						   left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
							on pa.products_attributes_id=pad.products_attributes_id
						   where pa.products_id = '" . $order->products[$i]['id'] . "' 
							and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' 
							and pa.options_id = popt.products_options_id 
							and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' 
							and pa.options_values_id = poval.products_options_values_id 
							and popt.language_id = '" . $languages_id . "' 
							and poval.language_id = '" . $languages_id . "'";
	  $attributes = tep_db_query($attributes_query);
	} else {
	  $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
	}
	$attributes_values = tep_db_fetch_array($attributes);


	$sql_data_array = array('orders_id' => $insert_id,
							'orders_products_id' => $order_products_id, 
							'products_options' => $attributes_values['products_options_name'],
							'products_options_values' => $attributes_values['products_options_values_name'], 
							'options_values_price' => $attributes_values['options_values_price'], 
							'price_prefix' => $attributes_values['price_prefix']);
	tep_db_perform(TABLE_HOLDING_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);

	if ((DOWNLOAD_ENABLED == 'true') && isset($attributes_values['products_attributes_filename']) && tep_not_null($attributes_values['products_attributes_filename'])) {
	  $sql_data_array = array('orders_id' => $insert_id, 
							  'orders_products_id' => $order_products_id, 
							  'orders_products_filename' => $attributes_values['products_attributes_filename'], 
							  'download_maxdays' => $attributes_values['products_attributes_maxdays'], 
							  'download_count' => $attributes_values['products_attributes_maxcount']);
	  tep_db_perform(TABLE_HOLDING_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);
	}
	$products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];

  }
}
//------insert customer choosen option eof ----
$total_weight += ($order->products[$i]['qty'] * $order->products[$i]['weight']);
$total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];
$total_cost += $total_products_price;

$products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
 }

?>

Share this post


Link to post
Share on other sites

I sent a gift voucher to myself from admin.

 

Then a made an order and redeemed it, which worked fine.

 

However now the gift voucher balance is still showing in my account. It won't let me redeem the voucher, but will let me send it to someone.

 

In admin the voucher shows as redeemed.

 

The only thing I can think of is that with this transaction, I didn't return to checkout_success (because of any error with my payment processor) - would this be the reason?

 

If not, any other ideas?

 

Thank you.

Share this post


Link to post
Share on other sites

If you don't return successfully to the site then the order doesn't get updated.

 

Vger

Share this post


Link to post
Share on other sites
I am continuing to develop this, and there is still a problem with redeeming a gift voucher when it is sent to the customer from within 'admin'.

 

I will also look at incorporating a 'Confirm Deletion' button on the GV Queue page.

 

Vger

I am using CCGV 5.15a (Full Package) - installd but when I go to test, the Checkout_shipping page is blank

 

Thnx

greg

Share this post


Link to post
Share on other sites

We only deal with CCGV(trad) in this support thread.

 

Vger

I am using CCGV 5.15a (Full Package) - installd but when I go to test, the Checkout_shipping page is blank

 

Thnx

greg

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

×