Add New status for magento reviews
-
07-02-2021 - |
سؤال
How can I add new status for reviews?
I want to do that from installer.
My code is kinda like this:
$sql = "INSERT INTO `review_status` (`status_code`) VALUES ('Approved And Verified');
";
try {
$conn = Mage::getSingleton('core/resource')->getConnection('core_write');
$conn->query($sql);
} catch (Exception $e){
echo $e->getMessage();
}
The status is added in database but not usable/seen in admin in order to change a review status.
Thanks in advance.
المحلول
The part from installer was good but also i needed to rewrite Helper and Model for Mage_Review:
class Custom_Review_Helper_Data extends Mage_Review_Helper_Data
{
public function getReviewStatuses()
{
return array(
Mage_Review_Model_Review::STATUS_APPROVED => $this->__('Approved'),
Mage_Review_Model_Review::STATUS_PENDING => $this->__('Pending'),
Mage_Review_Model_Review::STATUS_NOT_APPROVED => $this->__('Not Approved'),
Custom_Review_Model_Review::STATUS_APPROVED_AND_VERIFIED => $this->__('Approved And Verified')
);
}
}
class Custom_Review_Model_Review extends Mage_Review_Model_Review {
const STATUS_APPROVED_AND_VERIFIED = 4;
}
لا تنتمي إلى magento.stackexchange