Advertisement
Guest User

Untitled

a guest
Oct 1st, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. if (!$this->canShow($product)) {
  2. return false;
  3. }
  4.  
  5. <?php
  6. class Namespace_Modulename_Helper_Product extends Mage_Catalog_Helper_Product
  7. {
  8. //use to check product view visibility status
  9. const VISIBILITY_IN_PRODUCT_VIEW_PAGE = 1;
  10.  
  11. public function canShow($product, $where = 'catalog')
  12. {
  13. if (is_int($product)) {
  14. $product = Mage::getModel('catalog/product')->load($product);
  15. }
  16.  
  17. /* @var $product Mage_Catalog_Model_Product */
  18.  
  19. if (!$product->getId()) {
  20. return false;
  21. }
  22. if ($product->isVisibleInCatalog()) {
  23. if ($product->getVisibilityInProductView() == self::VISIBILITY_IN_PRODUCT_VIEW_PAGE) {
  24. return true;
  25. }
  26. }
  27. else {
  28. return false;
  29. }
  30. }
  31. }
  32.  
  33. if ($product->isVisibleInCatalog()) {
  34. if ($product->getVisibilityInProductView() == self::VISIBILITY_IN_PRODUCT_VIEW_PAGE) {
  35. return true;
  36. }
  37. }
  38. else {
  39. return false;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement