Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (!$this->canShow($product)) {
- return false;
- }
- <?php
- class Namespace_Modulename_Helper_Product extends Mage_Catalog_Helper_Product
- {
- //use to check product view visibility status
- const VISIBILITY_IN_PRODUCT_VIEW_PAGE = 1;
- public function canShow($product, $where = 'catalog')
- {
- if (is_int($product)) {
- $product = Mage::getModel('catalog/product')->load($product);
- }
- /* @var $product Mage_Catalog_Model_Product */
- if (!$product->getId()) {
- return false;
- }
- if ($product->isVisibleInCatalog()) {
- if ($product->getVisibilityInProductView() == self::VISIBILITY_IN_PRODUCT_VIEW_PAGE) {
- return true;
- }
- }
- else {
- return false;
- }
- }
- }
- if ($product->isVisibleInCatalog()) {
- if ($product->getVisibilityInProductView() == self::VISIBILITY_IN_PRODUCT_VIEW_PAGE) {
- return true;
- }
- }
- else {
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement