Jump to content
kgt

[Contribution] Discount Coupon Codes

Recommended Posts

@@joli1811 Can you confirm - is this addon still working for you on PayPal Express 3.1? Or have you tested it?

 

I cannot get it to work...

 

When a discount code is entered and the customer is re-directed to PP the per-line item feature is shut down (as I believe it is supposed to in the newest version when an external order total module is used) and only the total is shown. However it does not calculate in the coupon code into the total. I have tried with instant update on and off… neither work.

 

I will ONLY work with instant update off, if a customer - after being redirected by PP back to checkout_confimation  then goes back to checkout_payment and re-enters the coupon code.

Share this post


Link to post
Share on other sites

Hi Scott,

 

No not tested but funny enough  just doing a new site install with discount coupons so will get back to you on this in a few days

 

"oh oh i see problems coming (w00t) "

 

Regards

Joli


To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites

Hello @@joli1811 or @@greasemonkey ,

 

I was wondering if one of you could help me as I don't no a lot about code yet.

 

I previous had this add-on working great on my store (V: 2.3.3.4) but I recently upgraded to (2.3.4) and when I re-installed the add-on my " Checkout payment " page return Internal server error.

 

Here is what the code looks like: (it seems like something is acting weird but not sure what.

 

  <h2><?php echo TABLE_HEADING_COMMENTS; ?></h2>


  <div class="contentText">
    <?php echo tep_draw_textarea_field('comments', 'soft', '60', '5', $comments); ?>
  </div>
  
/* kgt - discount coupons */
if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS == 'true' ) {
?>
<h2><?php echo TABLE_HEADING_COUPON; ?></h2>


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


<?php
}
/* end kgt - discount coupons */  

Any help would be great :)

 

Thanks in advance.

Share this post


Link to post
Share on other sites


<h2><?php echo TABLE_HEADING_COMMENTS; ?></h2>

 

<div class="contentText">

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

</div>

<?php

/* kgt - discount coupons */

if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS == 'true' ) {

?>

<h2><?php echo TABLE_HEADING_COUPON; ?></h2>

 

<div class="contentText">

</div>

 

<div class="contentText">

<?php echo ENTRY_DISCOUNT_COUPON.' '.tep_draw_input_field('coupon', '', 'size="32"', $coupon); ?>

</div>

 

<?php

}

/* end kgt - discount coupons */

 

Edited by joli1811

To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites

Double post sorry think you are missing an opening <?php
 

  <div class="contentText">
    <?php echo tep_draw_textarea_field('comments', 'soft', '60', '5', $comments); ?>
  </div>
  <?php
Edited by joli1811

To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites

Hello @@joli1811

 

That make the code look better is notepad++ BUT page is still broken :(

 

I also tried finding my logs but the only ones I can seem to find are only show which page someone is on but doesnt list any issues.

 

If you need to see anymore of my code just let me know.

 

Thanks again.

Share this post


Link to post
Share on other sites

@@RS Designs what does it say when you hit checkout_payment.php?

 

Also, just confirm (because you missed the first <?php that you didn't by mistake delete the closing ?>

 

Does your code now look like this;

    <?php
  /* kgt - discount coupons */
	if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS == 'true' ) {
?>
<?php echo '<strong>' . TABLE_HEADING_COUPON . '</strong>'; ?>
        <div class="contentInfoText">
        <?php echo ENTRY_DISCOUNT_COUPON.' '.tep_draw_input_field('coupon', '', 'size="32"', $coupon); ?>
  	 </div>
		
<?php
	}
/* end kgt - discount coupons */ 
?>

Share this post


Link to post
Share on other sites

Hi there,

Is there someone else not happy about the fact that if a customer made a mistake, like entering a wrong discount coupon code, the error message is being displayed in the address bar of the browser instead of on the page itself like any other standard OsCommerce page does? (like create account)

 

I tried to figure it out myself, but I'm stuck. Maybe someone else has already fixed this?

Share this post


Link to post
Share on other sites

Displays x 3 times when there is an error normally ?

 

 

post-185951-0-26636800-1406323857_thumb.jpg

Edited by joli1811

To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites

Hi Guys,

I installed everything, edited existing files or uploaded ones I know I haven't altered before. In the backend the module appears to work fine. I can create coupon codes and edit them etc.. I gave the module a unique sort order..

 

I went through the common problems in the install html file (the first one about not displaying seems the most relevant so checked that one..)

 

There are No Error messages just NO mention of a coupon code anywhere on the front end. I  buy something and on the next page simply no mention at all. There's also no mention when you go to PayPal via Express checkout..

 

I'm guessing I've just omitted something obvious but rally struggling to see what.. (I'm fairly new to OSCommerce but fairly used to altering PHP and html FILE

 

(Also there's a SQL file in the download but then it says no need to alter the database via this method..)

 

Please tell me I'm an idiot and made some dumb mistake. If it fixes it I'll gladly agree :-) :-)

Edited by uncoolthreads

Share this post


Link to post
Share on other sites

Hi,

 

Have you installed the Discount Coupon  in the admin/modules/order total  ?

 

The sort order should be set to 2 adjust the others accordingly.

 

The discount will not appear on shopping cart page where the paypal express button is but first on checkout_payment.php so you need to use the paypal standard .

 

you could use the paypal express but you would need to remove the button from shopping_cart.php as the discount coupon code appears first later in the payment process. so the paypal express which also appears on checkout_payment.php   but sort of defeats the purpose of express checkout.

 

Regards

Joli

 

PS: Not sure where it says you do not need to run the SQL??

 

There are several new field needed check your database if you have them

CREATE TABLE `discount_coupons`
CREATE TABLE `discount_coupons_to_categories`
CREATE TABLE `discount_coupons_to_customers`

ETC......ETC 

If not you do need to run the SQL

Edited by joli1811

To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites

Hi,

 

Have you installed the Discount Coupon  in the admin/modules/order total  ?

 

The sort order should be set to 2 adjust the others accordingly.

 

The discount will not appear on shopping cart page where the paypal express button is but first on checkout_payment.php so you need to use the paypal standard .

 

you could use the paypal express but you would need to remove the button from shopping_cart.php as the discount coupon code appears first later in the payment process. so the paypal express which also appears on checkout_payment.php   but sort of defeats the purpose of express checkout.

 

Regards

Joli

 

PS: Not sure where it says you do not need to run the SQL??

 

There are several new field needed check your database if you have them

CREATE TABLE `discount_coupons`
CREATE TABLE `discount_coupons_to_categories`
CREATE TABLE `discount_coupons_to_customers`

ETC......ETC 

If not you do need to run the SQL

 

Hi Joli thanks for the help.

Yes I had installed the module etc.. I have now disabled PayPal Express and installed Standard..

 

In the install html file it says (near the end of the install instructions):

"The installation should now be complete. The module will automatically create the database tables needed, there is no SQL script you need to run"

 

I have those tables so no probs there.

 

Is there a way to make this work with PayPal Express checkout? - Could somebody (maybe the creator) give some detailed instructions in here?

 

thanks!

Share this post


Link to post
Share on other sites

I got this module installed (one by greasemonkey) with the one page checkout v2 (http://addons.oscommerce.com/info/7993) by Web Source 5 and everything is working Ok except payment modules - I'm wondering if there is anyone else perhaps tried these two and got it working 100%

 

the payment modules, I'm battling with is he Purchase Order and the eWaypayment module.  for the life of me I cannot find the errors! :blush:


"The doorstep to the temple of wisdom is a knowledge of our own ignorance."

Share this post


Link to post
Share on other sites

Hi,

 

I have the problem, that after inserting the coupon code and clicking next, it goes not the next step. While having debug mode activated, it goes to the next step but without adding the coupon. Any ideas?

 

Thanks!

Lars

Share this post


Link to post
Share on other sites

Hi,

 

Anybody ever get the solution to shipping zone exclusions?

1136 - Column count doesn't match value count at row 1

INSERT INTO discount_coupons_to_zones VALUES ( "U04XQP", 4 )

[TEP STOP]

Something wrong with this query

 case 'zones' :
        $sql_selected = 'SELECT dc2z.geo_zone_id AS id'.$display_fields.'
                          FROM '.TABLE_DISCOUNT_COUPONS_TO_ZONES.' dc2z
                          LEFT JOIN '.TABLE_GEO_ZONES.' gz
                            USING( geo_zone_id )
                          WHERE dc2z.coupons_id="'.$coupons_id.'"';
        $sql_all = 'SELECT gz.geo_zone_id AS id'.$display_fields.'
                    FROM '.TABLE_GEO_ZONES.' gz
                    %s';
        $where = 'WHERE gz.geo_zone_id NOT IN(%s) ';
      break;

He  is only getting the coupons_id and  geo_zone_id

 

but needs the  discount_coupons_to_zones_id  which = Table: zones_to_geo_zones  / zone_country_id

 

to function correctly

CREATE TABLE IF NOT EXISTS `discount_coupons_to_zones` (
  `discount_coupons_to_zones_id` int(11) NOT NULL AUTO_INCREMENT,
  `coupons_id` varchar(32) DEFAULT NULL,
  `geo_zone_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`discount_coupons_to_zones_id`),
  UNIQUE KEY `discount_coupons_to_zones_id` (`discount_coupons_to_zones_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;


1	discount_coupons_to_zones_id
2	coupons_id	
3	geo_zone_id

If I manually insert the zone_country_id into  discount_coupons_to_zones_id  in phpmyadmin  the exclusion seems to work as far as I have tested

any help would be appreciated been fighting with this all night (w00t)   ?

 

Think the bug has been there a long time

 

Regards

Joli

Edited by joli1811

To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites

Still trying to get sorted the zone exclusion will only work when excluding every zone :D so no one can use discount coupon

 

so still problems

 

The code at the front end which checks the zones is

//shipping zone exclusions
        $check_user_query = tep_db_query($sql = 'SELECT dc2z.geo_zone_id
                                                  FROM '.TABLE_DISCOUNT_COUPONS_TO_ZONES.' dc2z
                                                  LEFT JOIN '.TABLE_ZONES_TO_GEO_ZONES.' z2g
                                                    USING( geo_zone_id )
                                                  WHERE ( z2g.zone_id='.(int)$delivery['zone_id'].' or z2g.zone_id = 0 or z2g.zone_id IS NULL )
                                                    AND ( z2g.zone_country_id='.(int)$delivery['country_id'].' or z2g.zone_country_id = 0 )
                                                    AND dc2z.coupons_id="'.tep_db_input( $code ).'"' );

          if (tep_db_num_rows( $check_user_query ) > 0 ) {
           // $this->message( ENTRY_DISCOUNT_COUPON_ERROR ); //display the error message

and the code at the back which should insert the discount zone exclusion is

case 'zones' :
        $sql_selected = 'SELECT dc2z.geo_zone_id AS id'.$display_fields.'
                          FROM '.TABLE_DISCOUNT_COUPONS_TO_ZONES.' dc2z
                          LEFT JOIN '.TABLE_GEO_ZONES.' gz
						  
                            USING( geo_zone_id )
                          WHERE dc2z.coupons_id="'.$coupons_id.'"';
        $sql_all = 'SELECT gz.geo_zone_id AS id'.$display_fields.'
                    FROM '.TABLE_GEO_ZONES.' gz
                    %s';
        $where = 'WHERE gz.geo_zone_id NOT IN(%s) ';
      break;

		}

so the code at the front is not seeing the geo_zone_id

 

The database install which is also a mess I have done manually

CREATE TABLE IF NOT EXISTS `discount_coupons_to_zones` (
  `discount_coupons_to_zones_id` int(11) NOT NULL AUTO_INCREMENT,
  `coupons_id` varchar(32) DEFAULT NULL,
  `geo_zone_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`discount_coupons_to_zones_id`),
  UNIQUE KEY `discount_coupons_to_zones_id` (`discount_coupons_to_zones_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

--
-- Dumping data for table `discount_coupons_to_zones`
--

INSERT INTO `discount_coupons_to_zones` (`discount_coupons_to_zones_id`, `coupons_id`, `geo_zone_id`) VALUES
(1, 'RDXDJB', 1),
(2, 'testtest', 4);

so the geo zone is there now why is he not picking up the individual geo_zones  in the /include/classes/discount_coupon.php

 

Course the other problem is also there trying to insert from admin a zone exclusion  still gives this error

1136 - Column count doesn't match value count at row 1

INSERT INTO discount_coupons_to_zones VALUES ( "U04XQP", 4 )

[TEP STOP]

I guess this could never have worked funny nobody picked up before there were a few so called fixes but after studying they never changed anything strange one this really bugging me now haha

 

Regards

Joli


To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites

Just a question,

 

Do you have this problem ?

In checkout_confirmation, I see my discount and all if correct, but when I confirm my order, the discount is not taken and does'nt appear in my order in my admin.

 

Do you have this weird problem ?



Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

Tuto for 2.4 :
- How to Display a new page with app
- How to make Header Tags under app APP
- How to make a
boostrap modal with external element
 

 

Share this post


Link to post
Share on other sites

Think i remember of the top of my head I had a problem once with my /includes/classes/order.php with discounts not being carried over

 

What payment system is it there where the discount is not being carried over ?

 

Use paypal standard myself needed a  few changes.

 

Joli


To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites

No it's the normal order process like check.  

 the discount is not being carried over  and when I count the number of order_total in checkout_process.php , I have 3 loop and not 4. One is forgotten an it's the coupon.

 

I look your idea.

Edited by Gyakutsuki


Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

Tuto for 2.4 :
- How to Display a new page with app
- How to make Header Tags under app APP
- How to make a
boostrap modal with external element
 

 

Share this post


Link to post
Share on other sites

The problem don't come of order.php class. it work fine

 That I can said

 

In checkout_process.php

 
  require(DIR_WS_CLASSES . 'order_total.php');
  $order_total_modules = new order_total;
  $order_totals = $order_total_modules->process();


print_r($order_totals);
var_dump($order_totals);
exit;
 
the result is : 
 

Array ( [0] => Array ( [code] => ot_subtotal [title] => Sous-Total: [text] => 22.92$ CAD [value] => 22.92 [sort_order] => 5 )

[1] => Array ( [code] => ot_shipping [title] => Livraison gratuite (livraison offerte dés 5.): [text] => 0.00$ CAD [value] => 0.00 [sort_order] => 50 ) 

[2] => Array ( [code] => ot_total [title] => Total: [text] => 22.92$ CAD [value] => 22.92 [sort_order] => 60 ) )0 =>

array (size=5)
'code' => string 'ot_subtotal' (length=11)
'title' => string 'Sous-Total:' (length=11)
'text' => string '22.92$ CAD' (length=10)
'value' => float 22.92
'sort_order' => string '5' (length=1)
1 =>
array (size=5)
'code' => string 'ot_shipping' (length=11)
'title' => string 'Livraison gratuite (livraison offerte dés 5.):' (length=54)
'text' => string '0.00$ CAD' (length=9)
'value' => string '0.00' (length=4)
'sort_order' => string '50' (length=2)
2 =>
array (size=5)
'code' => string 'ot_total' (length=8)
'title' => string 'Total:' (length=6)
'text' => string ' 22.92$ CAD ' (length=12)
'value' => float 22.92
'sort_order' => string '60' (length=2)

It forgot ot_discount_coupon. the loop in order_total.php class count only 3 order total and not 4. Where is the last ?

 

Idea, I take and I continue my exploration.

Edited by Gyakutsuki


Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

Tuto for 2.4 :
- How to Display a new page with app
- How to make Header Tags under app APP
- How to make a
boostrap modal with external element
 

 

Share this post


Link to post
Share on other sites

just last information in checkout_confirmation I have the 4.

 

  require(DIR_WS_CLASSES . 'order_total.php');
  $order_total_modules = new order_total;
  $order_total_modules->process();




var_dump($order_total_modules->process());
exit;




array (size=4)
0 =>
array (size=5)
'code' => string 'ot_discount_coupon' (length=18)
'title' => string 'Code coupon lancement applique:' (length=31)
'text' => string '-5.00$ CAD' (length=10)
'value' => string '-5' (length=2)
'sort_order' => string '3' (length=1)
1 =>
array (size=5)
'code' => string 'ot_subtotal' (length=11)
'title' => string 'Sous-Total:' (length=11)
'text' => string '22.92$ CAD' (length=10)
'value' => float 22.92
'sort_order' => string '5' (length=1)
2 =>
array (size=5)
'code' => string 'ot_shipping' (length=11)
'title' => string 'Livraison gratuite (livraison offerte dés 5.):' (length=54)
'text' => string '0.00$ CAD' (length=9)
'value' => string '0.00' (length=4)
'sort_order' => string '50' (length=2)
3 =>
array (size=5)
'code' => string 'ot_total' (length=8)
'title' => string 'Total:' (length=6)
'text' => string ' 17.92$ CAD ' (length=12)
'value' => float 17.92
'sort_order' => string '60' (length=2)


Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

Tuto for 2.4 :
- How to Display a new page with app
- How to make Header Tags under app APP
- How to make a
boostrap modal with external element
 

 

Share this post


Link to post
Share on other sites

:thumbsup:  discount comes after subtotal in sort order !!

 

Discount Coupon 2     
Shipping      3     
Sub-Total     1     
Tax              4     
Total            5

 

regards

Joli


To improve is to change; to be perfect is to change often.

 

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

×