Jump to content



Latest News: (loading..)

- - - - -

[Contribution] Quantity Discounts by That Software Guy


  • Please log in to reply
140 replies to this topic

#41   robus

robus
  • Members
  • 24 posts
  • Real Name:Rob Field

Posted 24 October 2009 - 06:08 PM

im trying to exclude some products and categories. In your instructions your call everything a number. I have what I named each product/category but I don't see a specific number I only have what I named each. when I tried to exclude with the name of the category get a big parse error. When i give them the number in which they are ordered it still gives the discount to a product I don't want discounted.

function exclude_category($category) {
        switch($category) {
           case 2:
           case 3:
           case 4:
                return true;
        }
        return false;
    }

or the name of my category............

function exclude_category($category) {
        switch($category) {
           case Companion products:
           case Trigger Point Devices:
   case Volume and Professional Packages:
                return true;
        }
        return false;
    }

#42   swguy

swguy
  • Members
  • 163 posts
  • Real Name:Scott Wilson
  • Gender:Male
  • Location:Tampa Bay, Florida

Posted 24 October 2009 - 06:21 PM

Go here:
http://www.thatsoftwareguy.com/osc_quantity_discounts.html#faq

and search for "subcat".
Contributions: Better Together and Quantity Discounts , for osCommerce 2.2, 2.3.1 and 3.0.  See my profile for more details.

#43   robus

robus
  • Members
  • 24 posts
  • Real Name:Rob Field

Posted 24 October 2009 - 06:27 PM

there are no subcategories just categories and the products.

#44   swguy

swguy
  • Members
  • 163 posts
  • Real Name:Scott Wilson
  • Gender:Male
  • Location:Tampa Bay, Florida

Posted 24 October 2009 - 06:41 PM

Refresh the page and look at the next question.  I added more details.
Contributions: Better Together and Quantity Discounts , for osCommerce 2.2, 2.3.1 and 3.0.  See my profile for more details.

#45   robus

robus
  • Members
  • 24 posts
  • Real Name:Rob Field

Posted 24 October 2009 - 07:04 PM

I see said the blind man.........thanks that did it :thumbsup:

#46   robus

robus
  • Members
  • 24 posts
  • Real Name:Rob Field

Posted 24 October 2009 - 08:22 PM

one last question and then I will buy your precheckout order display mod. My main products are working fine, the categories i wanted excluded are excluded, I have 1 product that I want to discount at a different rate than the ones set in admin. I want product 30 to receive a 2.95ea discount at 3 and a 4.95ea discount at 12

#47   swguy

swguy
  • Members
  • 163 posts
  • Real Name:Scott Wilson
  • Gender:Male
  • Location:Tampa Bay, Florida

Posted 24 October 2009 - 08:39 PM

To learn about this, go to

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

and search for "apply_special_item_discount"
Contributions: Better Together and Quantity Discounts , for osCommerce 2.2, 2.3.1 and 3.0.  See my profile for more details.

#48   robus

robus
  • Members
  • 24 posts
  • Real Name:Rob Field

Posted 24 October 2009 - 10:33 PM

this............

function apply_special_item_discount($id, $count, &$disc_amount) {
        switch($id) {
           case 30:
                if ($count > 12) {
                   $disc_amount = $disc_amount * 4.95;
                } else if ($count > 3) {
                   $disc_amount = $disc_amount * 2.95;
                }
                break;
        }
    }

got me this............

Parse error: syntax error, unexpected T_DNUMBER in /home/sacrowed/public_html/store1/includes/modules/order_total/ot_quantity_discount.php on line 84


take into count that I have different values set up for a count of 12 and 3 for my main products than I do for this product.

#49   swguy

swguy
  • Members
  • 163 posts
  • Real Name:Scott Wilson
  • Gender:Male
  • Location:Tampa Bay, Florida

Posted 25 October 2009 - 12:20 AM

Debugging your changes on the forum is not something I can do, particularly not for free.  If you'd like to hire me to implement your discounting plan, please contact me by email.
Contributions: Better Together and Quantity Discounts , for osCommerce 2.2, 2.3.1 and 3.0.  See my profile for more details.

#50   robus

robus
  • Members
  • 24 posts
  • Real Name:Rob Field

Posted 25 October 2009 - 12:59 AM

I would sooner hammer bamboo toothpicks under my toenails than pay you a dime. you make a mod on a open source community so complicated just so you can get some work outa the deal! You need a magnifying glass to read the instructions and they read like they are coming from a monotone robbie the robot , here is one for free, ever heard of a paragraph?
  It kinda looks like this................debug my code.......its not my code its your freakin code I just filled in the blanks.........learn about this here .!.. <_<

#51   Bluecamel

Bluecamel
  • Members
  • 11 posts
  • Real Name:Jeff

Posted 26 October 2009 - 03:02 PM

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?

#52   swguy

swguy
  • Members
  • 163 posts
  • Real Name:Scott Wilson
  • Gender:Male
  • Location:Tampa Bay, Florida

Posted 27 October 2009 - 12:07 AM

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.2, 2.3.1 and 3.0.  See my profile for more details.

#53   Bluecamel

Bluecamel
  • Members
  • 11 posts
  • Real Name:Jeff

Posted 27 October 2009 - 04:10 AM

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.

View Postswguy, on 27 October 2009 - 12:07 AM, said:

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.


#54   swguy

swguy
  • Members
  • 163 posts
  • Real Name:Scott Wilson
  • Gender:Male
  • Location:Tampa Bay, Florida

Posted 27 October 2009 - 05:32 AM

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, 27 October 2009 - 05:33 AM.

Contributions: Better Together and Quantity Discounts , for osCommerce 2.2, 2.3.1 and 3.0.  See my profile for more details.

#55   Bluecamel

Bluecamel
  • Members
  • 11 posts
  • Real Name:Jeff

Posted 27 October 2009 - 06:27 PM

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!

View Postswguy, on 27 October 2009 - 05:32 AM, said:

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


#56   swguy

swguy
  • Members
  • 163 posts
  • Real Name:Scott Wilson
  • Gender:Male
  • Location:Tampa Bay, Florida

Posted 27 October 2009 - 07:43 PM

View PostBluecamel, on 27 October 2009 - 06:27 PM, said:

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.2, 2.3.1 and 3.0.  See my profile for more details.

#57   Bluecamel

Bluecamel
  • Members
  • 11 posts
  • Real Name:Jeff

Posted 27 October 2009 - 08:10 PM

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.


View Postswguy, on 27 October 2009 - 07:43 PM, said:

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.


#58   swguy

swguy
  • Members
  • 163 posts
  • Real Name:Scott Wilson
  • Gender:Male
  • Location:Tampa Bay, Florida

Posted 27 October 2009 - 11:57 PM

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.2, 2.3.1 and 3.0.  See my profile for more details.

#59   wveinti

wveinti
  • Members
  • 3 posts
  • Real Name:Walter

Posted 10 November 2009 - 09:17 PM

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

#60   swguy

swguy
  • Members
  • 163 posts
  • Real Name:Scott Wilson
  • Gender:Male
  • Location:Tampa Bay, Florida

Posted 10 November 2009 - 09:27 PM

View Postwveinti, on 10 November 2009 - 09:17 PM, said:

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.2, 2.3.1 and 3.0.  See my profile for more details.