Jump to content
Strider

Credit Class/Gift Vouchers/Discount Coupons 5.10

Recommended Posts

mpally: It sounds like you don't have GIFT as the first part of your model number of the gift voucher.

ie model number = GIFT-whatever

or GIFTwhatever

I never did post my solution, so just in case someone has the same problem. My error was I did name the model incorrectly. It seems like the biggest problems are caused by overlooking easy stuff. :)

Share this post


Link to post
Share on other sites
such & such? I haven't heard that one.. what kind of error msg... for what function or page

where is my coffee

He he - look at your browser address bar when you redeem a voucher :D

 

eg.

 

https://www.my_server.com/checkout_payment.php?error_message=Congratulations%2C+you+have+redeemed+%2420.00

 

Matti

I went through this entire thread. Granted I could have missed something but is anyone else having this problem?

 

Basically, if I use an invalid gift certificate no error message appears on the page to alert someone of the error. Instead, I see the error message in the browser address field. It's as if there is a code missing on the page that is not "grabbing" the HTTP variable or something. I tried looking but I don't really have the expertise w/PHP to actually know what I need to make sure the error messages appear on the page. Has anyone resolved this yet?

 

Matti, you posted the original issue did you ever find out what went wrong?

Share this post


Link to post
Share on other sites

The problem I'm having is that when I purchase a GV, the shipping is being charged. Anyone know how to get rid of this?

 

THanks!


Joel Gallant

Share this post


Link to post
Share on other sites

I don't think it's possible to set up shipping on an item-specific basis. What about setting up shipping by weight? If you deal with different shipping charges for different products, you can simply use weight to categorise the products.

 

Example:

Weight=1 : shipping is $1.99

Weight=2 : shipping is $2.99

 

That way you should be able to set up one option for products where

weight=0 : shipping is $0.00

 

Dunno if that makes sense to you ;)

 

 

Cheers,

Hans Kristian


Carlotta was the kind of town where they spell trouble T-R-U-B-I-L, and if you try to correct them, they kill you.

Share this post


Link to post
Share on other sites

I figured out the way to do it that way, but the problem that I have is that I have it set up by dollar amount.

 

So, if you buy something for $50 the shipping is going to be 7.50... for example. So, I have no idea how else to set it up....


Joel Gallant

Share this post


Link to post
Share on other sites

I saw another post about the same problem in the General Support forum earlier. One suggestion was to add support for downloadable products as there is no shipping on those, and just add the products which should have free shipping as downloadable. Would maybe require some moding though.

 

Another reply talked about a contrib that lets you have a free shipping option at checkout. Not sure that would be very helpful though...

 

I'll see if I can find the topic. :)


Carlotta was the kind of town where they spell trouble T-R-U-B-I-L, and if you try to correct them, they kill you.

Share this post


Link to post
Share on other sites

Ok, so when I turn my download option on, I get an error....

 

 

Warning: The downloadable products directory does not exist: /mnt/web_g/d47/s36/b01f2394/www/store/nfoscomm/catalogdownload/. Downloadable products will not work until this directory is valid.

 

 

Got an idea what I'm missing here?


Joel Gallant

Share this post


Link to post
Share on other sites

I've installed CCGV 5.10b

 

I get a voucher to show in shopping_Cart.php box but when I checkout (thru the whole process) i see no mention of the voucher or the ability to use it.

 

Any ideas? this thread is huge and i've searched for a few good hours.

 

Much appreciated.

 

Jacob

Share this post


Link to post
Share on other sites

So everything is installed & you purchased a voucher to try it out?

 

When it comes time to use it, you are going to need to ensure that you have authorized the voucher by clicking on the Gift Voucher Queue button then the "Redeem" option. Once that is done, the Voucher becomes live!

 

Afterwards, when it's time to purchase something, there will be a check box that will allow you to use the balance available.

 

Hope that makes sense! Now if I could only make mine work!


Joel Gallant

Share this post


Link to post
Share on other sites

One thing I dont understand is how to add vouchers as products? It needs to be linked somehow to "Gift Voucher Queue" right?

Share this post


Link to post
Share on other sites

Nope, as long as you have the product name as GIFTwhatever then it will automatically pick it up!

 

Let me know if you can make it work without shipping being charged!


Joel Gallant

Share this post


Link to post
Share on other sites

Would I be considered a fool if I tried to install ccgv-510b on a highly modified ms1 install? Is there anything that I can use to reference to help me with this attempt?

 

Chris

Share this post


Link to post
Share on other sites

Has anyone gotten Purchase Without Account, PayPal IPN, and CCGV to work together? I believe i'm having a problem because it's not logging my coupons as available yet.

Share this post


Link to post
Share on other sites

I just added thie Credit and Voucher system to my site: http://serendipityandbeyond.com/catalog/index.php

and everything works great down to the point of the customer getting to the order confirmation page where I get the error:

 

Fatal error: Call to undefined function: confirmation() in /catalog/checkout_confirmation.php on line 257

 

I double checked the code and cannot find where I have mis-typed, etc.

 

I love this add-on, so please help!

 

Also, how can you specify one category for EXCLUSION fron discounts? (ie.: Gift Vouchers?) (I tried listing the rest of the categories, but I have well over 100 and it would not take all that I approved of discounts...)

 

Thanks!

Edited by psychman

Share this post


Link to post
Share on other sites
I can't seem to get a coupon with restrict_to_products has a product with attributes.

 

I.e.

I have a 50% coupon "FIFTY"

WHERE: Valid Product List ::  1,7

 

1 x You've Got Mail $34.99

1 x Matrox G200 MMS

  - Memory: 4 mb

  - Model: Value $299.99

 

Sub-Total: $334.98

Flat Rate (Best Way): $5.00

Discount Coupons:FIFTY: -$17.50

FL TAX 7.0%: $12.07

Total: $334.55

 

Is this a bug/feature??  Anyone have a fix for it?

Any suggestions / comments on my first posted question??

Hi,

Hobzilla had posted a problem with coupon not getting properly discounted with restrict to products with attributes (the coupon was in percentage).

Even i faced the same problem and after much debugging int he file catalog/includes/modules/order_total/ot_coupon.php in the function calculate_credit()

I replaced the line

 

//Fred 2003-10-28, fix for the row above, otherwise the discount is calc based on price excl VAT! */

 

$pr_c = $this->product_price($pr_ids[$ii]);

 

with the following line

 

$pr_c = $this->product_price($order->products[$i]['id']);

 

Also in the same function below

I replaced the line

 

$pr_c = $this->product_price(tep_get_prid($order->products[$i]['id']));

 

(The function tep_get_prid was creating problem)

 

with the following line

 

$pr_c = $this->product_price($order->products[$i]['id']);

 

 

It is working fine now !!!

But i just need to know whether in doing this thing have i unknowingly allowed one more bug to creep in or is it ok ???

Maybe Strider,Fred ,Hobzilla or any other person could solve

Waiting for a reply desperately :(

Share this post


Link to post
Share on other sites

Hi,

One more thing I have read alot in this forum that there is a problem of discount coupon with authorize.net payment module. I dont have an account with authorize.net. so i cant test it myself. But if any of you have found any problems of authorize.net with discount coupons then kindly post in this forum

Also if u have found out the solutions to those problems then let me know

 

Hoping for some reply :)

Share this post


Link to post
Share on other sites

I have successfully installed this contribution with just one file that is causing an issue and that is catalog/includes/classes/order_total.php on line 14.

 

Here is that file

 

<?php
/*
 $Id: order_total.php,v 1.3.2.7 2003/05/14 22:52:58 wilt Exp $
 orig : order_total.php,v 1.4 2003/02/11 00:04:53 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 class order_total {
   var $modules;

// class constructor
   function order_total() {
     global $language;

     if (defined('MODULE_ORDER_TOTAL_INSTALLED') && tep_not_null(MODULE_ORDER_TOTAL_INSTALLED)) {
       $this->modules = explode(';', MODULE_ORDER_TOTAL_INSTALLED);

       reset($this->modules);
       while (list(, $value) = each($this->modules)) {
         include(DIR_WS_LANGUAGES . $language . '/modules/order_total/' . $value);
         include(DIR_WS_MODULES . 'order_total/' . $value);

         $class = substr($value, 0, strrpos($value, '.'));
         $GLOBALS[$class] = new $class;
       }
     }
   }

   function process() {
     $order_total_array = array();
     if (is_array($this->modules)) {
       reset($this->modules);
       while (list(, $value) = each($this->modules)) {
         $class = substr($value, 0, strrpos($value, '.'));
         if ($GLOBALS[$class]->enabled) {
           $GLOBALS[$class]->process();

           for ($i=0, $n=sizeof($GLOBALS[$class]->output); $i<$n; $i++) {
             if (tep_not_null($GLOBALS[$class]->output[$i]['title']) && tep_not_null($GLOBALS[$class]->output[$i]['text'])) {
               $order_total_array[] = array('code' => $GLOBALS[$class]->code,
                                            'title' => $GLOBALS[$class]->output[$i]['title'],
                                            'text' => $GLOBALS[$class]->output[$i]['text'],
                                            'value' => $GLOBALS[$class]->output[$i]['value'],
                                            'sort_order' => $GLOBALS[$class]->sort_order);
             }
           }
         }
       }
     }

     return $order_total_array;
   }

   function output() {
     $output_string = '';
     if (is_array($this->modules)) {
       reset($this->modules);
       while (list(, $value) = each($this->modules)) {
         $class = substr($value, 0, strrpos($value, '.'));
         if ($GLOBALS[$class]->enabled) {
           $size = sizeof($GLOBALS[$class]->output);
           for ($i=0; $i<$size; $i++) {
             $output_string .= '              <tr>' . "\n" .
                               '                <td align="right" class="main">' . $GLOBALS[$class]->output[$i]['title'] . '</td>' . "\n" .
                               '                <td align="right" class="main">' . $GLOBALS[$class]->output[$i]['text'] . '</td>' . "\n" .
                               '              </tr>';
           }
         }
       }
     }

     return $output_string;
   }
// ICW ORDER TOTAL CREDIT CLASS/GV SYSTEM - START ADDITION
//
// This function is called in checkout payment after display of payment methods. It actually calls
// two credit class functions.
//
// use_credit_amount() is normally a checkbox used to decide whether the credit amount should be applied to reduce
// the order total. Whether this is a Gift Voucher, or discount coupon or reward points etc.
//
// The second function called is credit_selection(). This in the credit classes already made is usually a redeem box.
// for entering a Gift Voucher number. Note credit classes can decide whether this part is displayed depending on
// E.g. a setting in the admin section.
//
   function credit_selection() {
     $selection_string = '';
     $close_string = '';
     $credit_class_string = '';
     if (MODULE_ORDER_TOTAL_INSTALLED) {
       $header_string = '<tr>' . "\n";
       $header_string .= '   <td><table border="0" width="100%" cellspacing="0" cellpadding="2">' . "\n";
       $output1_string .= '      <tr>' . "\n";
       $header_string .= '        <td class="main"><b>' . TABLE_HEADING_CREDIT . '</b></td>' . "\n";
       $header_string .= '      </tr>' . "\n";
       $header_string .= '    </table></td>' . "\n";
       $header_string .= '  </tr>' . "\n";
       $header_string .= '<tr>' . "\n";
       $header_string .= '   <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">' . "\n";
       $header_string .= '     <tr class="infoBoxContents"><td><table border="0" width="100%" cellspacing="0" cellpadding="2">' ."\n";
      $header_string .= '       <tr><td width="10">' .  tep_draw_separator('pixel_trans.gif', '10', '1') .'</td>' . "\n";
       $header_string .= '           <td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2">' . "\n";
       $close_string   = '                           </table></td>';
       $close_string  .= '<td width="10">' .  tep_draw_separator('pixel_trans.gif', '10', '1') . '</td>';
       $close_string  .= '</tr></table></td></tr></table></td>';
       $close_string  .= '<tr><td width="100%">' .  tep_draw_separator('pixel_trans.gif', '100%', '10') . '</td></tr>';
       reset($this->modules);
       $output_string = '';
       while (list(, $value) = each($this->modules)) {
         $class = substr($value, 0, strrpos($value, '.'));
         if ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) {
           $use_credit_string = $GLOBALS[$class]->use_credit_amount();
           if ($selection_string =='') $selection_string = $GLOBALS[$class]->credit_selection();
           if ( ($use_credit_string !='' ) || ($selection_string != '') ) {
             $output_string .=  '<tr colspan="4"><td colspan="4" width="100%">' .  tep_draw_separator('pixel_trans.gif', '100%', '10') . '</td></tr>';
             $output_string = ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" >' . "\n" .
                              '   <td width="10">' .  tep_draw_separator('pixel_trans.gif', '10', '1') .'</td>' .
                              '     <td class="main"><b>' . $GLOBALS[$class]->header . '</b></td>' . $use_credit_string;
             $output_string .= '<td width="10">' . tep_draw_separator('pixel_trans.gif', '10', '1') . '</td>';
             $output_string .= '  </tr>' . "\n";
             $output_string .= $selection_string;
           }

         }
       }
       if ($output_string != '') {
         $output_string = $header_string . $output_string;
         $output_string .= $close_string;
       }
     }
     return $output_string;
   }


//            if ($selection_string !='') {
//              $output_string .= '</td>' . "\n";
//              $output_string .= $selection_string;
//            }




// update_credit_account is called in checkout process on a per product basis. It's purpose
// is to decide whether each product in the cart should add something to a credit account.
// e.g. for the Gift Voucher it checks whether the product is a Gift voucher and then adds the amount
// to the Gift Voucher account.
// Another use would be to check if the product would give reward points and add these to the points/reward account.
//
   function update_credit_account($i) {
     if (MODULE_ORDER_TOTAL_INSTALLED) {
       reset($this->modules);
       while (list(, $value) = each($this->modules)) {
         $class = substr($value, 0, strrpos($value, '.'));
         if ( ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) ) {
           $GLOBALS[$class]->update_credit_account($i);
         }
       }
     }
   }
// This function is called in checkout confirmation.
// It's main use is for credit classes that use the credit_selection() method. This is usually for
// entering redeem codes(Gift Vouchers/Discount Coupons). This function is used to validate these codes.
// If they are valid then the necessary actions are taken, if not valid we are returned to checkout payment
// with an error
//
   function collect_posts() {
     global $HTTP_POST_VARS,$HTTP_SESSION_VARS;
     if (MODULE_ORDER_TOTAL_INSTALLED) {
       reset($this->modules);
       while (list(, $value) = each($this->modules)) {
         $class = substr($value, 0, strrpos($value, '.'));
         if ( ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) ) {
           $post_var = 'c' . $GLOBALS[$class]->code;
           if ($HTTP_POST_VARS[$post_var]) {
       if (!tep_session_is_registered($post_var)) tep_session_register($post_var);
    	 $post_var = $HTTP_POST_VARS[$post_var];
     }
           $GLOBALS[$class]->collect_posts();
         }
       }
     }
   }
// pre_confirmation_check is called on checkout confirmation. It's function is to decide whether the
// credits available are greater than the order total. If they are then a variable (credit_covers) is set to
// true. This is used to bypass the payment method. In other words if the Gift Voucher is more than the order
// total, we don't want to go to paypal etc.
//
   function pre_confirmation_check() {
     global $payment, $order, $credit_covers;
     if (MODULE_ORDER_TOTAL_INSTALLED) {
       $total_deductions  = 0;
       reset($this->modules);
       $order_total = $order->info['total'];
       while (list(, $value) = each($this->modules)) {
         $class = substr($value, 0, strrpos($value, '.'));
         $order_total = $this->get_order_total_main($class,$order_total);
         if ( ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) ) {
           $total_deductions = $total_deductions + $GLOBALS[$class]->pre_confirmation_check($order_total);
           $order_total = $order_total - $GLOBALS[$class]->pre_confirmation_check($order_total);
         }
       }
       if ($order->info['total'] - $total_deductions <= 0 ) {
  	 if(!tep_session_is_registered('credit_covers')) tep_session_register('credit_covers');
         $credit_covers = true;
       }
   else{   // belts and suspenders to get rid of credit_covers variable if it gets set once and they put something else in the cart
  	 if(tep_session_is_registered('credit_covers')) tep_session_unregister('credit_covers');	
   }
     }
   }
// this function is called in checkout process. it tests whether a decision was made at checkout payment to use
// the credit amount be applied aginst the order. If so some action is taken. E.g. for a Gift voucher the account
// is reduced the order total amount.
//
   function apply_credit() {
     if (MODULE_ORDER_TOTAL_INSTALLED) {
       reset($this->modules);
       while (list(, $value) = each($this->modules)) {
         $class = substr($value, 0, strrpos($value, '.'));
         if ( ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) ) {
           $GLOBALS[$class]->apply_credit();
         }
       }
     }
   }
// Called in checkout process to clear session variables created by each credit class module.
//
   function clear_posts() {
     global $HTTP_POST_VARS,$HTTP_SESSION_VARS;
     if (MODULE_ORDER_TOTAL_INSTALLED) {
       reset($this->modules);
       while (list(, $value) = each($this->modules)) {
         $class = substr($value, 0, strrpos($value, '.'));
         if ( ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) ) {
           $post_var = 'c' . $GLOBALS[$class]->code;
            if (tep_session_is_registered($post_var)) tep_session_unregister($post_var);
         }
       }
     }
   }
// Called at various times. This function calulates the total value of the order that the
// credit will be appled aginst. This varies depending on whether the credit class applies
// to shipping & tax
//
   function get_order_total_main($class, $order_total) {
     global $credit, $order;
//      if ($GLOBALS[$class]->include_tax == 'false') $order_total=$order_total-$order->info['tax'];
//      if ($GLOBALS[$class]->include_shipping == 'false') $order_total=$order_total-$order->info['shipping_cost'];
     return $order_total;
   }
// ICW ORDER TOTAL CREDIT CLASS/GV SYSTEM - END ADDITION
 }
?>

 

This is what is on line 14 in my editor:

 

class order_total {

 

Basically when trying to purchase something as soon as I click to continue from payment information I just get a blank screen with the following at the top:

 

Fatal error: Cannot redeclare class order_total in /home/popcorn/public_html/catalog/includes/classes/order_total.php on line 14

 

Can anyone solve this problem for me?

 

Mark

Share this post


Link to post
Share on other sites

My customers cannot buy anything until I can get this fixed. Can anyone please help?

Share this post


Link to post
Share on other sites
Nope, as long as you have the product name as GIFTwhatever then it will automatically pick it up!

 

Let me know if you can make it work without shipping being charged!

:) You have to put GIFT as the first four characters of the MODEL number of the gift voucher products. When purchased, the code will either be e-mailed directly to your customer or automatically entered in your gift voucher queue depending on your configuration.

 

As for shipping w/o a charge, make sure the weight of these gift vouchers is set to 0 in the product details. I have an easy contribution installed, Downloads Controller, that has a free shipper module along w/it. If an order has 0 weight, then their will be no shipping charge.

 

http://www.oscommerce.com/community/contri...ons,994/page,11

Share this post


Link to post
Share on other sites

I have a problem

My site is: http://www.iPodXtras.com

 

1)When I redeem a gift voucher or a coupon, no popup displays, and also, in the shopping cart box, it doesnt show what coupon you have redeemed... There is just this text...

Coupon : more info

the link for more info doesn't work either!

 

2)Also, I can't delete coupons that arent active... (And I can't change them to active either (with dates and stuff) ) When i go to all coupons, then click on the coupon, then click delete it takes me to the active coupon screen where it has the [ ] and should have the coupon number that it wants to delete but it doesnt have anything jsut the [ ] so i cant delete any coupons!

 

Thanks guys and gals (can't forget the gals)

 

Please help!!!! my site is live

Share this post


Link to post
Share on other sites

Hi guys,

 

Ok so I just read from Page 60 to the end and have gone through all the fixes, and believe that I have found some other issues.

 

Here's 1 example:

Let's say your buying a Product for $5.00 and you have a Discount Coupon $1.00 and the coupon is valid on products > 0.00 and now when your making a payment using a $5.00 gift certificate your total should be.

 

Subtotal: $5.00

Discount: -$1.00

Gift Certificate: $4.00

Total: $0.00

 

And then have a left over of $1.00 on gift certificate. But my current output is showing:

 

Warning: Division by zero in /home/testsite/includes/modules/order_total/ot_coupon.php on line 316.

 

On Line 316 it reads:

 

$ratio1 = $od_amount/($amount-$order->info['tax_groups'][$key]); ////debug

 

Even if i decide not to use the discount i'm still getting the same error above.

 

Thanks again for the support!

 

P.S. I have also tried using this on line 316

 

$ratio1 = round($od_amount/($amount-$order->info['tax_groups'][$key])); ////debug

 

and also tried using the code below on line 49

 

$order->info['total'] = $order->info['total'] - (tep_round($od_amount,2));

Edited by talon177

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

×