Jump to content
Strider

Credit Class/Gift Vouchers/Discount Coupons 5.10

Recommended Posts

OsirisPhnx,

In order to have a coupon sent in the welcome email you need to set up a coupon in admin-> vouchers/coupons-> coupon admin. Whatever you make the coupon code be is what you would put into the welcome coupon data field in configuration. Don't enter a discount amount, just the coupon code itself.

Milly,

 

Thanks for the tip. It is now working beautifuly.

 

OsirisPhnx

Share this post


Link to post
Share on other sites

Hi, when i use a free shipping coupon. I realize that when the shipping price is greater that the product(s) price. The coupon rest the product price intead the shipping.

 

Someboy have this problem too? any idea to fix this?

 

 

Other thing, when i try to use Paypal (paypal_ipn) the discount is not rested when the checkout process redirect the user to paypal.

 

I think that i need to add this sentence in /catalog/ipn.php:

if(tep_session_is_registered('credit_covers')) tep_session_unregister('credit_covers');
 $order_total_modules->clear_posts();//ICW ADDED FOR CREDIT CLASS SYSTEM
}

 

but i have not idea where place the code, this code is right?

 

// send emails to other people
 if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
   tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
 }
 if(tep_session_is_registered('credit_covers')) tep_session_unregister('credit_covers');
 $order_total_modules->clear_posts();//ICW ADDED FOR CREDIT CLASS SYSTEM
}
///////////////////////////////////////////////////////////////////////////////////////////////////
//                            END CHECKOUT_PROCESS                                               //
///////////////////////////////////////////////////////////////////////////////////////////////////
   } else {
       if (MODULE_PAYMENT_PAYPAL_IPN_DEBUG) {
         $description = sprintf(PAYMENT_CART_DESCRIPTION_MSG,number_format($ipn->key['mc_gross'],2),$ipn->key['mc_currency'],$ipn->key['first_name'],$ipn->key['last_name']);
         $ipn->send_email(PAYMENT_CART_DESCRIPTION,$description);
         unset($description);
       }
   }
 } else if ($ipn->txn_type() == 'send_money') {
   $description = sprintf(PAYMENT_SEND_MONEY_DESCRIPTION_MSG,number_format($ipn->key['mc_gross'],2),$ipn->key['mc_currency']);
   if (MODULE_PAYMENT_PAYPAL_IPN_DEBUG) $ipn->send_email(PAYMENT_SEND_MONEY_DESCRIPTION,$description);
   unset($description);
 } else if ($ipn->txn_type() == 'reversal') {
   $description = sprintf(PAYMENT_REVERSAL_DESCRIPTION_MSG,number_format($ipn->key['mc_gross'],2),$ipn->key['mc_currency']);
   if (MODULE_PAYMENT_PAYPAL_IPN_DEBUG) $ipn->send_email(PAYMENT_REVERSAL_DESCRIPTION,$description);
   unset($description);
 } else {
   if (MODULE_PAYMENT_PAYPAL_IPN_DEBUG) $ipn->send_email(PAYMENT_UNKNOWN_DESCRIPTION,PAYMENT_UNKNOWN_DESCRIPTION);
 }
 if (MODULE_PAYMENT_PAYPAL_IPN_DEBUG_TEST) {
     echo $ipn->debug_info();
 }
 require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

 

 

Thank you...

Share this post


Link to post
Share on other sites

Hi all

 

 

is there a way when a customer or a non-customer receives an voucher email with a link to force a login before?

 

the problem is: I click the link and the system tells me that the amount is successfully redeemed andit is also shown in the vart infobox.

 

but the amount is NOT in the system. you can't use it.

 

 

So I thought : well first log in and then click on the link. this way it works perfectly.

 

so- do you a) know this prob B) can tell me how to force a login within the email link?

 

would be great , thanks

Kai

Share this post


Link to post
Share on other sites

Hi all,

 

Please forgive me if I sound lazy, I'm just extremely busy. I have read through about 30 pages of this thread and haven't found anything that explains what is to gain from the newest upgrade. I do love this mod (mine is from Sept.) and have plans to use it a lot in my marketing.

 

I've downloaded the newest version of this so that I could be current. However, knowing that this is one of the more time consuming contribs, I'm not quite sure I would want to spend 3 or more hours to modify my files just yet, not because I don't want to, but because I don't have the time this week -- my shop is very successful due in very large part to OSC and now there's just not enough hours in the day. I would like to prioritize this in my schedule ONLY IF I NEED TO.

 

Is the newest upgrade dramatically different? What I guess I'm asking is in order to make a decision, it would be greatly appreciated if in a nutshell someone could detail the "bugs" that were fixed and were they major fixes. I haven't had any problems with the installation from Sept., but I also haven't used any of it's functionality other than sending a voucher upon signing up, and then seeing that everything got discounted and then zeroed out after purchasing.

 

I do want to start the coupon side though soon when I get to marketing.

 

Thanks in advance.

Share this post


Link to post
Share on other sites

well, things are working rather find.. just a few questions to go..

 

?? can guest buy vouchers? when voucher is sent out.. what if no one redeems? customers might need their own cpanel to manage the vouchers sent..

?? ability to choose amount of gift voucher to use during checkout? instead of watever balance there is?

?? why is it that the gv_redeem.php doesn't check for registered(cust_id) .. is there a reason for it? i see if we redeem frm e url in the e-mail.. the gv is considered redeemed but if i close the browser and open it again.. there goes the redeem amount.. and it belongs to neither customer..

 

hav any one done this already? i'm kind of lazy to do it myself.. so yup here asking.. if there's noone.. i'll prolly end up doing it...

 

btw, just something to note.. e e-mail link doesn't seem to work.. (ccgv-510b) change from

 

$gv_email .= EMAIL_GV_LINK . tep_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $id1,'NONSSL',false);;

to

$gv_email .= EMAIL_GV_LINK . '<a href="' . tep_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $id1,'NONSSL',false) . '">' . tep_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $id1,'NONSSL',false) . '</a>';

Edited by dericknwq

Share this post


Link to post
Share on other sites

Hi,

 

When I restrict the percentage coupon to specific categories, the discount is not being applied to product which have attributes defined.

 

Have someone the same problem ?

 

I work with osc2.2ms2 and ccgv-510b

 

 

PLEASE HELP

Share this post


Link to post
Share on other sites

I installed the contibution without a problem, tested it and it worked fine, but now I am getting the following error when I log in with an account I created:

 

1146 - Table 'osirisen_osc2.TABLE_COUPON_GV_CUSTOMER' doesn't exist    select amount from TABLE_COUPON_GV_CUSTOMER where customer_id = '2'    [TEP STOP]

 

I uploaded the sql file with phpAdmin, and everything elses is fine.

 

Have it configured for welcome coupon. I already "redeemed" the welcome coupon with the test account. Could this be causing the problem and if so, how do I fix it?

 

Thanks in Advance;

 

OsirisPhnx

Share this post


Link to post
Share on other sites
I installed the contibution without a problem, tested it and it worked fine, but now I am getting the following error when I log in with an account I created:

 

1146 - Table 'osirisen_osc2.TABLE_COUPON_GV_CUSTOMER' doesn't exist ? ?select amount from TABLE_COUPON_GV_CUSTOMER where customer_id = '2' ? ?[TEP STOP]

 

I uploaded the sql file with phpAdmin, and everything elses is fine.

 

Have it configured for welcome coupon. I already "redeemed" the welcome coupon with the test account. Could this be causing the problem and if so, how do I fix it?

 

Thanks in Advance;

 

OsirisPhnx

TABLE_COUPON_GV_CUSTOMER

 

you prolly forgotten to define the database table constant

 

did u require

require(DIR_WS_INCLUDES . 'add_ccgvdc_application_top.php');  // ICW CREDIT CLASS Gift Voucher Addittion

 

at the bottom of your application_top.php??

Share this post


Link to post
Share on other sites
TABLE_COUPON_GV_CUSTOMER

 

you prolly forgotten to define the database table constant

 

did u require

require(DIR_WS_INCLUDES . 'add_ccgvdc_application_top.php'); ?// ICW CREDIT CLASS Gift Voucher Addittion

 

at the bottom of your application_top.php??

You know... No matter how many times I looked at the code and tried to find the problem, I can't believe I missed something like that.

 

Thanks for your help. Boy do I feel stupid now... lol

 

Thanks again,

 

OsirisPhnx

Share this post


Link to post
Share on other sites

Question...

 

Purchases made with a GV show the purchase as "processing". This occurs when I as the admin send myself a GV. The probelm I have is that I am offering products by download - so needless to say they dont appear for download....

 

How can I change the level to "delivered" without having to do it manually?

Share this post


Link to post
Share on other sites

Hello, Just installed the latest version and have an error on checkout_confirmation

 

Fatal error: Call to undefined function: output() in /home/miller/public_html/store/checkout_confirmation.php on line 312

 

and that line is

 

echo $order_total_modules->output();

 

This was a by-hand install and I was very thorough.. any ideas?

Share this post


Link to post
Share on other sites

hey fellas. Now that my site has gone live (www.modyourcar.com) I am looknig at adding some features and this is one.

 

I have downlaoded the latest version of this (I think it's 5.10) and have installed it no problem over the top of my modded OSC site on my laptop (test environment). It took me about an hour, quite straight forward.

 

There's a couple of issues you guys may be able to help with:

 

1) When I purchase a $25 gift voucher the checkout confirmation screen only charges me $22 (ex tax) rather that $25. I haven't been able to figure out why.

 

2) If I have $25 in my voucher account and I try and send ALL of it to some one else (gv_send) it says I don't have that much in my account but I do. If I only send $24.99 it works fine and leaves a 0.01c balance in my account.

 

That's all for now. I just want to say it's a great contribution but does need a lot of work but you guys have done a great job to get it where it is!!!


Dan

Share this post


Link to post
Share on other sites

Hi,

 

I just noticed when a user sends a gift certificate to an unsubscribed user account, and the person clicks on the link, it shows the amount total in the shopping cart, but soon after they become a member the amount disappears from the shopping cart, but is still redeamable through checkout. Is it possible to somehow link the gift certificate amount to the email address that received the item, and when the person creates an account, it'll show up in their shopping cart box?

 

Sorry if this sounds confusing.

 

Thanks again.

Share this post


Link to post
Share on other sites

Has anyone managed to get the Credit Class/Gift Voucher to work with IPN?

 

I have two issues:

 

1) When a user uses their voucher, it doesn't deduct from the 'Total' - it just says: Gift Voucher: (value) after the total amount in checkout_confirmation. I mean, it's working, but if I can't tell that I need to pay less, my customers won't either.

 

2) The ipn.php doesn't contain some of the lines which need to be changed in checkout_process.php... Could someone tell me which Paypal_IPN files I need to change to get the two contribs working together?

 

 

 

Thanks

Share this post


Link to post
Share on other sites

I have the same issue as talon177 has

 

@t177 thanks that I am not the only one who has this - but just wondering if we are the only one?

 

Does anybody has a solution or a hint?

Share this post


Link to post
Share on other sites
Has anyone managed to get the Credit Class/Gift Voucher to work with IPN?

 

I have two issues:

 

1) When a user uses their voucher, it doesn't deduct from the 'Total' - it just says: Gift Voucher: (value) after the total amount in checkout_confirmation. I mean, it's working, but if I can't tell that I need to pay less, my customers won't either.

 

2) The ipn.php doesn't contain some of the lines which need to be changed in checkout_process.php... Could someone tell me which Paypal_IPN files I need to change to get the two contribs working together?

 

 

 

Thanks

Verel: I'll check mine out later today also, I'm in the same situation and I'm wondering if mine works, since I'm still in the testing/installing stage.

 

Saletco: I'm glad that i'm not the only one now, it was driving me nuts thinking I put a typo or something somewhere. Hopefully there's a solution for this.

Share this post


Link to post
Share on other sites

My IPN 1.7 seems to works now with the CCGV contrib

 

Try with this catalog/ipn.php

 

<?php
/*
 $Id: ipn.php,v 1.0 2003/12/31 19:41:45 gregbaboolal@yahoo.com Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 if ( strcmp(phpversion(),'4.0.6') <= 0 ) {
   $_GET = $HTTP_GET_VARS;
   $_POST = $HTTP_POST_VARS;
   $_SERVER = $HTTP_SERVER_VARS;
 }

 unset($_GET,$HTTP_GET_VARS,$HTTP_POST_VARS);

 //Continue the session
 $HTTP_POST_VARS['osCsid'] = $_POST['custom'];
 //Start up osC
 require_once('includes/application_top.php');

 require_once DIR_WS_CLASSES . 'paypal/ipn.php';
 require_once DIR_WS_LANGUAGES.'english/modules/payment/paypal.php';
 $ipn = new paypal_ipn(MODULE_PAYMENT_PAYPAL_IPN_DEBUG_EMAIL,$_POST,tep_session_name(),MODULE_PAYMENT_PAYPAL_IPN_DEBUG);
 unset($_POST,$HTTP_POST_VARS);

 //post back to PayPal system to validate
 //For a sample VALID IPN view PayPal's source page prior to returning checkout_success.php
 //If the IPN is not valid then don't do anything, set 'paypal_debug' to non-zero if
 //you want to investigate these occurances.
 if(!$ipn->authenticate('www.paypal.com') && !MODULE_PAYMENT_PAYPAL_IPN_DEBUG_TEST) exit;

 //Check that the receiver_email is your Primary PayPal email
 if (!$ipn->validate_receiver_email(MODULE_PAYMENT_PAYPAL_ID,MODULE_PAYMENT_PAYPAL_BUSINESS_ID) && !MODULE_PAYMENT_PAYPAL_IPN_DEBUG_TEST) exit;

 //Check the payment_status is Completed
 if ( $ipn->key['payment_status'] != 'Completed' && !MODULE_PAYMENT_PAYPAL_IPN_DEBUG_TEST) exit;

 //Check that txn_id has not been previously processed
 //NOTE: This disable notifications on refunds/reversals(?) with same transaction id's
 if (!$ipn->unique_txn_id() && !MODULE_PAYMENT_PAYPAL_IPN_DEBUG_TEST) exit;

 //Process payment
 if ( $ipn->txn_type() == 'web_accept' || $ipn->txn_type() == 'cart') {
   include_once DIR_WS_CLASSES . 'paypal/cart.php';
   $ipn_cart = new paypal_ipn_cart();
   //check that payment_amount/payment_currency are correct
   if ($ipn_cart->valid_payment($ipn,$cart,$currency) ) { //needs work
     $description = sprintf(PAYMENT_CART_DESCRIPTION_MSG,number_format($ipn->key['mc_gross'],2),$ipn->key['mc_currency'],$ipn->key['first_name'],$ipn->key['last_name']);
     if (MODULE_PAYMENT_PAYPAL_IPN_DEBUG > 1) $ipn->send_email(PAYMENT_CART_DESCRIPTION, $description);
     unset($description);
     $ipn->insert_ipn_txn();
///////////////////////////////////////////////////////////////////////////////////////////////////
//                            BEGIN CHECKOUT_PROCESS                                             //
///////////////////////////////////////////////////////////////////////////////////////////////////
 include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PROCESS);
 require(DIR_WS_CLASSES . 'payment.php');
if ($credit_covers) $payment=''; //ICW added for CREDIT CLASS
 $payment_modules = new payment($payment);
 require(DIR_WS_CLASSES . 'order.php');
 $order = new order;
 require(DIR_WS_CLASSES . 'order_total.php');
 $order_total_modules = new order_total;
 $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'],
                         'paypal_ipn_id' => $ipn->get_paypal_ipn_id());
 tep_db_perform(TABLE_ORDERS, $sql_data_array);
 $insert_id = tep_db_insert_id();
 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_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_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) && (STOCK_ALLOW_CHECKOUT == 'false') ) {
         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_ORDERS_PRODUCTS, $sql_data_array);
   $order_products_id = tep_db_insert_id();
   $order_total_modules->update_credit_account($i);//ICW ADDED FOR CREDIT CLASS 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_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_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";
 }
$order_total_modules->apply_credit();//ICW ADDED FOR CREDIT CLASS SYSTEM
// lets start with the email confirmation
 $email_order = STORE_NAME . "\n" .
                EMAIL_SEPARATOR . "\n" .
                EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
                EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .
                EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
 if ($order->info['comments']) {
   $email_order .= tep_db_output($order->info['comments']) . "\n\n";
 }
 $email_order .= EMAIL_TEXT_PRODUCTS . "\n" .
                 EMAIL_SEPARATOR . "\n" .
                 $products_ordered .
                 EMAIL_SEPARATOR . "\n";

 for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
   $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
 }

 if ($order->content_type != 'virtual') {
   $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" .
                   EMAIL_SEPARATOR . "\n" .
                   tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
 }

 $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
                 EMAIL_SEPARATOR . "\n" .
                 tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
 if (is_object($$payment)) {
   $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .
                   EMAIL_SEPARATOR . "\n";
   $payment_class = $$payment;
   $email_order .= $payment_class->title . "\n\n";
   if ($payment_class->email_footer) {
     $email_order .= $payment_class->email_footer . "\n\n";
   }
 }
 tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
// send emails to other people
 if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
   tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
 }
///////////////////////////////////////////////////////////////////////////////////////////////////
//                            END CHECKOUT_PROCESS                                               //
///////////////////////////////////////////////////////////////////////////////////////////////////
   } else {
       if (MODULE_PAYMENT_PAYPAL_IPN_DEBUG) {
         $description = sprintf(PAYMENT_CART_DESCRIPTION_MSG,number_format($ipn->key['mc_gross'],2),$ipn->key['mc_currency'],$ipn->key['first_name'],$ipn->key['last_name']);
         $ipn->send_email(PAYMENT_CART_DESCRIPTION,$description);
         unset($description);
       }
   }
 } else if ($ipn->txn_type() == 'send_money') {
   $description = sprintf(PAYMENT_SEND_MONEY_DESCRIPTION_MSG,number_format($ipn->key['mc_gross'],2),$ipn->key['mc_currency']);
   if (MODULE_PAYMENT_PAYPAL_IPN_DEBUG) $ipn->send_email(PAYMENT_SEND_MONEY_DESCRIPTION,$description);
   unset($description);
 } else if ($ipn->txn_type() == 'reversal') {
   $description = sprintf(PAYMENT_REVERSAL_DESCRIPTION_MSG,number_format($ipn->key['mc_gross'],2),$ipn->key['mc_currency']);
   if (MODULE_PAYMENT_PAYPAL_IPN_DEBUG) $ipn->send_email(PAYMENT_REVERSAL_DESCRIPTION,$description);
   unset($description);
 } else {
   if (MODULE_PAYMENT_PAYPAL_IPN_DEBUG) $ipn->send_email(PAYMENT_UNKNOWN_DESCRIPTION,PAYMENT_UNKNOWN_DESCRIPTION);
 }
 if (MODULE_PAYMENT_PAYPAL_IPN_DEBUG_TEST) {
     echo $ipn->debug_info();
 }
if(tep_session_is_registered('credit_covers')) tep_session_unregister('credit_covers');
 $order_total_modules->clear_posts();//ICW ADDED FOR CREDIT CLASS SYSTEM
 require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

Share this post


Link to post
Share on other sites

@talon

 

I guess that the problem is in gv_redeem.php - in the first part at the beginning:

 

// check for a voucher number in the url
 if (isset($HTTP_GET_VARS['gv_no'])) {
   $error = true;
   $gv_query = tep_db_query("select c.coupon_id, c.coupon_amount from " . TABLE_COUPONS . " c, " . TABLE_COUPON_EMAIL_TRACK . " et where coupon_code = '" . $HTTP_GET_VARS['gv_no'] . "' and c.coupon_id = et.coupon_id");
   if (tep_db_num_rows($gv_query) >0) {
     $coupon = tep_db_fetch_array($gv_query);
     $redeem_query = tep_db_query("select coupon_id from ". TABLE_COUPON_REDEEM_TRACK . " where coupon_id = '" . $coupon['coupon_id'] . "'");
     if (tep_db_num_rows($redeem_query) == 0 ) {
// check for required session variables
       if (!tep_session_is_registered('gv_id')) {
         tep_session_register('gv_id');
       }
       $gv_id = $coupon['coupon_id'];
       $error = false;
     } else {
       $error = true;
     }
   }
 } else {
   tep_redirect(FILENAME_DEFAULT);
 }
 if ((!$error) && (tep_session_is_registered('customer_id'))) {
// Update redeem status
   $gv_query = tep_db_query("insert into  " . TABLE_COUPON_REDEEM_TRACK . " (coupon_id, customer_id, redeem_date, redeem_ip) values ('" . $coupon['coupon_id'] . "', '" . $customer_id . "', now(),'" . $REMOTE_ADDR . "')");
   $gv_update = tep_db_query("update " . TABLE_COUPONS . " set coupon_active = 'N' where coupon_id = '" . $coupon['coupon_id'] . "'");
   tep_gv_account_update($customer_id, $gv_id);
   tep_session_unregister('gv_id');
 }

 

Maybe somebody could help with this a little bit.

Share this post


Link to post
Share on other sites

talon and saletco and anyone else that is having problems with gv_redeem:

gv_redeem works very well in 5.10b. I would suggest you look at your cart and see if you are losing that also when you register. This would mean you are losing your session. You can also test the way the gv's work by redeeming them as a non registered customer then exiting then redeeming them again. You will find they do not redeem til the customer signs in.

 

virtual1: the orders status is set in orders.php at about line 165.

      if (isset($GLOBALS[$payment]) && is_object($GLOBALS[$payment])) {

        $this->info['payment_method'] = $GLOBALS[$payment]->title;

 

        if ( isset($GLOBALS[$payment]->order_status) && is_numeric($GLOBALS[$payment]->order_status) && ($GLOBALS[$payment]->order_status > 0) ) {

          $this->info['order_status'] = $GLOBALS[$payment]->order_status;

        }

      }

You will need to change the first if statement to suit your needs.

 

 

veral: you need to change your sort order to have total higer than gv.

sort order should be something like

1 subtotal

2 shipping

3 tax

9 discount coupons

740 gift voucher

800 total


(my knowledge is so small you would think that an ant was a genius in comparison)

Share this post


Link to post
Share on other sites

This contribution looks awesome! I'm setting aside a big chunk of hours tonight to install the mod, but I had a quick question...

 

We want to be able to prepopulate customer accounts with a certain dollar amount that they can then spend whenever/however they want.

 

Would the best way to do this to be to create gift vouchers in the admin and then send to the recipients? Or can go in the back end and just drop a credit into their accounts?

 

Thanks in advance for any and all input and suggestions!

 

-D

Share this post


Link to post
Share on other sites

Hey guys, does your "normal" specials pricing overrule the CGdiscounts even if total amt off is lower than that of CGs?

 

Like lets say Im having a 5% off for a certain product for the general public. but this member of mine has a 8% off tagged to him by CGdiscount. it seems that the 5% dictated by the original OSc specials overrules the CGDiscs.. and shows up at checkout confirmation.

 

if im the only one then Im going to reinstall my CGdisc

 

TIA

Edited by langsoo

Share this post


Link to post
Share on other sites

you should have 13% off that particular product and 8% off of the rest of them.

Now this depends also on if your specials are setup through the database in a normal specials.


(my knowledge is so small you would think that an ant was a genius in comparison)

Share this post


Link to post
Share on other sites

Thanks to Strider and all the others who have made this contribution what it is. It's awesome.

 

For me everything went well with installation and nearly all seems to be working OK.

 

The one problem I have is using admin to send a gift voucher email to someone. I enter the information, preview it and click "send mail". I then get a Notice at the top saying "email sent to ....." and it goes back to the main "Send Gift Voucher To Customers" page.

 

However the email never arrives in the customer inbox. Anyone else had this problem? I've read through his thread and can't find the solution.

 

The send email works OK from the catalog side of the store though.

 

FYI I'm using 2.2 MS2 and 5.10b and haven't made any changes to gv_mail.php.

 

Thanks

Tim

Share this post


Link to post
Share on other sites

I am having the same issues that klyder is having on page 98 of this post. I have a 10% discount that when used with sales tax is not sending the correct value to my gateway. I believe that my sort order is setup correctly as the order total is displayed correctly on the confirmation page. I viewed the test order I had made in my merchant control panel and noticed that it displayed the shipping and tax correctly. However, the order total was sent without the discount.

 

I use http://www.oscommerce.com/community/contributions,1592 as my payment option which uses paygateway or Paradata as my gateway. Any thoughts?

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

×