Supertex Posted January 16, 2017 Share Posted January 16, 2017 Im trying to modify my store to track manual quantity changes. Part of the process is disallowing direct manipulation of the 'quantity' field in the 'edit' function of categories.php. I've set that field to 'disabled', so you can see what it's pulled from the DB, but you can't modify it. I've also added a field for "inventory_adjustment", but I cant figure out how to use $sql_data_array = array('products_quantity' => (int)tep_db_prepare_input($HTTP_POST_VARS['products_quantity']), to post the sum of the two fields: 'products_quantity' and 'inventory_adjustment'. I'd really appreciate a hand if someone has a few moments to spare. osC v2.3.1 MySQL v8.0.32 PHP v5.6.40 Installed addons: . Attribute Sets Plus .. Create Account & Manual Order Maker .. Customer Testimonials 2.3.4 .. Customer Blacklist .. Dynamic Info Pages .. FedEx Web Svcs v9 .. Filtered Sales Report .. Generic Box .. Google XML Sitemap SEO .. Maximum Order Value .. Modular Front Page .. Monthly Sales & Tax Report .. Multiple Products Manager .. Must Accept Terms & Conditions .. Order Editior .. PDF Customer Invoice .. Price in Cart Only .. Product Sort/Order .. Product Sort in Cart .. Quantity Discounts .. Restrict Delivery Methods .. SEO Header Tags - Reloaded .. Separate Pricing Per Customer .. Simpler Admin Session Length Control .. Sitemap SEO .. Show Free Ship + Modules .. Specials by Category for SPPC .. Store Mode (open|closed|maintenance) .. Store Pickup Shipping .. Theme Switcher .. Ultimate SEO URLs 5 Pro .. UPS XML Rates & Svcs 1.4 .. USPS methods 7.3.1 .. Who's Online Dashboard . Fixes: Add to cart -> 'product not found' : FIX Login issues with IE 11 : FIX Tools: Incredibly Handy: osC Xref Link to comment Share on other sites More sharing options...
Supertex Posted January 16, 2017 Author Share Posted January 16, 2017 Hrm...it seems the reason I was having trouble had more to do with the fact that the quantity field was set 'disabled'. If I remove that, then I have no trouble posting the sum back to the DB...but now I have to figure out how to disable the field... osC v2.3.1 MySQL v8.0.32 PHP v5.6.40 Installed addons: . Attribute Sets Plus .. Create Account & Manual Order Maker .. Customer Testimonials 2.3.4 .. Customer Blacklist .. Dynamic Info Pages .. FedEx Web Svcs v9 .. Filtered Sales Report .. Generic Box .. Google XML Sitemap SEO .. Maximum Order Value .. Modular Front Page .. Monthly Sales & Tax Report .. Multiple Products Manager .. Must Accept Terms & Conditions .. Order Editior .. PDF Customer Invoice .. Price in Cart Only .. Product Sort/Order .. Product Sort in Cart .. Quantity Discounts .. Restrict Delivery Methods .. SEO Header Tags - Reloaded .. Separate Pricing Per Customer .. Simpler Admin Session Length Control .. Sitemap SEO .. Show Free Ship + Modules .. Specials by Category for SPPC .. Store Mode (open|closed|maintenance) .. Store Pickup Shipping .. Theme Switcher .. Ultimate SEO URLs 5 Pro .. UPS XML Rates & Svcs 1.4 .. USPS methods 7.3.1 .. Who's Online Dashboard . Fixes: Add to cart -> 'product not found' : FIX Login issues with IE 11 : FIX Tools: Incredibly Handy: osC Xref Link to comment Share on other sites More sharing options...
auzStar Posted January 16, 2017 Share Posted January 16, 2017 @@Supertex One way of doing it Shawn is to use a hidden filed to post the qty. So you could change "tep_draw_input_field(" to "tep_draw_hidden_field(" and then place the output qty next to it i.e.: tep_draw_hidden_field('products_quantity', $pInfo->products_quantity) . $pInfo->products_quantity; cheers My Add-onsAdvanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download SupportAjax Product Listing for osC 2.3.4 (bootstrap) Download SupportCategory New Products Carousel for osC 2.3.4 (bootstrap) Download SupportCategory Popular Products Carousel for osC 2.3.4 (bootstrap) Download SupportCustomer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download SupportFront Page New Products Carousel for osC 2.3.4 (bootstrap) Download SupportIndex Nested - Product Listing for osC 2.3.4 (bootstrap) Download SupportMatch Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download SupportModular Category Page for osC 2.3.4 (bootstrap) Download SupportNEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download SupportNEW Equal Height Module for osC 2.3.4 (bootstrap) Download SupportProducts Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download SupportTwitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download SupportUpcoming Products Modules for osC 2.3.4 (bootstrap) Download Support Assisted Add-onsScroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support Bootstrap Add-ons created by other membersosCommerce Bootstrap Addons and Code Link to comment Share on other sites More sharing options...
Jack_mcs Posted January 17, 2017 Share Posted January 17, 2017 @@Supertex I'm confused about what you mean when you say you want to disable the field. Your use of the word field indicated you are talking about the database but, as far as I know, it isn't possible to disable a field in the database. Can you explain in more detail what you mean? Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
burt Posted January 17, 2017 Share Posted January 17, 2017 A disabled field is just that. It's disabled from any use.Use readonly instead of disabled. Link to comment Share on other sites More sharing options...
Supertex Posted February 11, 2017 Author Share Posted February 11, 2017 @@Jack_mcs I was talking about the "Quantity" input form field in admin/categories.php. I wanted it to show, but not be editable, because I added a 'quantity adjustment' form field to be used instead. At the same time, I added a new DB table with an auto-incrementing field for 'event_id', and then fields for event_date, products_quantity, adjustment_quantity, product_id, products_name, and products_model. So when you 'save' a product, the quantity and adjustment are combined and the result is then saved in the "products_quantity" field of the products table, and a snapshot of the quantity before the update, as well as the adjustment, etc. is saved to my "inventory" table. With this, I can create an inventory report that will show modifications to product quantities that were made manually, but ignore any stock decrements due to order processing. I've had ...issues... with keeping quantities right, like entering a shipment quantity instead of adding the shipment to what I have on-hand and THEN adding it (because I'm a dummy). This will just help with tracking down any inconsistencies in site inventory vs shelf inventory. At AuzStar's advice, I ended up doing this: <td class="main" border="1"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_hidden_field('products_quantity', $pInfo->products_quantity) . tep_draw_input_field('products_quantity', $pInfo->products_quantity, 'disabled') . tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . TEXT_QUANTITY_ADJUSTMENT . tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('quantity_adjustment'); ?></td> And as far as I can tell, this seems to work great. Now I have to integrate my "stats_low_stock.php" file to do the same. Right now, it uses this: function tep_add_product_shipment($products_id, $shipment) { $sql = "update " . TABLE_PRODUCTS . " set products_quantity = products_quantity + " . $shipment . " where products_id = '" . (int)$products_id . "'"; echo 'update successful'; //add a button here after verbose return tep_db_query($sql); } But now I need for it to update the 'inventory' table as well. Haven't jumped on this yet. osC v2.3.1 MySQL v8.0.32 PHP v5.6.40 Installed addons: . Attribute Sets Plus .. Create Account & Manual Order Maker .. Customer Testimonials 2.3.4 .. Customer Blacklist .. Dynamic Info Pages .. FedEx Web Svcs v9 .. Filtered Sales Report .. Generic Box .. Google XML Sitemap SEO .. Maximum Order Value .. Modular Front Page .. Monthly Sales & Tax Report .. Multiple Products Manager .. Must Accept Terms & Conditions .. Order Editior .. PDF Customer Invoice .. Price in Cart Only .. Product Sort/Order .. Product Sort in Cart .. Quantity Discounts .. Restrict Delivery Methods .. SEO Header Tags - Reloaded .. Separate Pricing Per Customer .. Simpler Admin Session Length Control .. Sitemap SEO .. Show Free Ship + Modules .. Specials by Category for SPPC .. Store Mode (open|closed|maintenance) .. Store Pickup Shipping .. Theme Switcher .. Ultimate SEO URLs 5 Pro .. UPS XML Rates & Svcs 1.4 .. USPS methods 7.3.1 .. Who's Online Dashboard . Fixes: Add to cart -> 'product not found' : FIX Login issues with IE 11 : FIX Tools: Incredibly Handy: osC Xref Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.