Example #1
0
 /**
  * Product view block, don't cache if rendered with cart item update
  *
  * @param Mage_Catalog_Block_Product_View $block
  */
 public function applyProductView(Mage_Catalog_Block_Product_Abstract $block)
 {
     // The "messages" block is session-dependent, don't cache
     if (Mage::helper('cache')->responseHasMessages()) {
         $block->setData('cache_lifetime', null);
         return;
     }
     // Cart stuff is session-dependent
     $request = $block->getRequest();
     if ($request->getModuleName() == 'checkout' && $request->getControllerName() == 'cart' && $request->getActionName() == 'configure' && $request->getParam('id')) {
         $block->setData('cache_lifetime', null);
         return;
     }
     // Set cache keys
     $keys = $block->getCacheKeys();
     $customer = Mage::getSingleton('customer/session')->getCustomer();
     $keys = array_merge($keys, array($customer->getGroupId()));
     $product = $block->getProduct();
     if ($product) {
         $tags = array(Mage_Catalog_Model_Product::CACHE_TAG . '_' . $block->getProduct()->getId());
         $taxCalculator = Mage::getModel('tax/calculation');
         $product = $block->getProduct();
         $keys = array_merge($keys, array($product->getId(), $taxCalculator->getRate($taxCalculator->getRateRequest()->setProductClassId($product->getTaxClassId()))));
     } else {
         $tags = array(Mage_Catalog_Model_Product::CACHE_TAG);
     }
     $block->setData('cache_tags', $tags);
     $block->setData('cache_keys', $keys);
 }
Example #2
0
 protected function _toHtml()
 {
     $html = "\n<!-- MSEMANTIC 1.2.6.5 begin -->";
     $html .= "\n";
     $id = Mage::registry('current_product')->getId();
     $product = Mage::getModel('catalog/product')->load($id);
     if ($product->getTypeId() == "grouped") {
         $html .= "<!-- Magento grouped products are not supported by MSemantic at the moment.-->";
     } else {
         @(include_once "../../EssentiaLib/includeAll.php");
         $this->initData();
         if ($this->settings['basicsettings']['active']) {
             $html .= parent::_toHtml();
             $this->rdff->useRdfNamespaces("rdf,rdfs,xsd,dc,owl,vcard,gr,product,v,foaf,media");
             $html .= $this->rdff->startRdfa($this->Business->getLegalName());
             $this->GR->setBusiness($this->Business)->setProduct($this->Product);
             $html .= $this->GR->pOffering();
             $html .= $this->rdff->endRdfa();
             //@webdirx_div::debug(htmlentities($html));
         }
     }
     $html .= "\n";
     $html .= "<!-- MSEMANTIC end. http://www.msemantic.com -->\n";
     return $html;
 }
Example #3
0
 protected function _beforeToHtml()
 {
     $todayDate = AO::app()->getLocale()->date()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
     $collection = $this->_addProductAttributesAndPrices(AO::getResourceModel('catalog/product_collection'))->addStoreFilter()->addAttributeToFilter('news_from_date', array('date' => true, 'to' => $todayDate))->addAttributeToFilter('news_to_date', array('or' => array(0 => array('date' => true, 'from' => $todayDate), 1 => array('is' => new Zend_Db_Expr('null')))), 'left')->addAttributeToSort('news_from_date', 'desc')->setPageSize($this->getProductsCount())->setCurPage(1);
     $this->setProductCollection($collection);
     return parent::_beforeToHtml();
 }
Example #4
0
 public function __construct()
 {
     $this->configP = Mage::getStoreConfig('dailydeal/general');
     parent::__construct();
     $maxday = 350;
     $from = (int) @$_GET['from'];
     $to = (int) @$_GET['to'];
     $to = $to == $maxday ? 0 : $to;
     $datefrom = date('Y-m-d H:i:s', mktime(0, 0, 0, date('m'), date('d') + $from, date('y')));
     $dateto = date('Y-m-d H:i:s', mktime(0, 0, 0, date('m'), date('d') + $to, date('y')));
     $todayDate = date('Y-m-d H:i:s');
     //echo $todayDate;
     // $todayDate = '2014-01-11 11:24:39 ';
     // $dateFrom = Mage::app()->getLocale()->date($todayDate, Varien_Date::DATETIME_INTERNAL_FORMAT);
     // echo Mage::getModel('core/date')->gmtDate(null, time());
     //echo Mage::getModel('core/date')->gmtDate();
     //echo Mage::getModel('core/date')->gmtDate(null, time());
     // echo $dateFrom = Mage::app()->getLocale()->date(date('Y-m-d H:i:s'), Varien_Date::DATETIME_INTERNAL_FORMAT);
     $tomorrow = mktime(0, 0, 0, date('m'), date('d') + 1, date('y'));
     $tomorrowDate = date('m/d/y', $tomorrow);
     $collection = Mage::getResourceModel('catalogsearch/advanced_collection')->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())->addMinimalPrice()->addStoreFilter();
     Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
     $collection->getSelect()->join(array('t2' => Mage::getSingleton('core/resource')->getTableName('dailydeal/dailydealproducts')), '(e.entity_id = t2.productid and t2.status != 2 ' . ($from ? ' and t2.closetime >= "' . $datefrom . '"' : ' and t2.starttime <= "' . $todayDate . '"') . ($to ? ' and t2.closetime <= "' . $dateto . '"' : '') . ' and t2.closetime >= "' . $todayDate . '")', array('t2.sold', 't2.save', 't2.quantity', 't2.starttime', 't2.closetime'));
     // Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
     // $collection->getSelect()->join(array('t2' => Mage::getSingleton('core/resource')->getTableName('dailydeal/dailydealproducts')),'e.entity_id = t2.productid ', array('t2.sold', 't2.save', 't2.quantity', 't2.starttime', 't2.closetime'));
     //$collection->getSelect()->group('e.entity_id');
     // echo count($collection);
     //$collection->setPageSize($this->get_prod_count())->setCurPage($this->get_cur_page());
     $this->setCollection($collection);
 }
 public function getGroupIdentifier()
 {
     if (parent::getGroupIdentifier()) {
         return parent::getGroupIdentifier();
     }
     return 'default';
 }
Example #6
0
 protected function _prepareLayout()
 {
     if ($breadcrumbsBlock = $this->getLayout()->getBlock('breadcrumbs')) {
         $product = $this->getProduct();
         $sess = Mage::getSingleton('udropship/session');
         $searchUrlKey = $sess->getData('udsell_search_type') ? 'mysellSearch' : 'sellSearch';
         if ($sess->getData('udsell_search_type')) {
             $breadcrumbsBlock->addCrumb('sellyours', array('label' => Mage::helper('catalog')->__('My Sell List'), 'title' => Mage::helper('catalog')->__('My Sell List'), 'link' => $this->getUrl('udsell/index/mysellSearch')));
         } else {
             $breadcrumbsBlock->addCrumb('sellyours', array('label' => Mage::helper('catalog')->__('Sell Yours'), 'title' => Mage::helper('catalog')->__('Sell Yours'), 'link' => $this->getUrl('udsell/index/sellSearch')));
         }
         if (Mage::registry('current_category')) {
             $cat = Mage::registry('current_category');
             $pathIds = explode(',', $cat->getPathInStore());
             array_shift($pathIds);
             $cats = Mage::helper('udropship/catalog')->getCategoriesCollection($pathIds);
             foreach ($cats as $c) {
                 $breadcrumbsBlock->addCrumb('sellyours_cat' . $c->getId(), array('label' => $c->getName(), 'title' => $c->getName(), 'link' => $this->getUrl('udsell/index/' . $searchUrlKey, array('_current' => true, 'c' => $c->getId()))));
             }
             $breadcrumbsBlock->addCrumb('sellyours_cat' . $cat->getId(), array('label' => $cat->getName(), 'title' => $cat->getName(), 'link' => $this->getUrl('udsell/index/' . $searchUrlKey, array('_current' => true, 'c' => $cat->getId()))));
         }
         $breadcrumbsBlock->addCrumb('sellyours_query', array('label' => htmlspecialchars($product->getName()), 'title' => htmlspecialchars($product->getName()), 'link' => $this->getUrl('*/*/*', array('_current' => true))));
     }
     return Mage_Catalog_Block_Product_Abstract::_prepareLayout();
 }
 /**
  * Add meta information from product to head block
  *
  * @return Mage_Catalog_Block_Product_View
  */
 protected function _prepareLayout()
 {
     $this->getLayout()->createBlock('catalog/breadcrumbs');
     $headBlock = $this->getLayout()->getBlock('head');
     if ($headBlock) {
         $product = $this->getProduct();
         $title = $product->getMetaTitle();
         if ($title) {
             $headBlock->setTitle($title);
         }
         $keyword = $product->getMetaKeyword();
         $currentCategory = Mage::registry('current_category');
         if ($keyword) {
             $headBlock->setKeywords($keyword);
         } elseif ($currentCategory) {
             $headBlock->setKeywords($product->getName());
         }
         $description = $product->getMetaDescription();
         if ($description) {
             $headBlock->setDescription($description);
         } else {
             $headBlock->setDescription(Mage::helper('core/string')->substr($product->getDescription(), 0, 255));
         }
     }
     return Mage_Catalog_Block_Product_Abstract::_prepareLayout();
 }
Example #8
0
 public function __construct($attributes = array())
 {
     $helper = Mage::helper('ves_verticalmenu/data');
     $this->_config = $helper->get($attributes);
     /* End init meida files */
     parent::__construct();
 }
Example #9
0
 protected function _toHtml()
 {
     if (!(bool) Mage::getStoreConfig('newproducts/general/active')) {
         return '';
     }
     return parent::_toHtml();
 }
 protected function _prepareLayout()
 {
     $title = $this->getHeaderText();
     $this->getLayout()->getBlock('head')->setTitle($title);
     $this->getLayout()->getBlock('root')->setHeaderTitle($title);
     return parent::_prepareLayout();
 }
Example #11
0
 protected function _beforeToHtml()
 {
     if ($this->getTemplate() == 'dgt/widget/default.phtml') {
         switch ($this->getData('widget_type')) {
             case 'product':
                 switch ($this->getData('mode')) {
                     case 'related':
                         $this->setTemplate('dgt/widget/related.phtml');
                         break;
                     default:
                         $this->setTemplate('dgt/widget/product.phtml');
                         break;
                 }
                 switch ($this->getData('widget_tab')) {
                     case 'categories':
                     case 'collections':
                         $this->setTemplate('dgt/widget/tab.phtml');
                         break;
                 }
                 break;
             case 'attribute':
                 $this->setTemplate('dgt/widget/attribute.phtml');
                 break;
             case 'block':
                 $this->setTemplate('dgt/widget/block.phtml');
                 break;
             case 'category':
                 $this->setTemplate('dgt/widget/category.phtml');
                 break;
         }
     }
     return parent::_beforeToHtml();
 }
 /**
  * Preparing layout
  *
  * @return Mage_Catalog_Block_Product_Compare_List
  */
 protected function _prepareLayout()
 {
     if ($headBlock = $this->getLayout()->getBlock('head')) {
         $headBlock->setTitle(AO::helper('catalog')->__('Compare Products List') . ' - ' . $headBlock->getDefaultTitle());
     }
     return parent::_prepareLayout();
 }
Example #13
0
 /**
  * Add meta information from product to head block
  *
  * @return Mage_Catalog_Block_Product_View
  */
 protected function _prepareLayout()
 {
     $this->getLayout()->createBlock('catalog/breadcrumbs');
     $headBlock = $this->getLayout()->getBlock('head');
     if ($headBlock) {
         $product = $this->getProduct();
         $title = $product->getMetaTitle();
         if ($title) {
             $headBlock->setTitle($title);
         }
         $keyword = $product->getMetaKeyword();
         $currentCategory = Mage::registry('current_category');
         if ($keyword) {
             $headBlock->setKeywords($keyword);
         } elseif ($currentCategory) {
             $headBlock->setKeywords($product->getName());
         }
         $description = $product->getMetaDescription();
         if ($description) {
             $headBlock->setDescription($description);
         } else {
             $headBlock->setDescription(Mage::helper('core/string')->substr($product->getDescription(), 0, 255));
         }
         if ($this->helper('catalog/product')->canUseCanonicalTag()) {
             $params = array('_ignore_category' => true);
             $headBlock->addLinkRel('canonical', $product->getUrlModel()->getUrl($product, $params));
         }
     }
     return parent::_prepareLayout();
 }
Example #14
0
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     $toolbar = $this->getToolbarBlock();
     $collection = $this->getCollection();
     if ($orders = $this->getAvailableOrders()) {
         $toolbar->setAvailableOrders($orders);
     }
     if ($sort = $this->getSortBy()) {
         $toolbar->setDefaultOrder($sort);
     }
     if ($dir = $this->getDefaultDirection()) {
         $toolbar->setDefaultDirection($dir);
     }
     $toolbar->setCollection($collection);
     $this->setChild('toolbar', $toolbar);
     $this->getCollection()->load();
     $partner = $this->getProfileDetail();
     if ($partner->getShoptitle() != '') {
         $this->getLayout()->getBlock('head')->setTitle($partner->getShoptitle());
     } else {
         $this->getLayout()->getBlock('head')->setTitle($partner->getProfileurl());
     }
     $this->getLayout()->getBlock('head')->setKeywords($partner->getMetaKeyword());
     $this->getLayout()->getBlock('head')->setDescription($partner->getMetaDescription());
     return $this;
 }
Example #15
0
 protected function _toHtml()
 {
     if (!$this->helper('featuredproducts')->getIsActive()) {
         return '';
     }
     return parent::_toHtml();
 }
Example #16
0
 public function __construct()
 {
     parent::__construct();
     $productSize = 5;
     //  No Of Products Display in Frontend
     $storeId = Mage::app()->getStore()->getId();
     $sql = "SELECT f.product_id, f.qty_ordered  FROM sales_flat_order_item as f, sales_order as s WHERE s.entity_id = f.order_id and s.store_id = {$storeId} and f.parent_item_id is NULL";
     $data = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($sql);
     $output = array();
     foreach ($data as $d) {
         if (isset($output[$d['product_id']])) {
             $output[$d['product_id']] += $d['qty_ordered'];
         } else {
             $output[$d['product_id']] = $d['qty_ordered'];
         }
     }
     arsort($output);
     $final = array_slice(array_keys($output), 0, $productSize);
     $products = Mage::getModel('catalog/product')->getCollection();
     $products->addAttributeToSelect('*');
     $products->addAttributeToFilter('entity_id', array('in' => $final));
     $products->load();
     Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
     Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
     $this->setProductCollection($products);
 }
Example #17
0
 public function __construct($attributes = array())
 {
     $helper = Mage::helper('ves_megamenu/data');
     $this->_config = $helper->get($attributes);
     if ($attributes) {
         $this->convertAttributesToConfig($attributes);
     }
     /* End init meida files */
     parent::__construct();
     if ($this->hasData("template") && $this->getData("template")) {
         $this->setTemplate($this->getData("template"));
     } else {
         $this->setTemplate('ves/megamenu/default.phtml');
     }
     /*Cache Block*/
     $enable_cache = $this->getConfig("enable_cache", 1);
     if (!$enable_cache) {
         $cache_lifetime = null;
     } else {
         $cache_lifetime = $this->getConfig("cache_lifetime", 86400);
         $cache_lifetime = (int) $cache_lifetime > 0 ? $cache_lifetime : 86400;
     }
     $this->addData(array('cache_lifetime' => $cache_lifetime));
     $this->addCacheTag(array(Mage_Core_Model_Store::CACHE_TAG, Mage_Cms_Model_Block::CACHE_TAG, Ves_Megamenu_Model_Megamenu::CACHE_BLOCK_TAG));
     /*End Cache Block*/
 }
Example #18
0
 /**
  * Render product info as hidden meta data if the module is enabled for the
  * current store.
  * If it is a "bundle" product with fixed price type, then do not render.
  * These are not supported due to their child products not having prices
  * available.
  *
  * @return string
  */
 protected function _toHtml()
 {
     if (!Mage::helper('nosto_tagging')->isModuleEnabled() || !Mage::helper('nosto_tagging/account')->existsAndIsConnected()) {
         return '';
     }
     return parent::_toHtml();
 }
Example #19
0
 public function __construct()
 {
     parent::__construct();
     //        $this->setTemplate('reports/product_viewed.phtml');
     $ignore = null;
     if (($product = Mage::registry('product')) && $product->getId()) {
         $ignore = $product->getId();
     }
     $customer = Mage::getSingleton('customer/session')->getCustomer();
     if ($customer->getId()) {
         $subjectId = $customer->getId();
         $subtype = 0;
     } else {
         $subjectId = Mage::getSingleton('log/visitor')->getId();
         $subtype = 1;
     }
     $collection = Mage::getModel('reports/event')->getCollection()->addRecentlyFiler(1, $subjectId, $subtype, $ignore);
     $productIds = array();
     foreach ($collection as $event) {
         $productIds[] = $event->getObjectId();
     }
     unset($collection);
     $productCollection = null;
     if ($productIds) {
         $productCollection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('name')->addAttributeToSelect('price')->addAttributeToSelect('small_image')->addIdFilter($productIds);
         Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($productCollection);
         Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($productCollection);
         $productCollection->setPageSize(5)->setCurPage(1)->load();
     }
     $this->setRecentlyViewedProducts($productCollection);
 }
Example #20
0
 /**
  * _construct
  */
 public function _construct()
 {
     parent::_construct();
     $this->addPriceBlockType('simple', 'catalog/product_price', 'merchandiser/new/category/price.phtml');
     $this->addPriceBlockType('grouped', 'catalog/product_price', 'merchandiser/new/category/price-grouped.phtml');
     $this->addPriceBlockType('configurable', 'catalog/product_price', 'merchandiser/new/category/price-configurable.phtml');
 }
Example #21
0
 /**
  * Add meta information from product to head block
  *
  * @return Mage_Catalog_Block_Product_View
  */
 protected function _prepareLayout()
 {
     $this->getLayout()->createBlock('catalog/breadcrumbs');
     $headBlock = $this->getLayout()->getBlock('head');
     if ($headBlock) {
         $title = $this->getProduct()->getMetaTitle();
         if ($title) {
             $headBlock->setTitle($title);
         }
         $keyword = $this->getProduct()->getMetaKeyword();
         $currentCategory = Mage::registry('current_category');
         if ($keyword) {
             $headBlock->setKeywords($keyword);
         } elseif ($currentCategory) {
             $headBlock->setKeywords($this->getProduct()->getName());
         }
         $description = $this->getProduct()->getMetaDescription();
         if ($description) {
             $headBlock->setDescription($description);
         } else {
             $headBlock->setDescription($this->getProduct()->getDescription());
         }
     }
     return parent::_prepareLayout();
 }
 /**
  * Retrive product
  *
  * @return Mage_Catalog_Model_Product
  */
 public function getProduct()
 {
     $product = parent::getProduct();
     if (is_null($product->getTypeInstance(true)->getStoreFilter($product))) {
         $product->getTypeInstance(true)->setStoreFilter(Mage::app()->getStore(), $product);
     }
     return $product;
 }
 /**
  * Render product info as hidden meta data if the module is enabled for the
  * current store.
  * If it is a "bundle" product with fixed price type, then do not render.
  * These are not supported due to their child products not having prices
  * available.
  *
  * @return string
  */
 protected function _toHtml()
 {
     $product = $this->getProduct();
     if (!Mage::helper('nosto_tagging')->isModuleEnabled() || !Mage::helper('nosto_tagging/account')->existsAndIsConnected() || $product->getTypeId() === Mage_Catalog_Model_Product_Type::TYPE_BUNDLE && (int) $product->getPriceType() === Mage_Bundle_Model_Product_Price::PRICE_TYPE_FIXED) {
         return '';
     }
     return parent::_toHtml();
 }
Example #24
0
 protected function _toHtml()
 {
     if (sizeof($this->getWishlistItems()->getItems()) > 0) {
         return parent::_toHtml();
     } else {
         return '';
     }
 }
Example #25
0
 protected function _beforeToHtml()
 {
     $collection = Mage::getSingleton('catalogsale/layer')->getProductCollection();
     $collection->setPageSize($this->getProductsCount())->setCurPage(1);
     $collection->getSelect()->order('rand()');
     $this->setProductCollection($collection);
     return parent::_beforeToHtml();
 }
Example #26
0
 public function getAddToCartUrl($product, $additional = array())
 {
     $additional = array();
     if ($this->getRequest()->getParam('wishlist_next')) {
         $additional['wishlist_next'] = 1;
     }
     return parent::getAddToCartUrl($product, $additional);
 }
Example #27
0
 protected function _beforeToHtml()
 {
     $collection = Mage::getResourceModel('catalog/product_collection');
     $collection->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds());
     $collection = $this->_addProductAttributesAndPrices($collection)->addStoreFilter()->addAttributeToSort('entity_id', 'desc')->setPageSize($this->getLimit())->setCurPage(1);
     $this->setProductCollection($collection);
     return parent::_beforeToHtml();
 }
Example #28
0
 public function getAddToCartUrl($product, $additional = array())
 {
     if ($this->helper('icart')->isEnabled()) {
         return $this->helper('icart')->getAddUrl($product, $additional);
     } else {
         return parent::getAddToCartUrl($product, $additional);
     }
 }
Example #29
0
 public function getCacheKeyInfo()
 {
     $info = parent::getCacheKeyInfo();
     $info[] = Mage::app()->getStore()->getCurrentCurrencyCode();
     $info[] = Mage::getSingleton('customer/session')->getCustomerGroupId();
     $info[] = $this->getProduct()->getId();
     return $info;
 }
Example #30
0
 /**
  * Render product info as hidden meta data if the module is enabled for the
  * current store.
  * If it is a "bundle" product with fixed price type, then do not render.
  * These are not supported due to their child products not having prices
  * available.
  *
  * @return string
  */
 protected function _toHtml()
 {
     /** @var Nosto_Tagging_Helper_Account $helper */
     $helper = Mage::helper('nosto_tagging/account');
     if (!Mage::helper('nosto_tagging')->isModuleEnabled() || !$helper->existsAndIsConnected()) {
         return '';
     }
     return parent::_toHtml();
 }