S
S
Sergey Bard2018-04-02 14:23:05
opencart
Sergey Bard, 2018-04-02 14:23:05

How to add weight in product editing?

Hello. I started working with opencart 2.3, I received a task, the price of the goods is indicated per kg (example 0.25 kg = 100 rubles), now I need to make sure that when editing the order in the admin panel, the manager can change the weight of the product and immediately that the final price would be recalculated (so that after changing the mass, the price would change depending on the price per kilo), I decided this with a big crutch), made an additional. table

-- ----------------------------
-- Table structure for oc_order_product_weight
-- ----------------------------
DROP TABLE IF EXISTS `oc_order_product_weight`;
CREATE TABLE `oc_order_product_weight` (
  `order_custom_weight_id` int(11) NOT NULL AUTO_INCREMENT,
  `order_id` int(11) NOT NULL,
  `order_product_id` int(11) NOT NULL,
  `weight` decimal(15,2) NOT NULL,
  PRIMARY KEY (`order_custom_weight_id`)
) ENGINE=MyISAM AUTO_INCREMENT=27 DEFAULT CHARSET=utf8;

and removed the button from updating the number of goods in the order, putting it on the mass, and when the manager clicks update, he updates the price data directly in the database, etc., because as I understand it, the usual update redirects here index.php?route= api/cart/products&token=, and from this there is an update in the cart table and if everything is fine then it resaves the data
ysk05L.jpg
everything works only at the stage of updating the product, and if you go through all the order editing items and click save at the end, then nothing in fact does not change (as previously said, it looks into the basket and makes an update on it),
I understand that I made complete crap), and I ask you to tell me how to proceed in such cases, continue and completely rewrite the editing of the order as needed without taking into account the basket, in general, completely for myself or is it better to find a ready-made module for this case (although I searched but did not find it) ?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question