简体   繁体   English

如何在opencart中按类别向产品添加属性

[英]How to add attributes to product by category in opencart

I want to Add attributes(Options) to multiple products having same category. 我想将属性(选项)添加到具有相同类别的多个产品中。 Is there an option available in open cart or any way to do this, 打开购物车中是否有可用的选项或执行此操作的任何方式,

If I Add attribute(Options) to products of same category should it apply to all the products? 如果我将属性(选项)添加到同一类别的产品中,是否应该将其应用于所有产品?

Opencart 2.0 Opencart 2.0

Put this lines in opencart2\\admin\\model\\catalog\\product.php line no 611 approx In Public function getTotalProducts($data = array()) { .... 将此行放入opencart2 \\ admin \\ model \\ catalog \\ product.php行中,大约611行在公共函数getTotalProducts($ data = array()){...中。

Function And Open opencart2/admin/index.php?route=catalog/product&token=47e2a 功能并打开opencart2 / admin / index.php?route = catalog / product&token = 47e2a

Page once and delete this line after executing this lines 页面一次,执行此行后将其删除

    $query = $this->db->query("SELECT product_id FROM " . DB_PREFIX . "product_to_category WHERE category_id = (SELECT category_id FROM `oc_category_description` WHERE name = 'Cameras' AND language_id = '1')");

    foreach ($query->rows as $key) {
      $this->db->query("INSERT INTO " . DB_PREFIX . "product_attribute SET product_id = '" . $key['product_id'] . "', attribute_id = '9', language_id = '1', text = 'Testing'");
        }

You Can change Category name -> name = 'Cameras',________ Language id -> language_id = '1'(for english), ___________ Attribute id ->attribute_id = '9'(You can check attribute id at opencart2/admin/index.php?route=catalog/attribute/edit&token=4e2a&attribute_id=3), ________ Attribute Text -> text = 'Testing' 您可以更改类别名称->名称='摄像机',________语言ID-> language_id ='1'(对于英语),___________属性ID-> attribute_id ='9'(您可以在opencart2 / admin / index中检查属性ID .php?route = catalog / attribute / edit&token = 4e2a&attribute_id = 3),________属性文本->文本=“测试”

Ask me for more clarity 请我更清楚

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

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