简体   繁体   English

在opencart 3.x中获取股票信息

[英]Getting stock information in opencart 3.x

I want to implement a task similar to the one here Getting stock information in opencart 2.3.0.2 , but my problem is that when deleting a product, the information about the warehouse will disappear.我想实现一个类似于这里的任务Getting stock information in opencart 2.3.0.2 ,但我的问题是删除产品时,有关仓库的信息将消失。 I want to enter the data into the table order_product, but I still don't understand how.我想将数据输入到表 order_product 中,但我仍然不明白该怎么做。 Help me please.请帮帮我。

I can't figure out how to write information about the rest of the goods to the database.我想不通如何将货物的rest的信息写入数据库。 I don't understand how to implement it.我不明白如何实施它。

Hmm... You want to save product`s stock information in order_product table?嗯...您想将产品的库存信息保存在order_product 表中吗?

So first you must to add custom field in oc_order_product所以首先你必须在 oc_order_product 中添加自定义字段

ALTER TABLE `oc_order_product` ADD `stock_status` INT(11) NOT NULL AFTER `reward`; 

Then in catalog/controller/checkout/confirm.php in $order_data['products'][] = array( You must add key - stock_status然后在catalog/controller/checkout/confirm.php$order_data['products'][] = array( You must add key - stock_status

'stock' => $this->model_catalog_product->getProduct($product['product_id'])['stock_status'],

So we modified our controller in customer side, and now our data receive the stock_status.所以我们在客户端修改了我们的controller,现在我们的数据接收stock_status。

After receive products data from customer side, we must save in oc_order_table从客户那里收到产品数据后,我们必须保存在 oc_order_table

Open path - catalog/model/checkout/order.php and edit addOrder function... After reward = '". (int)$product['reward']. "' in products loop add after comma:打开路径 - catalog/model/checkout/order.php并编辑 addOrder function... 在reward = '". (int)$product['reward']. "'之后在产品循环中添加逗号后:

stock_status = '" . $this->db->escape(product['stock_status']) . "'

I write an example, how to save data from customer side about product stock data.我写了一个例子,如何从客户方保存关于产品库存数据的数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM