This is a discussion on Compatability oscommerce contribs for OSCMax within the osCMax v2 Customization/Mods forums, part of the osCMax v2.0 Forums category; Originally Posted by met00 For example, here is the edit product for our admin - you can see that it ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#11
| ||||
| ||||
| Quote:
Hi met00, I have just added the Margin Report contribution to my store, looking good so far. I see you have made some addition on your categories.php that makes it show right there the margin in amount and %, could I please borrow that code from you...?? |
|
#12
| |||
| |||
| Ummm, Margin Report is NOT from me so I have no idea what fields they call from the database (we modified the code to meet our needs as margin report didn't). Below is the code where we add costs and compute margin... Code: <? // MOD: added MSRP ?>
<tr bgcolor="#ebebff">
<td class="main"><?php echo TEXT_PRODUCTS_PRICE_MSRP; ?></td>
<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_msrp', $pInfo->products_msrp); ?></td>
</tr>
<tr bgcolor="#ebebff">
<td class="main"><?php echo TEXT_PRODUCTS_PRICE_NET; ?></td>
<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_price', $pInfo->products_price, 'onKeyUp="updateGross()"'); ?></td>
</tr>
<tr bgcolor="#ebebff">
<td class="main"><?php echo TEXT_PRODUCTS_PRICE_GROSS; ?></td>
<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_price_gross', $pInfo->products_price, 'OnKeyUp="updateNet()"'); ?></td>
</tr>
<?
$margin = $pInfo->products_price - $pInfo->products_cost;
if ($pInfo->products_price != 0) $marginp = (1 - ( $pInfo->products_cost / $pInfo->products_price )) * 100;
if ($margin < .01 ) $margin = "<font color=red>".$margin."</font>";
?>
<tr bgcolor="#ebebff">
<td class="main"><?php echo TEXT_PRODUCTS_PRICE_COST; ?></td>
<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_cost', $pInfo->products_cost); ?> <i>Margin: <?echo $margin; ?> (<?echo sprintf('%01.2f',$marginp); ?>%)</i></td>
</tr>
__________________ so endith the lesson<think>sometimes I just sit's and thinks</think> "Here you are with a hand full of holes, a thumb up your ass, and a big grin to pass the time of day with." - TWB |
| The Following User Says Thank You to met00 For This Useful Post: | ||
MindTwist (11-14-2007) | ||
|
#13
| ||||
| ||||
| It will, I will be able to work it out from that, thanks! |
|
#14
| ||||
| ||||
| That did the trick, I hardly had to change anything since my variables are the same. I thought that the shown margin would update real time like the prices do (you change the net price, and the gross price will change to show your price + taxes), guess I hoped for too much and let you know. Thx! |
|
#15
| ||||
| ||||
| So here is my solution, now the info gets updated real-time as you change any of the values, gross value, net value, or product cost: ![]() Here I created updateMargin, and added a call to the function on updateGross and updateNet, so if the net or gross values change, the margins will do so too. PHP Code: PHP Code: PHP Code: |
| Thread Tools | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| postaffiliatepro code compatability ? | fatbloke | osCMax v2 Customization/Mods | 1 | 01-18-2007 06:31 AM |
| OSCommerce Contribs that work | spottedhaggis | osCMax v2 Customization/Mods | 0 | 02-20-2006 06:14 PM |
| Adding Contribs using BTS | mattdpeterson | osCMax v1.7 General Mods Discussion | 0 | 05-23-2004 02:59 PM |
| Using Contribs??? | WebMistress | osCommerce 2.2 Modification Help | 12 | 04-20-2004 08:54 AM |
| Contribs - can I use a contrib straight from oscommerce | jloyzaga | osCMax v1.7 Discussion | 2 | 09-17-2003 12:31 AM |