Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Discount Coupon Codes 3.34 for osc 2.3.1


rvilma

Recommended Posts

I've installed the contrib and getting errors:

 

 

 

Warning: Division by zero in /home5/saveonva/public_html/manage/includes/classes/split_page_results.php on line 33

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-0, MAX_DISPLAY_SEARCH_RESULTS_ADMIN' at line 1

 

select * from discount_coupons cd order by cd.coupons_date_end, coupons_date_start limit -0, MAX_DISPLAY_SEARCH_RESULTS_ADMIN

Link to comment
Share on other sites

Warning: Division by zero in /home5/saveonva/public_html/manage/includes/classes/split_page_results.php on line 33

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-0, MAX_DISPLAY_SEARCH_RESULTS_ADMIN' at line 1

 

select * from discount_coupons cd order by cd.coupons_date_end, coupons_date_start limit -0, MAX_DISPLAY_SEARCH_RESULTS_ADMIN

Link to comment
Share on other sites

@@rvilma I see I made a mistake when uploading the a new version of this addon.

 

On line 201 of admin/coupons.php change

 

$coupons_split = new splitPageResults( $HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS_ADMIN, $coupons_query_raw, $coupons_query_numrows );

 

To

 

$coupons_split = new splitPageResults( $HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $coupons_query_raw, $coupons_query_numrows );

 

I will fix this promptly...

 

 

 

 

Link to comment
Share on other sites

  • 3 months later...

Greasemonkey - thanks for this version. I have two issues that I need help with please. I have used OScommerce for 10 years now so i have a good understaning of how works under the hood. I download your package and added or replaced the code on the pages per your installation file but I have run into two isses.

 

1) MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS == 'true' on checkout_payment.php does not contain the value of true, and I cannot locate where this value is being set. Is this supposed to be in the configuration table or within a file?

 

I can comment this code out and leave the coupon input field active - which is what i did.

 

I enter the coupon code and it calculates correctly on the follow page - checkout confirmation.php

 

2) If the coupon is set to 100% making the product free the credit card payment information is still displayed on that page. If you submit that page wihout entering cc info, it directs you back to checkout_payment.php

 

So that's my problem and I don't know how to solve it.

 

Thanks

Link to comment
Share on other sites

  • 5 years later...

hello everyone,  what comes to discount coupon: shopping_cart using paypal express don't have  a place to input the coupon code, i am building a ajax so with paypal express from the shopping_cart will work also.

 

 

1. codes gets erased when i go thru the checkout again

2. code Discount Coupon ???? applied: doesn't show in shopping_cart.php

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

 

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

  if (!tep_session_unregister('coupon')) tep_session_register('coupon');
  $coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);

  if (is_array($payment_modules->modules)) {
    $payment_modules->pre_confirmation_check();
  }

  if( tep_not_null( $coupon ) && is_object( $order->coupon ) ) { 
    $order->coupon->verify_code();
    if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG != 'true' ) {
          if( !$order->coupon->is_errors() ) { //if we have passed all tests (no error message), make sure we still meet free shipping requirements, if any
              if( $order->coupon->is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); 
          } else {
              if( tep_session_unregister('coupon') ) tep_session_unregister('coupon');
              tep_redirect( tep_href_link( FILENAME_SHOPPING_CART1, 'error_message=' . urlencode( implode( ' ', $order->coupon->get_messages() ) ), 'SSL' ) );
          }
    }
    } else {
        if( tep_session_unregister('coupon') ) { 
      tep_session_unregister('coupon');
      require_once( DIR_WS_CLASSES.'discount_coupon.php' );
      if( discount_coupon::is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_SHOPPING_CART1, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); 
    }
}

 

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

<?php
    if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS == 'false' ) {
?>

<div class="shippingcoupon container">

<div class="text-left shipsmday"><?php echo ENTRY_SHIPSAMEDAY;?></div>

<div class="shipcouon">
<span><?php echo ENTRY_DISCOUNT_COUPON;?></span>
<?php echo tep_draw_input_fieldclear('coupon', 'if(this.value == &#39;Enter Promo Code Here&#39;) { this.value = &#39;&#39;; }','if(this.value == &#39;Enter Promo Code Here&#39;) { this.value = &#39;&#39;; }', ''.ENTRY_COUPONS.'', $coupon); ?>
<?php echo tep_draw_couponcode(IMAGE_BUTTON_APPLY, 'submit', null, 'primary', null, ''); ?>
</div>


<?php
    }
?>


<br>
<div class="container">
<div class="text-rights">

<?php echo tep_draw_button(IMAGE_BUTTON_CHECKOUTS, 'triangle-1-e', null, 'primary'); ?>
</div>


<?php
    $initialize_checkout_methods = $payment_modules->checkout_initialization_method();

    if (!empty($initialize_checkout_methods)) {
?>
<div class="text-rights"><?php echo TEXT_ALTERNATIVE_CHECKOUT_METHODS; ?></div>

<?php
      reset($initialize_checkout_methods);
      while (list(, $value) = each($initialize_checkout_methods)) {
?>

  <p class="text-right"><?php echo $value; ?></p>

<?php
      }
    }
?>

----------------------------------------------------------------html------------------------------------------------------

////
// Output COUPON
  function tep_draw_couponcode($title = null, $icon = null, $link = null, $priority = null, $params = null, $style = null) {
    static $button_counter = 1;

    $types = array('coupon', 'button', 'reset');

    if ( !isset($params['type']) ) {
      $params['name'] = 'coupon';
    }

    if ( !in_array($params['name'], $types) ) {
      $params['name'] = 'coupon';
    }

    if ( ($params['name'] == 'coupon') && isset($link) ) {
      $params['name'] = 'button';
    }

    if (!isset($priority)) {
      $priority = 'secondary';
    }

    $button = NULL;

    if ( ($params['name'] == 'button') && isset($link) ) {
      $button .= '<a href="' . $link . '"';

      if ( isset($params['newwindow']) ) {
        $button .= '';
      }
    } else {
      $button .= '<button';
      $button .= ' name="' . tep_output_string($params['name']) . '"';
    }

    if ( isset($params['params']) ) {
      $button .= ' ' . $params['params'];
    }

    $button .= 'type="button" onclick="ajaxFunction()" id="couponapplyajax" class="couponapply"';


    $button .= 'value="apply">';


    $button .= $title;

    if ( ($params['name'] == 'button') && isset($link) ) {
      $button .= '</a>';
    } else {
      $button .= '</button>';
    }

    $button_counter++;

    return $button;
  }

// Rewview Button
  function tep_draw_reviews($title = null, $icon = null, $link = null, $priority = null, $params = null, $style = null) {
    static $button_counter = 1;

    $types = array('submit', 'button', 'reset');

    if ( !isset($params['type']) ) {
      $params['type'] = 'submit';
    }

    if ( !in_array($params['type'], $types) ) {
      $params['type'] = 'submit';
    }

    if ( ($params['type'] == 'submit') && isset($link) ) {
      $params['type'] = 'button';
    }

    if (!isset($priority)) {
      $priority = 'secondary';
    }

    $button = NULL;

    if ( ($params['type'] == 'button') && isset($link) ) {
      $button .= '<a href="' . $link . '"';

      if ( isset($params['newwindow']) ) {
        $button .= ' target="_blank"';
      }
    } else {
      $button .= '<button ';
      $button .= ' type="' . tep_output_string($params['type']) . '"';
    }

    if ( isset($params['params']) ) {
      $button .= ' ' . $params['params'];
    }

    $button .= ' class="btn ';

    $button .= (isset($style)) ? $style : 'btn-default';

    $button .= '">';

    if (isset($icon) && tep_not_null($icon)) {
      $button .= ' <span class="' . $icon . '"></span> ';
    }

    $button .= $title;

    if ( ($params['type'] == 'button') && isset($link) ) {
      $button .= '</a>';
    } else {
      $button .= '</button>';
    }

    $button_counter++;

    return $button;
  }

Link to comment
Share on other sites

Join the conversation

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

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

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

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

×   Your previous content has been restored.   Clear editor

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

×
×
  • Create New...