If this is your first visit, check our documentation. To post, register or login.
Forums / Addon Order Total Modules / Quantity Discounts for 1.3

Quantity Discounts for 1.3

Started by swguy on 13 Aug 2006, 10:22 AM · Views: 226,694

Results 721 to 740 of 847
6 Oct 2013, 9:15 PM
#721
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,758
Plugin Contributions:
56

Quantity Discounts for 1.3

You're going to have to do some debugging. Start printing out the variables after the line that says $order = unserialize($SESSION['swipehq_order' . $order_id]);
and see where things are going awry.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

6 Oct 2013, 11:16 PM
#722
mikecnz avatar

mikecnz

New Zenner

Join Date:
Mar 2009
Location:
New Zealand
Posts:
76
Plugin Contributions:
0

Re: Quantity Discounts for 1.3

Hi,

Sorry, I am not very good at PHP - I tried using print_r and echo to print the variables, but it is just causing the site to crash. How do I go about printing variables?

(I have also check Zencarts error log but there is nothing coming up in there).

Thanks,

Mike.

11 Oct 2013, 1:59 AM
#724
mikecnz avatar

mikecnz

New Zenner

Join Date:
Mar 2009
Location:
New Zealand
Posts:
76
Plugin Contributions:
0

Re: Quantity Discounts for 1.3

Hi again,

Below is the contents of the order_total array being used for the confirmation e-mail.

order_total Object
(
[modules] => Array
(
[0] => ot_subtotal.php
[1] => ot_shipping.php
[2] => ot_quantity_discount.php
[3] => ot_tax.php
[4] => ot_total.php
)

)
</pre><br><br> <pre>Array
(
[0] => Array
(
[code] => ot_subtotal
[title] => Sub-Total:
[text] => $135.60
[value] => 135.6
[sort_order] => 100
)

[1] => Array
    (
        [code] => ot_shipping
        [title] => Fastways Courier (Delivery to <b>2110</b> -  Please allow 2-3 working days for delivery once payment has been confirmed<br>1 box(es) 1.16kg(s)):
        [text] => $4.50
        [value] => 4.49995
        [sort_order] => 200
    )

[2] => Array
    (
        [code] => ot_quantity_discount
        [title] => Quantity Discount:
        [text] => -$6.78
        [value] => 6.78
        [sort_order] => 295
    )

[3] => Array
    (
        [code] => ot_tax
        [title] => GST:
        [text] => $16.52
        [value] => 16.51695
        [sort_order] => 300
    )

[4] => Array
    (
        [code] => ot_total
        [title] => Total:
        [text] => $126.54
        [value] => 126.53995
        [sort_order] => 999
    )

All information is correct with the exception of the total. I can only assume that the swipehq code is somehow telling the order_total module to take the discount of the total twice - although I can't figure out where or how. Any ideas?

Thanks,

Mike

11 Oct 2013, 5:09 AM
#725
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,758
Plugin Contributions:
56

Re: Quantity Discounts for 1.3

mikecnz:

I have e-mailed SwipeHQ re this, but they say it is due to the mods I have installed and can't help.

I'll bet you the same thing happens if you use the (built in) Group Discounting module, btw.

Try this: Instead of creating a new $order_total_modules, unserialize it the way you unserialize the order (you would of course have to serialize it when you serialize the order too).

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

6 Nov 2013, 1:31 AM
#726
mikecnz avatar

mikecnz

New Zenner

Join Date:
Mar 2009
Location:
New Zealand
Posts:
76
Plugin Contributions:
0

Re: Quantity Discounts for 1.3

Hi Scott,

You were correct in your assumption. I have been talking with SwipeHQ about your suggestion, but have been stonewalled. I tried to work it out myself but couldn't get it to work (mostly because it was trial and error and I really don’t know what I am doing).

The other thought I had was would it be possible to pull the information from the database (like the admin invoice does)? I've look at the tables but can't find where the quantity discount is recorded.

Thanks,

Mike.

6 Nov 2013, 1:35 AM
#727
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,758
Plugin Contributions:
56

Re: Quantity Discounts for 1.3

It's in the order totals table. Sorry they're not cooperating - did you tell them the same problem will exist with built-in Group Discounts?

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

6 Nov 2013, 1:59 AM
#728
mikecnz avatar

mikecnz

New Zenner

Join Date:
Mar 2009
Location:
New Zealand
Posts:
76
Plugin Contributions:
0

Re: Quantity Discounts for 1.3

Thanks, I obviously didn't look far enough through the orders to find one that qualified for a discount (silly me)

Yes, I mentioned to them that the issue wasn't just with the mod, I think they are just to busy to care at the moment.
Could I perhaps try something likes this:

$order_totals = $db->Execute("select , text, from " . TABLE_ORDER_TOTALS . "
where orders_id = '" . (int)$oID . "'");

Although now that I have written that it doesn't look like it would work.

Regards,

Mike.

8 Nov 2013, 4:07 PM
#729
pudzpud avatar

pudzpud

Zen Follower

Join Date:
May 2009
Posts:
156
Plugin Contributions:
0

Re: Quantity Discounts for 1.3

Thanks for the help - one more question...

I am trying to add discounts to a third category using this module but I cannot get the 'quantity discount' box to show up in this new category. I have added the following text to: /public_html/includes/modules/order_total/ot_quantity_discount.php

   case 102:
			if ($count > 29) {
				$disc_amount = 15;
			} elseif ($count > 19) {
				$disc_amount = 10;
			} elseif ($count > 9) {
				$disc_amount = 5;
			}
		break;

Is there somewhere else I need to 'activate' this so that the discount box will show up?
It still shows on my two other categories (which have the discounts listed on the same ot_quantity_discount page) but just not this third one.

Thanks

8 Nov 2013, 11:16 PM
#730
pudzpud avatar

pudzpud

Zen Follower

Join Date:
May 2009
Posts:
156
Plugin Contributions:
0

Re: Quantity Discounts for 1.3

It's ok, have got it sorted now.
It won't let me delete the last post tho.

10 Nov 2013, 3:54 PM
#731
sysserv avatar

sysserv

New Zenner

Join Date:
Feb 2011
Posts:
1
Plugin Contributions:
0

Re: Quantity Discounts for 1.3

I have installed the module, but i have searched for ages?
Sure i am being stupid but where in the admin panel is the configuration for the discounts setup

10 Nov 2013, 6:52 PM
#732
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,758
Plugin Contributions:
56

Re: Quantity Discounts for 1.3

Use admin-modules-order total-quantity discounts - edit to set the configuration. It applies to the whole cart.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

11 Nov 2013, 11:18 AM
#733
nipinuk avatar

nipinuk

Zen Follower

Join Date:
Oct 2005
Location:
Hampshire, UK
Posts:
96
Plugin Contributions:
0

Re: Quantity Discounts for 1.3

Hi Scott,

I'm using Zencart 1.5.1 and Quantity Discounts 1.12. I've read http://www.thatsoftwareguy.com/zencart_quantity_discounts.html and tried searching the forum.

I have "Display Prices with Tax" = true (in Admin->Configuration->My Store) as I want to display prices including UK VAT.

On my test product info page (http://tinyurl.com/lkeo9hr), you will see that I've plonked on your codes for Quantity Discounts Marketing Example 1 and 4. The prices displayed currently do not include VAT.

How do I get it to display the prices including vAT?

Many thanks!

11 Nov 2013, 11:40 AM
#734
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,758
Plugin Contributions:
56

Re: Quantity Discounts for 1.3

Edit the file includes/modules/order_total/ot_quantity_discount.php and go to the function get_discounted_prices.

Where the call to $this->print_amount is made, switch that to

$currencies->display_price($disprice, zen_get_tax_rate($product_info->fields['products_tax_class_id']));

(Note that you will need to look up the tax class id - i.e.

$sql = "SELECT products_tax_class_id FROM " . TABLE_PRODUCTS . " WHERE products_id = " . (int)$product;
$product_info = $db->Execute($sql);

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

11 Nov 2013, 12:04 PM
#735
nipinuk avatar

nipinuk

Zen Follower

Join Date:
Oct 2005
Location:
Hampshire, UK
Posts:
96
Plugin Contributions:
0

Re: Quantity Discounts for 1.3

Thank you so much for the quick reply. I'm not a programmer so this is what I think I should do if I understand your reply correctly. Apologies in advance if I'm taking things too literally.

My tax class id is 1.

In the file includes/modules/order_total/ot_quantity_discount.php, I need to replace
$priceinfo[$pos]['price'] = $this->print_amount($disprice);
with
$priceinfo[$pos]['price'] = $currencies->display_price($disprice, zen_get_tax_rate($product_info->fields['products_tax_class_id']));
$sql = "SELECT products_tax_class_id FROM " . TABLE_PRODUCTS . " WHERE products_id = 1 " . (int)$product;
$product_info = $db->Execute($sql);

Bet I got that wrong!

11 Nov 2013, 2:29 PM
#736
nipinuk avatar

nipinuk

Zen Follower

Join Date:
Oct 2005
Location:
Hampshire, UK
Posts:
96
Plugin Contributions:
0

Re: Quantity Discounts for 1.3

It didn't work. Tried different combinations too. Sorry to bother you but would really appreciate a dumbed down version. :) Thanks

11 Nov 2013, 9:49 PM
#737
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,758
Plugin Contributions:
56

Re: Quantity Discounts for 1.3

change

$priceinfo[$pos]['price'] = $this->print_amount($disprice);

to

$priceinfo[$pos]['price'] = $currencies->display_price($disprice, zen_get_tax_rate(1));

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

11 Nov 2013, 10:09 PM
#738
nipinuk avatar

nipinuk

Zen Follower

Join Date:
Oct 2005
Location:
Hampshire, UK
Posts:
96
Plugin Contributions:
0

Re: Quantity Discounts for 1.3

Thank you for your patience Scott.

I did exactly as you suggested (twice. I made sure I used an unmodified includes/modules/order_total/ot_quantity_discount.php from the zipped file). I'm now getting a blank where the pricing has dissapeared with the buy button at http://tinyurl.com/lkeo9hr

12 Nov 2013, 1:15 AM
#739
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,758
Plugin Contributions:
56

Re: Quantity Discounts for 1.3

ah ok. at the top of the function add

global $currencies;

So you have

   function get_discounted_prices($product, $category) {
      global $currencies;

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

12 Nov 2013, 9:56 AM
#740
nipinuk avatar

nipinuk

Zen Follower

Join Date:
Oct 2005
Location:
Hampshire, UK
Posts:
96
Plugin Contributions:
0

Re: Quantity Discounts for 1.3

You're a star Scott. It worked! Thank you very much!