New question, same topic, and again, a thanks in advance for the help.
In ShopAdmin.template.php, I have the following:
<table>
<tr>
<td align="right"><label for="itemname">', $txt['shop_name'], ':</label></td>
<td><input name="itemname" id="itemname" type="text" value="', $context['shop_edit']['name'], '" size="80" style="width: 100%" /></td>
</tr><tr>
<td align="right" valign="top"><label for="itemdesc">', $txt['shop_description'], ':</label></td>
<td><textarea name="itemdesc" id="itemdesc" cols="40" rows="6" style="width: 100%">', $context['shop_edit']['desc'], '</textarea></td>
</tr><tr>
<td align="right"><label for="itemprice">', $txt['shop_price'], ':</label></td>
<td>', $modSettings['shopCurrencyPrefix'], '<input name="itemprice" id="itemprice" type="text" value="', $context['shop_edit']['price'], '" size="5" />', $modSettings['shopCurrencySuffix'], '</td>
</tr><tr>
<td align="right"><label for="itemstock">', $txt['shop_stock'], ':</label></td>
<td><input name="itemstock" id="itemstock" type="text" value="', $context['shop_edit']['stock'], '" size="5" /></td>
</tr>';
//BEGIN CODE ADDED FOR Variable Restock Rates
echo '<tr>
<td align="right"><label for="stock_period">', $txt['shop_stock_period'], ':</label></td>
<td><input name="stock_period" id="stock_period" type="text" value="', $context['shop_item']['stock_period'], '"size="5" /></td>
</tr><tr>
<td align="right"><label for="stock_add">', $txt['shop_stock_add'], ':</label></td>
<td><input name="stock_add" id="stock_add" type="text" value="', $context['shop_item']['stock_add'], '"size="5" /></td>
</tr><tr>
<td align="right"><label for="max_stock">', $txt['shop_max_stock'], ':</label></td>
<td><input name="max_stock" id="max_stock" type="text" value="', $context['shop_item']['max_stock'], '"size="5" /></td>
</tr>';
//END CODE ADDED FOR Variable Restock Rates
echo '<tr>
<td align="right"><label for="cat">', $txt['shop_category'], ':</label></td>
<td>
The form continues, but that gets all of my stuff in there.
In ShopAdmin.php, I have the following:\
// Update the item information
// QUERY UPDATED FOR Variable Restock Rates
db_query("
UPDATE {$db_prefix}shop_items
SET name = '{$_POST['itemname']}',
`desc` = '{$_POST['itemdesc']}',
price = {$_POST['itemprice']},
stock = {$_POST['itemstock']},
image = '{$_POST['icon']}',
delete_after_use = {$delete},
category = {$_POST['cat']},
stock_period = {$_POST['stock_period']},
stock_add = {$_POST['stock_add']},
max_stock = {$_POST['max_stock']},
{$additional}
WHERE id = {$_POST['id']}
LIMIT 1", __FILE__, __LINE__);
When I run it, it lets me get to the edit page, but the three new text fields are empty. And when I click Edit, I get a MYSQL error at the end of that ShopAdmin.php block.
I know I have some $context stuff in the template; did I miss a location where I need to add this data? I'm assuming that it's the $context being missing that's causing data to not make it over to the query, which is causing the query to fail. Can anyone help?
Edit: Removed extra tabs.
EditX2: Fixed the issue. It was two problems rolled into one. I was using $context['shop_item'] instead of ['shop_edit'] in the template, and I had an extra comma in the query, since $additional begins with a comma if it's needed.
I've now got this installed on my site, and things are working swimmingly at the moment. Thanks again.