Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Quantity Discounts by That Software Guy


swguy

Recommended Posts

I have installed this mod and everything works as in giving the discount, my question is I am trying to use the "Quantity Discounts Marketing 4 output" I have set up the Discount Level 1, Discount Level 2, Discount Level 3, etc but when I look at the chart on the product page it return results like: *note the 0.00 dollar amounts

 

Amount Spent Discount

$0.00 - $60.99 15%

$0.00 - $99.99 20%

$0.00 + 25%

 

If you look at the chart above I would think it would return:

 

Amount Spent Discount

$40.00 - $60.99 15%

$61.00 - $99.99 20%

$100.00 + 25%

 

I am trying to figure out why it isn't showing correctly? Could someone help me out with this? What am I missing?

Link to comment
Share on other sites

On OSC 2.2rc2 with php5 it works perfectly if you paste the code in to product_info.php. Did you type the code by hand? Did you perhaps miss

 

$dislist = $discount->get_discount_parms();

 

 

That's the only possible cause I can see.

Contributions: Better Together and Quantity Discounts for osCommerce 2.3.x and Phoenix. See my profile for more details.

Link to comment
Share on other sites

I used the code that was located on That Software Guy

 

<!-- bof osCommerce Quantity Discounts Contribution Example 4 Marketing Text -->
<tr><td>
<?php
 $value = "ot_quantity_discount.php"; 
 require_once(DIR_WS_LANGUAGES . $language . 
         '/modules/order_total/'. $value);
 require_once(DIR_WS_MODULES . "order_total/" . $value);
 $discount = new ot_quantity_discount();  
 if (($discount->check() > 0) && 
     ($discount->is_discountable((int)$HTTP_GET_VARS['products_id'])) ) { 
    echo '<div class="content" id="discountPolicy4">'; 
    echo '<table border="1" bgcolor="#FFFF66"><tr><td>Amount Spent</td><td>Discount</td></tr>'; 
    $dislist = $discount->get_discount_parms();
    $raw_dislist = $discount->get_discount_parms(true);
    global $currencies; 
    for ($i = 0; $i < sizeof($dislist); $i++) {
        echo '<tr><td>' . $currencies->display_price($dislist[$i]['level'], 0); 
        if ($i == (sizeof($dislist) - 1)) {
           echo " + "; 
        } else { 
           echo " - ";
           echo $currencies->display_price($raw_dislist[$i+1]['level'] - 0.01, 0); 
        }
        echo "</td><td>" . $dislist[$i]['discount'] .  "</td></tr>";
    }
    echo '</table>';
    echo '<br /></div>';
 }
?>
</td></tr>
<!-- eof Quantity Discounts Contribution Example 4 Marketing Text -->

 

I copied and pasted the code, uninstalled through admin with still no resolution.

 

On OSC 2.2rc2 with php5 it works perfectly if you paste the code in to product_info.php. Did you type the code by hand? Did you perhaps miss

 

$dislist = $discount->get_discount_parms();

 

 

That's the only possible cause I can see.

Link to comment
Share on other sites

What OSC and PHP are you running?

 

Please try this code:

 

<!-- bof osCommerce Quantity Discounts Contribution Example 4 Marketing Text TEST -->
<tr><td>
<?php
 $value = "ot_quantity_discount.php"; 
 require_once(DIR_WS_LANGUAGES . $language . 
         '/modules/order_total/'. $value);
 require_once(DIR_WS_MODULES . "order_total/" . $value);
 $discount = new ot_quantity_discount();  
 if (($discount->check() > 0) && 
     ($discount->is_discountable((int)$HTTP_GET_VARS['products_id'])) ) { 
    echo '<div class="content" id="discountPolicy4">'; 
    echo '<table border="1" bgcolor="#FFFF66"><tr><td>Amount Spent</td><td>Discount</td></tr>'; 
    $dislist = $discount->get_discount_parms();
    $raw_dislist = $discount->get_discount_parms(true);
    global $currencies; 
    for ($i = 0; $i < sizeof($dislist); $i++) {
        echo '<tr><td>' . $currencies->display_price($raw_dislist[$i]['level'], 0); 
        if ($i == (sizeof($dislist) - 1)) {
           echo " + "; 
        } else { 
           echo " - ";
           echo $currencies->display_price($raw_dislist[$i+1]['level'] - 0.01, 0); 
        }
        echo "</td><td>" . $dislist[$i]['discount'] .  "</td></tr>";
    }
    echo '</table>';
    echo '<br /></div>';
 }
?>
</td></tr>
<!-- eof Quantity Discounts Contribution Example 4 Marketing Text TEST -->

Edited by swguy

Contributions: Better Together and Quantity Discounts for osCommerce 2.3.x and Phoenix. See my profile for more details.

Link to comment
Share on other sites

It appears that this is working correctly. Can I ask what you did to change to get the parm to work ? Thanks for helping with this and thanks for the Mod!

 

What OSC and PHP are you running?

 

Please try this code:

 

<!-- bof osCommerce Quantity Discounts Contribution Example 4 Marketing Text TEST -->
<tr><td>
<?php
 $value = "ot_quantity_discount.php"; 
 require_once(DIR_WS_LANGUAGES . $language . 
         '/modules/order_total/'. $value);
 require_once(DIR_WS_MODULES . "order_total/" . $value);
 $discount = new ot_quantity_discount();  
 if (($discount->check() > 0) && 
     ($discount->is_discountable((int)$HTTP_GET_VARS['products_id'])) ) { 
    echo '<div class="content" id="discountPolicy4">'; 
    echo '<table border="1" bgcolor="#FFFF66"><tr><td>Amount Spent</td><td>Discount</td></tr>'; 
    $dislist = $discount->get_discount_parms();
    $raw_dislist = $discount->get_discount_parms(true);
    global $currencies; 
    for ($i = 0; $i < sizeof($dislist); $i++) {
        echo '<tr><td>' . $currencies->display_price($raw_dislist[$i]['level'], 0); 
        if ($i == (sizeof($dislist) - 1)) {
           echo " + "; 
        } else { 
           echo " - ";
           echo $currencies->display_price($raw_dislist[$i+1]['level'] - 0.01, 0); 
        }
        echo "</td><td>" . $dislist[$i]['discount'] .  "</td></tr>";
    }
    echo '</table>';
    echo '<br /></div>';
 }
?>
</td></tr>
<!-- eof Quantity Discounts Contribution Example 4 Marketing Text TEST -->

Link to comment
Share on other sites

It appears that this is working correctly. Can I ask what you did to change to get the parm to work ? Thanks for helping with this and thanks for the Mod!

 

I changed the first call to display_price to

 

        echo '<tr><td>' . $currencies->display_price($raw_dislist[$i]['level'], 0); 

 

Please confirm your PHP and osCommerce version; I'm curious why my original code didn't work for you, and I have never seen this bug report.

Contributions: Better Together and Quantity Discounts for osCommerce 2.3.x and Phoenix. See my profile for more details.

Link to comment
Share on other sites

Sure!

HTTP Server: Apache

PHP Version: 5.2.5 (Zend: 2.2.0)

Server OS: Linux 2.4.21-60

Database: MySQL 5.0.67

osCommerce Online Merchant v2.2 RC2 (from application_top.php)

 

Hope this information helps.

 

 

I changed the first call to display_price to

 

        echo '<tr><td>' . $currencies->display_price($raw_dislist[$i]['level'], 0); 

 

Please confirm your PHP and osCommerce version; I'm curious why my original code didn't work for you, and I have never seen this bug report.

Link to comment
Share on other sites

Well, I tightened up the code a bit for examples 4 and 5 and posted them. I'm happier with this now anyhow.

 

Thanks for reporting this issue.

Contributions: Better Together and Quantity Discounts for osCommerce 2.3.x and Phoenix. See my profile for more details.

Link to comment
Share on other sites

  • 2 weeks later...

I setup my Quantity Discounts with this property

 

Disable If Coupon Used = true

 

but anyways when there is a coupon still shows up

when it should not right?

 

please some advice or help

or if I have to pay you to have this working please let me know but I need to fix this problem

 

thanx

Link to comment
Share on other sites

I setup my Quantity Discounts with this property

Disable If Coupon Used = true

...

 

There are several Quantity Discounts mods; you're using another one. Mine does not have this setting.

Contributions: Better Together and Quantity Discounts for osCommerce 2.3.x and Phoenix. See my profile for more details.

Link to comment
Share on other sites

Coupons are a mod to osCommerce, so it would depend on what version, flavor, etc. I wouldn't add this to my mod for general use because there would be too many ways to go wrong. If you want a quote on customizing your specific site, you are welcome to email me.

Contributions: Better Together and Quantity Discounts for osCommerce 2.3.x and Phoenix. See my profile for more details.

Link to comment
Share on other sites

  • 2 weeks later...

Hello, I am very new to OsCommerce and e-commerce in general. I found your contribution very interesting but I just can´t get it to install. I put the files in the right directories and installed (I made sure the module had a different sort order), but nothing shows up at the product information page. I´m running OSC2.2rc and this is my webpage www.panda.pe

Thank you for this great contrib! It was just what i was looking for!

Link to comment
Share on other sites

Hello, I am very new to OsCommerce and e-commerce in general. I found your contribution very interesting but I just can´t get it to install. I put the files in the right directories and installed (I made sure the module had a different sort order), but nothing shows up at the product information page. I´m running OSC2.2rc and this is my webpage www.panda.pe

Thank you for this great contrib! It was just what i was looking for!

 

Welcome to osCommerce. The discount doesn't show up on the product information page by default; it shows up on the checkout confirmation page.

 

If you want something to show up on the product information page, you need to add the "marketing text" as follows:

 

http://www.thatsoftwareguy.com/osc_quantity_discounts.html#marketing

Contributions: Better Together and Quantity Discounts for osCommerce 2.3.x and Phoenix. See my profile for more details.

Link to comment
Share on other sites

Thank you so much!!! I finally solved it! Just one more question, is it possible to apply different discount rates for different categories?? For example:

category 1:

20% off for 20 items

40% off for 30 items

 

category 2:

10% off for 12 items

20% off for 24 items

 

Is there some kind of way to implement this?

Link to comment
Share on other sites

Thank you so much!!! I finally solved it! Just one more question, is it possible to apply different discount rates for different categories??

 

Yes, but you have to write a bit of code.

 

Look for apply_special_category_discount in the help:

http://www.thatsoftwareguy.com/osc_quantity_discounts.html

Edited by swguy

Contributions: Better Together and Quantity Discounts for osCommerce 2.3.x and Phoenix. See my profile for more details.

Link to comment
Share on other sites

Well, the only problem is that this function appears to be available only if one is using "Total by Category" as a Discount basis, while I use "total by Item". . .

 

If you use total by item, you will need to call apply_special_item_discount() but deduce the category id from the item number.

Contributions: Better Together and Quantity Discounts for osCommerce 2.3.x and Phoenix. See my profile for more details.

Link to comment
Share on other sites

Hi Software guy

 

Thanks for a great contribution. :thumbsup:

 

Is there some way that its possible to include sub categories, when adding lets say cat_id 145, and that cat. have 30 sub categories.

The idea is, that I want it to be possible to receive discount when you buy across categories.

For example: if you have to buy for 500$ from category id_145 to obtain the discount, and you take for 300$ from one sub cat. and 200$ from another sub. cat.

 

I hope you understand what I mean, despite my miserable English :P

Edited by -Buggi-
Link to comment
Share on other sites

I understand what you mean - it's just that Quantity Discounts is designed to work at one consistent level only.

 

See your PM for other ideas.

 

Scott

Contributions: Better Together and Quantity Discounts for osCommerce 2.3.x and Phoenix. See my profile for more details.

Link to comment
Share on other sites

  • 2 months later...

Hi Scott,

 

First off, thanks for the great mod!

 

I am curious to the ideas you have given -Buggi-. Basically I am facing the same problem.

 

I have several main categories which consist of subcategories up to three levels deep, e.g.

 

Women

|

----> Clothing

|

----> Nike

|

----> Jackets

----> Shirts

----> Dresses

----> Pants

 

When I assign a discount by category, than it will by default use the deepest level (Jackets, Shirts, Dresses, Pants), however I would love to assign it to the level above, in this case "Nike". Any ideas?

 

Thanks,

John

Link to comment
Share on other sites

  • 3 weeks later...

Great work Guy!

I noticed a little issue with order editor. In admin/edit_orders.php, when the quantity of items is modified to a quantity under the first level (a quantity without discount), the order editor refreshes and shows the order total correctly, but it continues showing a 'Quantity Discount' line with the previous discount amount that creates confussion.

 

Thanks Guy!

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