Jump to content
kgt

[Contribution] Discount Coupon Codes

Recommended Posts

This is correct for when you use a fixed discount. A fixed discount is technically still a percentage discount where the maximum amount applied is equal to the order minimum. This gives a "fixed" discount.

 

Thank you very much, and again sorry for creating confusion, I should have put some thought to it before I post.

Share this post


Link to post
Share on other sites
You need to ensure that you have made the changes to checkout_payment.php as described in the install instructions. Also, the module must be set to "active" in your admin section.

 

 

ok, I added it, apparently I missed it, however, now I get the error:

 

Fatal error: Cannot redeclare tep_db_connect() (previously declared in /home/lotions2/public_html/osCommerce/catalog/includes/functions/database.php:13) in /home/lotions2/public_html/osCommerce/catalog/includes/functions/database.php on line 13

 

any thoughts?

 

and where in the code should I add it?


If it was easy, anyone could do it!

Share this post


Link to post
Share on other sites
ok, I added it, apparently I missed it, however, now I get the error:

 

Fatal error: Cannot redeclare tep_db_connect() (previously declared in /home/lotions2/public_html/osCommerce/catalog/includes/functions/database.php:13) in /home/lotions2/public_html/osCommerce/catalog/includes/functions/database.php on line 13

 

any thoughts?

 

and where in the code should I add it?

 

 

You have uploaded checkout_payment.php over top of the language file that exists at includes/languages/english/checkout_payment.php. You'll need to restore the language file from a backup.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
You have uploaded checkout_payment.php over top of the language file that exists at includes/languages/english/checkout_payment.php. You'll need to restore the language file from a backup.

since I am a retard and didnt back it up, could you email me a copy at shawn@lotions2go.com?

 

thanks,

shawn


If it was easy, anyone could do it!

Share this post


Link to post
Share on other sites
Actually, there's also a copy of it in the install zip for this contribution. It includes the change you need to make for the coupons display. If you get it from the OSC install, you'll need to add that change back in.

 

ok, I uploaded the file, but it still didnt work. I have enclosed the code for checkout_payment.php in catalog/includes/languages/english/checkout_paymaent.php:

 

<?php

/*

$Id: checkout_payment.php,v 1.113 2003/06/29 23:03:27 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

// if the customer is not logged on, redirect them to the login page

if (!tep_session_is_registered('customer_id')) {

$navigation->set_snapshot();

tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

}

 

// if there is nothing in the customers cart, redirect them to the shopping cart page

if ($cart->count_contents() < 1) {

tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));

}

 

// if no shipping method has been selected, redirect the customer to the shipping method selection page

if (!tep_session_is_registered('shipping')) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));

}

 

// avoid hack attempts during the checkout procedure by checking the internal cartID

if (isset($cart->cartID) && tep_session_is_registered('cartID')) {

if ($cart->cartID != $cartID) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));

}

}

 

// Stock Check

if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) {

$products = $cart->get_products();

for ($i=0, $n=sizeof($products); $i<$n; $i++) {

if (tep_check_stock($products[$i]['id'], $products[$i]['quantity'])) {

tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));

break;

}

}

}

 

// if no billing destination address was selected, use the customers own address as default

if (!tep_session_is_registered('billto')) {

tep_session_register('billto');

$billto = $customer_default_address_id;

} else {

// verify the selected billing address

$check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$billto . "'");

$check_address = tep_db_fetch_array($check_address_query);

 

if ($check_address['total'] != '1') {

$billto = $customer_default_address_id;

if (tep_session_is_registered('payment')) tep_session_unregister('payment');

}

}

 

require(DIR_WS_CLASSES . 'order.php');

$order = new order;

 

if (!tep_session_is_registered('comments')) tep_session_register('comments');

 

$total_weight = $cart->show_weight();

$total_count = $cart->count_contents();

 

// load all enabled payment modules

require(DIR_WS_CLASSES . 'payment.php');

$payment_modules = new payment;

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PAYMENT);

 

$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));

$breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

//kgt - discount coupons

define('TABLE_HEADING_COUPON', 'Do you have a promotional code or discount coupon?' );

//end kgt - discount coupons

 

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

<script language="javascript"><!--

var selected;

 

function selectRowEffect(object, buttonSelect) {

if (!selected) {

if (document.getElementById) {

selected = document.getElementById('defaultSelected');

} else {

selected = document.all['defaultSelected'];

}

}

 

if (selected) selected.className = 'moduleRow';

object.className = 'moduleRowSelected';

selected = object;

 

// one button is not an array

if (document.checkout_payment.payment[0]) {

document.checkout_payment.payment[buttonSelect].checked=true;

} else {

document.checkout_payment.payment.checked=true;

}

}

 

function rowOverEffect(object) {

if (object.className == 'moduleRow') object.className = 'moduleRowOver';

}

 

function rowOutEffect(object) {

if (object.className == 'moduleRowOver') object.className = 'moduleRow';

}

//--></script>

<?php echo $payment_modules->javascript_validation(); ?>

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="3" cellpadding="3">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><?php echo tep_draw_form('checkout_payment', tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'), 'post', 'onsubmit="return check_form();"'); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_payment.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

if (isset($HTTP_GET_VARS['payment_error']) && is_object(${$HTTP_GET_VARS['payment_error']}) && ($error = ${$HTTP_GET_VARS['payment_error']}->get_error())) {

?>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><b><?php echo tep_output_string_protected($error['title']); ?></b></td>

</tr>

</table></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBoxNotice">

<tr class="infoBoxNoticeContents">

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td class="main" width="100%" valign="top"><?php echo tep_output_string_protected($error['error']); ?></td>

<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

<?php

/* kgt - discount coupons */

?>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><b><?php echo TABLE_HEADING_COUPON; ?></b></td>

</tr>

</table></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><?php echo ENTRY_DISCOUNT_COUPON.' '.tep_draw_input_field('coupon', '', 'size="32"'); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

/* end kgt - discount coupons */

?>

</table></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

}

?>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><b><?php echo TABLE_HEADING_BILLING_ADDRESS; ?></b></td>

</tr>

</table></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td class="main" width="50%" valign="top"><?php echo TEXT_SELECTED_BILLING_DESTINATION; ?><br><br><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL') . '">' . tep_image_button('button_change_address.gif', IMAGE_BUTTON_CHANGE_ADDRESS) . '</a>'; ?></td>

<td align="right" width="50%" valign="top"><table border="0" cellspacing="0" cellpadding="2">

<tr>

<td class="main" align="center" valign="top"><b><?php echo TITLE_BILLING_ADDRESS; ?></b><br><?php echo tep_image(DIR_WS_IMAGES . 'arrow_south_east.gif'); ?></td>

<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td class="main" valign="top"><?php echo tep_address_label($customer_id, $billto, true, ' ', '<br>'); ?></td>

<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><b><?php echo TABLE_HEADING_PAYMENT_METHOD; ?></b></td>

</tr>

</table></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<?php

$selection = $payment_modules->selection();

 

if (sizeof($selection) > 1) {

?>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td class="main" width="50%" valign="top"><?php echo TEXT_SELECT_PAYMENT_METHOD; ?></td>

<td class="main" width="50%" valign="top" align="right"><b><?php echo TITLE_PLEASE_SELECT; ?></b><br><?php echo tep_image(DIR_WS_IMAGES . 'arrow_east_south.gif'); ?></td>

<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

<?php

} else {

?>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td class="main" width="100%" colspan="2"><?php echo TEXT_ENTER_PAYMENT_INFORMATION; ?></td>

<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

<?php

}

 

$radio_buttons = 0;

for ($i=0, $n=sizeof($selection); $i<$n; $i++) {

?>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<?php

if ( ($selection[$i]['id'] == $payment) || ($n == 1) ) {

echo ' <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";

} else {

echo ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";

}

?>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td class="main" colspan="3"><b><?php echo $selection[$i]['module']; ?></b></td>

<td class="main" align="right">

<?php

if (sizeof($selection) > 1) {

echo tep_draw_radio_field('payment', $selection[$i]['id']);

} else {

echo tep_draw_hidden_field('payment', $selection[$i]['id']);

}

?>

</td>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

<?php

if (isset($selection[$i]['error'])) {

?>

<tr>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td class="main" colspan="4"><?php echo $selection[$i]['error']; ?></td>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

<?php

} elseif (isset($selection[$i]['fields']) && is_array($selection[$i]['fields'])) {

?>

<tr>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td colspan="4"><table border="0" cellspacing="0" cellpadding="2">

<?php

for ($j=0, $n2=sizeof($selection[$i]['fields']); $j<$n2; $j++) {

?>

<tr>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td class="main"><?php echo $selection[$i]['fields'][$j]['title']; ?></td>

<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td class="main"><?php echo $selection[$i]['fields'][$j]['field']; ?></td>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

<?php

}

?>

</table></td>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

<?php

}

?>

</table></td>

<td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

<?php

$radio_buttons++;

}

?>

</table></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><b><?php echo TABLE_HEADING_COMMENTS; ?></b></td>

</tr>

</table></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td><?php echo tep_draw_textarea_field('comments', 'soft', '60', '5'); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td class="main"><b><?php echo TITLE_CONTINUE_CHECKOUT_PROCEDURE . '</b><br>' . TEXT_CONTINUE_CHECKOUT_PROCEDURE; ?></td>

<td class="main" align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td width="50%" align="right"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td>

<td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>

</tr>

</table></td>

<td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>

<td><?php echo tep_image(DIR_WS_IMAGES . 'checkout_bullet.gif'); ?></td>

<td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>

</tr>

</table></td>

<td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>

<td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>

<td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td align="center" width="25%" class="checkoutBarFrom"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '" class="checkoutBarFrom">' . CHECKOUT_BAR_DELIVERY . '</a>'; ?></td>

<td align="center" width="25%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_PAYMENT; ?></td>

<td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td>

<td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_FINISHED; ?></td>

</tr>

</table></td>

</tr>

</table></form></td>

<!-- body_text_eof //-->

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- right_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

<!-- right_navigation_eof //-->

 

//kgt - discount coupons

define('TABLE_HEADING_COUPON', 'Do you have a promotional code or discount coupon?' );

//end kgt - discount coupons

 

</table></td>

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


If it was easy, anyone could do it!

Share this post


Link to post
Share on other sites
ok, I uploaded the file, but it still didnt work. I have enclosed the code for checkout_payment.php in catalog/includes/languages/english/checkout_paymaent.php:

 

 

That is not the code for includes/languages/english/checkout_payment.php. You must use the file in the corresponding directory on the install zip file.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites

how about this code, I deleted the file on the server and uploaded the new copy, but still no option for the coupon in the payment page.

 

here is the code for checkout_payment.php:

 

<?php

/*

$Id: checkout_payment.php,v 1.14 2003/02/06 17:38:16 thomasamoulton Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

*/

 

define('NAVBAR_TITLE_1', 'Checkout');

define('NAVBAR_TITLE_2', 'Payment Method');

 

define('HEADING_TITLE', 'Payment Information');

 

define('TABLE_HEADING_BILLING_ADDRESS', 'Billing Address');

define('TEXT_SELECTED_BILLING_DESTINATION', 'Please choose from your address book where you would like the invoice to be sent to.');

define('TITLE_BILLING_ADDRESS', 'Billing Address:');

 

define('TABLE_HEADING_PAYMENT_METHOD', 'Payment Method');

define('TEXT_SELECT_PAYMENT_METHOD', 'Please select the preferred payment method to use on this order.');

define('TITLE_PLEASE_SELECT', 'Please Select');

define('TEXT_ENTER_PAYMENT_INFORMATION', 'This is currently the only payment method available to use on this order.');

 

define('TABLE_HEADING_COMMENTS', 'Add Comments About Your Order');

 

define('TITLE_CONTINUE_CHECKOUT_PROCEDURE', 'Continue Checkout Procedure');

define('TEXT_CONTINUE_CHECKOUT_PROCEDURE', 'to confirm this order.');

//kgt - discount coupons

define('TABLE_HEADING_COUPON', 'Do you have a promotional code or discount coupon?' );

//end kgt - discount coupons

?>


If it was easy, anyone could do it!

Share this post


Link to post
Share on other sites

what are these settings for?

 

Display Format for Order Total Line

Display format for the discount coupon code order total line.

 

Variables:

[coupon_desc]

[percent_discount]

[coupons_min_order]

[coupons_number_available]


If it was easy, anyone could do it!

Share this post


Link to post
Share on other sites

Hi

 

I'm trying to follow the tips on the manual to activate the contribution. But when i follow the: ...go to Modules > Order Total > Discount Coupon in the admininistration section of your website... i can't find the Discount Coupon. What should be missing.

 

Thanks


Rui Ganga

Share this post


Link to post
Share on other sites

ok, now I have a new problem, it adds the box for the coupon code, but then when you go to the next page it gives me this error:

 

1146 - Table 'lotions2_p_os2.TABLE_DISCOUNT_COUPONS' doesn't exist

 

SELECT coupons_discount_percent, coupons_description, coupons_max_use, coupons_min_order, coupons_max_order, coupons_number_available FROM TABLE_DISCOUNT_COUPONS WHERE coupons_id = '2244' AND ( coupons_date_start <= CURDATE() OR coupons_date_start IS NULL ) AND ( coupons_date_end >= CURDATE() OR coupons_date_end IS NULL )

 

also would like to move the discount coupons box to the top of the page if any one knows how.

 

thanks,

shawn


If it was easy, anyone could do it!

Share this post


Link to post
Share on other sites
ok, now I have a new problem, it adds the box for the coupon code, but then when you go to the next page it gives me this error:

 

1146 - Table 'lotions2_p_os2.TABLE_DISCOUNT_COUPONS' doesn't exist

 

SELECT coupons_discount_percent, coupons_description, coupons_max_use, coupons_min_order, coupons_max_order, coupons_number_available FROM TABLE_DISCOUNT_COUPONS WHERE coupons_id = '2244' AND ( coupons_date_start <= CURDATE() OR coupons_date_start IS NULL ) AND ( coupons_date_end >= CURDATE() OR coupons_date_end IS NULL )

 

also would like to move the discount coupons box to the top of the page if any one knows how.

 

thanks,

shawn

ok, got it fixed, after doing some research, I found that I missed some code in one of the files.

 

thanks for the help, off to the next contrib!!!


If it was easy, anyone could do it!

Share this post


Link to post
Share on other sites

Hi

 

Know it is working fine. I follow the things already wrote in the form a did it right.

Only one thing is not working perfectely. If I create a discount with a minimal buy 100 and the higher 500, if the buy is under 500 the percent (10%) is calculated from the maximal value instead of the products total.

 

Some ideas for this?

 

Best regards


Rui Ganga

Share this post


Link to post
Share on other sites
what are these settings for?

 

Display Format for Order Total Line

Display format for the discount coupon code order total line.

 

Variables:

[coupon_desc]

[percent_discount]

[coupons_min_order]

[coupons_number_available]

 

 

This is explained in the manual.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
Hi

 

Know it is working fine. I follow the things already wrote in the form a did it right.

Only one thing is not working perfectely. If I create a discount with a minimal buy 100 and the higher 500, if the buy is under 500 the percent (10%) is calculated from the maximal value instead of the products total.

 

Some ideas for this?

 

Best regards

 

 

This is how it is supposed to work.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
Hi

 

I'm trying to follow the tips on the manual to activate the contribution. But when i follow the: ...go to Modules > Order Total > Discount Coupon in the admininistration section of your website... i can't find the Discount Coupon. What should be missing.

 

Thanks

 

You need to upload all of the new files listed in the install file from the install zip.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
how about this code, I deleted the file on the server and uploaded the new copy, but still no option for the coupon in the payment page.

 

here is the code for checkout_payment.php:

 

This is the proper language file. You still need to add the correct changes to checkout_payment.php in your root catalog directory.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites

Kristen,

 

Thanks for your help a few days ago... fixed discounts is working great.

 

I need to disable the minimum order amount for fixed discounts. I realize that it must be in the DB for it to make the calculation. With that said, my client needs to have a fixed discount with no minimum order amount.

 

I saw where djmonkey1 (pg 25/26 of this thread) was able to change the code on the discount_coupon.php page to do this. I made the change with the code provided. I also added the field "coupon_type" to the "discount_coupons" table and manually set the field for my coupon to "fixed".

 

It still tells me that my order does not meet the minimum order amount. Was there more to it than this?

Share this post


Link to post
Share on other sites
Kristen,

 

Thanks for your help a few days ago... fixed discounts is working great.

 

I need to disable the minimum order amount for fixed discounts. I realize that it must be in the DB for it to make the calculation. With that said, my client needs to have a fixed discount with no minimum order amount.

 

I saw where djmonkey1 (pg 25/26 of this thread) was able to change the code on the discount_coupon.php page to do this. I made the change with the code provided. I also added the field "coupon_type" to the "discount_coupons" table and manually set the field for my coupon to "fixed".

 

It still tells me that my order does not meet the minimum order amount. Was there more to it than this?

 

If you want to completely disable minimum order checking, simply comment out line 36 of includes/classes/discount_coupon.php:

 

$this->check_coupons_min_order();

 

so that it looks like

 

//$this->check_coupons_min_order();


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
If you want to completely disable minimum order checking, simply comment out line 36 of includes/classes/discount_coupon.php:

 

$this->check_coupons_min_order();

 

so that it looks like

 

//$this->check_coupons_min_order();

 

Excellent. We're actually adjusting it a bit. We still need to honor the minimum order sometimes. We added an optional field to the DB and in the admin section to force minimum order checking. We edited line 36 to be conditional based on what's in the new field... now we can have our cake and eat it too.

 

BTW, I recived your email and I will catch up with you when we get this thing launched in a day or two.

Share this post


Link to post
Share on other sites

Hi I´m using this contribution Discount Coupon Codes and it´s working fine.

 

I´m trying to implement the contribution "E.U. VAT Intracom Number"

http://www.oscommerce.com/community/contributions,1848

 

This contribution can automatically remove tax for european customers who enters a VAT-number when they register.

 

To do this I have to implement some code in my catalog/includes/classes/order.php

 

Where I need to implemet the code I allready have some code from the Discount Coupon Codes contribution.

 

Is it possible to merge the two codes somehow?

 

I have tried but when I try the tax get charged two times. I would really need some help with this.

 

My catalog/includes/classes/order.php with Discount Codes looks like this.

 

<?php
/*
 $Id: order.php,v 1.33 2003/06/09 22:25:35 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 {
var $info, $totals, $products, $customer, $delivery, $content_type;

function order($order_id = '') {
  $this->info = array();
  $this->totals = array();
  $this->products = array();
  $this->customer = array();
  $this->delivery = array();

  if (tep_not_null($order_id)) {
	$this->query($order_id);
  } else {
	$this->cart();
  }
}

function query($order_id) {
  global $languages_id;

  $order_id = tep_db_prepare_input($order_id);

  $order_query = tep_db_query("select customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_tva_intracom, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");
  $order = tep_db_fetch_array($order_query);

  $totals_query = tep_db_query("select title, text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' order by sort_order");
  while ($totals = tep_db_fetch_array($totals_query)) {
	$this->totals[] = array('title' => $totals['title'],
							'text' => $totals['text']);
  }

  $order_total_query = tep_db_query("select text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' and class = 'ot_total'");
  $order_total = tep_db_fetch_array($order_total_query);

  $shipping_method_query = tep_db_query("select title from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' and class = 'ot_shipping'");
  $shipping_method = tep_db_fetch_array($shipping_method_query);

  $order_status_query = tep_db_query("select orders_status_name from " . TABLE_ORDERS_STATUS . " where orders_status_id = '" . $order['orders_status'] . "' and language_id = '" . (int)$languages_id . "'");
  $order_status = tep_db_fetch_array($order_status_query);

  $this->info = array('currency' => $order['currency'],
					  'currency_value' => $order['currency_value'],
					  'payment_method' => $order['payment_method'],
					  'cc_type' => $order['cc_type'],
					  'cc_owner' => $order['cc_owner'],
					  'cc_number' => $order['cc_number'],
					  'cc_expires' => $order['cc_expires'],
					  'date_purchased' => $order['date_purchased'],
					  'orders_status' => $order_status['orders_status_name'],
					  'last_modified' => $order['last_modified'],
					  'total' => strip_tags($order_total['text']),
					  'shipping_method' => ((substr($shipping_method['title'], -1) == ':') ? substr(strip_tags($shipping_method['title']), 0, -1) : strip_tags($shipping_method['title'])));

  $this->customer = array('id' => $order['customers_id'],
						  'name' => $order['customers_name'],
						  'company' => $order['customers_company'],
						  'street_address' => $order['customers_street_address'],
						  'suburb' => $order['customers_suburb'],
						  'city' => $order['customers_city'],
						  'postcode' => $order['customers_postcode'],
						  'state' => $order['customers_state'],
						  'country' => $order['customers_country'],
						  'format_id' => $order['customers_address_format_id'],
						  'telephone' => $order['customers_telephone'],
						  'email_address' => $order['customers_email_address']);

  $this->delivery = array('name' => $order['delivery_name'],
						  'company' => $order['delivery_company'],
						  'street_address' => $order['delivery_street_address'],
						  'suburb' => $order['delivery_suburb'],
						  'city' => $order['delivery_city'],
						  'postcode' => $order['delivery_postcode'],
						  'state' => $order['delivery_state'],
						  'country' => $order['delivery_country'],
						  'format_id' => $order['delivery_address_format_id']);

  if (empty($this->delivery['name']) && empty($this->delivery['street_address'])) {
	$this->delivery = false;
  }

  $this->billing = array('name' => $order['billing_name'],
						 'company' => $order['billing_company'],
						 //BOF for VAT INTRACOM
						 'tva_intracom' => $order['billing_tva_intracom'],
						 // EOF for TVA_INTRACOM
						 'street_address' => $order['billing_street_address'],
						 'suburb' => $order['billing_suburb'],
						 'city' => $order['billing_city'],
						 'postcode' => $order['billing_postcode'],
						 'state' => $order['billing_state'],
						 'country' => $order['billing_country'],
						 'format_id' => $order['billing_address_format_id']);

  $index = 0;
  $orders_products_query = tep_db_query("select orders_products_id, products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");
  while ($orders_products = tep_db_fetch_array($orders_products_query)) {
	$this->products[$index] = array('qty' => $orders_products['products_quantity'],
								'id' => $orders_products['products_id'],
									'name' => $orders_products['products_name'],
									'model' => $orders_products['products_model'],
									'tax' => $orders_products['products_tax'],
									'price' => $orders_products['products_price'],
									'final_price' => $orders_products['final_price']);

	$subindex = 0;
	$attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'");
	if (tep_db_num_rows($attributes_query)) {
	  while ($attributes = tep_db_fetch_array($attributes_query)) {
		$this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'],
																 'value' => $attributes['products_options_values'],
																 'prefix' => $attributes['price_prefix'],
																 'price' => $attributes['options_values_price']);

		$subindex++;
	  }
	}

	$this->info['tax_groups']["{$this->products[$index]['tax']}"] = '1';

	$index++;
  }
}

function cart() {
  global $customer_id, $sendto, $billto, $cart, $languages_id, $currency, $currencies, $shipping, $payment;

  $this->content_type = $cart->get_content_type();

  $customer_address_query = tep_db_query("select c.customers_firstname, c.customers_lastname, c.customers_telephone, c.customers_email_address, ab.entry_company, ab.entry_tva_intracom, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2, co.countries_iso_code_3, co.address_format_id, ab.entry_state from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " co on (ab.entry_country_id = co.countries_id) where c.customers_id = '" . (int)$customer_id . "' and ab.customers_id = '" . (int)$customer_id . "' and c.customers_default_address_id = ab.address_book_id");
  $customer_address = tep_db_fetch_array($customer_address_query);

  $shipping_address_query = tep_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int)$customer_id . "' and ab.address_book_id = '" . (int)$sendto . "'");
  $shipping_address = tep_db_fetch_array($shipping_address_query);

  $billing_address_query = tep_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_tva_intracom, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int)$customer_id . "' and ab.address_book_id = '" . (int)$billto . "'");
  $billing_address = tep_db_fetch_array($billing_address_query);

  $tax_address_query = tep_db_query("select ab.entry_country_id, ab.entry_zone_id from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) where ab.customers_id = '" . (int)$customer_id . "' and ab.address_book_id = '" . (int)($this->content_type == 'virtual' ? $billto : $sendto) . "'");
  $tax_address = tep_db_fetch_array($tax_address_query);

  $this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID,
					  'currency' => $currency,
					  'currency_value' => $currencies->currencies[$currency]['value'],
					  'payment_method' => $payment,
					  'cc_type' => (isset($GLOBALS['cc_type']) ? $GLOBALS['cc_type'] : ''),
					  'cc_owner' => (isset($GLOBALS['cc_owner']) ? $GLOBALS['cc_owner'] : ''),
					  'cc_number' => (isset($GLOBALS['cc_number']) ? $GLOBALS['cc_number'] : ''),
					  'cc_expires' => (isset($GLOBALS['cc_expires']) ? $GLOBALS['cc_expires'] : ''),
					  'shipping_method' => $shipping['title'],
					  'shipping_cost' => $shipping['cost'],
					  'subtotal' => 0,
					  'tax' => 0,
					  'tax_groups' => array(),
					  //kgt - discount coupons
					  'coupon' => (isset($GLOBALS['coupon']) ? $GLOBALS['coupon'] : ''),
					  'applied_discount' => array(),
					  //end kgt - discount coupons
					  'comments' => (isset($GLOBALS['comments']) ? $GLOBALS['comments'] : ''));

  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;
	}
  }

  $this->customer = array('firstname' => $customer_address['customers_firstname'],
						  'lastname' => $customer_address['customers_lastname'],
						  'company' => $customer_address['entry_company'],
						  'street_address' => $customer_address['entry_street_address'],
						  'suburb' => $customer_address['entry_suburb'],
						  'city' => $customer_address['entry_city'],
						  'postcode' => $customer_address['entry_postcode'],
						  'state' => ((tep_not_null($customer_address['entry_state'])) ? $customer_address['entry_state'] : $customer_address['zone_name']),
						  'zone_id' => $customer_address['entry_zone_id'],
						  'country' => array('id' => $customer_address['countries_id'], 'title' => $customer_address['countries_name'], 'iso_code_2' => $customer_address['countries_iso_code_2'], 'iso_code_3' => $customer_address['countries_iso_code_3']),
						  'format_id' => $customer_address['address_format_id'],
						  'telephone' => $customer_address['customers_telephone'],
						  'email_address' => $customer_address['customers_email_address']);

  $this->delivery = array('firstname' => $shipping_address['entry_firstname'],
						  'lastname' => $shipping_address['entry_lastname'],
						  'company' => $shipping_address['entry_company'],
						  'street_address' => $shipping_address['entry_street_address'],
						  'suburb' => $shipping_address['entry_suburb'],
						  'city' => $shipping_address['entry_city'],
						  'postcode' => $shipping_address['entry_postcode'],
						  'state' => ((tep_not_null($shipping_address['entry_state'])) ? $shipping_address['entry_state'] : $shipping_address['zone_name']),
						  'zone_id' => $shipping_address['entry_zone_id'],
						  'country' => array('id' => $shipping_address['countries_id'], 'title' => $shipping_address['countries_name'], 'iso_code_2' => $shipping_address['countries_iso_code_2'], 'iso_code_3' => $shipping_address['countries_iso_code_3']),
						  'country_id' => $shipping_address['entry_country_id'],
						  'format_id' => $shipping_address['address_format_id']);

  $this->billing = array('firstname' => $billing_address['entry_firstname'],
						 'lastname' => $billing_address['entry_lastname'],
						 'company' => $billing_address['entry_company'],
						 //BOF for VAT INTRACOM
						 'tva_intracom' => $billing_address['entry_tva_intracom'],
						 // EOF for TVA_INTRACOM
						 'street_address' => $billing_address['entry_street_address'],
						 'suburb' => $billing_address['entry_suburb'],
						 'city' => $billing_address['entry_city'],
						 'postcode' => $billing_address['entry_postcode'],
						 'state' => ((tep_not_null($billing_address['entry_state'])) ? $billing_address['entry_state'] : $billing_address['zone_name']),
						 'zone_id' => $billing_address['entry_zone_id'],
						 'country' => array('id' => $billing_address['countries_id'], 'title' => $billing_address['countries_name'], 'iso_code_2' => $billing_address['countries_iso_code_2'], 'iso_code_3' => $billing_address['countries_iso_code_3']),
						 'country_id' => $billing_address['entry_country_id'],
						 'format_id' => $billing_address['address_format_id']);

  $index = 0;
  $products = $cart->get_products();
  for ($i=0, $n=sizeof($products); $i<$n; $i++) {
	$this->products[$index] = array('qty' => $products[$i]['quantity'],
									'name' => $products[$i]['name'],
									'model' => $products[$i]['model'],
									'tax' => tep_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']),
									'tax_description' => tep_get_tax_description($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']),
									'price' => $products[$i]['price'],
									'final_price' => $products[$i]['price'] + $cart->attributes_price($products[$i]['id']),
									'weight' => $products[$i]['weight'],
									'id' => $products[$i]['id']);

	if ($products[$i]['attributes']) {
	  $subindex = 0;
	  reset($products[$i]['attributes']);
	  while (list($option, $value) = each($products[$i]['attributes'])) {
		$attributes_query = 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 = '" . (int)$products[$i]['id'] . "' and pa.options_id = '" . (int)$option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int)$languages_id . "' and poval.language_id = '" . (int)$languages_id . "'");
		$attributes = tep_db_fetch_array($attributes_query);

		$this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options_name'],
																 'value' => $attributes['products_options_values_name'],
																 'option_id' => $option,
																 'value_id' => $value,
																 'prefix' => $attributes['price_prefix'],
																 'price' => $attributes['options_values_price']);

		$subindex++;
	  }
	}

	//kgt - discount coupon
	if( !empty( $this->info['coupon'] ) ) {
		if( !isset( $this_coupon ) ) {
	require_once( DIR_WS_CLASSES . 'discount_coupon.php' );
		$this_coupon = new discount_coupon( $this->info['coupon'] );
		}
		$applied_discount = $this_coupon->calculate_discount( $this->products[$index], $n );
	  if( isset( $this->info['applied_discount'][$this->products[$index]['tax_description']] ) ) {
	  $this->info['applied_discount'][$this->products[$index]['tax_description']] += $applied_discount;
		} else {
		$this->info['applied_discount'][$this->products[$index]['tax_description']] = $applied_discount;
	}
	$this_actual_shown_price = null;
	if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_SUBTOTAL == 'false' ) {
		//we don't want to display the subtotal with the discount applied, so apply the discount then set the applied_discount variable to zero so that it's not added into the order subtotal, but is still used to correctly calculate tax
		$this_actual_shown_price = ( tep_add_tax( $this->products[$index]['final_price'], $this->products[$index]['tax'] ) * $this->products[$index]['qty'] ) - $applied_discount;
		$applied_discount = 0;
	}
	}
	$shown_price = ( tep_add_tax( $this->products[$index]['final_price'], $this->products[$index]['tax'] ) * $this->products[$index]['qty'] ) - $applied_discount;
	$this->info['subtotal'] += $shown_price;
	//if we need to display the subtotal without the discount applied, then add the shown price to the subtotal, then change shown price to the price with the applied discount in order to properly calculate taxes
	if( isset( $this_actual_shown_price ) ) $shown_price = $this_actual_shown_price;
	//end kgt - discount coupon

	$products_tax = $this->products[$index]['tax'];
	$products_tax_description = $this->products[$index]['tax_description'];
	if (DISPLAY_PRICE_WITH_TAX == 'true') {
	  $this->info['tax'] += $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));
	  if (isset($this->info['tax_groups']["$products_tax_description"])) {
		$this->info['tax_groups']["$products_tax_description"] += $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));
	  } else {
		$this->info['tax_groups']["$products_tax_description"] = $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));
	  }
	} else {
	  $this->info['tax'] += ($products_tax / 100) * $shown_price;
	  if (isset($this->info['tax_groups']["$products_tax_description"])) {
		$this->info['tax_groups']["$products_tax_description"] += ($products_tax / 100) * $shown_price;
	  } else {
		$this->info['tax_groups']["$products_tax_description"] = ($products_tax / 100) * $shown_price;
	  }
	}

	$index++;
  }

  if (DISPLAY_PRICE_WITH_TAX == 'true') {
	$this->info['total'] = $this->info['subtotal'] + $this->info['shipping_cost'];
  } else {
	$this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + $this->info['shipping_cost'];
  }
//kgt - discount coupon
if( !empty( $this->info['coupon'] ) && MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_SUBTOTAL == 'false' ) {
  foreach( $this->info['applied_discount'] as $discount ){
		$this->info['total'] -= $discount;
	  }
}
//end kgt - discount coupon
}
 }
?>

 

And the part from the VAT contribution I´m trying to implement looks like this. It´s supposed to go at the end of the order.php The code from the VAT contribution is marked with "// BOF for TVA_intracom_v3.4"

 

 $subindex++;

}

}

// BOF for TVA_intracom_v3.4

//For those who want taxes automatically if the conditions below are OK, uncomment the lines below

if ($this->billing['company'] != '' && $this->billing['tva_intracom'] != '' && $this->billing['country']['id'] != STORE_COUNTRY && $this->delivery['country']['id'] != STORE_COUNTRY) {

$shown_price = $this->products[$index]['final_price'] * $this->products[$index]['qty'];

$this->info['subtotal'] += $shown_price;

} else {

// EOF for TVA_intracom_v3.4

 

$shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];

$this->info['subtotal'] += $shown_price;

 

// BOF for TVA_intracom_v3.4

//For those who want taxes automatically if the conditions below are OK, uncomment the line below

}

// EOF for TVA_intracom_v3.4

 

// BOF for TVA_intracom_v3.4

//For those who want taxes automatically if the conditions below are OK, uncomment the lines below

if ($this->billing['company'] != '' && $this->billing['tva_intracom'] != '' && $this->billing['country']['id'] != STORE_COUNTRY && $this->delivery['country']['id'] != STORE_COUNTRY) {

$products_tax = 0;

$products_tax_description = NO_TAX;

} else {

// EOF for TVA_intracom_v3.4

$products_tax = $this->products[$index]['tax'];

$products_tax_description = $this->products[$index]['tax_description'];

// BOF for TVA_intracom_v3.4

//For those who want taxes automatically if the conditions below are OK, uncomment the line below

}

// EOF for TVA_intracom_v3.4

 

if (DISPLAY_PRICE_WITH_TAX == 'true') {

$this->info['tax'] += $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)

Share this post


Link to post
Share on other sites

Looks like my posting was too long and was cut off and I wasn´t fast enough to edit it.

 

I paste the last bit of it here again.

 

----------------------------

And the part from the VAT contribution I´m trying to implement looks like this. It´s supposed to go at

 

the end of the order.php The code from the VAT contribution is marked with "// BOF for

 

TVA_intracom_v3.4"

 

 $subindex++;
	  }
	}
// BOF for TVA_intracom_v3.4
//For those who want taxes automatically if the conditions below are OK, uncomment the lines below
		if ($this->billing['company'] != '' && $this->billing['tva_intracom'] != '' && 

$this->billing['country']['id'] != STORE_COUNTRY && $this->delivery['country']['id'] != STORE_COUNTRY) 

{
			$shown_price = $this->products[$index]['final_price'] * 

$this->products[$index]['qty'];
			$this->info['subtotal'] += $shown_price;
		} else {	
// EOF for TVA_intracom_v3.4				

	$shown_price = tep_add_tax($this->products[$index]['final_price'], 

$this->products[$index]['tax']) * $this->products[$index]['qty'];
	$this->info['subtotal'] += $shown_price;

// BOF for TVA_intracom_v3.4
//For those who want taxes automatically if the conditions below are OK, uncomment the line below	


		}
// EOF for TVA_intracom_v3.4

// BOF for TVA_intracom_v3.4
//For those who want taxes automatically if the conditions below are OK, uncomment the lines below
		if ($this->billing['company'] != '' && $this->billing['tva_intracom'] != '' && 

$this->billing['country']['id'] != STORE_COUNTRY && $this->delivery['country']['id'] != STORE_COUNTRY) 

{
			$products_tax = 0;
			$products_tax_description = NO_TAX;
		} else {	
// EOF for TVA_intracom_v3.4
		$products_tax = $this->products[$index]['tax'];
	$products_tax_description = $this->products[$index]['tax_description'];
// BOF for TVA_intracom_v3.4
//For those who want taxes automatically if the conditions below are OK, uncomment the line below	


		}
// EOF for TVA_intracom_v3.4

	if (DISPLAY_PRICE_WITH_TAX == 'true') {
	  $this->info['tax'] += $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . 

str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));
	  if (isset($this->info['tax_groups']["$products_tax_description"])) {
		$this->info['tax_groups']["$products_tax_description"] += $shown_price - ($shown_price / 

(($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', 

$products_tax)));
	  } else {
		$this->info['tax_groups']["$products_tax_description"] = $shown_price - ($shown_price / 

(($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', 

$products_tax)));
	  }
	} else {
	  $this->info['tax'] += ($products_tax / 100) * $shown_price;
	  if (isset($this->info['tax_groups']["$products_tax_description"])) {
		$this->info['tax_groups']["$products_tax_description"] += ($products_tax / 100) * 

$shown_price;
	  } else {
		$this->info['tax_groups']["$products_tax_description"] = ($products_tax / 100) * 

$shown_price;
	  }
	}

	$index++;
  }

  if (DISPLAY_PRICE_WITH_TAX == 'true') {
	$this->info['total'] = $this->info['subtotal'] + $this->info['shipping_cost'];
  } else {
	$this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + 

$this->info['shipping_cost'];
  }
}
 }
?>

 

I would really appreciate any help with this to bring me closer to a solution. Could this even be

 

done?

I would really like to use both contributions.

 

Thanks in advance

 

Per

Share this post


Link to post
Share on other sites

I just installed Discount Coupon Codes and this is the error I get when trying to goto the module:

 

Parse error: parse error, unexpected ')' in /home/sales/public_html/shop/admin/includes/boxes/catalog.php on line 32

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

×