Jump to content
kgt

[Contribution] Discount Coupon Codes

Recommended Posts

Has anyone come up with a true "fix" for the recalculate shipping function? I looked at the new "Bug Fix" download from February 09 by ChilliNr1 and as far as I can tell it isn't really a fix, it simply doesn't call the recalculate shipping function.

 

This means the site still won't recalculate shipping if the discount amount changes the order total enough to affect shipping rates. This may not matter if you do everything by weight - but if you are using a table method and/or free shipping contribution, then it does matter.

 

Anybody have any idea how to get the function is_recalc_shipping working properly with table rates and or free shipping contributions?


~Tracy
 

Share this post


Link to post
Share on other sites

Can anyone help me?

 

I'd like to include shipping cost when using percentage discount. Let's say I have a 10% percentage discount. I hope, the discount = 10% * ( price total + shipping cost).

 

I found from the discout_coupon.php that there are two functions may be important. But I failed many times after I tried to modifiy them. Can you give me some advice?

 

Thank you in advance.

 

 

function calculate_discount( $product = array(), $current_product = 0 ) {

if( !$this->is_allowed_product( tep_get_prid( $product['id'] ) ) ) { //check that the product isn't excluded

$applied_discount = 0; //don't apply a discount

if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG == 'true' ) $this->message( 'INFO: Excluded product '.$product['id'].'. Discount of '.$applied_discount.' not applied.', 'debug' );

} else {

switch( $this->coupon['coupons_discount_type'] ) {

case 'shipping':

$applied_discount = 0;

break;

case 'fixed':

//get the percentage of the total discount to apply to this item:

$percentage_applied = $this->coupon['coupons_discount_amount'] / $this->cart_info['valid_products']['total'];

if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG == 'true' ) $this->message( 'INFO: Percentage of discount applied to product '.$product['id'].': '.$percentage_applied.'.', 'debug' );

//calculate the applied discount:

$applied_discount = $product['final_price'] - $percentage_applied;

if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG == 'true' ) $this->message( 'INFO: Fixed discount applied to product '.$product['id'].': '.$applied_discount.'.', 'debug' );

//this section is to make sure that both the fixed discount and the tax are correct:

if( $this->cart_info['valid_products']['line_items'] == ( $current_product + 1 ) ) {

$difference = $this->coupon['coupons_discount_amount'] - ( array_sum( $this->applied_discount ) + $applied_discount );

if( $difference != 0 ) {

if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG == 'true' ) $this->message( 'INFO: Fixed adjustment for product '.$product['id'].': difference: '.$difference.' unadjusted applied_discount: '.$applied_discount, 'debug' );

$applied_discount += $difference;

}

} //end code to ensure accurate fixed discount and tax

break;

case 'percent':

$applied_discount = $product['final_price'] * $this->coupon['coupons_discount_amount'] * $product['qty'];

break;

}

 

 

 

function finalize_discount( $info ) {

//make sure we meet the order minimum

if( !$this->check_coupons_min_order() ) {

$this->applied_discount = array();

if( $this->is_exists_exclusions() ) $this->message( ENTRY_DISCOUNT_COUPON_EXCLUSION_ERROR ); //add on to the min_order error message since we have excluded items

}

if( !$this->is_errors() ) { //if there are no errors, we can apply the discount

if( $this->coupon['coupons_discount_type'] == 'shipping' ) { //discount shipping if the coupon type is shipping

$this->applied_discount['shipping'] = $info['shipping_cost'] * $this->coupon['coupons_discount_amount'];

$this->applied_discount['shipping'] = $this->applied_discount['shipping'];

$info['total'] -= $this->applied_discount['shipping'];

if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG == 'true' ) $this->message( 'INFO: Shipping Discount of '.$this->applied_discount['shipping'].' applied.', 'debug' );

} else if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DISPLAY_SUBTOTAL == 'false' ) { //subtract the discount from the order total if it's not displayed in the subtotal

foreach( $this->applied_discount as $discount ) {

$info['total'] -= $discount;

if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG == 'true' ) $this->message( 'INFO: Discount of '.$discount.' applied to order total.', 'debug' );

}

}

if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_ALLOW_NEGATIVE == 'false' && $info['total'] < 0 ) $info['total'] = 0;

}

return $info['total'];

}

Share this post


Link to post
Share on other sites
Has anyone come up with a true "fix" for the recalculate shipping function? I looked at the new "Bug Fix" download from February 09 by ChilliNr1 and as far as I can tell it isn't really a fix, it simply doesn't call the recalculate shipping function.

 

This means the site still won't recalculate shipping if the discount amount changes the order total enough to affect shipping rates. This may not matter if you do everything by weight - but if you are using a table method and/or free shipping contribution, then it does matter.

 

Anybody have any idea how to get the function is_recalc_shipping working properly with table rates and or free shipping contributions?

Hi,

I`m using the free shipping module when purchase is over 50Euro.

That`s why I fixed (deleted the call for recalculating) it!

Before that, you have an amount over 50Euro for example in your cart and free shipping.

When you`ve entered a coupon code and the amount is recalculated below 50Euro,

you`ve to pay shipping again...

I don`t use shipping per weight or anything like that!

It`ll work with the free shipping module!!!

I can`t say how it affects the table method?!

 

Can anyone help me?

 

I'd like to include shipping cost when using percentage discount. Let's say I have a 10% percentage discount. I hope, the discount = 10% * ( price total + shipping cost).

 

I found from the discout_coupon.php that there are two functions may be important. But I failed many times after I tried to modifiy them. Can you give me some advice?

 

Thank you in advance.

Hi,

with this option in admin, it`s not possible at all.

It`s not only change some rows in discout_coupon.php...

It`s a little bit more complicated than that!

But what is it good for?

It`s not more attractiv to customers, than give discount by shopping cart worth...

For example: Give 10% for 10Euro, 20% for 25Euro, 30% for 40Euro and so on, but stop before giving 100% ;)

Or you can give procebtual discount an shipping up to free shipping.

But both isn`t more attractiv in my eyes!

Greetings!

Edited by ChilliNr1

Share this post


Link to post
Share on other sites

Thank you for your answer, but I'm not saying I need to add a new option in admin. I think it's easy to change the percentage option into what I want.

 

case 'percent':

$applied_discount = $product['final_price'] * $this->coupon['coupons_discount_amount'] * $product['qty'];

 

I want to change the formula above into

 

$applied_discount = $product['final_price'] * $this->coupon['coupons_discount_amount'] * $product['qty'] + " Shipping cost" * $this->coupon['coupons_discount_amount'] ;

 

 

But I don't what's the shipping cost here. I tried "$info['shipping_cost'] ", but it doesn't work. Can anyone tell me?

 

 

Hi,

with this option in admin, it`s not possible at all.

It`s not only change some rows in discout_coupon.php...

It`s a little bit more complicated than that!

But what is it good for?

It`s not more attractiv to customers, than give discount by shopping cart worth...

For example: Give 10% for 10Euro, 20% for 25Euro, 30% for 40Euro and so on, but stop before giving 100% ;)

Or you can give procebtual discount an shipping up to free shipping.

But both isn`t more attractiv in my eyes!

Greetings!

Share this post


Link to post
Share on other sites

Still trying to figure this out. Anyone else have this problem?

Hi there

So installed everything, ran the query and it all looks good, except that when I go to Modules> order total and try to set it to true, I see the option there, and the arrow, but can't see anything on the side of that.

The last thing to the right of the page is the arrow and the little info icons, so i can't set it to true. Please help!

Share this post


Link to post
Share on other sites
If you'd like screenshots, you may email me and I will email them to you.

 

does this coupon contribution support this type of coupon?

 

buy product a, product b, and product c and get 10% off your entire order. if all products are in the cart, you qualify for the 10% off coupon?

Share this post


Link to post
Share on other sites

That sounds like the Together Discount contribution.

 

does this coupon contribution support this type of coupon?

 

buy product a, product b, and product c and get 10% off your entire order. if all products are in the cart, you qualify for the 10% off coupon?


~Tracy
 

Share this post


Link to post
Share on other sites

The problem is that by commenting out the call to the recalculate shipping function, the website won't check to see if shipping charges should change.

 

Our shipping rates are calculated after the discount is applied, and they are "table rate" shipping. This means that, for example, if their subtotal before discount was $40, their shipping will show as $9.95 - then the discount gets subtracted and the subtotal becomes $35.00 - their shipping should now only be $7.95. With the call to the recalc_shipping function commented out, the site will leave the shipping at $9.95 and not try to correct it.

 

If I do call the function to try to correct the shipping, it either doesn't work, or it will take the customer back to the page to select shipping and then not keep the coupon code in the order. So if the customer doesn't re-enter the coupon code, they either get stuck in a loop, or they are allowed to place their order with the discount applied - but we don't know what discount they used because it is no longer on the order.

 

Does that make sense? So right now I'm just trying to figure out how to get the recalc_shipping function working properly so customers are charged the correct shipping amount after their discount is applied, and the discount coupon stays in the order (unless the customer deletes it from the order).

 

Hi,

I`m using the free shipping module when purchase is over 50Euro.

That`s why I fixed (deleted the call for recalculating) it!

Before that, you have an amount over 50Euro for example in your cart and free shipping.

When you`ve entered a coupon code and the amount is recalculated below 50Euro,

you`ve to pay shipping again...

I don`t use shipping per weight or anything like that!

It`ll work with the free shipping module!!!

I can`t say how it affects the table method?!


~Tracy
 

Share this post


Link to post
Share on other sites

Parse error: syntax error, unexpected ')' in /var/www/vhosts/themancaveoutletstore.com/httpdocs/admin/includes/boxes/catalog.php on line 37

 

'<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a><br>' .

 

I am getting lost to the problem... it was the classic issue... I added a period to the end of the line above and then the error changed to this line below.

 

Parse error: syntax error, unexpected ')' in /var/www/vhosts/themancaveoutletstore.com/httpdocs/admin/includes/boxes/catalog.php on line 47

 

which is this line:

 

'<a href="' . tep_href_link(FILENAME_RELATED_PRODUCTS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_RELATED_PRODUCTS . '</a>' );

 

any ideas are welcomed. I mean that line worked fine before I added this contrib. and I need this code - I need both lol...

 

<?php
/*
 $Id: catalog.php,v 1.21 2003/07/09 01:18:53 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 2002 osCommerce

 Released under the GNU General Public License
*/
?>
<!-- catalog //-->
         <tr>
           <td>
<?php
 $heading = array();
 $contents = array();

 $heading[] = array('text'  => BOX_HEADING_CATALOG,
                    'link'  => tep_href_link(FILENAME_CATEGORIES, 'selected_box=catalog'));

 if ($selected_box == 'catalog') {
   $contents[] = array('text'  => '<a href="' . tep_href_link(FILENAME_CATEGORIES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCTS . '</a><br>' .
							   '<a href="' . tep_href_link(FILENAME_FEATURED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_FEATURED_PRODUCTS . '</a><br>' .

                                  '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCTS_ATTRIBUTES . '</a><br>' .        
                                  '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES_COPIER, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_ATTRIBUTES_COPIER . '</a><br>' .
                                  '<a href="' . tep_href_link(FILENAME_PRODUCTS_MULTI, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCTS_MULTI . '</a><br>' .
                                  '<a href="' . tep_href_link('text_attributes.php', '', 'NONSSL') . '" class="menuBoxContentLink">Text Attributes</a><br>' .

                                  '<a href="' . tep_href_link(FILENAME_MANUFACTURERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_MANUFACTURERS . '</a><br>' .
                                  '<a href="' . tep_href_link(FILENAME_REVIEWS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_REVIEWS . '</a><br>' .
                                  '<a href="' . tep_href_link(FILENAME_SPECIALS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_SPECIALS . '</a><br>' .



                                 //kgt - discount coupons
                                  '<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a><br>' .
                                  '<a href="' . tep_href_link(FILENAME_DISCOUNT_COUPONS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_DISCOUNT_COUPONS . '</a>' );
                                  /***************
                                  '<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a>' );
                                  ***************/
                                  //end kgt - discount coupons 

        /* Optional Related Products (ORP) */
       '<a href="' . tep_href_link(FILENAME_RELATED_PRODUCTS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_RELATED_PRODUCTS . '</a>' );
       //ORP:end

       }

 $box = new box;
 echo $box->menuBox($heading, $contents);
?>
           </td>
         </tr>
<!-- catalog_eof //-->


Yeah Yeah I am learning as I go... lol

Share this post


Link to post
Share on other sites
Never mind I fixed this for some reason the debug was printing out the content in the source even though debug mode was set to false. I inserted another comment tag inside the admin/orders.php file to fix it. If you have this problem I would suggest doing the same until someone has the time to fix this bug.

 

where are you inserted this tag comment ? I am having the same problem... =(

 

someone help me please

Edited by carla.teixeira

Share this post


Link to post
Share on other sites

I have just installed the latest version of the ecommerce software and discount coupon version 3.32 and when i try to log into the admin page i get the following error

 

"The requested URL /mssnew/catalog/admin/FILENAME_LOGIN was not found on this server."

 

any ideas would be most welcome.

Edited by stevieg1978

Share this post


Link to post
Share on other sites

Hi all, I'm pretty new to this forum and I need help. My problem is the same as voltagexx. I receive an error upon applying a discount to the shopping cart:

 

1062 - Duplicate entry 'UL0209-238' for key 1

insert into discount_coupons_to_orders (coupons_id, orders_id) values ('UL0209', '238')

 

Any help will be much appreciated. :)

 

 

I'm still wondering if there's any possibility at all that anyone would know a fix for the problem I mentioned previously....

 

 

I'm getting an error sometimes where an order can be started and then if you go back in to pay and stuff (like if you have an item saved in your shopping cart and came back a day later to buy it), the code is already in there, and when you try to submit it, the following message comes up, and there's no way to pay.

 

 

1062 - Duplicate entry 'myspace-17' for key 1

 

insert into discount_coupons_to_orders (coupons_id, orders_id) values ('myspace', '17')

Share this post


Link to post
Share on other sites

Please disregard. I found the problem. In the checkout_process.php, there's a duplicate set of scripts below. I just deleted the other one and its working fine now:

 

//kgt - discount coupons

if( tep_session_is_registered( 'coupon' ) && is_object( $order->coupon ) ) {

$sql_data_array = array( 'coupons_id' => $order->coupon->coupon['coupons_id'],

'orders_id' => $insert_id );

tep_db_perform( TABLE_DISCOUNT_COUPONS_TO_ORDERS, $sql_data_array );

}

//end kgt - discount coupons

 

 

Hi all, I'm pretty new to this forum and I need help. My problem is the same as voltagexx. I receive an error upon applying a discount to the shopping cart:

 

1062 - Duplicate entry 'UL0209-238' for key 1

insert into discount_coupons_to_orders (coupons_id, orders_id) values ('UL0209', '238')

 

Any help will be much appreciated. :)

Edited by leoprimero

Share this post


Link to post
Share on other sites

:blush: :lol:

This is the support thread for the Order Total contribution Discount Coupon Codes found here:

 

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

 

 

 

Hello I install the contribution (ot_discount_coupon_codes_3_32) and I am having a lot of trouble:

* Once I did make a coupon I can not erased. and it sign me off from the admin area

* My coupon is way too generous, it give 20% off of the item's price, 20% off shipping, and 20% off the total price (60% off total!)

I did install the last bug fix from the contribution.

 

Any help is very much appreciate. I am against time, please SOS

 

Thank you


Andrea

Share this post


Link to post
Share on other sites

Hi,

 

No matter if i toggle this subtotal with or without discount option on/off it still displays subtotal with the discount applied.

 

Any ideas as how to get this right?

 

Richard

Share this post


Link to post
Share on other sites

Please help

 

We have the discount coupons module installed and all works fine, but we now need to change our shipping details (free shipping for orders over £15) and where we were able to do this before, we now cannot.

 

Please could someone shed any light?


Debbie Harrison

 

Share this post


Link to post
Share on other sites

I should explain my last post a bit better:

 

Basically we need to amend delivery to the table rate so delivery is free to orders over £15 (its currently £10) and basically table rate is nowhere to be found and we now cannot edit anything.

 

 

 

I get:

 

kcssprob2202.gif

 

Please could anyone help or can I at least get in somewhere and adjust the PHP code manually so we can make this change?


Debbie Harrison

 

Share this post


Link to post
Share on other sites

On looking further this morning, the only place I can change the shipping is under order Total module.

 

kc2302.gif

 

But this doesn't work. I am assuming because we aren't using the coupons yet.

 

Please could someone help - surely normal delivery changes can still be adjusted. :blink:


Debbie Harrison

 

Share this post


Link to post
Share on other sites

Ok the problem is sorted. And I shall share the problem and the solution here for any other poor soul who falls into the same trap.

 

Going back a few pages to http://forums.oscommerce.com/index.php?s=&...t&p=1364763 wontonesaju said rename the old file to something with a prefix eg index-bk.php

 

When everything seems to be working Ok, remove the old files as this is what was messing up the shipping pages.


Debbie Harrison

 

Share this post


Link to post
Share on other sites

I installed this contribution on two different websites sometime around January 23, 2009, and I thought it was great! Everything seemed to be working perfectly, but I've noticed a problem.

 

Ever since I installed the contribution, when customers checkout, their orders are logged on the admin side as soon as they click the continue button on the checkout_payment page. Since there are a couple/few more clicks between there and actual payment, there's time for the customer to change their mind and just close the browser instead of completing the order. When that happens, I'm left with an order in the system that I think is a valid order (we often accept pre-orders with no deposit required, so lack of payment doesn't mean it's not a valid order), but the customer denies placing the order since they never fully completed checkout. I hope that made sense to someone.

 

Anyway, since installing this, the orders are being logged upon continuing from the checkout_payment page, rather than from the checkout_confirmation page. I need to fix it so that orders are only logged when customers click continue on the payment page and are sent on to PayPal. Before PayPal payment, not after.

 

Any help??? Please???

Share this post


Link to post
Share on other sites

I am having a big problem with where the discount amount is inserted in the account_history_info.php page.

Basically, its a custom template and it works perfectly for a customers order history if I remove this code from the file.

 

 

<?php

for ($i=0, $n=sizeof($order->totals); $i<$n; $i++) {

echo ' <tr>' . "\n" .

' <td class="main" >' . $order->totals[$i]['title'] . '</td>' . "\n" .

' <td class="main" >' . $order->totals[$i]['text'] . '</td>' . "\n" .

' </tr>' . "\n";

}

?>

I have included the code from the page below, and have higlighted where the result from the above syntax should be placed. However I have edited the syntax repeatedly, tried multiple different layouts, moved it around to almost every part of the page (template monster template), and I cannot get it to work as it should? (eg/ without screwing the page layout up!)

 

 

The discount amount goes into the info box but sends the bottom of the page layout on a trip!!! As soon as I remove the code, its ok.

 

) || (isset($HTTP_GET_VARS['order_id']) && !is_numeric($HTTP_GET_VARS['order_id']))) {

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

}

 

$customer_info_query = tep_db_query("select o.customers_id from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_STATUS . " s where o.orders_id = '". (int)$HTTP_GET_VARS['order_id'] . "' and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' and s.public_flag = '1'");

$customer_info = tep_db_fetch_array($customer_info_query);

if ($customer_info['customers_id'] != $customer_id) {

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

}

 

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

 

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

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

$breadcrumb->add(sprintf(NAVBAR_TITLE_3, $HTTP_GET_VARS['order_id']), tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $HTTP_GET_VARS['order_id'], 'SSL'));

 

require(DIR_WS_CLASSES . 'order.php');

$order = new order($HTTP_GET_VARS['order_id']);

?>

<!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; ?>">

<script type="text/javascript" src="iepngfix_tilebg.js"></script>

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

<style type="text/css">

.ie6_png {behavior: url("iepngfix.htc") }

.ie6_png img {behavior: url("iepngfix.htc") }

</style>

</head>

 

<body>

<!-- header //-->

<?php $tab_sel = 5; ?>

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

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" class="<?php echo MAIN_TABLE; ?>" cellspacing="0" cellpadding="0">

<tr>

<td class="<?php echo BOX_WIDTH_TD_LEFT; ?>"><table border="0" class="<?php echo BOX_WIDTH_LEFT; ?>" cellspacing="0" cellpadding="0">

<!-- left_navigation //-->

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

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td class="<?php echo CONTENT_WIDTH_TD; ?>"><?php echo panel_top(); ?>

 

<?php echo tep_draw_top();?>

 

<?php echo tep_draw_title_top();?>

 

<?php echo HEADING_TITLE; ?>

 

<?php echo tep_draw_title_bottom();?>

 

<?php echo tep_draw1_top();?>

 

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

<tr>

<td class="main" colspan="2"><b><?php echo sprintf(HEADING_ORDER_NUMBER, $HTTP_GET_VARS['order_id']) . ' <small>(' . $order->info['orders_status'] . ')</small>'; ?></b></td>

</tr>

<tr>

<td class="smallText"><?php echo HEADING_ORDER_DATE . ' ' . tep_date_long($order->info['date_purchased']); ?></td>

<td class="smallText" align="right"><?php echo HEADING_ORDER_TOTAL . ' ' . $order->info['total']; ?></td>

</tr>

</table>

 

<?php echo tep_draw_infoBox_top();?>

 

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

<tr>

<?php

if ($order->delivery != false) {

?>

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

<tr>

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

</tr>

<tr>

<td class="main"><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br>'); ?></td>

</tr>

<?php

if (tep_not_null($order->info['shipping_method'])) {

?>

<tr>

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

</tr>

<tr>

<td class="main"><?php echo $order->info['shipping_method']; ?></td>

</tr>

<?php

}

?>

</table></td>

<?php

}

?>

<td width="<?php echo (($order->delivery != false) ? '70%' : '100%'); ?>"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

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

<?php

if (sizeof($order->info['tax_groups']) > 1) {

?>

<tr>

<td class="main" colspan="2"><b><?php echo HEADING_PRODUCTS; ?></b></td>

<td class="smallText" align="right"><b><?php echo HEADING_TAX; ?></b></td>

<td class="smallText" align="right"><b><?php echo HEADING_TOTAL; ?></b></td>

</tr>

<?php

} else {

?>

<tr>

<td class="main" colspan="3"><b><?php echo HEADING_PRODUCTS; ?></b></td>

</tr>

<?php

}

 

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

echo ' <tr>' . "\n" .

' <td class="main" align="right" width="30">' . $order->products[$i]['qty'] . ' x</td>' . "\n" .

' <td class="main">' . $order->products[$i]['name'];

 

if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) {

for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {

echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i></small></nobr>';

}

}

 

echo '</td>' . "\n";

 

if (sizeof($order->info['tax_groups']) > 1) {

echo ' <td class="main" align="right">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n";

}

 

echo ' <td class="main" align="right">' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</td>' . "\n" .

' </tr>' . "\n";

}

?>

</table></td>

</tr>

</table></td>

</tr>

</table>

 

<?php echo tep_draw_infoBox_bottom();?>

 

<table cellpadding="0" cellspacing="0" border="0">

<tr>

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

</tr>

<tr>

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

</tr>

<tr>

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

</tr>

</table>

 

<?php echo tep_draw_infoBox_top();?>

 

<table border="0" cellspacing="0" cellpadding="0">

<tr>

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

<tr>

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

</tr>

<tr>

<td class="main"><?php echo tep_address_format($order->billing['format_id'], $order->billing, 1, ' ', '<br>'); ?></td>

</tr>

<tr>

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

</tr>

<tr>

<td class="main"><?php echo $order->info['payment_method']; ?></td>

</tr>

</table></td>

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

 

 

<?php

for ($i=0, $n=sizeof($order->totals); $i<$n; $i++) {

echo ' <tr>' . "\n" .

' <td class="main" align="right" width="100%">' . $order->totals[$i]['title'] . '</td>' . "\n" .

' <td class="main" align="right">' . $order->totals[$i]['text'] . '</td>' . "\n" .

' </tr>' . "\n";

}

?>

 

 

 

</table></td>

</tr>

</table>

 

<?php echo tep_draw_infoBox_bottom();?>

 

<?php echo tep_pixel_trans();?>

 

<table cellpadding="0" cellspacing="0" border="0">

<tr>

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

</tr>

</table>

 

<?php echo tep_pixel_trans();?>

 

 

<?php echo tep_draw_infoBox_top();?>

 

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

<?php

$statuses_query = tep_db_query("select os.orders_status_name, osh.date_added, osh.comments from " . TABLE_ORDERS_STATUS . " os, " . TABLE_ORDERS_STATUS_HISTORY . " osh where osh.orders_id = '" . (int)$HTTP_GET_VARS['order_id'] . "' and osh.orders_status_id = os.orders_status_id and os.language_id = '" . (int)$languages_id . "' and os.public_flag = '1' order by osh.date_added");

while ($statuses = tep_db_fetch_array($statuses_query)) {

echo ' <tr>' . "\n" .

' <td class="main" width="70">' . tep_date_short($statuses['date_added']) . '</td>' . "\n" .

' <td class="main" width="70">' . $statuses['orders_status_name'] . '</td>' . "\n" .

' <td class="main">' . (empty($statuses['comments']) ? ' ' : nl2br(tep_output_string_protected($statuses['comments']))) . '</td>' . "\n" .

' </tr>' . "\n";

}

?>

</table>

 

<?php echo tep_draw_infoBox_bottom();?>

 

<?php

if (DOWNLOAD_ENABLED == 'true') include(DIR_WS_MODULES . 'downloads.php');

?>

 

<?php echo tep_pixel_trans();?>

 

<?php echo tep_draw_infoBox2_top();?>

 

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

<tr><td><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY, tep_get_all_get_params(array('order_id')), 'SSL') . '">' . tep_image_button('button_back1.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td></tr>

</table>

 

<?php echo tep_draw_infoBox2_bottom();?>

 

<?php echo tep_draw1_bottom();?>

 

<?php echo tep_draw_bottom();?>

 

</td>

<!-- body_text_eof //-->

<td class="<?php echo BOX_WIDTH_TD_RIGHT; ?>"><table border="0" class="<?php echo BOX_WIDTH_RIGHT; ?>" cellspacing="0" cellpadding="0">

<!-- right_navigation //-->

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

<!-- right_navigation_eof //-->

</table></td>

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

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

<!-- footer_eof //-->

</body>

</html>

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

 

 

Would be most grateful if anyone has any suggestions as to how to cure this or if they have had similar issues?

 

 

 

Thanks in advance

Share this post


Link to post
Share on other sites

hello KGT,

 

thx for this nice contribution. I have installed the latest release. It seems to work, but there is some broblem anyway:

 

1. Installation catalog/includes/classes/order.php

 

My code is alittle different from those you let us change to:

 

        //kgt - discount coupons
       if( is_object( $this->coupon ) ) {
         $applied_discount = 0;
         $discount = $this->coupon->calculate_discount( $this->products[$index], $valid_products_count );
         if( $discount['applied_discount'] > 0 ) $valid_products_count++;
         $shown_price = $this->coupon->calculate_shown_price( $discount, $this->products[$index] );
         $this->info['subtotal'] += $shown_price['shown_price'];
         $shown_price = $shown_price['actual_shown_price'];
       } else {
         $shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];
         $this->info['subtotal'] += $shown_price;
       }
       /**************
       $shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];
       $this->info['subtotal'] += $shown_price;
       **************/
       //end kgt - discount coupons

 

 

but my original file is this:

 

/**************

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

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

**************/

 

2. installation admin/includes/boxes/catalog.php

and

installation admin/includes/boxes/reports.php

 

Your code to change is:

 

//kgt - discount coupons
                                  '<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a><br>'
                                  '<a href="' . tep_href_link(FILENAME_DISCOUNT_COUPONS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_DISCOUNT_COUPONS . '</a>' );
                                  /***************
                                  '<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a>' );
                                  ***************/
                                  //end kgt - discount coupons 

 

but I think there is a dot missing after the 2nd line (because with dot its working)

 

                                   //kgt - discount coupons
                                  '<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a><br>' .
                                  '<a href="' . tep_href_link(FILENAME_DISCOUNT_COUPONS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_DISCOUNT_COUPONS . '</a>' );
                                  /***************
                                  '<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a>' );
                                  ***************/
                                  //end kgt - discount coupons 

 

3. After proceed from checkout_payment to checkout_confirmation I get displayed this code above my website (above the header):

 

case 'fixed': $discount_amount = $currencies->format( $this->coupon['coupons_discount_amount'] ); break; } $min_order = ( $this->coupon['coupons_min_order'] != 0 ? ( $this->coupon['coupons_min_order_type'] == 'price' ? $currencies->format( $this->coupon['coupons_min_order'] ) : (int)$this->coupon['coupons_min_order'] ) : '' ); //replace the variables with their proper values: $display = str_replace( '[code]', $this->coupon['coupons_id'], $display ); $display = str_replace( '[discount_amount]', $discount_amount, $display ); $display = str_replace( '[coupon_desc]', $this->coupon['coupons_description'], $display ); $display = str_replace( '[min_order]', $min_order, $display ); $display = str_replace( '[number_available]', $this->coupon['coupons_number_available'], $display ); $display = str_replace( '[tax_desc]', $tax_group, $display ); return $display; } function is_errors() { if( count( $this->messages['error'] ) > 0 ) return true; return false; } function message( $message, $error_level = 'error' ) { $this->messages[$error_level][] = $message; } function get_messages( $error_level = 'error' ) { if( $error_level == 'debug' ) return $this->messages; return $this->messages[$error_level]; } } ?> 

 

Any ideas and support? Thx in advance.

 

Btw, my website is www.lifestyle1001.com

Share this post


Link to post
Share on other sites
I dont think so. I made a complete copy of my store and went in and edited each file. So, theres not really anyway to overwrite anything. What I am thinking is that one of the files I edited in the admin folder was done wrong. (wrong place within file, etc.) Thats my only guess. Thanks for your input. Anyone have any other ideas?

 

I'm having the same problem and i'm in the process to review all the admin files... Maybe you found the problem already ???

 

I have just find something that seems bad in the admin/catalog.php file...

 

The '<a href="' . tep_href_link(FILENAME_PRODUCTS_EXPECTED, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_PRODUCTS_EXPECTED . '</a><br>'.

 

line does't finish with a point... Weird, isn't it ???

 

I'm trying to solve the problem, i would tell something here if i find the cause.

 

(after a while) It seems the problem is in the modified catalog.php and reports.php in the admin/includes/boxes folder.

 

Anyone knows if the latest contrib version works in any OSCommerce installation ??? I have 2.2-MS2...

Edited by XaviGracia

Share this post


Link to post
Share on other sites

Yes !

* The Dots are missing,

* The code is different in the nstallation catalog/includes/classes/order.php

 

After running in so much trouble I discovered that it is better to have in the admin the coupon as number 1


Andrea

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

×