I had a simple code change bookmarked from the forum. Guess my bad since I actually expected the bookmark to work forever (at least a while) and never actually saved the code change anywhere.
The code changed when I did an update and now I need to add it back.
The change had a couple lines to add/overwrite to automatically increment the next products sku from the last product listed's sku.
Anyone have this code saved? Anyone know what and where I'd add such a thing?
Thank you in advance for your assistance.
Found it!
Open /app/design/adminhtml/default/default/template/catalog/product/edit.phtmland add the following snippet to the bottom of the file:
<?php $dbread = Mage::getSingleton('core/resource')->getConnection('core_read'); $sql = $dbread->query("SELECT * FROM catalog_product_entity ORDER BY created_at DESC LIMIT 1"); $res = $sql->fetch(); ?> <script type="text/javascript"> if(document.getElementById('sku').value == ""){ document.getElementById('sku').value = <?php echo (int)$res["sku"] + 1; ?>; } </script>
What this code does:
Therefore, you don’t have to manually enter the SKU yourself when adding the product.
Thanks a ton to magentothem (dot) com for archiving this!
Ugh, not sure what is wrong but the code isn't working for me now. Anyone have any knowledge as to what is wrong?