public function topcartAction()
 {
     # TOPCART
     $quote = Mage::helper('checkout/cart')->getQuote();
     $items = $quote->getAllItems();
     $count = 0;
     foreach ($items as $item) {
         if ($item->getProduct()->getTypeId() == 'cartproduct') {
             continue;
         } elseif ($item->getParentItemId()) {
             continue;
         }
         $count += $item->getQty();
     }
     $total = Mage::helper('core')->currency(Mage::getSingleton('checkout/session')->getQuote()->getSubtotal());
     $topcart = '<p class="item-canvas">Items in cart: ' . $count . ' Total: ' . $total . ' </p>';
     $content = array('topcart' => $topcart);
     # FEATURED IN NAVIGATION
     $nav = new Mage_Catalog_Block_Navigation();
     $helper = Mage::helper('catalog/category');
     $categories = $helper->getStoreCategories();
     foreach ($categories as $c) {
         $content['featured-' . $c->getId()] = $nav->getFeaturedProductsBox($c);
     }
     # ONSALE
     $onsale = new Cofamedia_Onsale_Block_Onsale();
     $content['onsale'] = $this->getLayout()->createBlock('onsale/onsale')->setTemplate('onsale/onsale.phtml')->toHtml();
     echo Zend_Json::encode($content);
 }
Example #2
0
 public function renderCategoriesMenuHtml($level = 0, $outermostItemClass = '', $childrenWrapClass = '')
 {
     if ($this->_checkHideNavigation()) {
         return '';
     }
     return parent::renderCategoriesMenuHtml($level, $outermostItemClass, $childrenWrapClass);
 }
Example #3
0
 public function _toHtml()
 {
     if (!(bool) Mage::getStoreConfig('manufacturer/general/enable')) {
         return '';
     }
     return parent::_toHtml();
 }
Example #4
0
 public function drawItem($category, $level = 0, $last = false)
 {
     if ($this->_checkLoginCatalog()) {
         return '';
     }
     return parent::drawItem($category, $level, $last);
 }
Example #5
0
 /**
  * We set cache to null when product direct access option is enabled and customer
  * is in product page to avoid wrong category tree showing with enabled caches
  * 
  * Adds 1 extra second to page load
  * Ultra version has caching and best performance
  * 
  * @return null
  */
 public function getCacheLifetime()
 {
     $condition = Mage::registry('current_product') !== null && $this->getConfig()->activeProductCategoriesInDirectAccess();
     if ($condition) {
         return null;
     }
     return parent::getCacheLifetime();
 }
Example #6
0
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     $urlBuilder = Mage::getModel('amshopby/url_builder');
     /** @var Amasty_Shopby_Model_Url_Builder $urlBuilder */
     $urlBuilder->reset();
     $urlBuilder->clearPagination();
     $this->urlBuilder = $urlBuilder;
 }
 protected function _construct()
 {
     parent::_construct();
     $this->p0b = array(self::DDTYPE_MEGA => "mega", self::DDTYPE_CLASSIC => "classic", self::DDTYPE_SIMPLE => "simple");
     $this->p0c = FALSE;
     $this->p0d = "#@#";
     $this->p0e = FALSE;
     $this->p0f = NULL;
     if (Mage::registry('current_category')) {
         $this->p10 = Mage::registry('current_category')->getId();
     }
 }
Example #8
0
 public function renderCategoriesMenuHtml($catId = 0, $level = 0, $outermostItemClass = '', $childrenWrapClass = '')
 {
     if (!$catId) {
         return parent::renderCategoriesMenuHtml($level, $outermostItemClass, $childrenWrapClass);
     } else {
         $catId = str_replace("category/", "", $catId);
         $storeId = Mage::app()->getStore()->getId();
         $lib_multicache = Mage::helper('megamenupro/multicache');
         $cache = Mage::getStoreConfig('megamenupro/enable_cache');
         $html = "";
         if ($cache == 1) {
             $html = $lib_multicache->get('navigation_' . $storeId . '_' . $catId . '_' . $level);
         }
         if (!$html) {
             $this->cleanCache();
             if (Mage::helper('catalog/category_flat')->isEnabled()) {
                 $categories = Mage::getModel('megamenupro/megamenupro')->getCategories($catId);
             } else {
                 $categories = Mage::getModel('catalog/category')->getCategories($catId);
             }
             $activeCategories = array();
             foreach ($categories as $child) {
                 if ($child->getIsActive()) {
                     $activeCategories[] = $child;
                 }
             }
             $activeCategoriesCount = count($activeCategories);
             $hasActiveCategoriesCount = $activeCategoriesCount > 0;
             if (!$hasActiveCategoriesCount) {
                 return '';
             }
             $html = '';
             $j = 0;
             foreach ($activeCategories as $category) {
                 $html .= $this->_renderCategoryMenuItemHtml($category, $level, $j == $activeCategoriesCount - 1, $j == 0, true, $outermostItemClass, $childrenWrapClass, true);
                 $j++;
             }
             $html = base64_encode($html);
             if ($cache == 1) {
                 $this->time_cache = Mage::getStoreConfig('megamenupro/cache_time');
                 $lib_multicache = Mage::helper('megamenupro/multicache');
                 $lib_multicache->set('navigation_' . $storeId . '_' . $catId . '_' . $level, $html, $this->time_cache * 60);
             }
         }
         return base64_decode($html);
     }
 }
 public function _prepareLayout()
 {
     return parent::_prepareLayout();
 }
Example #10
0
 protected function _prepareLayout()
 {
     $this->_prepareFrames();
     parent::_prepareLayout();
 }
Example #11
0
 /**
  * Construct parent and define $_config
  *
  */
 protected function _construct()
 {
     parent::_construct();
     $this->_config = Mage::getModel('sidenav/config');
 }
    public function favpanelloadAction()
    {
        $obj = new Mage_Catalog_Block_Navigation();
        $activeCategories = array();
        foreach ($obj->getStoreCategories() as $child) {
            if ($child->getIsActive()) {
                $activeCategories[] = $child;
            }
        }
        if (count($activeCategories) < 1) {
            return '';
        }
        $tempcounter = 1;
        foreach ($activeCategories as $category) {
            if (strtolower($category->getName()) != 'clearance') {
                if ($tempcounter <= 3) {
                    $even[] = $category->getId();
                } else {
                    $odd[] = $category->getId();
                }
                $tempcounter++;
            }
        }
        /* bestseller collection picked */
        $storeId = Mage::app()->getStore()->getId();
        //$bestseller_products_parent = Mage::getResourceModel('productreports/product_collection')->addOrderedQtyCustom()->addAttributeToSelect('*')->setStoreId($storeId)->addAttributeToFilter('type_id','configurable')->addStoreFilter($storeId)->setOrder('ordered_qty', 'desc'); // most best sellers on top
        /* bestseller collection picked */
        $_bestSellertobeDisplayed = (int) Mage::getStoreConfig('bannerlist/fav_settings/num_to_display');
        $_tobedisplayedfirst = (int) Mage::getStoreConfig('bannerlist/fav_settings/display_order');
        $ctr = 1;
        $html = '';
        $html .= '<div class="top-panel">';
        foreach ($even as $category_id) {
            $category = Mage::getModel("catalog/category")->load($category_id);
            $subCats = $category->getChildren();
            //show only the enabled childs (dont show "Get the Look" childs)
            $subCatsArr = explode(",", $subCats);
            $bestseller_products_ids = array();
            $bestseller_products = Mage::getResourceModel('productreports/product_collection')->addOrderedQtyCustom()->addAttributeToSelect('*')->setStoreId($storeId)->addAttributeToFilter('type_id', 'configurable')->addStoreFilter($storeId)->addCategoryFilter($category)->addViewsCount()->setPageSize($_bestSellertobeDisplayed);
            Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($bestseller_products);
            Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($bestseller_products);
            foreach ($bestseller_products as $bestproducts) {
                $bestseller_products_ids[] = $bestproducts->getEntityId();
            }
            unset($bestseller_products);
            unset($bestproducts);
            $cat_name = strtolower($category->getName());
            $catID = $category->getId();
            $html .= '<div class="b-category-item">
							<div class="cat-div">
							<div class="cat-name">' . $cat_name . '</div></div>';
            $product_collection = $category->getProductCollection()->addFieldToFilter("status", 1)->addFieldToFilter("visibility", 4)->addAttributeToFilter("inchoo_featured_product", 1);
            if ($_tobedisplayedfirst == 0) {
                $ids_merged = array_unique(array_merge($bestseller_products_ids, $product_collection->getAllIds()));
            } elseif ($_tobedisplayedfirst == 1) {
                $ids_merged = array_unique(array_merge($product_collection->getAllIds(), $bestseller_products_ids));
            } else {
                $ids_merged = array_unique(array_merge($bestseller_products_ids, $product_collection->getAllIds()));
            }
            if (sizeof($ids_merged) > 0) {
                $i = sizeof($ids_merged);
                $counter = 0;
                $flag = false;
                foreach ($ids_merged as $product_ids) {
                    $_product = Mage::getModel('catalog/product')->load($product_ids);
                    $commArr = array();
                    $prod_cats = $_product->getCategoryIds();
                    $commArr = array_intersect($prod_cats, $subCatsArr);
                    if (is_array($commArr) && count($commArr)) {
                        if ($_product != "") {
                            if ($_product->isSaleable()) {
                                if ($counter == 0) {
                                    $html .= '<ul id="favcarousel' . $ctr . '" class="jcarousel jcarousel-skin-tango cat-products-' . $category->getId() . ' main-cat-ul">';
                                    $flag = true;
                                }
                                $html .= '<li class="prod-name">
															<div class="prod-image">
																<a href="' . $_product->getProductUrl() . '?catId=' . $catID . '&name=' . $_product->getName() . '">
																	<img src="' . Mage::helper("catalog/image")->init($_product, "small_image")->resize(110, 110) . '" alt="' . $_product->getName() . '" title="' . $_product->getName() . '" />
																</a>
															</div>
															<div class="prod-container">
																<div class="prod-name">
																	<a href="' . $_product->getProductUrl() . '?catId=' . $catID . '&name=' . $_product->getName() . '">';
                                $name = $_product->getName();
                                if (strlen($name) > 15) {
                                    $html .= substr($name, 0, 15) . "...";
                                } else {
                                    $html .= $name;
                                }
                                $html .= '</a>
																</div>
															<div class="prod-price">';
                                $defPrice = $_product->getPrice();
                                $specialprice = 0;
                                $_taxHelper = Mage::helper('tax');
                                $currentDate = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
                                $currentDate = date("Y-m-d h:m:s", $currentDate);
                                $specialToDate = $_product->getSpecialToDate();
                                $specialFromDate = $_product->getSpecialFromDate();
                                if (($currentDate >= $specialFromDate && $currentDate < $specialToDate || $specialToDate == "") && $_product->getSpecialPrice() != 0) {
                                    $price = $_product->getFinalPrice();
                                    $specialprice = $_product->getSpecialPrice();
                                } else {
                                    $price = $_product->getFinalPrice();
                                }
                                $price = $_taxHelper->getPrice($_product, $price, true);
                                if ($specialprice != 0 && (int) $specialprice <= (int) $price) {
                                    $specialprice = $_taxHelper->getPrice($_product, $_product->getSpecialPrice(), true);
                                    $price = $specialprice;
                                }
                                if (!((int) $price < (int) $defPrice)) {
                                    $html .= Mage::helper('common')->currency($price);
                                } else {
                                    // Discount percents output start
                                    $_savePercent = 100 - round($price / $defPrice * 100);
                                    $html .= '<div class="strike">' . Mage::helper('common')->currency($defPrice) . '</div><div class="red">' . Mage::helper('common')->currency($price) . '</div><div class="price-discount-flag-fav"><span>' . $_savePercent . '% OFF</span></div>';
                                }
                                $html .= '</div>
														<button type="submit" onClick="setLocation(\'' . $this->getAddToCartUrl($_product) . '\')" class="add-to-basket">Add to Basket</button>
													</div>
												</li>';
                                $counter++;
                            }
                        }
                    }
                    unset($_product);
                }
                if ($counter > 0 && $flag) {
                    $html .= '</ul>';
                }
                unset($product_collection);
                unset($ids_merged);
            }
            $html .= '</div>';
            unset($category);
            unset($bestseller_products_ids);
            $ctr++;
        }
        $html .= '</div>';
        $html .= '<div class="bottom-panel">';
        foreach ($odd as $category_id) {
            $category = Mage::getModel("catalog/category")->load($category_id);
            $subCats = $category->getChildren();
            //show only the enabled childs (dont show "Get the Look" childs)
            $subCatsArr = explode(",", $subCats);
            $bestseller_products = Mage::getResourceModel('productreports/product_collection')->addOrderedQtyCustom()->addAttributeToSelect('*')->setStoreId($storeId)->addAttributeToFilter('type_id', 'configurable')->addStoreFilter($storeId)->addCategoryFilter($category)->addViewsCount()->setPageSize($_bestSellertobeDisplayed);
            Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($bestseller_products);
            Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($bestseller_products);
            $bestseller_products_ids = array();
            foreach ($bestseller_products as $bestproducts) {
                $bestseller_products_ids[] = $bestproducts->getEntityId();
            }
            unset($bestseller_products);
            unset($bestproducts);
            $cat_name = strtolower($category->getName());
            $catID = $category->getId();
            $html .= '<div class="b-category-item">
							<div class="cat-div">
								<div class="cat-name">' . $cat_name . '</div>
							</div>';
            $product_collection = $category->getProductCollection()->addFieldToFilter("status", 1)->addFieldToFilter("visibility", 4)->addAttributeToFilter("inchoo_featured_product", 1);
            if ($_tobedisplayedfirst == 0) {
                $ids_merged = array_unique(array_merge($bestseller_products_ids, $product_collection->getAllIds()));
            } elseif ($_tobedisplayedfirst == 1) {
                $ids_merged = array_unique(array_merge($product_collection->getAllIds(), $bestseller_products_ids));
            } else {
                $ids_merged = array_unique(array_merge($bestseller_products_ids, $product_collection->getAllIds()));
            }
            if (sizeof($ids_merged) > 0) {
                $i = sizeof($ids_merged);
                $counter = 0;
                $flag = false;
                foreach ($ids_merged as $product_id) {
                    $_product = Mage::getModel('catalog/product')->load($product_id);
                    $commArr = array();
                    $prod_cats = $_product->getCategoryIds();
                    $commArr = array_intersect($prod_cats, $subCatsArr);
                    if (is_array($commArr) && count($commArr)) {
                        if ($_product != "") {
                            if ($_product->isSaleable()) {
                                if ($counter == 0) {
                                    $html .= '<ul id="favcarousel' . $ctr . '" class="jcarousel jcarousel-skin-tango cat-products-' . $category->getId() . ' main-cat-ul">';
                                    $flag = true;
                                }
                                $html .= '<li class="prod-name">
											<div class="prod-image">
												<a href="' . $_product->getProductUrl() . '?catId=' . $catID . '&name=' . $_product->getName() . '">
													<img src="' . Mage::helper("catalog/image")->init($_product, "small_image")->resize(110, 110) . '" alt="' . $_product->getName() . '" title="' . $_product->getName() . '" />
												</a>
											</div>
											<div class="prod-container">
												<div class="prod-name">
													<a href="' . $_product->getProductUrl() . '?catId=' . $catID . '&name=' . $_product->getName() . '">';
                                $name = $_product->getName();
                                if (strlen($name) > 15) {
                                    $html .= substr($name, 0, 15) . "...";
                                } else {
                                    $html .= $name;
                                }
                                $html .= '</a>
												</div>
												<div class="prod-price">';
                                $defPrice = $_product->getPrice();
                                $specialprice = 0;
                                $_taxHelper = Mage::helper('tax');
                                $currentDate = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
                                $currentDate = date("Y-m-d h:m:s", $currentDate);
                                $specialToDate = $_product->getSpecialToDate();
                                $specialFromDate = $_product->getSpecialFromDate();
                                if (($currentDate >= $specialFromDate && $currentDate < $specialToDate || $specialToDate == "") && $_product->getSpecialPrice() != 0) {
                                    $price = $_product->getFinalPrice();
                                    $specialprice = $_product->getSpecialPrice();
                                } else {
                                    $price = $_product->getFinalPrice();
                                }
                                $price = $_taxHelper->getPrice($_product, $price, true);
                                if ($specialprice != 0 && (int) $specialprice <= (int) $price) {
                                    $specialprice = $_taxHelper->getPrice($_product, $_product->getSpecialPrice(), true);
                                    $price = $specialprice;
                                }
                                if (!((int) $price < (int) $defPrice)) {
                                    $html .= Mage::helper('common')->currency($price);
                                } else {
                                    // Discount percents output start
                                    $_savePercent = 100 - round($price / $defPrice * 100);
                                    $html .= '<div class="strike">' . Mage::helper('common')->currency($defPrice) . '</div><div class="red">' . Mage::helper('common')->currency($price) . '</div><div class="price-discount-flag-fav"><span >' . $_savePercent . '% OFF</span></div>';
                                }
                                $html .= '</div>
													<button type="submit" onClick="setLocation(\'' . $this->getAddToCartUrl($_product) . '\')" class="add-to-basket">Add to Basket</button>
											</div>
										</li>';
                                $counter++;
                            }
                        }
                    }
                    unset($_product);
                }
                if ($counter > 0 && $flag) {
                    $html .= '</ul>';
                }
                unset($product_collection);
                unset($ids_merged);
            }
            $html .= '</div>';
            unset($category);
            unset($counter);
            unset($bestseller_products_ids);
            $ctr++;
        }
        $html .= '</div>';
        $html .= '<script>jQuery("#favcarousel1,#favcarousel2,#favcarousel3,#favcarousel4,#favcarousel5,#favcarousel6").jcarousel({ vertical: true, scroll: 2 });</script>';
        $this->getResponse()->setBody($html);
        //print $html;
    }
Example #13
0
 protected function _construct()
 {
     parent::_construct();
 }
Example #14
0
 protected function _construct()
 {
     parent::_construct();
     $this->cfgExt = (object) Mage::helper('magicmenu')->getConfig();
 }