Magento如何将产品组锁定到数据库中的产品 [英] How does Magento key a product group to a product in the database

查看:89
本文介绍了Magento如何将产品组锁定到数据库中的产品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从SQL查询中,我需要知道magento如何将相关产品键到实际产品本身.我读了很多关于如何使用php的有用提示

From a SQL Query I need to know how does magento key the related products to the actual product itself. I read a lot of useful tips on how to do with with php

$collection = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToSort('name', 'ASC');

但是我需要知道如何使用mysql将这些组标识为一个ID.

But I need to know how to identity these groups to a id with mysql.

推荐答案

对于相关产品,Magento使用 catalog_product_link 表.

For a related product Magento uses catalog_product_link table.

其中包含产品ID 相关产品链接类型.

要查看所有链接类型,可以查看 catalog_product_link_type 表.

To see all link types you can check the catalog_product_link_type table.

SELECT link.link_id, link.product_id, link.linked_product_id, link.link_type_id, type.code 
FROM catalog_product_link link 
  LEFT JOIN catalog_product_link_type type ON link.link_type_id = type.link_type_id
WHERE 
  code = 'super' -- grouped products
  AND linked_product_id IN (123456) -- child simple product(s)
;

通过此链接可以找到更多详细信息: 专用于Magento eCommerce CE版的在线数据库图表工具

More extensive information can be found with this link: online Database Diagram Tool dedicated to Magento eCommerce CE Edition

这篇关于Magento如何将产品组锁定到数据库中的产品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆