Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Easy Discount


boxtel

Recommended Posts

I did that and it never seemed to work!I installed all the files from the contrib into the catalog folder. Do i need to add them to admin equivilants??

 

I went to admin/modules/order_total in the control panel and installed the easy discount there is that what you mean?

 

 

What should i expect to see in the code for the above files? anything that would identify easy discount is installed properly?

Link to comment
Share on other sites

I did that and it never seemed to work!I installed all the files from the contrib into the catalog folder. Do i need to add them to admin equivilants??

 

I went to admin/modules/order_total in the control panel and installed the easy discount there is that what you mean?

 

there is no admin/modules/order_total that I am aware of.

 

all order total modules are to be put in:

 

catalog/includes/modules/order_total/

 

then they will show up in your admin menu modules->order_total where you can install them and change some settings for them like enabling and the sort order.

 

then the discounts will show on your confirmation page like all the others.

Treasurer MFC

Link to comment
Share on other sites

there is no admin/modules/order_total that I am aware of.

 

all order total modules are to be put in:

 

catalog/includes/modules/order_total/

 

then they will show up in your admin menu modules->order_total where you can install them and change some settings for them like enabling and the sort order.

 

then the discounts will show on your confirmation page like all the others.

 

 

Thats what i did and meant :) sorry it was late at night and i was typing in the dark :(

 

It never worked :!

 

Below is a snapshot of my checkoutconfirmation page. As you can see the discount is calculated in the shoppingcart info box to show you the Order total i want to be passed to PAYPAL. Hope this helps you further to debug my p[roblem

 

 

printscreen.gif

 

I have the sort order set at 2 for easy discount

Edited by lancaster_unik
Link to comment
Share on other sites

Thats what i did and meant :) sorry it was late at night and i was typing in the dark :(

 

It never worked :!

 

Below is a snapshot of my checkoutconfirmation page. As you can see the discount is calculated in the shoppingcart info box to show you the Order total i want to be passed to PAYPAL. Hope this helps you further to debug my p[roblem

printscreen.gif

 

I have the sort order set at 2 for easy discount

 

well, if the order total module is correctly installed, then try changing the sort order to 3, I also sometimes have difficulty getting a module to activate because of that strange sort order construction.

Treasurer MFC

Link to comment
Share on other sites

OK - That seems to have semi worked! I set its order as 5!

 

This then produced the following output:

 

 

 

Sub-Total: ?157.90

Shipping: ?0.00

Total: ?157.90

10% Discount?100.00: -?15.79

 

 

I was expecting:

 

Sub-Total: ?157.90

Shipping: ?0.00

10% Discount?100.00: -?15.79

Total: ?157.90 (should be - discount)!

 

When i then click continue to payment it transfers the discounted amount which is correct!

 

I have tried easy discounts sort order as 1,2,3,4,5 and its only 5 that it seems to display?

 

What sort order do you have?

 

Easy Discount 5

Shipping 2

Sub-Total 1

Tax 3

Total 4

 

Is my current order!

Link to comment
Share on other sites

OK - That seems to have semi worked! I set its order as 5!

 

This then produced the following output:

Sub-Total: ?157.90

Shipping: ?0.00

Total: ?157.90

10% Discount?100.00: -?15.79

I was expecting:

 

Sub-Total: ?157.90

Shipping: ?0.00

10% Discount?100.00: -?15.79

Total: ?157.90 (should be - discount)!

 

When i then click continue to payment it transfers the discounted amount which is correct!

 

I have tried easy discounts sort order as 1,2,3,4,5 and its only 5 that it seems to display?

 

What sort order do you have?

 

Easy Discount 5

Shipping 2

Sub-Total 1

Tax 3

Total 4

 

Is my current order!

 

sub total 1

easy discount 3

2gether discount 5

category discount 7

VIP discount 10

Loyalty discount 15

low order fee 50

shipping 80

total 99

Treasurer MFC

Link to comment
Share on other sites

sub total 1

easy discount 3

2gether discount 5

category discount 7

VIP discount 10

Loyalty discount 15

low order fee 50

shipping 80

total 99

 

 

working now - many thanks...

 

One final question.... How do i change / where do i edit to change the text that displays alongside the discount?

Link to comment
Share on other sites

Hi,

 

What code (and where to add it) if I wanted to give a 10% off order amount (before tax/shipping) for all orders between April 10-25th?

 

Sorry, I have no idea how to go about this.

 

Thanks!

 

application_top before last ?>

 

if ($cart->count_contents() > 0) {

$begin = "10 April 2006";

$end = "25 April 2006";

$this_day = strtotime("now");

$date1 = strtotime($begin);

$date2 = strtotime($end);

if (($this_day >= $date1) and ($this_day <= $date2)) $easy_discount->set('DATEDISC1', '10% discount from '. $begin.' to '.$end,$cart->show_total()*0.1);

} else {

$easy_discount->clear('DATEDISC1');

}

Treasurer MFC

Link to comment
Share on other sites

Hi, the code works perfect! XD Thank you so much!

 

However I have a question about Easy Discount and the Points and Rewards module.

 

Both discounts (the 10% off for Easy Discount and the points redeemed) do show up on the final order confirmation page, but on the Payment details page, the 'estimated total of my purchase' does not reflect the Easy Discount discount.

 

testorderquestion3sd.gif

 

Any idea how to fix it so that it shows?

 

Thanks!

Edited by nekotachi
Link to comment
Share on other sites

Hi, the code works perfect! XD Thank you so much!

 

However I have a question about Easy Discount and the Points and Rewards module.

 

Both discounts (the 10% off for Easy Discount and the points redeemed) do show up on the final order confirmation page, but on the Payment details page, the 'estimated total of my purchase' does not reflect the Easy Discount discount.

 

testorderquestion3sd.gif

 

Any idea how to fix it so that it shows?

 

Thanks!

 

there is no "estimated total of my purchase" on the payment details page that I am aware of.

 

if that is a "points and rewards" feature, then you need to incorporate ED into calculations made there.

Treasurer MFC

Link to comment
Share on other sites

I love this mod! Howevah, everything works beautifully until I go to check out and the discount doesn't show up on the checkout confirmation page.

 

I'm assuming it's because the checkout confirmation page is on my secure server (my shopping cart and other items are on the non-secure server). I presume I have to add/modify files on the secure server, which I've done. However, I can't seem to install the module on the secure server since the admin page there continues to route me back to the admin page on the non-secure server. (I'll work on that since it's not specific to this mod support).

 

Do I need to modify the checkout confirmation page as well?

 

The site is http://www.catspajamas.biz

 

Promo codes are:

 

CPJ30606 ($25 off your purhcase of $100 or more)

and

CPJ101006 ($10 of any purchase).

Link to comment
Share on other sites

I love this mod! Howevah, everything works beautifully until I go to check out and the discount doesn't show up on the checkout confirmation page.

 

I'm assuming it's because the checkout confirmation page is on my secure server (my shopping cart and other items are on the non-secure server). I presume I have to add/modify files on the secure server, which I've done. However, I can't seem to install the module on the secure server since the admin page there continues to route me back to the admin page on the non-secure server. (I'll work on that since it's not specific to this mod support).

 

Do I need to modify the checkout confirmation page as well?

 

The site is http://www.catspajamas.biz

 

Promo codes are:

 

CPJ30606 ($25 off your purhcase of $100 or more)

and

CPJ101006 ($10 of any purchase).

 

not sure how your servers work but no, ED has a normal order total module with sort order so there is no need to edit confirmation.

Treasurer MFC

Link to comment
Share on other sites

Hi! I have just installed this as a % off and it is working fine except that the discount is not updating when the shopping cart contents changed. It stays with the same dollar amount unless the the discount code is entered in again. Any help would be appreciated. Thanks

Link to comment
Share on other sites

Hi! I have just installed this as a % off and it is working fine except that the discount is not updating when the shopping cart contents changed. It stays with the same dollar amount unless the the discount code is entered in again. Any help would be appreciated. Thanks

 

well, then you have to make sure that the entered code is remembered like:

 

if (MODULE_EASY_DISCOUNT_STATUS == 'true') {

if ((isset($_POST['coupon_code'])) and ($_POST['coupon_code'] != '')) {

$couponcode = strtolower($_POST['coupon_code']);

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

$coupon_code = '';

}

if ($cart->count_contents() > 0) {

switch ($couponcode) {

case 'valid code' : $easy_discount->set('COUPON','10% Coupon Discount', $cart->show_total() * 0.1);break;

}

} else {

$easy_discount->clear('COUPON');

}

}

 

so now the variable $couponcode is remembered (registered as a session variable) and need not be entered again.

Treasurer MFC

Link to comment
Share on other sites

well, then you have to make sure that the entered code is remembered like:

 

if (MODULE_EASY_DISCOUNT_STATUS == 'true') {

if ((isset($_POST['coupon_code'])) and ($_POST['coupon_code'] != '')) {

$couponcode = strtolower($_POST['coupon_code']);

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

$coupon_code = '';

}

if ($cart->count_contents() > 0) {

switch ($couponcode) {

case 'valid code' : $easy_discount->set('COUPON','10% Coupon Discount', $cart->show_total() * 0.1);break;

}

} else {

$easy_discount->clear('COUPON');

}

}

 

so now the variable $couponcode is remembered (registered as a session variable) and need not be entered again.

 

 

Tried that and did not fix the problem. At the present I am just bouncing form checkout shipping back to the shopping cart to update the cart and I am on a shared ssl so I can see the session number and it is staying the same. I thought at first that I may be losing the session info and that was the problem but that does not seem to be it.

 

The whole thing was easy to setup and it does the discount just fine so I am probably just missing something stupid but I do not see it.

 

Thanks

 

Joy

 

 

This is my now my exact setup.

 

application_top.php

 

// include shopping cart class

require(DIR_WS_CLASSES . 'shopping_cart.php');

// include easy discount products class

require(DIR_WS_CLASSES . 'easy_discount.php');

 

 

// include currencies class and create an instance

require(DIR_WS_CLASSES . 'currencies.php');

$currencies = new currencies();

 

//easy discount

if (!tep_session_is_registered('easy_discount')) {

tep_session_register('easy_discount');

$easy_discount = new easy_discount();

}

 

 

checkout_shipping.php

 

require('includes/application_top.php');

require('includes/classes/http_client.php');

 

if (MODULE_EASY_DISCOUNT_STATUS == 'true') {

if ((isset($_POST['coupon_code'])) and ($_POST['coupon_code'] != '')) {

$couponcode = strtolower($_POST['coupon_code']);

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

$coupon_code = '';

}

if ($cart->count_contents() > 0) {

switch ($couponcode) {

case '123456' : $easy_discount->set('COUPON','10% Coupon Discount', $cart->show_total() * 0.1);break;

}

} else {

$easy_discount->clear('COUPON');

}

}

 

 

<tr>

<td class="main"><?php echo tep_draw_form('coupon_code', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(), $request_type)); ?></td>

 

<td>

<?php

if (MODULE_EASY_DISCOUNT_STATUS == 'true') // easy discount module enabled

 

echo 'and enter in your Discount Code: if you have one. ' . '<br>' . tep_draw_input_field('couponcode','', ' size="30" '); ?></td>

 

</form>

</tr>

 

 

in includes/boxes/shopping_cart.php

 

 

if ($easy_discount->count() > 0) {

$info_box_contents [] = array('align' => ' right ',

'text' => 'Discounts: <font color="red">- '.$currencies->format(($easy_discount->total())).'</font>');

$info_box_contents [] = array('align' => ' right ',

'text' => 'Total: '.$currencies->format(($cart->show_total() - $easy_discount->total())));

}

Link to comment
Share on other sites

Tried that and did not fix the problem. At the present I am just bouncing form checkout shipping back to the shopping cart to update the cart and I am on a shared ssl so I can see the session number and it is staying the same. I thought at first that I may be losing the session info and that was the problem but that does not seem to be it.

 

The whole thing was easy to setup and it does the discount just fine so I am probably just missing something stupid but I do not see it.

 

Thanks

 

Joy

This is my now my exact setup.

 

application_top.php

 

// include shopping cart class

require(DIR_WS_CLASSES . 'shopping_cart.php');

// include easy discount products class

require(DIR_WS_CLASSES . 'easy_discount.php');

// include currencies class and create an instance

require(DIR_WS_CLASSES . 'currencies.php');

$currencies = new currencies();

 

//easy discount

if (!tep_session_is_registered('easy_discount')) {

tep_session_register('easy_discount');

$easy_discount = new easy_discount();

}

checkout_shipping.php

 

require('includes/application_top.php');

require('includes/classes/http_client.php');

 

if (MODULE_EASY_DISCOUNT_STATUS == 'true') {

if ((isset($_POST['coupon_code'])) and ($_POST['coupon_code'] != '')) {

$couponcode = strtolower($_POST['coupon_code']);

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

$coupon_code = '';

}

if ($cart->count_contents() > 0) {

switch ($couponcode) {

case '123456' : $easy_discount->set('COUPON','10% Coupon Discount', $cart->show_total() * 0.1);break;

}

} else {

$easy_discount->clear('COUPON');

}

}

<tr>

<td class="main"><?php echo tep_draw_form('coupon_code', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(), $request_type)); ?></td>

 

<td>

<?php

if (MODULE_EASY_DISCOUNT_STATUS == 'true') // easy discount module enabled

 

echo 'and enter in your Discount Code: if you have one. ' . '<br>' . tep_draw_input_field('couponcode','', ' size="30" '); ?></td>

 

</form>

</tr>

in includes/boxes/shopping_cart.php

if ($easy_discount->count() > 0) {

$info_box_contents [] = array('align' => ' right ',

'text' => 'Discounts: <font color="red">- '.$currencies->format(($easy_discount->total())).'</font>');

$info_box_contents [] = array('align' => ' right ',

'text' => 'Total: '.$currencies->format(($cart->show_total() - $easy_discount->total())));

}

 

 

tep_draw_input_field('couponcode','', ' size="30" ');

 

should be:

 

tep_draw_input_field('coupon_code','', ' size="30" ');

Treasurer MFC

Link to comment
Share on other sites

tep_draw_input_field('couponcode','', ' size="30" ');

 

should be:

 

tep_draw_input_field('coupon_code','', ' size="30" ');

 

 

Thanks, so close yet so far.

 

The total is now updating when I go back to checkout like it should.

 

The only problem I see now is that when I update or add something to the shopping cart the discount in the shopping cart box does not update until I go to the checkout page.

Link to comment
Share on other sites

Thanks, so close yet so far.

 

The total is now updating when I go back to checkout like it should.

 

The only problem I see now is that when I update or add something to the shopping cart the discount in the shopping cart box does not update until I go to the checkout page.

 

well, to handle that, put this part in the bottom of application_top.php instead of checkout_shipping.

 

if (MODULE_EASY_DISCOUNT_STATUS == 'true') {

if ((isset($_POST['coupon_code'])) and ($_POST['coupon_code'] != '')) {

$couponcode = strtolower($_POST['coupon_code']);

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

$coupon_code = '';

}

if ($cart->count_contents() > 0) {

switch ($couponcode) {

case '123456' : $easy_discount->set('COUPON','10% Coupon Discount', $cart->show_total() * 0.1);break;

}

} else {

$easy_discount->clear('COUPON');

}

}

Treasurer MFC

Link to comment
Share on other sites

Hi Amanda,

 

I have another obsecure question... I need ALL easy discounts (and my low order fee) to not be figured in if a specific shipping method is selected. Can this be done?

 

So to be more specific.....

 

if Shipping Module = Fixed Domestic/International Shipping Per Product

then DONT apply:

Order Total -Easy Discount
Order Total - Low Order Fee

 

Any idea on where and how this can be done would be of great help.

 

Thanks,

 

Nate

Link to comment
Share on other sites

well, to handle that, put this part in the bottom of application_top.php instead of checkout_shipping.

 

if (MODULE_EASY_DISCOUNT_STATUS == 'true') {

if ((isset($_POST['coupon_code'])) and ($_POST['coupon_code'] != '')) {

$couponcode = strtolower($_POST['coupon_code']);

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

$coupon_code = '';

}

if ($cart->count_contents() > 0) {

switch ($couponcode) {

case '123456' : $easy_discount->set('COUPON','10% Coupon Discount', $cart->show_total() * 0.1);break;

}

} else {

$easy_discount->clear('COUPON');

}

}

 

 

Thanks, That did it!!!!! Works great

Link to comment
Share on other sites

Hi Amanda,

 

I have another obsecure question... I need ALL easy discounts (and my low order fee) to not be figured in if a specific shipping method is selected. Can this be done?

 

So to be more specific.....

 

if Shipping Module = Fixed Domestic/International Shipping Per Product

then DONT apply:

Order Total -Easy Discount
Order Total - Low Order Fee

 

Any idea on where and how this can be done would be of great help.

 

Thanks,

 

Nate

 

well, as for low order fee:

 

in the order total module you cab dynamically disable it by checking the selected shipping module like:

 

function ot_loworderfee() {

global $shipping;

 

$this->code = 'ot_loworderfee';

$this->title = MODULE_ORDER_TOTAL_LOWORDERFEE_TITLE;

$this->description = MODULE_ORDER_TOTAL_LOWORDERFEE_DESCRIPTION;

$this->enabled = ((MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS == 'true') ? true : false);

$this->sort_order = MODULE_ORDER_TOTAL_LOWORDERFEE_SORT_ORDER;

$this->output = array();

if ($shipping['id'] == YOUR_SHIPPING_MODULE) $this->enabled = false;

}

 

you have to check what the id of that particular shipping module is. It is mostly in the form of worldzones_worldzones.

 

it's that simple.

 

For easy discount I would do it on the front-end as otherwise you display discount messages and at checkout you disable the module and let them dissapear.

 

So better not issue the discounts in the first place.

But ofcourse that means that you can only issue discounts after a shipping method is chosen.

Then you can do the same condition check as above for discount issuing.

Treasurer MFC

Link to comment
Share on other sites

Thanks Amanda,

 

So I replaced:

 function ot_loworderfee() {
  $this->code = 'ot_loworderfee';
  $this->title = MODULE_ORDER_TOTAL_LOWORDERFEE_TITLE;
  $this->description = MODULE_ORDER_TOTAL_LOWORDERFEE_DESCRIPTION;
  $this->enabled = ((MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS == 'true') ? true : false);
  $this->sort_order = MODULE_ORDER_TOTAL_LOWORDERFEE_SORT_ORDER;

  $this->output = array();
}

with:

$this->code = 'ot_loworderfee';
$this->title = MODULE_ORDER_TOTAL_LOWORDERFEE_TITLE;
$this->description = MODULE_ORDER_TOTAL_LOWORDERFEE_DESCRIPTION;
$this->enabled = ((MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS == 'true') ? true : false);
$this->sort_order = MODULE_ORDER_TOTAL_LOWORDERFEE_SORT_ORDER;
$this->output = array();
if ($shipping['id'] == fixed) $this->enabled = false;
}

 

I think the id is 'fixed' as the file name is fixed.php and the path when making changes to it via the admin includes 'fixed' -- /admin/modules.php?set=shipping&module=fixed ... but even the low order fee is still displaying and being applied.

 

 

As far as the easy discount goes... since I don't display the discounts in my shopping_cart.php, or anywhere else, untill checkout_confirmation.php could I not just put it in ot_easy_discount.php ?

 

Would I change this:

 

	
  function ot_easy_discount() {
  $this->code = 'ot_easy_discount';
  $this->title = MODULE_EASY_DISCOUNT_TITLE;
  $this->description = MODULE_EASY_DISCOUNT_DESCRIPTION;
  $this->enabled = ((MODULE_EASY_DISCOUNT_STATUS == 'true') ? true : false);
  $this->sort_order = MODULE_EASY_DISCOUNT_SORT_ORDER;
  $this->output = array();
}

 

to

 

	function ot_easy_discount() {
  $this->code = 'ot_easy_discount';
  $this->title = MODULE_EASY_DISCOUNT_TITLE;
  $this->description = MODULE_EASY_DISCOUNT_DESCRIPTION;
  $this->enabled = ((MODULE_EASY_DISCOUNT_STATUS == 'true') ? true : false);
  $this->sort_order = MODULE_EASY_DISCOUNT_SORT_ORDER;
  $this->output = array();
  if ($shipping['id'] == fixed) $this->enabled = false;
  }

 

If you have any ideas why it would not be working (my guess is somthing w/ the shipping id) pleast let me know.

 

Thanks again!

 

Nate

Link to comment
Share on other sites

Thanks Amanda,

 

So I replaced:

 function ot_loworderfee() {
  $this->code = 'ot_loworderfee';
  $this->title = MODULE_ORDER_TOTAL_LOWORDERFEE_TITLE;
  $this->description = MODULE_ORDER_TOTAL_LOWORDERFEE_DESCRIPTION;
  $this->enabled = ((MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS == 'true') ? true : false);
  $this->sort_order = MODULE_ORDER_TOTAL_LOWORDERFEE_SORT_ORDER;

  $this->output = array();
}

with:

$this->code = 'ot_loworderfee';
$this->title = MODULE_ORDER_TOTAL_LOWORDERFEE_TITLE;
$this->description = MODULE_ORDER_TOTAL_LOWORDERFEE_DESCRIPTION;
$this->enabled = ((MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS == 'true') ? true : false);
$this->sort_order = MODULE_ORDER_TOTAL_LOWORDERFEE_SORT_ORDER;
$this->output = array();
if ($shipping['id'] == fixed) $this->enabled = false;
}

 

I think the id is 'fixed' as the file name is fixed.php and the path when making changes to it via the admin includes 'fixed' -- /admin/modules.php?set=shipping&module=fixed ... but even the low order fee is still displaying and being applied.

As far as the easy discount goes... since I don't display the discounts in my shopping_cart.php, or anywhere else, untill checkout_confirmation.php could I not just put it in ot_easy_discount.php ?

 

Would I change this:

 

	
  function ot_easy_discount() {
  $this->code = 'ot_easy_discount';
  $this->title = MODULE_EASY_DISCOUNT_TITLE;
  $this->description = MODULE_EASY_DISCOUNT_DESCRIPTION;
  $this->enabled = ((MODULE_EASY_DISCOUNT_STATUS == 'true') ? true : false);
  $this->sort_order = MODULE_EASY_DISCOUNT_SORT_ORDER;
  $this->output = array();
}

 

to

 

	function ot_easy_discount() {
  $this->code = 'ot_easy_discount';
  $this->title = MODULE_EASY_DISCOUNT_TITLE;
  $this->description = MODULE_EASY_DISCOUNT_DESCRIPTION;
  $this->enabled = ((MODULE_EASY_DISCOUNT_STATUS == 'true') ? true : false);
  $this->sort_order = MODULE_EASY_DISCOUNT_SORT_ORDER;
  $this->output = array();
  if ($shipping['id'] == fixed) $this->enabled = false;
  }

 

If you have any ideas why it would not be working (my guess is somthing w/ the shipping id) pleast let me know.

 

Thanks again!

 

Nate

 

 

you forgot this :

 

global $shipping;

 

and it probably should be :

 

if ($shipping['id'] == 'fixed_fixed') $this->enabled = false;

 

and yes, if there is no display before that, simple disable the ot module likewise.

Treasurer MFC

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...