Totally Zenned
- Join Date:
- Aug 2004
- Location:
- Fountain Hills, AZ
- Posts:
- 476
- Plugin Contributions:
- 0
Issue collecting data with new field added to products
I'm trying to do something that should have been very simple, but I think I'm running into a function somewhere I'm unaware of.
I'm simply trying to add a field in the add products which collects the wholesale cost of the product. I am not using any contribution for this. Later once the data has all been input and saved to the database, I will be creating custom reports that will use this data.
The problem I'm encountering is that all went perfect in regards to having the new field appear on my products add screen and accepting the data and it saves to the database; however what is happening is there is a function somewhere that is overwriting the typed input the same way that it does gross when the products price is entered.
In other words, if I enter 10.00 as the price of the product and it is not taxable (for simplicity for this example) the Gross populates 10 - I then type in 5.00 for the cost. When the product is saved and I reopen it to check to be sure the new field was saved - I find that now the wholesale cost was updated to reflect the products price - 10 !!
I've looked at all the functions and vars in the page (collect_info.php) and I see nothing that should grab my field - products_wholesale_cost and update it this way.
I tried it in reverse and edited the product in the db to reflect the correct cost. When I first open the products edit page it shows the cost correctly. The moment I update it - it once again overwrite the amount and increases it to the retail price.:huh:
<td class="main"><?php echo TEXT_PRODUCTS_WHOLESALE_COST; ?></td>
<td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ' ' . zen_draw_input_field('products_wholesale_cost', $pInfo->products_wholesale_cost); ?>
The code for the products_price and gross contains the update function that mine does not - 'onKeyUp="updateGross()" or 'onKeyUp="updateNet()"
<td class="main"><?php echo TEXT_PRODUCTS_PRICE_NET; ?></td>
<td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ' ' . zen_draw_input_field('products_price', $pInfo->products_price, 'onKeyUp="updateGross()"'); ?></td>
</tr>
Have I chosen an already used variable name with a related function? I used the developers tool kit and came up with nothing when searching. I've tried even moving my new field away from the price to another position in the screen - I change the db from decimal to float - I even added code to indicated that this was a _POST variable as is the Name, description and URL. Nothing I do will stop this update. :cry:
I'm baffled - can anyone enlighten me on this one?