我很想知道 Magento禁用产品怎么样?
代码在哪里负责产品状态,即在Magento中使用启用或停用?
Plz为我提供Magento产品停用的代码位置?
答案 0 :(得分:3)
googling your answer的更多努力可能对您有所帮助:
http://www.magentocommerce.com/boards/viewthread/195388/#t243282
Mage::getModel('catalog/product_status')->updateProductStatus($product->getId(), $storeId, Mage_Catalog_Model_Product_Status::STATUS_DISABLED);
另外,你可以运行(在linux上)以下grep命令
grep -rin -A2 -B2 "updateProductStatus" *
找出可能调用该段代码的实例。
编辑:在Magento 1.6.2.0上,您可以在这里找到它。 (例如上面shell命令的结果)
electricjesus@quadsrv64:~/projects/magento/magento/app$ grep -rin -A2 -B2 "updateProductStatus" *
code/core/Mage/Catalog/Model/Product/Flat/Indexer.php-172- * @return Mage_Catalog_Model_Product_Flat_Indexer
code/core/Mage/Catalog/Model/Product/Flat/Indexer.php-173- */
code/core/Mage/Catalog/Model/Product/Flat/Indexer.php:174: public function updateProductStatus($productId, $status, $store = null)
code/core/Mage/Catalog/Model/Product/Flat/Indexer.php-175- {
code/core/Mage/Catalog/Model/Product/Flat/Indexer.php-176- if (is_null($store)) {
code/core/Mage/Catalog/Model/Product/Flat/Indexer.php-177- foreach (Mage::app()->getStores() as $store) {
code/core/Mage/Catalog/Model/Product/Flat/Indexer.php:178: $this->updateProductStatus($productId, $status, $store->getId());
code/core/Mage/Catalog/Model/Product/Flat/Indexer.php-179- }
code/core/Mage/Catalog/Model/Product/Flat/Indexer.php-180- return $this;
--
code/core/Mage/Catalog/Model/Product/Flat/Observer.php-110- $storeId = $storeId > 0 ? $storeId : null;
code/core/Mage/Catalog/Model/Product/Flat/Observer.php-111-
code/core/Mage/Catalog/Model/Product/Flat/Observer.php:112: $this->_getIndexer()->updateProductStatus($productId, $status, $storeId);
code/core/Mage/Catalog/Model/Product/Flat/Observer.php-113-
code/core/Mage/Catalog/Model/Product/Flat/Observer.php-114- return $this;
--
code/core/Mage/Catalog/Model/Product/Indexer/Flat.php-317- if (isset($data['catalog_product_flat_status'])) {
code/core/Mage/Catalog/Model/Product/Indexer/Flat.php-318- $status = $data['catalog_product_flat_status'];
code/core/Mage/Catalog/Model/Product/Indexer/Flat.php:319: $this->_getIndexer()->updateProductStatus($productIds, $status);
code/core/Mage/Catalog/Model/Product/Indexer/Flat.php-320- }
code/core/Mage/Catalog/Model/Product/Indexer/Flat.php-321-
--
code/core/Mage/Catalog/Model/Product/Status.php-198- * @return Mage_Catalog_Model_Product_Status
code/core/Mage/Catalog/Model/Product/Status.php-199- */
code/core/Mage/Catalog/Model/Product/Status.php:200: public function updateProductStatus($productId, $storeId, $value)
code/core/Mage/Catalog/Model/Product/Status.php-201- {
code/core/Mage/Catalog/Model/Product/Status.php-202- Mage::getSingleton('catalog/product_action')
--
code/core/Mage/Catalog/Model/Resource/Product/Status.php-106- * @return Mage_Catalog_Model_Resource_Product_Status
code/core/Mage/Catalog/Model/Resource/Product/Status.php-107- */
code/core/Mage/Catalog/Model/Resource/Product/Status.php:108: public function updateProductStatus($productId, $storeId, $value)
code/core/Mage/Catalog/Model/Resource/Product/Status.php-109- {
code/core/Mage/Catalog/Model/Resource/Product/Status.php-110- $statusAttributeId = $this->_getProductAttribute('status')->getId();