Skip to main content
deleted 1 character in body
Source Link
Marius
  • 198.5k
  • 55
  • 424
  • 833

Replace #Ineed here a wishlist url with

 <?php echo $this->helper('wishlist')->getAddUrl($item) ?>

[EDIT]
Also you don't need to loop through the collection and load each product separately, then generate an array from them. It's a real performance killer.

you can replace this;

        foreach ($productCollection as $product) {
            $product = Mage::getModel('catalog/product')->load($product->getId());
            $collection[] = array(
                'name' => $product->getName(),
                'image' => (string)$this->helper('catalog/image')->init($product, 'small_image')->resize(max(100, (int)$this->_currentList->getThumbnailWidth())),
                'url' => $product->getProductUrl(),
                'price' => $product->getPrice(),
                'finalprice' => $product->getFinalPrice(),
                'sku'       => $product->getId(),
                'qty'       => $product->getIsInStock()
            );
        }

        Mage::app()->saveCache(json_encode($collection), $this->getCacheTags(), array($this->getCacheTags()));

with this:

         Mage::app()->saveCache(json_encode($collection->toArray()), $this->getCacheTags(), array($this->getCacheTags()));

Replace #Ineed here a wishlist url with

 <?php echo $this->helper('wishlist')->getAddUrl($item) ?>

Replace #Ineed here a wishlist url with

 <?php echo $this->helper('wishlist')->getAddUrl($item) ?>

[EDIT]
Also you don't need to loop through the collection and load each product separately, then generate an array from them. It's a real performance killer.

you can replace this;

        foreach ($productCollection as $product) {
            $product = Mage::getModel('catalog/product')->load($product->getId());
            $collection[] = array(
                'name' => $product->getName(),
                'image' => (string)$this->helper('catalog/image')->init($product, 'small_image')->resize(max(100, (int)$this->_currentList->getThumbnailWidth())),
                'url' => $product->getProductUrl(),
                'price' => $product->getPrice(),
                'finalprice' => $product->getFinalPrice(),
                'sku'       => $product->getId(),
                'qty'       => $product->getIsInStock()
            );
        }

        Mage::app()->saveCache(json_encode($collection), $this->getCacheTags(), array($this->getCacheTags()));

with this:

         Mage::app()->saveCache(json_encode($collection->toArray()), $this->getCacheTags(), array($this->getCacheTags()));
deleted 1 character in body
Source Link
Marius
  • 198.5k
  • 55
  • 424
  • 833

Replace #Ineed here a wishlist url with

 <?php echo $this->helper('wishlist')->getAddUrl($_product$item) ?>

Replace #Ineed here a wishlist url with

 <?php echo $this->helper('wishlist')->getAddUrl($_product) ?>

Replace #Ineed here a wishlist url with

 <?php echo $this->helper('wishlist')->getAddUrl($item) ?>
Source Link
Marius
  • 198.5k
  • 55
  • 424
  • 833

Replace #Ineed here a wishlist url with

 <?php echo $this->helper('wishlist')->getAddUrl($_product) ?>