我正在尝试复制 oscommerce 中的 manfacturers 功能,但我陷入了写入数据库的困境
oscommerce 中的制造商功能被证明是非常有用的功能,我用它来按条件过滤产品。 然后我希望能够拥有另一个这样的功能来更多地过滤我的产品 我复制了所有与制造商相关的文件和代码片段,并将其称为“副产品”;到目前为止,我设法让大部分工作正常进行:
在管理区域中,我可以添加新的副产品(制造商) - 然后我可以在视图页面中查看组合框(就像有第二个制造商组合框一样,但具有不同的功能)内容)
现在的问题是尝试将副产品分配给新产品时。我再次设法将该选项放入 .../admin/categories.php - 这样用户就可以输入产品名称,选择其制造商并以同样的方式选择“副产品”。
但是,当我将产品添加到数据库时,除了 byproducts_id 之外,所有内容都会添加到产品表中,
我确保对数据库进行了正确的更改。这是我认为当我添加新产品时应该运行的代码
来自 .../admin/categories.php
tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id, byproducts_id)
values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "', now(), " . (empty($product['products_date_available']) ? "null" : "'" . tep_db_input($product['products_date_available']) . "'") . ", '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "', '" . (int)$product['byproducts_id'] . "')");
$dup_products_id = tep_db_insert_id();
此代码不会给出任何错误,正如我所说,我知道我需要将代码添加到其他文件,因此,每个提到制造商的文件,我都复制/粘贴了代码并将制造商更改为副产品 - 但我有一种强烈的感觉,问题不在上面的代码中,而是在其他地方,
非常感谢您的帮助
the manufacturers function in oscommerce is proving to be very useful feature, I'm using it to filter products by their conditions.
I then wanted to be able to have another of such functionalities to filter my products ones more
I have dublicated all the files and code snippets related to manufacturers and called it 'byproducts'; so far I managed to get most of it working:
In the admin area I can add the new byproducts (manufacturers) - and then I can view the combo box in the view pages (exactly like having a second manufacturers combo box, but with different content)
Now the problem is when trying to assign the byproducts to a new product. Again I managed to place the option into the .../admin/categories.php - so the user can type the product name, select their manufacturer and select the 'byproduct' such the sameway.
But when I add the product to the database, everthing gets added to the products table apart from the byproducts_id
I made sure that I have made the right changes to the database. this is the code that I think should be running when I add a new product
From .../admin/categories.php
tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id, byproducts_id)
values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "', now(), " . (empty($product['products_date_available']) ? "null" : "'" . tep_db_input($product['products_date_available']) . "'") . ", '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "', '" . (int)$product['byproducts_id'] . "')");
$dup_products_id = tep_db_insert_id();
This code does not give any errors, as I said I am aware that I needed to add code to other files, so every file that mentioned manufacturer, I coped the coped/pasted the code and changed the manufacturer to byproducts - But I have a strong feeling that the problem is not in the above code but somewhere else
thanks a lot for your help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论