简体   繁体   English

如何隐藏Magento前端的简单产品?

[英]How to hide simple products in Magento front end?

I am inserting some products in magento programmatically, I want to show just configurable products in front end (Like magento itself) and when user selects "View Details" in details page he can select attributes to select the associated simple product.(I dont want to show associated products in front end) But now both configurable and simple products are available in product list in front end. 我以编程方式在magento中插入一些产品,我想在前端显示可配置的产品(如magento本身),当用户在详细信息页面中选择“查看详细信息”时,他可以选择属性来选择相关的简单产品。(我不想要在前端显示相关产品)但是现在前端的产品列表中都提供了可配置和简单的产品。 why it happens? 为什么会这样?

In the General tab of the simple products, set Visibility to Not Visible Individually . 在简单产品的“ General选项卡中,将“ Visibility设置为“ Not Visible Individually This will hide them from the front-end, but keep them enabled for use with the configurable products. 这会将它们隐藏在前端,但要保持它们与可配置产品一起使用。

This can also be done programmatically if that's how you're creating the products: 如果您正在创建产品,也可以通过编程方式完成此操作:

$product->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE)

// from Mage_Catalog_Model_Product_Visibility:
// const VISIBILITY_NOT_VISIBLE    = 1;
// const VISIBILITY_IN_CATALOG     = 2;
// const VISIBILITY_IN_SEARCH      = 3;
// const VISIBILITY_BOTH           = 4;

// remember to call $product->save() at some point

If you want to hide the simple products from frontend, you can also do this from backend, without writing any code. 如果要隐藏前端的简单产品,也可以从后端执行此操作,而无需编写任何代码。

Go to Catalog->Manage Products, in the Type dropdown, filter "simple product". 转到目录 - >管理产品,在类型下拉列表中,过滤“简单产品”。 After filtering select all products and select "Update Attributes" from Mass action. 过滤后,选择所有产品,然后从批量操作中选择“更新属性”。 From there change the visibility to "Not Visible Individually" which will be applied to all simple products. 从那里将可见性更改为“不可见的单独”,这将适用于所有简单的产品。

Thanks friends! 谢谢朋友! I found it. 我找到了。 I set visibility to Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_SEARCH and now it's Ok 我将可见性设置为Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_SEARCH ,现在已经可以了

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

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