Jump to content
Strider

Credit Class/Gift Vouchers/Discount Coupons 5.10

Recommended Posts

I installed this and all seems to work fine, upon checkout when it asks for a Coupon Code I input it, but when I click "Continue" all it does reload the checkout_payment form with the "Congratulations" message and asking for credit card/payment details again.

 

I compared all of my files to the ones that come with this contribution and they're all the same..

 

Any ideas?

Share this post


Link to post
Share on other sites

i think i removed the button next to coupon redemption bit, so people continued doen the page to enter payment options ... i cont remember, i'll look again, but i know i got around it somehow.

Share this post


Link to post
Share on other sites
If a voucher completely covers the cost of a purchase I end up with "Payment Method: Credit Card" in order history, admin etc. which is a bit misleading & might alarm some dozy shoppers

Hi All,

 

I've just been reminded of this (thanks Mibble!) and as it seems I might not be the only person that gets it, I thought I'd share the (easy!) solution:

 

In checkout_process.php:

 

replace line 88 or thereabouts:

'payment_method' => $order->info['payment_method'],

with

'payment_method' => (($credit_covers) ? 'Nothing to pay!' : $order->info['payment_method']),

 

& replace about line 251:

if (is_object($$payment)) {

with

if ((!$credit_covers) && (is_object($$payment))) {

 

This also saves you from having 'Credit Card' (or whatever your default is) appearing on Invoices and Packing Slips when there was no payment.

 

Disclaimer: I have heavily modified the code so the line numbers above are just a guide, although they shouldn't be too far off for stock osC+ccgv.

 

Hope it helps someone,

Anna

Share this post


Link to post
Share on other sites
Hi All,

 

I've just been reminded of this (thanks Mibble!) and as it seems I might not be the only person that gets it, I thought I'd share the (easy!) solution:

Anna,

 

I've had CCGV working for some time, but I had never checked for this error. Sure enough, Im also getting it. I applied your fixes, but they don't seem to do anything for me, no fix but also no additional errors, which makes me think that the fix may be working but $credit_covers is allways empty. Is that possible? Where does $credit_covers value come from?

 

Thanks,

Rick Knight

Share this post


Link to post
Share on other sites

Thanks for the fix, Anna!

 

Quick other question: when a customer tries to redeem a discount code for a forbidden category, the discount doesn't come through, but there is no error message or anything saying why. Is there a quick way to fix this?

 

Thanks much,

Susan

Share this post


Link to post
Share on other sites

Installation of the 5.11 package has gone pretty smooth. The one problem I'm having is that my shopping cart box is displaying the products twice. (If a customer has a gv amount, that amount is only displayed once) Here's a screen shot:

 

shopping_cart2x.jpg

 

 

Here's my code for /includes/boxes/shopping_cart.php

<?php
/*
 $Id: shopping_cart.php,v 1.18 2003/02/10 22:31:06 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
?>
<!-- shopping_cart //-->
<script language="javascript"><!--
function couponpopupWindow(url) {
 window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,re
sizable=yes,copyhistory=no,width=450,height=280,screenX=150,screenY=150,top=150,l
eft=150')
}
//--></script>
         <tr>
           <td>
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => BOX_HEADING_SHOPPING_CART);

 new infoBoxHeadingShopping($info_box_contents);

 $cart_contents_string = '';
 if ($cart->count_contents() > 0) {
   $cart_contents_string = '<table border="0" width="100%" cellspacing="0" cellpadding="0">';
   $products = $cart->get_products();
   for ($i=0, $n=sizeof($products); $i<$n; $i++) {
     $cart_contents_string .= '<tr><td align="right" valign="top" >';

     if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {
       $cart_contents_string .= '<span class="newItemInCart">';
     } else {
       $cart_contents_string .= '<span class="infoBoxContentsRed2">';
     }

     $cart_contents_string .= $products[$i]['quantity'] . ' x </span></td><td valign="top" class="infoBoxContentsRed2"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">';

     if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {
       $cart_contents_string .= '<span class="newItemInCart">';
     } else {
       $cart_contents_string .= '<span class="infoBoxContentsRed2">';
     }

     $cart_contents_string .= $products[$i]['name'] . '</span></a></td></tr>';

     if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {
       tep_session_unregister('new_products_id_in_cart');
     }
   }
   $cart_contents_string .= '</table>';
 } else {
   $cart_contents_string .= BOX_SHOPPING_CART_EMPTY;
 }

 $info_box_contents = array();
 $info_box_contents[] = array('text' => $cart_contents_string);

 if ($cart->count_contents() > 0) {
   $info_box_contents[] = array('text' => tep_draw_separator());
   $info_box_contents[] = array('align' => 'right',
                                'text' => $currencies->format($cart->show_total()));
 }
 // ICW ADDED FOR CREDIT CLASS GV
 if (tep_session_is_registered('customer_id')) {
   $gv_query = tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $customer_id . "'");
   $gv_result = tep_db_fetch_array($gv_query);
   if ($gv_result['amount'] > 0 ) {
     $info_box_contents[] = array('align' => 'left','text' => tep_draw_separator());
     $info_box_contents[] = array('align' => 'left','text' => '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td class="smalltext">' . VOUCHER_BALANCE . '</td><td class="smalltext" align="right" valign="bottom">' . $currencies->format($gv_result['amount']) . '</td></tr></table>');
     $info_box_contents[] = array('align' => 'left','text' => '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td class="smalltext"><a href="'. tep_href_link(FILENAME_GV_SEND) . '">' . BOX_SEND_TO_FRIEND . '</a></td></tr></table>');
   }
 }
 if (tep_session_is_registered('gv_id')) {
   $gv_query = tep_db_query("select coupon_amount from " . TABLE_COUPONS . " where coupon_id = '" . $gv_id . "'");
   $coupon = tep_db_fetch_array($gv_query);
   $info_box_contents[] = array('align' => 'left','text' => tep_draw_separator());
   $info_box_contents[] = array('align' => 'left','text' => '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td class="smalltext">' . VOUCHER_REDEEMED . '</td><td class="smalltext" align="right" valign="bottom">' . $currencies->format($coupon['coupon_amount']) . '</td></tr></table>');

 }
 if (tep_session_is_registered('cc_id') && $cc_id) {
   $info_box_contents[] = array('align' => 'left','text' => tep_draw_separator());
   $info_box_contents[] = array('align' => 'left','text' => '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td class="smalltext">' . CART_COUPON . '</td><td class="smalltext" align="right" valign="bottom">' . '<a href="javascript:couponpopupWindow(\'' . tep_href_link(FILENAME_POPUP_COUPON_HELP, 'cID=' . $cc_id) . '\')">' . CART_COUPON_INFO . '</a>' . '</td></tr></table>');

 }
 // ADDED FOR CREDIT CLASS GV END ADDITTION
 new infoBoxRed($info_box_contents);
 
 $info_box_contents[] = array('align' => 'center',
           'text' => '<a href="' . tep_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL') . '">' . BOX_SHOPPING_CART_VIEW . '</a>' . '    ' .
            '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'NONSSL') . '">' .  BOX_SHOPPING_CART_CHECKOUT . '</a>');
 new infoBoxRed($info_box_contents);
 
 $info_box_contents2 = array();
 $info_box_contents2[] = array('text' => tep_image('images/redbox_bottom.gif'));
 
 new infoBoxRedBottom($info_box_contents2);

?>
           </td>
         </tr>
<!-- shopping_cart_eof //-->

 

As you can tell, it is a modified store so I've been very carefull about what I try to fix. Everything I've tried so far hasn't worked.

 

I would really appreciate someone who knows more about PHP taking a look at this file and pointing out the obvious error(s).

 

Many thanks-

Lisa


"You can't be a smart cookie if you have a crummy attitude." - John Maxwell

Share this post


Link to post
Share on other sites
Installation of the 5.11 package has gone pretty smooth.  The one problem I'm having is that my shopping cart box is displaying the products twice.  (If a customer has a gv amount, that amount is only displayed once)  Here's a screen shot:

 

    if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {

        $cart_contents_string .= '<span class="newItemInCart">';

      } else {

        $cart_contents_string .= '<span class="infoBoxContentsRed2">';

      }

 

      $cart_contents_string .= $products[$i]['quantity'] . ' x </span></td><td valign="top" class="infoBoxContentsRed2"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">';

 

      if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {

        $cart_contents_string .= '<span class="newItemInCart">';

      } else {

        $cart_contents_string .= '<span class="infoBoxContentsRed2">';

      }

I'm not a php expert, but I think you have some duplicate code here. I would start by removing one of these...

    if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {

        $cart_contents_string .= '<span class="newItemInCart">';

      } else {

        $cart_contents_string .= '<span class="infoBoxContentsRed2">';

      }

Good luck.

 

Rick Knight

Share this post


Link to post
Share on other sites
Where does $credit_covers value come from?

Hi Rick,

I think it's set in the session by the order_total class pre_confirmation_check() at checkout_confirmation.php but, once again, I have heavily modified the store code. I hope that clue helps! Good luck!

Anna

Share this post


Link to post
Share on other sites
Quick other question: when a customer tries to redeem a discount code for a forbidden category, the discount doesn't come through, but there is no error message or anything saying why. Is there a quick way to fix this?

 

Hi Susan,

 

I don't know if there's a "quick" way! :(

 

I think you're in the same boat as me as I posted the message below nearly a month ago but got no replies.

Function calculate_credit in includes/modules/order_total/ot_coupon.php checks a whole load of things such as minimum order amount, restrict to products and restrict to categories, but I don't find any mechanism for displaying a message if any of those checks fail.

 

As I wrote before, I don't want to change that code as it seems to be called from all over the place. I'd really appreciate a reply from someone who's more familiar with this stuff, especially as it now looks like I'm not the only one!

 

Anna

 

Hello all, I've heavily customised my store so I may have introduced this small problem, or not...

 

Does anyone else get a message if they attempt to use a discount coupon but the minimum order has not been reached?

 

e.g. if someone is trying to use a "?2 off your next order over ?10" coupon, but is spending only ?8, my store currently acts correctly and makes no discount, but equally gives no message.  :unsure:

 

>> Have I broken the message or is it not there for everyone else too?

 

If I haven't broken it as it just wasn't there...

 

I can see the minimum order amount is checked in function calculate_credit in includes/modules/order_total/ot_coupon.php but as this is called from all over the place I'm loathe to raise an error from there.

Maybe it can be checked in function collect_posts instead?

 

Anyone?

Thanks

Anna

Share this post


Link to post
Share on other sites

Oh Man! Everything was working for me....then I started modifying some testing some code out .... thought I put everything back to how it was... I have backups, but they are from a few days ago..and that is still a lot of work lost.

 

When I click to add a gift voucher to my shopping cart I get the following error:

 

Error!

Unable to determine the page link!

 

Is there anyone out there, that can point me in the right direction?

 

Click Here to View Error

Edited by TCwho

Share this post


Link to post
Share on other sites

:::Update:::

 

The problem seem to go away... After the initial error everything works as usual again.

 

The way to mimic the error:

 

1. The site must not be in your cache or cookie stored

2. You must directly go to Gift Voucher category

3. You must choose add to cart (without clicking gift voucher to get more details, product description, etc)

 

This only happens for this item. I have tried to mimic same error with other products, even other categories with only 1 item, such as the Gift Voucher Category in question at the site.

 

:::Edited:::

Oh and I have done a search for +unable +determine +page +link

 

Search Friendly URL is set to False

Configure.php file is fine

Edited by TCwho

Share this post


Link to post
Share on other sites

I have a problem with this contribution.

 

The installation went fine and it all appeared to work, but for some reason since a customer tried to redeem a voucher the payment confirmation screen is no longer accessable.

 

Steps followed:

 

Choose the product to buy and add to cart

Click Checkout

on Delivery Information click continue

 

Once this continue has been clicked it then returns you back to delivery info and just seems to get stuck there.

 

Please help.

Share this post


Link to post
Share on other sites
Once this continue has been clicked it then returns you back to delivery info and just seems to get stuck there.

 

Please help.

 

I had this problem and seem to recall it had something to do with Order Total order. Go to Admin > Modules > Order Total. The order that works best for me is:

 

Sub-total 1

Shipping 2

Tax 3

Discount Coupons 9

Gift Vouchers 739

Total 740

 

Hope that helps!

 

Susan

Aspiring Arts

Share this post


Link to post
Share on other sites

Solved my problem.

 

I noticed it was not just happening in that scenario. It was also happening if I click on Whats New Arrow to view all new products and then clicked on add to cart for product listed there....

 

I just recently had modified the code through another thread I saw, where instead of when someone adds something to thier cart and then they hit continue shopping it would normally take them back to last product added, but this modification would take them back 2 screens..which normally would be the main category screen...

 

Needless to say, this was causing my problem. After I reverted the code back to normal, the problem went away.

 

catalog/shopping_cart.php original code:

               <td class="main"><?php echo '<a href="' . tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode']) . '">' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?></td>

 

had changed it to this:

 

<td class="main">
<?php
$back = sizeof($navigation->path)-3;  // Go back 2 screens
echo '<a href="' . tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode']) . '">' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>';
?>
</td>

 

So if anyone else had saw this in another thread....this is the reason you will have the error I was having....

 

Side note:

an osC Team Member, if I recall correctly, 241 had posted this code:

               <td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?></td>

However those following that thread...learned that this would take a customer back to default page(index.php)

Share this post


Link to post
Share on other sites
Not as far as I can tell sorry!

 

If you find a way to do this easily (also a heavily modified store) let me know !

Anna

I think I'm gonna have to do it myself TBH, I've even crated a seperate thread asking for this feature and got no reply. <_< If do create something that does this, I'll make it a contrib. :)

Share this post


Link to post
Share on other sites

Susan, thanks for that.

 

Unfortunately it seems for one customer the problem has not been resolved. Anything else anyone can suggest??

 

 

:huh:

Share this post


Link to post
Share on other sites

I have this contrib working, except with the following coupon setting:

 

percent discount + free shipping

 

... the free shipping discount is applied during checkout, but the percent discount is NOT applied.

 

any ideas as to why this is happening?

 

Thanks

Jason

Share this post


Link to post
Share on other sites

I am having a situation with any gift vouchers purchased in the store not sending an email to the customer showing the GV code or link to redeem as well as not having anything show up in the admin GV QUEUE??? So the customer would be purchasing something and then is not able to redeem the GV and I have no visibility that a GV needs to be redeemed.

 

All functions of the CCGV contrib work when sending a GV straight from admin.

 

I set the weight to 0, enabled downloads etc. My sort orders are good and everything shows up in checkout and payment.

 

Has anyone encountered the Gift Vouchers NOT appearing in the admin queue??? Can you please point me in the right direction?

 

Thanks in advance.

Share this post


Link to post
Share on other sites

Strider, Mibble, Anna, Anyone?

 

I thought I had this contrib working flawlessly, until I read Anna's message about $credit_covers. I had somehow overlooked that in my testing. Everything is working except that when the credit covers the total purchase, the customer is still taken through the payment section of the checkout process and the invoice indicates the default payment method instead of no payment method. This is very confusing to customers, so I need to find a fix.

 

I've applied the changes Anna recomended and I've checked for the pre_confirmation_check in catalog/includes/classes/order_total.php and it looks like everything is there, but it just acts like $credit_covers is not being set true.

 

Any ideas what may be causing this and how I might fix it?

 

Thanks,

Rick Knight

Share this post


Link to post
Share on other sites
I have this contrib working, except with the following coupon setting:

 

percent discount + free shipping

 

... the free shipping discount is applied during checkout, but the percent discount is NOT applied.

 

any ideas as to why this is happening?

 

Thanks

Jason

 

 

Yes...out of the box, free shipping overrides any discount amount (percentage or dollar off). It says that in the little note to the right hand side of the free shipping check box.

Share this post


Link to post
Share on other sites

Hello all, :)

 

after i install that great mod, i have found an error in my

install, after i send me an voucher.

 

When i click the email link, to add the voucher at my account, i see

that message :(

 

my folder/my folder/gv_redeem.php on line 67

 

* my folder are placeholder *

 

Can everyone help me ?

 

Cheers

Hobbes

Share this post


Link to post
Share on other sites

Hello,

 

Which are modification brought so that CCGV works correctly with Paypal V3a in the catalog and also in the admin

 

Thank you for your answer


IEUFLR2000

Share this post


Link to post
Share on other sites

Before I post this question, I fully acknowledge being a complete douche who didn't spend 3 hours searching to see if my question has already been answered. I apologize. With that being said, I am seeing a weird behavior during the checkout process w/ regards to an GV's that are present. AFTER I checked out, using the full GV value against my order, I was still able to email the GV to a friend from the checkout_success page.

 

Am I missing something obvious about how this module works? I thought that once you redeemed the full value of a GV during checkout, it was gone; no longer available to send to someone else. Any suggestions, theories, insults?

 

Thanks in advance.


cxdi_logo_100x45.gif

Share this post


Link to post
Share on other sites
Hello,

 

Which are modification brought so that CCGV works correctly with Paypal V3a in the catalog and also in the admin

 

Thank you for your answer

 

My problem is simple now I is not the number of command(order) which displays in "Gift Voucher Release Queue"

 

Gift-Voucher-Release-Queue.gif


IEUFLR2000

Share this post


Link to post
Share on other sites
For a quick fix you can edit the paypal module.

 

/catalog/includes/modules/payment/paypal.php

 

comment out lines 89 & 90

 

                              tep_draw_hidden_field('amount', number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) .

                              tep_draw_hidden_field('shipping', number_format($order->info['shipping_cost'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) .

 

and replace them with this line

 

                              tep_draw_hidden_field('amount', number_format(($order->info['total']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) .

 

What this does is just send the total to paypal and doesnt break it down into total and shipping.

 

If you look at the code in line 89 it works it out by deducting the shipping from the total so thats how you end up with a negative figure in paypal.

 

HTH

 

Simon

Hello I have the same problem as that with PayPal_Shopping_Cart_IPN_v3.0a.

In my catalog file / includes / modules / payment / paypal.php, me is not as it but towards the line 104 this

 

    //Returns the gross total amount to compare with paypal.mc_gross
   function grossPaymentAmount($my_currency) {
     global $order, $currencies;
     return number_format(($order->info['total']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
   }

   function amount($my_currency) {
     global $order, $currencies;
     return number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
   }
   function process_button() {
     return false;
   }

   function before_process() {
     if(!class_exists('PayPal_osC')) include_once(DIR_WS_MODULES . 'payment/paypal/classes/osC/osC.class.php');
     if (PayPal_osC::check_order_status()) {
       tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, '', 'SSL'));
     } else {
       include(DIR_WS_MODULES . 'payment/paypal/catalog/checkout_process.inc.php');
     }
     exit;
   }

 

How solved the problem?

 

 

Thank you


IEUFLR2000

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

×