Adding tags to products in Magento
问题 what is the code needed to insert tags to a product in Magento? thanks 回答1: $tagName = 'php'; $customerID = NULL; $storeId = Mage::app()->getStore()->getId(); $productID = 1; $tagModel = Mage::getModel('tag/tag'); $tagModel->loadByName($tagName); //$tagModel->unsetData()->loadByName($tagName); //if using a loop if (!$tagModel->getId()) { $tagModel->setName($tagName) ->setFirstCustomerId($customerId) ->setFirstStoreId($storeId) ->setStatus($tagModel->getPendingStatus()) ->save(); }