Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[CONTRIBUTION] CCGV (trad)


Vger

Recommended Posts

Need some newbie advice please.

I installed this contribution a couple days ago and have gone through my files 3 times now and cant seem to find where I made a mistake on the install.

Instead of the right colum i am getting Parse Error: syntax error, unexpected $end. /include/boxes/shopping_cart.php line 95. To see the problem in action please visit www.vapoligy.com

The last few lines look realy odd but everything i try seems to be giving more errors. As i newbie i would greatly appreciate any assistance.

Thank You

<?php
/*
 $Id: shopping_cart.php 1739 2007-12-20 00:52:16Z hpdl $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
?>
<!-- shopping_cart //-->
         <tr>
           <td>
<?php
$info_box_contents = array();
$info_box_contents[] = array('text' => BOX_HEADING_SHOPPING_CART);



 new infoBoxHeading($info_box_contents, false, true, tep_href_link(FILENAME_SHOPPING_CART));

 $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" class="infoBoxContents">';

     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="infoBoxContents">';
     }

     $cart_contents_string .= $products[$i]['quantity'] . ' x </span></td><td valign="top" class="infoBoxContents"><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="infoBoxContents">';
     }

     $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());
// {{ buySAFE Module
   if (is_array($buysafe_result) && $buysafe_result['IsBuySafeEnabled'] == 'true')
   {
     $info_box_contents[] = array('text' => '<table width="100%" cellspacing="0" cellpadding="1" border="0"><tr><td class="boxText"> </td><td class="boxText" align="right">' . $currencies->format($cart->show_total()) . '</td></tr><tr><td class="boxText">' . $buysafe_result['MiniCartLineDisplayText'] . '</td><td class="boxText" align="right">' . $buysafe_result['BondCostDisplayText'] . '</td></tr><tr><td class="boxText"> </td><td class="boxText" align="right">' . ($buysafe_result['BondCostDisplayText'] ? $currencies->format($cart->show_total() + $buysafe_result['TotalBondCost']) : $currencies->format($cart->show_total())) . '</td></tr></table>');
   }
   else
   {
   $info_box_contents[] = array('align' => 'right',
                                'text' => $currencies->format($cart->show_total()));
 }
// ADDED FOR CCGV
 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>');

 }

// ADDED FOR CCGV END ADDITTION
 new infoBox($info_box_contents);

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

Edited by DOOL
Link to comment
Share on other sites

Figured that error out by trial and error.

I ended up adding a } and that seems to have fixed it.

 

// ADDED FOR CCGV END ADDITTION 
 new infoBox($info_box_contents); 
} 
?> 
           </td> 
         </tr> 
<!-- shopping_cart_eof //-->

problem now is when i try to send the gift voucher i get a few fields for who to send it to but instead of a send button there is a statement of

 

ERROR

Unable to determine the page link.

 

any help on this would be greatly apprecaited.

Thanks

Link to comment
Share on other sites

  • 1 month later...

Hi Everyone

 

If using a Discount Coupon and the amount set for purchasing is less then what is being purchased (for example: discount coupon minimum order is $50 and the customer purchases only $15) then it doesn't show anything about the discount coupon in the confirmation screen of checkout.

 

Is it possible a message can appear at the bottem saying discount coupen value minimum purchase value is too low for order. Minimum purchase to use Discount Coupen is $x (in this example $50).

 

Could someone show how that could be done please?

 

I belive this would be a good feature to have.

Link to comment
Share on other sites

  • 3 weeks later...

Not sure if this is how this module is set up, but I added a product with a price of $1. I added a coupon for free shipping for that product. When I enter the coupon code, it doesn't give me free shipping, it gives me a discount for $1 which is the sub-total amount. If I change the price to $2 then it gives me discount for $2. This only happens when the price is less than $3. If I change the price to $3 then it works ok and it gives me the discount for the shipping amount.

 

Any suggestions?

 

Thanks

 

Ricardo

Link to comment
Share on other sites

  • 2 months later...

I have been trying to get my CCGV addon to work completely correct and I am kind of stumped for awhile. If the voucher is less than the order it works just fine, if order is same as voucher or order is less than voucher balance, my site will not get past checkout payment.

 

I have one page checkout installed too. Same results when I don't use the One Page Checkout. So this tells me it is in the core code someplace, correct?

 

So a recap:

 

If order is more than voucher it works great!

 

When voucher balance is more than order or equal to order it prompts for payment method but does not allow me to select both voucher and payment.

 

Anyone have an idea where/what the fix is?

Life Is Too Short,

Enjoy Your Coffee!

Pete

Link to comment
Share on other sites

  • 1 month later...

For all of those who installed this module on RC version and have problem with coupon name update in database here is the solution:

 

in coupon_admin.php in CCGV(trad), find

$insert_id = tep_db_insert_id($query);

 

change to

 

 

$insert_id = tep_db_insert_id();

Link to comment
Share on other sites

  • 4 months later...

Hi guy and Mister Vger.

 

I have found a small bug, here it is:

When a customer use a coupon (send by email, for example) to do shopping, everything is working fine. I have discovered that the script didn't take into account the expiration date of this coupon.

It takes into account the expiration date, only when the query is made in the checkout_payment page, but not after !!!

In fact a coupon can have a year longevity, but your script is not checking the expiration date. If the balance is positive, then the customer can use the coupon even 100 years after!!!

 

I am going to find a solution from now, but If anubody has a try on it, it will be great !

 

Best regards,

 

Marc

osCommerce 2.2 MS2 in 6 languages

TVA Intracomm

Numbers of visitors online

Who's online Enhancement

....

Link to comment
Share on other sites

  • 1 month later...

Not sure if this is how this module is set up, but I added a product with a price of $1. I added a coupon for free shipping for that product. When I enter the coupon code, it doesn't give me free shipping, it gives me a discount for $1 which is the sub-total amount. If I change the price to $2 then it gives me discount for $2. This only happens when the price is less than $3. If I change the price to $3 then it works ok and it gives me the discount for the shipping amount.

 

Any suggestions?

 

Thanks

 

Ricardo

OK - I know this contribution is getting long in the tooth and the above post is over a year old but this may help somebody else:

 

If Free Shipping Coupon is restricted to a product and the total cost of products at checkout (of which one must be the restricted one) is < shipping cost at checkout then CCGV will return a discount of that products cost and not the shipping cost

 

Error lies in the function calculate_credit($amount) at line 146 (in the file catalog/includes/modules/order_total/ot_coupon.php which returns $od_amount – that amount is incorrectly calculated under the above circumstances.

 

Line 227 says

 

if ($od_amount>$amount) $od_amount = $amount;

 

If the Order Discount amount is > products total then Order Discount should be reduced to match the products total (fair enough)

 

Removing that line to test the function will, in the above circumstances, get the correct result. Solution - I guess you could move further up the function to the line

if ($get_result['coupon_type']=='S') $c_deduct = $order->info['shipping_cost'];

and just return the value for $od_amount immediately after that or, what I did,

 

			if ($get_result['coupon_type'] !='S') {
	if ($od_amount>$amount) $od_amount = $amount;}
	}

 

Graeme

Link to comment
Share on other sites

  • 8 months later...

I know I've done something wrong but I can't figure out what. When using a coupon, the correct coupon amount and order total appear all the way through checkout but, during payment processing, the coupon amount is treated as being doubled.

 

For example, during checkout, the order shows a subtotal of $20.00, a coupon amount of $2.00, and an order total of $18.00.

 

When the processed though, only $16.00 is charged and the order in the order history shows a subtotal of $20.00, a coupon amount of $2.00, and an order total of $16.00.

 

Does anyone know where I should look for the cause of this?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...