Jump to content

apply discount to some products


sheriff

Recommended Posts

Hi all !

 

I have a list of products with price. How can I add to to every product a discount ?

 

 

this is how the list are build

 

	<tr>
	<td align="center" bgcolor="<?php echo $row_color; ?>"><?php echo $id; ?>
	<td align="left" bgcolor="<?php echo $row_color; ?>"> <?php echo $name; ?></td>
	<td align="left" bgcolor="<?php echo $row_color; ?>"> <?php echo $desc; ?></td>
	<td align="center" bgcolor="<?php echo $row_color; ?>"><?php echo $um; ?></td>
	<td align="right" bgcolor="<?php echo $row_color; ?>"><?php echo $price; ?> RON </td>
	<td align="right" bgcolor="<?php echo $row_color; ?>">
			<select name="discount[]">
				<option value="" selected>---</option>
				<option value="3">3%</option>
				<option value="5">5%</option>
				<option value="7">7%</option>
				<option value="10">10%</option>
			</select></td>
	<td align="center" bgcolor="<?php echo $row_color; ?>"><input type='checkbox' name="check[]" value="<?php echo $id; ?>"></td>
	</tr>

 

 

 

This is the way how it grabs from database the list !

 

if(isset($_POST)){
          if(count($_POST['check'])){
            $list_selected = "";
            foreach($_POST['check'] as $key => $ids){
                   $list_selected .= $ids .",";
            }
            $list_selected = substr($list_selected,0,strlen($list_selected)-1);
            // This will give ur selected ids like this 100,203,125,123
          }else{
            $list_selected = "-1";
          } 
}

 

Now the question !

 

How can I calculate from the price th $discount !?

 

Thanks for help !

Link to comment
https://forums.phpfreaks.com/topic/46548-apply-discount-to-some-products/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.