Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2009
    Posts
    120
    Plugin Contributions
    0

    help question Help with a little bit of PHP coding for discounting ....

    Hello,

    I have a module that was built where if multiples of 3 are put into the cart then, one of the products is free.

    Today, I modified the code so that the first product would be £5.99 then every product after would be discounted by £3.49. The problem is that for every multiple of two products that are added £3.49 is deducted!

    I'm sure it should be a simple coding fix? I would really appreciate it if someone could take a minute to have a look at the relevant bit and tell me what I need to change. Please. :)

    Here's the code:

    Code:
      }
    
    		$disc_amount += $this->get_disc_amount($all_items, $price);
    		  
           $this->explanation = YOUR_CURRENT_3_FOR_2_DISCOUNT_CONFETTI . "\\n" . "\\n"; 
           $this->explanation .= "\\n\\n" . TOTAL_DISCOUNT . $this->print_amount($disc_amount); 
    	   $od_amount['total'] = round($disc_amount, 2); 
           return $od_amount;
       }
    
       function get_disc_amount($count,$price) {
          $disc_amount = 0;
    	  $new_count = $count - ($count%2);
    //	  if (($count % 2) == 0) {
    	  	$disc_amount = ($new_count/2) * 3.49;
    //	  }	
          return $disc_amount; 
       }
    Many thanks,

    Gary

  2. #2
    Join Date
    Feb 2009
    Posts
    120
    Plugin Contributions
    0

    Default Re: Help with a little bit of PHP coding for discounting ....

    Can anyone help, please? :)

  3. #3
    Join Date
    Jan 2012
    Posts
    2
    Plugin Contributions
    0

    Default Re: Help with a little bit of PHP coding for discounting ....

    I'm not 100% sure what you are asking for, but this should work. I read it that you didn't want the multiples of 3 thing any more, just deduct 3.49 from each if ordering more than 1 (excluding the first).
    PHP Code:
    function get_disc_amount($count,$price) {
    $disc_amount = ($count 1)* 3.49;
    return 
    $disc_amount


  4. #4
    Join Date
    Feb 2009
    Posts
    120
    Plugin Contributions
    0

    Default Re: Help with a little bit of PHP coding for discounting ....

    That worked perfectly. Thanks very much. :)

 

 

Similar Threads

  1. v151 need help to find a little bit of code.
    By Nixe in forum General Questions
    Replies: 2
    Last Post: 19 Mar 2013, 01:58 PM
  2. Replies: 7
    Last Post: 4 Aug 2009, 12:53 PM
  3. Help with a bit of coding! Alternative to creating drop-down list
    By teaj in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 5 May 2009, 12:25 PM
  4. A little help with some coding required!
    By Still Crazy in forum General Questions
    Replies: 2
    Last Post: 12 Apr 2007, 06:13 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR