Version Notes
WishlistPlus adds the features of Pagination, search and selective add to cart to your wishlst module.
Download this release
Release Info
Developer | Magento Core Team |
Extension | WishlistPlus |
Version | 1.0.1 |
Comparing to | |
See all releases |
Version 1.0.1
- app/code/local/Customwishlist/Customwishlist/controllers/IndexController.php +88 -0
- app/code/local/Mage/Wishlist/Block/Abstract.php +263 -0
- app/code/local/Mage/Wishlist/Block/Customer/Wishlist.php +73 -0
- app/design/frontend/default/default/template/wishlist/view.phtml +247 -0
- app/etc/modules/Customwishlist_Customwishlist.xml +9 -0
- package.xml +18 -0
app/code/local/Customwishlist/Customwishlist/controllers/IndexController.php
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Customwishlist_Customwishlist_IndexController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
public function indexAction()
|
5 |
+
{
|
6 |
+
$this->loadLayout();
|
7 |
+
$this->renderLayout();
|
8 |
+
}
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Add selected items on wishlist page to shoping cart
|
12 |
+
*
|
13 |
+
*/
|
14 |
+
public function addselectedtocartAction() {
|
15 |
+
$messages = array();
|
16 |
+
$urls = array();
|
17 |
+
$wishlistIds = array();
|
18 |
+
$notSalableNames = array(); // Out of stock products message
|
19 |
+
|
20 |
+
$ids = Mage::helper('core')->htmlEscape($this->getRequest()->getParam('ids'));
|
21 |
+
$qtys = Mage::helper('core')->htmlEscape($this->getRequest()->getParam('qtys'));
|
22 |
+
|
23 |
+
$ids_arr = split(',', $ids);
|
24 |
+
$qtys_arr = split(',', $qtys);
|
25 |
+
|
26 |
+
$i=0;
|
27 |
+
foreach($ids_arr as $id)
|
28 |
+
{
|
29 |
+
$id = intval($id);
|
30 |
+
$qty = intval($qtys_arr[$i]);
|
31 |
+
if($id != '' && $qty != '')
|
32 |
+
{
|
33 |
+
try {
|
34 |
+
$product = Mage::getModel('catalog/product')
|
35 |
+
->load($id)
|
36 |
+
->setQty($qty);
|
37 |
+
if ($product->isSalable()) {
|
38 |
+
Mage::getSingleton('checkout/cart')->addProduct($product,$qty);
|
39 |
+
}
|
40 |
+
else {
|
41 |
+
$notSalableNames[] = $product->getName();
|
42 |
+
}
|
43 |
+
}
|
44 |
+
catch(Exception $e)
|
45 |
+
{
|
46 |
+
$url = Mage::getSingleton('checkout/session')->getRedirectUrl(true);
|
47 |
+
if ($url)
|
48 |
+
{
|
49 |
+
$url = Mage::getModel('core/url')
|
50 |
+
->getUrl('catalog/product/view', array(
|
51 |
+
'id' => $id,
|
52 |
+
'wishlist_next' => 1
|
53 |
+
));
|
54 |
+
|
55 |
+
$urls[] = $url;
|
56 |
+
$messages[] = $e->getMessage();
|
57 |
+
$wishlistIds[] = $item->getId();
|
58 |
+
} else {
|
59 |
+
//$item->delete();
|
60 |
+
}
|
61 |
+
}
|
62 |
+
Mage::getSingleton('checkout/cart')->save();
|
63 |
+
}
|
64 |
+
$i++;
|
65 |
+
}
|
66 |
+
|
67 |
+
if (count($notSalableNames) > 0) {
|
68 |
+
Mage::getSingleton('checkout/session')
|
69 |
+
->addNotice($this->__('Following product(s) is currently out of stock:'));
|
70 |
+
array_map(array(Mage::getSingleton('checkout/session'), 'addNotice'), $notSalableNames);
|
71 |
+
}
|
72 |
+
|
73 |
+
if ($urls) {
|
74 |
+
Mage::getSingleton('checkout/session')->addError(array_shift($messages));
|
75 |
+
$this->getResponse()->setRedirect(array_shift($urls));
|
76 |
+
|
77 |
+
Mage::getSingleton('checkout/session')->setWishlistPendingUrls($urls);
|
78 |
+
Mage::getSingleton('checkout/session')->setWishlistPendingMessages($messages);
|
79 |
+
Mage::getSingleton('checkout/session')->setWishlistIds($wishlistIds);
|
80 |
+
}
|
81 |
+
else {
|
82 |
+
Mage::getSingleton('checkout/session')
|
83 |
+
->addNotice($this->__('Product(s) Added successfully'));
|
84 |
+
$this->_redirect('wishlist/index');
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
}
|
app/code/local/Mage/Wishlist/Block/Abstract.php
ADDED
@@ -0,0 +1,263 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Wishlist
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Wishlist Product Items abstract Block
|
30 |
+
*
|
31 |
+
* @category Mage
|
32 |
+
* @package Mage_Wishlist
|
33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
abstract class Mage_Wishlist_Block_Abstract extends Mage_Catalog_Block_Product_Abstract
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Wishlist Product Items Collection
|
39 |
+
*
|
40 |
+
* @var Mage_Wishlist_Model_Mysql4_Product_Collection
|
41 |
+
*/
|
42 |
+
protected $_collection;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Wishlist Model
|
46 |
+
*
|
47 |
+
* @var Mage_Wishlist_Model_Wishlist
|
48 |
+
*/
|
49 |
+
protected $_wishlist;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Retrieve Wishlist Data Helper
|
53 |
+
*
|
54 |
+
* @return Mage_Wishlist_Helper_Data
|
55 |
+
*/
|
56 |
+
protected function _getHelper()
|
57 |
+
{
|
58 |
+
return Mage::helper('wishlist');
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Retrieve Customer Session instance
|
63 |
+
*
|
64 |
+
* @return Mage_Customer_Model_Session
|
65 |
+
*/
|
66 |
+
protected function _getCustomerSession()
|
67 |
+
{
|
68 |
+
return Mage::getSingleton('customer/session');
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Retrieve Wishlist model
|
73 |
+
*
|
74 |
+
* @return Mage_Wishlist_Model_Wishlist
|
75 |
+
*/
|
76 |
+
protected function _getWishlist()
|
77 |
+
{
|
78 |
+
if (is_null($this->_wishlist)) {
|
79 |
+
if (Mage::registry('shared_wishlist')) {
|
80 |
+
$this->_wishlist = Mage::registry('shared_wishlist');
|
81 |
+
}
|
82 |
+
elseif (Mage::registry('wishlist')) {
|
83 |
+
$this->_wishlist = Mage::registry('wishlist');
|
84 |
+
}
|
85 |
+
else {
|
86 |
+
$this->_wishlist = Mage::getModel('wishlist/wishlist');
|
87 |
+
if ($this->_getCustomerSession()->isLoggedIn()) {
|
88 |
+
$this->_wishlist->loadByCustomer($this->_getCustomerSession()->getCustomer());
|
89 |
+
}
|
90 |
+
}
|
91 |
+
}
|
92 |
+
return $this->_wishlist;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Prepare additional conditions to collection
|
97 |
+
*
|
98 |
+
* @param Mage_Wishlist_Model_Mysql4_Product_Collection $collection
|
99 |
+
* @return Mage_Wishlist_Block_Customer_Wishlist
|
100 |
+
*/
|
101 |
+
protected function _prepareCollection($collection)
|
102 |
+
{
|
103 |
+
return $this;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Retrieve Wishlist Product Items collection
|
108 |
+
*
|
109 |
+
* @return Mage_Wishlist_Model_Mysql4_Product_Collection
|
110 |
+
*/
|
111 |
+
public function getWishlistItems()
|
112 |
+
{
|
113 |
+
if (is_null($this->_collection)) {
|
114 |
+
$attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
|
115 |
+
$this->_collection = $this->_getWishlist()
|
116 |
+
->getProductCollection()
|
117 |
+
->addAttributeToSelect($attributes)
|
118 |
+
->addStoreFilter()
|
119 |
+
->addUrlRewrite();
|
120 |
+
|
121 |
+
Mage::getSingleton('catalog/product_visibility')
|
122 |
+
->addVisibleInSiteFilterToCollection($this->_collection);
|
123 |
+
|
124 |
+
$this->_prepareCollection($this->_collection);
|
125 |
+
}
|
126 |
+
|
127 |
+
$searchquery = trim(Mage::helper('core')->htmlEscape(Mage::app()->getRequest()->getParam('wishq')));
|
128 |
+
|
129 |
+
$searchkey = '%'.$searchquery.'%';
|
130 |
+
|
131 |
+
|
132 |
+
if(isset($searchquery) && $searchquery != '')
|
133 |
+
{
|
134 |
+
$this->_collection->addAttributeToFilter(
|
135 |
+
array(
|
136 |
+
array('attribute'=>'name', 'like'=>$searchkey),
|
137 |
+
array('attribute'=>'sku', 'like'=>$searchkey),
|
138 |
+
array('attribute'=>'short_description', 'like'=>$searchkey)
|
139 |
+
)
|
140 |
+
);
|
141 |
+
}
|
142 |
+
// echo $this->_collection->getSelect();die;
|
143 |
+
|
144 |
+
// return $collection;
|
145 |
+
return $this->_collection;
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Back compatibility retrieve wishlist product items
|
150 |
+
*
|
151 |
+
* @deprecated
|
152 |
+
* @return Mage_Wishlist_Model_Mysql4_Product_Collection
|
153 |
+
*/
|
154 |
+
public function getWishlist()
|
155 |
+
{
|
156 |
+
return $this->getWishlistItems();
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Retrieve URL for Removing item from wishlist
|
161 |
+
*
|
162 |
+
* @param Mage_Catalog_Model_Product $item
|
163 |
+
* @return string
|
164 |
+
*/
|
165 |
+
public function getItemRemoveUrl($product)
|
166 |
+
{
|
167 |
+
return $this->_getHelper()->getRemoveUrl($product);
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Retrieve Add Item to shopping cart URL
|
172 |
+
*
|
173 |
+
* @param Mage_Catalog_Model_Product $product
|
174 |
+
* @return string
|
175 |
+
*/
|
176 |
+
public function getItemAddToCartUrl($product)
|
177 |
+
{
|
178 |
+
return $this->_getHelper()->getAddToCartUrl($product);
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Retrieve URL for adding Product to wishlist
|
183 |
+
*
|
184 |
+
* @param Mage_Catalog_Model_Product $product
|
185 |
+
* @return string
|
186 |
+
*/
|
187 |
+
public function getAddToWishlistUrl($product)
|
188 |
+
{
|
189 |
+
return $this->_getHelper()->getAddUrl($product);
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Retrieve Escaped Description for Wishlist Item
|
194 |
+
*
|
195 |
+
* @param Mage_Catalog_Model_Product $item
|
196 |
+
* @return string
|
197 |
+
*/
|
198 |
+
public function getEscapedDescription($item)
|
199 |
+
{
|
200 |
+
if ($item->getWishlistItemDescription()) {
|
201 |
+
return $this->htmlEscape($item->getWishlistItemDescription());
|
202 |
+
}
|
203 |
+
return ' ';
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Check Wishlist item has description
|
208 |
+
*
|
209 |
+
* @param Mage_Catalog_Model_Product $item
|
210 |
+
* @return bool
|
211 |
+
*/
|
212 |
+
public function hasDescription($item)
|
213 |
+
{
|
214 |
+
return trim($item->getWishlistItemDescription()) != '';
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Retrieve formated Date
|
219 |
+
*
|
220 |
+
* @param string $date
|
221 |
+
* @return string
|
222 |
+
*/
|
223 |
+
public function getFormatedDate($date)
|
224 |
+
{
|
225 |
+
return $this->formatDate($date, Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
* Check is the wishlist has a salable product(s)
|
230 |
+
*
|
231 |
+
* @return bool
|
232 |
+
*/
|
233 |
+
public function isSaleable()
|
234 |
+
{
|
235 |
+
foreach ($this->getWishlistItems() as $item) {
|
236 |
+
if ($item->isSaleable()) {
|
237 |
+
return true;
|
238 |
+
}
|
239 |
+
}
|
240 |
+
|
241 |
+
return false;
|
242 |
+
}
|
243 |
+
|
244 |
+
/**
|
245 |
+
* Retrieve wishlist loaded items count
|
246 |
+
*
|
247 |
+
* @return int
|
248 |
+
*/
|
249 |
+
public function getWishlistItemsCount()
|
250 |
+
{
|
251 |
+
return $this->getWishlistItems()->count();
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Check is the wishlist has items
|
256 |
+
*
|
257 |
+
* @return bool
|
258 |
+
*/
|
259 |
+
public function hasWishlistItems()
|
260 |
+
{
|
261 |
+
return $this->getWishlistItemsCount() > 0;
|
262 |
+
}
|
263 |
+
}
|
app/code/local/Mage/Wishlist/Block/Customer/Wishlist.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Wishlist
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Wishlist block customer items
|
30 |
+
*
|
31 |
+
* @category Mage
|
32 |
+
* @package Mage_Wishlist
|
33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Mage_Wishlist_Block_Customer_Wishlist extends Mage_Wishlist_Block_Abstract
|
36 |
+
{
|
37 |
+
/**
|
38 |
+
* Preparing global layout
|
39 |
+
*
|
40 |
+
* @return Mage_Wishlist_Block_Customer_Wishlist
|
41 |
+
*/
|
42 |
+
protected function _prepareLayout()
|
43 |
+
{
|
44 |
+
/* if ($headBlock = $this->getLayout()->getBlock('head')) {
|
45 |
+
$headBlock->setTitle($this->__('My Wishlist'));
|
46 |
+
}*/
|
47 |
+
|
48 |
+
parent::_prepareLayout();
|
49 |
+
$pager = $this->getLayout()->createBlock('page/html_pager', 'wishlist.customer.pager')
|
50 |
+
->setCollection($this->getWishlist());
|
51 |
+
$this->setChild('pager', $pager);
|
52 |
+
$this->getWishlist()->load();
|
53 |
+
return $this;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Retrieve Back URL
|
58 |
+
*
|
59 |
+
* @return string
|
60 |
+
*/
|
61 |
+
public function getBackUrl()
|
62 |
+
{
|
63 |
+
if ($this->getRefererUrl()) {
|
64 |
+
return $this->getRefererUrl();
|
65 |
+
}
|
66 |
+
return $this->getUrl('customer/account/');
|
67 |
+
}
|
68 |
+
|
69 |
+
public function getPagerHtml()
|
70 |
+
{
|
71 |
+
return $this->getChildHtml('pager');
|
72 |
+
}
|
73 |
+
}
|
app/design/frontend/default/default/template/wishlist/view.phtml
ADDED
@@ -0,0 +1,247 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
/* @var $this Mage_Wishlist_Block_Customer_Wishlist */
|
27 |
+
?>
|
28 |
+
<script language="javascript">
|
29 |
+
function addSelectedToCart(f)
|
30 |
+
{
|
31 |
+
var ids='';
|
32 |
+
var qtys='';
|
33 |
+
var notSelected = false;
|
34 |
+
var formElements = "";
|
35 |
+
for (var n=0; n < f.elements.length; n++)
|
36 |
+
{
|
37 |
+
if(f.elements[n].type == 'checkbox' && f.elements[n].checked)
|
38 |
+
{
|
39 |
+
var id = f.elements[n].id;
|
40 |
+
var qty = f.elements[n+2].value;
|
41 |
+
if(id != '')
|
42 |
+
{
|
43 |
+
ids += id + ',';
|
44 |
+
qtys += qty+',';
|
45 |
+
}
|
46 |
+
}
|
47 |
+
if(f.elements[n].type == 'checkbox' && f.elements[n].checked)
|
48 |
+
{
|
49 |
+
notSelected = true;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
if(ids == '' || ids == ',')
|
53 |
+
{
|
54 |
+
alert('Please select an item.');
|
55 |
+
return false;
|
56 |
+
}
|
57 |
+
if(qtys == '' || qtys == ',')
|
58 |
+
{
|
59 |
+
alert('Quantity cannot be blank.');
|
60 |
+
return false;
|
61 |
+
}
|
62 |
+
else
|
63 |
+
{
|
64 |
+
var url = '<?php echo $this->getUrl('customwishlist/index/addselectedtocart') ?>'+'ids/'+ids+'/qtys/'+qtys;
|
65 |
+
document.location.href= url;
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
function doSelectAll(status)
|
70 |
+
{
|
71 |
+
objInput = document.getElementsByTagName('input');
|
72 |
+
|
73 |
+
for(var i =0 ; i < objInput.length; i++)
|
74 |
+
{
|
75 |
+
if(objInput[i].type == "checkbox")
|
76 |
+
{
|
77 |
+
objInput[i].checked = status;
|
78 |
+
}
|
79 |
+
}
|
80 |
+
}
|
81 |
+
</script>
|
82 |
+
|
83 |
+
<?php $cart = Mage::getModel('checkout/cart'); ?>
|
84 |
+
<?php
|
85 |
+
$cartqtys = array();
|
86 |
+
$cartprices = array();
|
87 |
+
|
88 |
+
$cartItems = $cart->getProductIds();
|
89 |
+
foreach ($cart->getQuote()->getAllItems() as $citem)
|
90 |
+
{
|
91 |
+
$cartqtys[$citem->getProductId()][] = $citem->getQty();
|
92 |
+
$cartprices[$citem->getProductId()][] = $citem->getBaseCalculationPrice();
|
93 |
+
}
|
94 |
+
?>
|
95 |
+
<div class="my-wishlist">
|
96 |
+
<div class="page-title title-buttons">
|
97 |
+
<?php if ($this->helper('wishlist')->isRssAllow() && $this->hasWishlistItems()): ?>
|
98 |
+
<a href="<?php echo $this->helper('wishlist')->getRssUrl(); ?>" class="link-rss"><?php echo $this->__('RSS Feed') ?></a>
|
99 |
+
<?php endif; ?>
|
100 |
+
<h1><?php echo $this->__('My Wishlist') ?></h1>
|
101 |
+
</div>
|
102 |
+
|
103 |
+
<?php
|
104 |
+
$searchq = Mage::app()->getRequest()->getParam('wishq');
|
105 |
+
?>
|
106 |
+
<form method="get" action="<?php echo Mage::getUrl() ?>wishlist/" id="search_wish_form">
|
107 |
+
<div class="form-search" style="margin-bottom:10px;" style="float:left;">
|
108 |
+
<label for="search">Search:</label>
|
109 |
+
<input type="text" class="input-text" value="<?php echo (isset($searchq) && $searchq!='')?$searchq:'';?>" name="wishq" id="wishsearch" autocomplete="off" style="width:200px">
|
110 |
+
<button class="button" title="Search" type="submit"><span><span>Search Wishlist</span></span></button>
|
111 |
+
<script type="text/javascript">
|
112 |
+
//<![CDATA[
|
113 |
+
var wishsearchForm = new Varien.searchForm('search_wish_form', 'wishsearch', 'Search wishlist here...');
|
114 |
+
//]]>
|
115 |
+
</script>
|
116 |
+
<?php
|
117 |
+
if(isset($searchq) && $searchq!='')
|
118 |
+
{
|
119 |
+
?>
|
120 |
+
<a style="padding:5px;" href="<?php echo $this->getUrl('wishlist'); ?>">View All Items</a>
|
121 |
+
<?php
|
122 |
+
}
|
123 |
+
?>
|
124 |
+
</div>
|
125 |
+
</form>
|
126 |
+
|
127 |
+
<div class="clear"></div>
|
128 |
+
<?php
|
129 |
+
if($searchq != '' && isset($searchq))
|
130 |
+
{
|
131 |
+
?>
|
132 |
+
<div class="page-head">
|
133 |
+
<h3><?php echo Mage::helper('core')->htmlEscape($this->__("Search results for '%s'", $searchq)) ?></h3>
|
134 |
+
</div>
|
135 |
+
<?php
|
136 |
+
}
|
137 |
+
?>
|
138 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
139 |
+
<?php echo $this->getPagerHtml(); ?>
|
140 |
+
<?php if ($this->hasWishlistItems()): ?>
|
141 |
+
<form action="<?php echo $this->getUrl('*/*/update') ?>" method="post">
|
142 |
+
<fieldset>
|
143 |
+
<?php echo $this->getBlockHtml('formkey')?>
|
144 |
+
<table class="data-table" id="wishlist-table">
|
145 |
+
<col width="80" />
|
146 |
+
<col width="1" />
|
147 |
+
<col />
|
148 |
+
<col width="1" />
|
149 |
+
<col width="1" />
|
150 |
+
<col width="1" />
|
151 |
+
<thead>
|
152 |
+
<tr>
|
153 |
+
<th style="text-align: center; !important " ><input type="checkbox" name="chck" onclick="doSelectAll(this.checked)" ></th>
|
154 |
+
<th><?php echo $this->__('Product') ?></th>
|
155 |
+
<th><?php echo $this->__('Comment') ?></th>
|
156 |
+
<th><?php echo $this->__('Qty') ?></th>
|
157 |
+
<th class="a-center"><span class="nobr"><?php echo $this->__('Added On') ?></span></th>
|
158 |
+
<!--<th class="a-center"><span class="nobr"><?php echo $this->__('Add to Cart') ?></span></th>-->
|
159 |
+
<th> </th>
|
160 |
+
</tr>
|
161 |
+
</thead>
|
162 |
+
<tbody>
|
163 |
+
<?php foreach ($this->getWishlistItems() as $item): ?>
|
164 |
+
<?php
|
165 |
+
$color = "";
|
166 |
+
if(in_array($item->getProductId(),$cartItems))
|
167 |
+
{
|
168 |
+
$color = " #FFF8C6";
|
169 |
+
}
|
170 |
+
?>
|
171 |
+
<tr style="background-color: <?php echo $color ?> !important ;" >
|
172 |
+
<td style="text-align: center; !important ">
|
173 |
+
<?php if($item->isSaleable()): ?>
|
174 |
+
<input type="checkbox" id="<?php echo $item->getId() ?>"><br />
|
175 |
+
<?php endif; ?>
|
176 |
+
<?php
|
177 |
+
if(in_array($item->getProductId(),$cartItems))
|
178 |
+
{
|
179 |
+
?>
|
180 |
+
<center><span style="color:green; font-weight:bold;">In Cart</span></center>
|
181 |
+
<p><strong><?php echo $cartqtys[$item->getProductId()][0] ?></strong> x <?php echo Mage::helper('core')->currency($cartprices[$item->getProductId()][0]) ?></p>
|
182 |
+
<?php
|
183 |
+
}
|
184 |
+
?>
|
185 |
+
</td>
|
186 |
+
<td>
|
187 |
+
<a class="product-image" href="<?php echo $this->getProductUrl($item) ?>" title="<?php echo $this->htmlEscape($item->getName()) ?>"><img src="<?php echo $this->helper('catalog/image')->init($item, 'small_image')->resize(113, 113); ?>" width="113" height="113" alt="<?php echo $this->htmlEscape($item->getName()) ?>" /></a>
|
188 |
+
<h2 class="product-name"><a href="<?php echo $this->getProductUrl($item) ?>"><?php echo $this->htmlEscape($item->getName()) ?></a></h2>
|
189 |
+
<?php echo $this->getPriceHtml($item) ?>
|
190 |
+
</td>
|
191 |
+
<td>
|
192 |
+
<textarea name="description[<?php echo $item->getWishlistItemId() ?>]" rows="3" cols="5" onfocus="focusComment(this)" onblur="focusComment(this)" title="<?php echo $this->__('Comment') ?>"><?php echo $this->hasDescription($item) ? $this->getEscapedDescription($item) : $this->helper('wishlist')->defaultCommentString() ?></textarea>
|
193 |
+
</td>
|
194 |
+
<td>
|
195 |
+
<input type="text" value="1" maxlength="12" id="qty_<?php echo $item->getId(); ?>" class="input-text qty" name="qty">
|
196 |
+
</td>
|
197 |
+
<td>
|
198 |
+
<span class="nobr"><?php echo $this->getFormatedDate($item->getAddedAt()) ?></span>
|
199 |
+
</td>
|
200 |
+
<!--<td class="a-center">
|
201 |
+
<?php if ($item->isSaleable()): ?>
|
202 |
+
<button type="button" title="<?php echo $this->__('Add to Cart') ?>" onclick="setLocation('<?php echo $this->getItemAddToCartUrl($item) ?>')" class="button btn-cart"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
|
203 |
+
<?php else: ?>
|
204 |
+
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
|
205 |
+
<?php endif; ?>
|
206 |
+
</td>-->
|
207 |
+
<td>
|
208 |
+
<a href="<?php echo $this->getItemRemoveUrl($item) ?>" title="<?php echo $this->__('Remove Item') ?>" onclick="return confirmRemoveWishlistItem();" class="btn-remove btn-remove2"><?php echo $this->__('Remove item')?></a>
|
209 |
+
</td>
|
210 |
+
</tr>
|
211 |
+
<?php endforeach ?>
|
212 |
+
</tbody>
|
213 |
+
</table>
|
214 |
+
<?php echo $this->getPagerHtml(); ?>
|
215 |
+
<script type="text/javascript">decorateTable('wishlist-table')</script>
|
216 |
+
<div class="buttons-set buttons-set2">
|
217 |
+
<button type="submit" onclick="this.name='save_and_share'" title="<?php echo $this->__('Share Wishlist') ?>" class="button btn-share"><span><span><?php echo $this->__('Share Wishlist') ?></span></span></button>
|
218 |
+
<?php if($this->isSaleable()):?>
|
219 |
+
<button onClick="addSelectedToCart(this.form)" class="button btn-add" type="button"><span><?php echo $this->__('Add Selected to Cart') ?></span></button>
|
220 |
+
<button type="button" title="<?php echo $this->__('Add All to Cart') ?>" onclick="setLocation('<?php echo $this->getUrl('*/*/allcart') ?>')" class="button btn-add"><span><span><?php echo $this->__('Add All to Cart') ?></span></span></button>
|
221 |
+
<?php endif;?>
|
222 |
+
<button type="submit" title="<?php echo $this->__('Update Wishlist') ?>" onclick="this.name='do'" class="button btn-update"><span><span><?php echo $this->__('Update Wishlist') ?></span></span></button>
|
223 |
+
</div>
|
224 |
+
</fieldset>
|
225 |
+
</form>
|
226 |
+
<?php else: ?>
|
227 |
+
<p><?php echo $this->__('You have no items in your wishlist.') ?></p>
|
228 |
+
<?php endif ?>
|
229 |
+
<script type="text/javascript">
|
230 |
+
//<![CDATA[
|
231 |
+
function confirmRemoveWishlistItem() {
|
232 |
+
return confirm('<?php echo $this->__('Are you sure you want to remove this product from your wishlist?') ?>');
|
233 |
+
}
|
234 |
+
|
235 |
+
function focusComment(obj) {
|
236 |
+
if( obj.value == '<?php echo $this->helper('wishlist')->defaultCommentString() ?>' ) {
|
237 |
+
obj.value = '';
|
238 |
+
} else if( obj.value == '' ) {
|
239 |
+
obj.value = '<?php echo $this->helper('wishlist')->defaultCommentString() ?>';
|
240 |
+
}
|
241 |
+
}
|
242 |
+
//]]>
|
243 |
+
</script>
|
244 |
+
</div>
|
245 |
+
<div class="buttons-set">
|
246 |
+
<p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>« </small><?php echo $this->__('Back') ?></a></p>
|
247 |
+
</div>
|
app/etc/modules/Customwishlist_Customwishlist.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Customwishlist_Customwishlist>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Customwishlist_Customwishlist>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>WishlistPlus</name>
|
4 |
+
<version>1.0.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>WishlistPlus adds the features of Pagination, search and selective add to cart to your wishlst module.</summary>
|
10 |
+
<description>WishlistPlus adds the features of Pagination, search and selective add to cart to your wishlst module.</description>
|
11 |
+
<notes>WishlistPlus adds the features of Pagination, search and selective add to cart to your wishlst module.</notes>
|
12 |
+
<authors><author><name>Arvind Bhardwaj</name><user>auto-converted</user><email>bhardwajsonheight@gmail.com</email></author><author><name>Arvind Bhardwaj</name><user>auto-converted</user><email>bhardwajsonheight@gmail.com</email></author></authors>
|
13 |
+
<date>2011-02-08</date>
|
14 |
+
<time>09:34:48</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Customwishlist"><dir name="Customwishlist"><dir name="controllers"><file name="IndexController.php" hash="10b92133ffaa20d5dd6d31da009701eb"/></dir></dir></dir><dir name="Mage"><dir name="Wishlist"><dir name="Block"><file name="Abstract.php" hash="72b0d8f8e4da904d168363d3a57b6fb4"/><dir name="Customer"><file name="Wishlist.php" hash="384efdba68ca1ed7c665bc848c218da6"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="wishlist"><file name="view.phtml" hash="8a2a83127edb746386a1e6a4e2f90fd1"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Customwishlist_Customwishlist.xml" hash="76f03ae1f3d1904758bd80b113dfe207"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies/>
|
18 |
+
</package>
|