0

OK so we're in magento 1.8.1.0 and for some reason the following logic returns false all the time

<?php if ($this->getAllowWriteReviewFlag()): ?>

Even if I log in, I have the option "System > Configuration > Catalog > Reviews > Allow guests to write reviews" set to true, so technially that function should return true. If I log in, I get the same thing.

Also, I have checked that Mage_Reviews is enabled in System > Config > Developer > advanced

Any ideas?

2
  • where do you call this line of code? What model does it use? – FROSIT Jul 21 '15 at 13:45
  • In which layout file is getAllowWriteReviewFlag() being called? And has this been defined in the corresponding Block? – eetzen Jul 21 '15 at 16:02
0

It sounds like you are using a block that does not inherit that method (function). Instead you could check in the system config object for the setting.

$_userCanReview = Mage::getStoreConfig('catalog/review/allow_guest');

That will return a string of 1 or 0. Remember that you will also (probably) need to determine whether a user is logged in or not; so that registered and logged-in users can write reviews.

$_userLoggedIn = Mage::getSingleton('customer/session')->isLoggedIn();

I'll leave it to you to put together for you own use case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.