Version Notes
Fixed minor bugs
Download this release
Release Info
Developer | Magento Core Team |
Extension | IfuturzAddgallery |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
- app/code/local/Ifuturz/Adminhtml/Block/Customer/Edit/Tab1234/Gallery.php +187 -0
- app/code/local/Ifuturz/Adminhtml/Block/Customer/Edit/Tab1234/Gallery/Grid/Renderer/Description.php +10 -0
- app/code/local/Ifuturz/Adminhtml/Block/Customer/Edit/Tab1234/View/Gallery.php +81 -0
- app/code/local/Ifuturz/Adminhtml/Block/Customer/Edit/Tabs.php +18 -0
- app/code/local/Ifuturz/Adminhtml/controllers/CustomerController.php +32 -0
- app/code/local/Ifuturz/Adminhtml/etc/config.xml +28 -0
- app/code/local/Ifuturz/Gallery/Block/Abstract.php +213 -0
- app/code/local/Ifuturz/Gallery/Block/Customer/Gallery.php +31 -0
- app/code/local/Ifuturz/Gallery/Block/Customer/Sharing.php +55 -0
- app/code/local/Ifuturz/Gallery/Block/Customer/Sidebar.php +66 -0
- app/code/local/Ifuturz/Gallery/Block/Links.php +28 -0
- app/code/local/Ifuturz/Gallery/Block/Share/Email/Items.php +41 -0
- app/code/local/Ifuturz/Gallery/Block/Share/Email/Rss.php +10 -0
- app/code/local/Ifuturz/Gallery/Block/Share/Gallery.php +53 -0
- app/code/local/Ifuturz/Gallery/Controller/Abstract.php +143 -0
- app/code/local/Ifuturz/Gallery/Helper/Data.php +305 -0
- app/code/local/Ifuturz/Gallery/Model/Gallery.php +281 -0
- app/code/local/Ifuturz/Gallery/Model/Item.php +224 -0
- app/code/local/Ifuturz/Gallery/Model/Mysql4/Gallery.php +42 -0
- app/code/local/Ifuturz/Gallery/Model/Mysql4/Gallery/Collection.php +12 -0
- app/code/local/Ifuturz/Gallery/Model/Mysql4/Item.php +41 -0
- app/code/local/Ifuturz/Gallery/Model/Mysql4/Item/Collection.php +50 -0
- app/code/local/Ifuturz/Gallery/Model/Mysql4/Product/Collection.php +130 -0
- app/code/local/Ifuturz/Gallery/Model/Observer.php +135 -0
- app/code/local/Ifuturz/Gallery/Model/Session.php +11 -0
- app/code/local/Ifuturz/Gallery/controllers/IndexController.php +364 -0
- app/code/local/Ifuturz/Gallery/controllers/SharedController.php +47 -0
- app/code/local/Ifuturz/Gallery/etc/adminhtml.xml +22 -0
- app/code/local/Ifuturz/Gallery/etc/config.xml +143 -0
- app/code/local/Ifuturz/Gallery/etc/system.xml +63 -0
- app/code/local/Ifuturz/Gallery/sql/gallery_setup/mysql4-install-0.7.0.php +37 -0
- app/code/local/Ifuturz/Gallery/sql/gallery_setup/mysql4-upgrade-0.7.0-0.7.1.php +15 -0
- app/code/local/Ifuturz/Gallery/sql/gallery_setup/mysql4-upgrade-0.7.1-0.7.2.php +18 -0
- app/code/local/Ifuturz/Gallery/sql/gallery_setup/mysql4-upgrade-0.7.2-0.7.4.php +22 -0
- app/code/local/Ifuturz/Gallery/sql/gallery_setup/mysql4-upgrade-0.7.4-0.7.5.php +47 -0
- app/code/local/Ifuturz/Gallery/sql/gallery_setup/mysql4-upgrade-0.7.5-0.7.6.php +1 -0
- app/code/local/Ifuturz/Gallery/sql/gallery_setup/mysql4-upgrade-0.7.6-0.7.7.php +6 -0
- app/code/local/Ifuturz/Gallery/sql/gallery_setup/mysql4-upgrade-0.7.7-0.7.8.php +6 -0
- app/code/local/Mage/Adminhtml/Block/Customer/Edit/Tab/Gallery.php +187 -0
- app/code/local/Mage/Adminhtml/Block/Customer/Edit/Tab/Gallery/Grid/Renderer/Description.php +10 -0
- app/code/local/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Gallery.php +81 -0
- app/design/frontend/default/default/layout/gallery.xml +81 -0
- app/design/frontend/default/default/template/catalog/product/list.phtml +131 -0
- app/design/frontend/default/default/template/gallery/email/items.phtml +53 -0
- app/design/frontend/default/default/template/gallery/email/rss.phtml +31 -0
- app/design/frontend/default/default/template/gallery/shared.phtml +79 -0
- app/design/frontend/default/default/template/gallery/sharing.phtml +83 -0
- app/design/frontend/default/default/template/gallery/sidebar.phtml +60 -0
- app/design/frontend/default/default/template/gallery/view.phtml +114 -0
- app/etc/modules/Ifuturz_All.xml +13 -0
- app/locale/en_US/Ifuturz_Gallery.csv +69 -0
- app/locale/en_US/template/email/gallery_share.html +49 -0
- package.xml +18 -0
app/code/local/Ifuturz/Adminhtml/Block/Customer/Edit/Tab1234/Gallery.php
ADDED
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Ifuturz_Adminhtml_Block_Customer_Edit_Tab_Gallery extends Mage_Adminhtml_Block_Widget_Grid
|
3 |
+
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Default sort field
|
7 |
+
*
|
8 |
+
* @var string
|
9 |
+
*/
|
10 |
+
|
11 |
+
protected $_defaultSort = 'added_at';
|
12 |
+
/**
|
13 |
+
* Parent template name
|
14 |
+
*
|
15 |
+
* @var string
|
16 |
+
*/
|
17 |
+
protected $_parentTemplate;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Initialize Grid
|
21 |
+
*
|
22 |
+
*/
|
23 |
+
public function __construct()
|
24 |
+
{
|
25 |
+
parent::__construct();
|
26 |
+
$this->setId('galleryGrid');
|
27 |
+
$this->setUseAjax(true);
|
28 |
+
$this->_parentTemplate = $this->getTemplate();
|
29 |
+
$this->setTemplate('customer/tab/gallery.phtml');
|
30 |
+
$this->setEmptyText(Mage::helper('customer')->__('No Items Found'));
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Retrieve current customer object
|
35 |
+
*
|
36 |
+
* @return Mage_Customer_Model_Customer
|
37 |
+
*/
|
38 |
+
protected function _getCustomer()
|
39 |
+
{
|
40 |
+
return Mage::registry('current_customer');
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Prepare customer gallery product collection
|
45 |
+
*
|
46 |
+
* @return Mage_Adminhtml_Block_Customer_Edit_Tab_Gallery
|
47 |
+
*/
|
48 |
+
protected function _prepareCollection()
|
49 |
+
{
|
50 |
+
$gallery = Mage::getModel('gallery/gallery');
|
51 |
+
$collection = $gallery->loadByCustomer($this->_getCustomer())
|
52 |
+
->setSharedStoreIds($gallery->getSharedStoreIds(false))
|
53 |
+
->getProductCollection()
|
54 |
+
->resetSortOrder()
|
55 |
+
->addAttributeToSelect('name')
|
56 |
+
->addAttributeToSelect('price')
|
57 |
+
->addAttributeToSelect('small_image')
|
58 |
+
->setDaysInGallery(true)
|
59 |
+
->addStoreData();
|
60 |
+
|
61 |
+
$this->setCollection($collection);
|
62 |
+
|
63 |
+
return parent::_prepareCollection();
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Prepare Grid columns
|
68 |
+
*
|
69 |
+
* @return Mage_Adminhtml_Block_Customer_Edit_Tab_Gallery
|
70 |
+
*/
|
71 |
+
protected function _prepareColumns()
|
72 |
+
{
|
73 |
+
|
74 |
+
/*$this->addColumn('product_id', array(
|
75 |
+
'header' => Mage::helper('customer')->__('ID'),
|
76 |
+
'index' => 'product_id',
|
77 |
+
'type' => 'number',
|
78 |
+
'width' => '130px'
|
79 |
+
));*/
|
80 |
+
|
81 |
+
$this->addColumn('product_name', array(
|
82 |
+
'header' => Mage::helper('customer')->__('Product name'),
|
83 |
+
'index' => 'name'
|
84 |
+
));
|
85 |
+
|
86 |
+
$this->addColumn('description', array(
|
87 |
+
'header' => Mage::helper('customer')->__('User description'),
|
88 |
+
'index' => 'gallery_item_description',
|
89 |
+
'renderer' => 'adminhtml/customer_edit_tab_gallery_grid_renderer_description'
|
90 |
+
));
|
91 |
+
|
92 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
93 |
+
$this->addColumn('store', array(
|
94 |
+
'header' => Mage::helper('customer')->__('Added From'),
|
95 |
+
'index' => 'store_name',
|
96 |
+
'type' => 'store'
|
97 |
+
));
|
98 |
+
}
|
99 |
+
|
100 |
+
$this->addColumn('visible_in', array(
|
101 |
+
'header' => Mage::helper('customer')->__('Visible In'),
|
102 |
+
'index' => 'item_store_id',
|
103 |
+
'type' => 'store'
|
104 |
+
));
|
105 |
+
|
106 |
+
$this->addColumn('added_at', array(
|
107 |
+
'header' => Mage::helper('customer')->__('Date Added'),
|
108 |
+
'index' => 'added_at',
|
109 |
+
'gmtoffset' => true,
|
110 |
+
'type' => 'date'
|
111 |
+
));
|
112 |
+
|
113 |
+
$this->addColumn('days', array(
|
114 |
+
'header' => Mage::helper('customer')->__('Days in Gallery'),
|
115 |
+
'index' => 'days_in_gallery',
|
116 |
+
'type' => 'number'
|
117 |
+
));
|
118 |
+
|
119 |
+
$this->addColumn('action', array(
|
120 |
+
'header' => Mage::helper('customer')->__('Action'),
|
121 |
+
'index' => 'gallery_item_id',
|
122 |
+
'type' => 'action',
|
123 |
+
'filter' => false,
|
124 |
+
'sortable' => false,
|
125 |
+
'actions' => array(
|
126 |
+
array(
|
127 |
+
'caption' => Mage::helper('customer')->__('Delete'),
|
128 |
+
'url' => '#',
|
129 |
+
'onclick' => 'return galleryControl.removeItem($gallery_item_id);'
|
130 |
+
)
|
131 |
+
)
|
132 |
+
));
|
133 |
+
|
134 |
+
return parent::_prepareColumns();
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Retrieve Grid URL
|
139 |
+
*
|
140 |
+
* @return string
|
141 |
+
*/
|
142 |
+
public function getGridUrl()
|
143 |
+
{
|
144 |
+
return $this->getUrl('*/*/gallery', array('_current'=>true));
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Add column filter to collection
|
149 |
+
*
|
150 |
+
* @param Mage_Adminhtml_Block_Widget_Grid_Column $column
|
151 |
+
* @return Mage_Adminhtml_Block_Customer_Edit_Tab_Gallery
|
152 |
+
*/
|
153 |
+
protected function _addColumnFilterToCollection($column)
|
154 |
+
{
|
155 |
+
if($column->getId()=='store') {
|
156 |
+
$this->getCollection()->addFieldToFilter('item_store_id', $column->getFilter()->getCondition());
|
157 |
+
return $this;
|
158 |
+
}
|
159 |
+
|
160 |
+
if ($this->getCollection() && $column->getFilter()->getValue()) {
|
161 |
+
$this->getCollection()->addFieldToFilter($column->getIndex(), $column->getFilter()->getCondition());
|
162 |
+
}
|
163 |
+
|
164 |
+
return $this;
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Retrieve Grid Parent Block HTML
|
169 |
+
*
|
170 |
+
* @return string
|
171 |
+
*/
|
172 |
+
public function getGridParentHtml()
|
173 |
+
{
|
174 |
+
$templateName = Mage::getDesign()->getTemplateFilename($this->_parentTemplate, array('_relative'=>true));
|
175 |
+
return $this->fetchView($templateName);
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Retrieve Row click URL
|
180 |
+
*
|
181 |
+
* @return string
|
182 |
+
*/
|
183 |
+
public function getRowUrl($row)
|
184 |
+
{
|
185 |
+
return $this->getUrl('*/catalog_product/edit', array('id' => $row->getProductId()));
|
186 |
+
}
|
187 |
+
}
|
app/code/local/Ifuturz/Adminhtml/Block/Customer/Edit/Tab1234/Gallery/Grid/Renderer/Description.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Ifuturz_Adminhtml_Block_Customer_Edit_Tab_Gallery_Grid_Renderer_Description extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
3 |
+
{
|
4 |
+
|
5 |
+
public function render(Varien_Object $row)
|
6 |
+
{
|
7 |
+
return nl2br(htmlspecialchars($row->getData($this->getColumn()->getIndex())));
|
8 |
+
}
|
9 |
+
|
10 |
+
}
|
app/code/local/Ifuturz/Adminhtml/Block/Customer/Edit/Tab1234/View/Gallery.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ifuturz_Adminhtml_Block_Customer_Edit_Tab_View_Gallery extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setId('customer_view_gallery_grid');
|
10 |
+
$this->setSortable(false);
|
11 |
+
$this->setPagerVisibility(false);
|
12 |
+
$this->setFilterVisibility(false);
|
13 |
+
$this->setEmptyText(Mage::helper('customer')->__("There are no items in customer's gallery at the moment"));
|
14 |
+
}
|
15 |
+
|
16 |
+
protected function _prepareCollection()
|
17 |
+
{
|
18 |
+
$gallery = Mage::getModel('gallery/gallery');
|
19 |
+
$collection = $gallery->loadByCustomer(Mage::registry('current_customer'))
|
20 |
+
->setSharedStoreIds($gallery->getSharedStoreIds(false))
|
21 |
+
->getProductCollection()
|
22 |
+
->addAttributeToSelect('name')
|
23 |
+
->addStoreData();
|
24 |
+
|
25 |
+
$this->setCollection($collection);
|
26 |
+
|
27 |
+
return parent::_prepareCollection();
|
28 |
+
}
|
29 |
+
|
30 |
+
protected function _prepareColumns()
|
31 |
+
{
|
32 |
+
$this->addColumn('product_id', array(
|
33 |
+
'header' => Mage::helper('customer')->__('Product ID'),
|
34 |
+
'index' => 'product_id',
|
35 |
+
'type' => 'number',
|
36 |
+
'width' => '100px'
|
37 |
+
));
|
38 |
+
|
39 |
+
$this->addColumn('product_name', array(
|
40 |
+
'header' => Mage::helper('customer')->__('Product Name'),
|
41 |
+
'index' => 'name'
|
42 |
+
));
|
43 |
+
|
44 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
45 |
+
$this->addColumn('store', array(
|
46 |
+
'header' => Mage::helper('customer')->__('Added From'),
|
47 |
+
'index' => 'store_id',
|
48 |
+
'type' => 'store',
|
49 |
+
'width' => '160px',
|
50 |
+
));
|
51 |
+
}
|
52 |
+
|
53 |
+
$this->addColumn('added_at', array(
|
54 |
+
'header' => Mage::helper('customer')->__('Date Added'),
|
55 |
+
'index' => 'added_at',
|
56 |
+
'type' => 'date',
|
57 |
+
'width' => '140px',
|
58 |
+
));
|
59 |
+
|
60 |
+
$this->addColumn('days', array(
|
61 |
+
'header' => Mage::helper('customer')->__('Days in Gallery'),
|
62 |
+
'index' => 'days_in_gallery',
|
63 |
+
'type' => 'number',
|
64 |
+
'width' => '140px',
|
65 |
+
));
|
66 |
+
|
67 |
+
return parent::_prepareColumns();
|
68 |
+
}
|
69 |
+
|
70 |
+
public function getHeadersVisibility()
|
71 |
+
{
|
72 |
+
return ($this->getCollection()->getSize() > 0);
|
73 |
+
}
|
74 |
+
|
75 |
+
public function getRowUrl($row)
|
76 |
+
{
|
77 |
+
return $this->getUrl('*/catalog_product/edit', array('id' => $row->getProductId()));
|
78 |
+
}
|
79 |
+
|
80 |
+
}
|
81 |
+
|
app/code/local/Ifuturz/Adminhtml/Block/Customer/Edit/Tabs.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once 'Mage/Adminhtml/Block/Customer/Edit/Tabs.php';
|
3 |
+
class Ifuturz_Adminhtml_Block_Customer_Edit_Tabs extends Mage_Adminhtml_Block_Customer_Edit_Tabs
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _beforeToHtml()
|
7 |
+
{
|
8 |
+
$this->addTab('gallery', array(
|
9 |
+
'label' => Mage::helper('customer')->__('Gallery'),
|
10 |
+
'class' => 'ajax',
|
11 |
+
'url' => $this->getUrl('*/*/gallery', array('_current' => true)),
|
12 |
+
));
|
13 |
+
|
14 |
+
$this->_updateActiveTab();
|
15 |
+
return parent::_beforeToHtml();
|
16 |
+
}
|
17 |
+
|
18 |
+
}
|
app/code/local/Ifuturz/Adminhtml/controllers/CustomerController.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once 'Mage/Adminhtml/controllers/CustomerController.php';
|
3 |
+
class Ifuturz_Adminhtml_CustomerController extends Mage_Adminhtml_CustomerController
|
4 |
+
{
|
5 |
+
public function galleryAction()
|
6 |
+
{
|
7 |
+
$this->_initCustomer();
|
8 |
+
$customer = Mage::registry('current_customer');
|
9 |
+
if ($customer->getId()) {
|
10 |
+
if($itemId = (int) $this->getRequest()->getParam('delete')) {
|
11 |
+
try {
|
12 |
+
Mage::getModel('gallery/item')->load($itemId)
|
13 |
+
->delete();
|
14 |
+
}
|
15 |
+
catch (Exception $e) {
|
16 |
+
Mage::logException($e);
|
17 |
+
}
|
18 |
+
}
|
19 |
+
}
|
20 |
+
$this->getResponse()->setBody($this->getLayout()->createBlock('adminhtml/customer_edit_tab_gallery')->toHtml());
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Customer last view wishlist for ajax
|
25 |
+
*
|
26 |
+
*/
|
27 |
+
public function viewGalleryAction()
|
28 |
+
{
|
29 |
+
$this->_initCustomer();
|
30 |
+
$this->getResponse()->setBody($this->getLayout()->createBlock('adminhtml/customer_edit_tab_view_gallery')->toHtml());
|
31 |
+
}
|
32 |
+
}
|
app/code/local/Ifuturz/Adminhtml/etc/config.xml
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Ifuturz_Adminhtml>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Ifuturz_Adminhtml>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<blocks>
|
10 |
+
<adminhtml>
|
11 |
+
<rewrite>
|
12 |
+
<customer_edit_tabs>Ifuturz_Adminhtml_Block_Customer_Edit_Tabs</customer_edit_tabs>
|
13 |
+
</rewrite>
|
14 |
+
</adminhtml>
|
15 |
+
</blocks>
|
16 |
+
</global>
|
17 |
+
<admin>
|
18 |
+
<routers>
|
19 |
+
<adminhtml>
|
20 |
+
<args>
|
21 |
+
<modules>
|
22 |
+
<ifuturz_adminhtml before="Mage_Adminhtml">Ifuturz_Adminhtml</ifuturz_adminhtml>
|
23 |
+
</modules>
|
24 |
+
</args>
|
25 |
+
</adminhtml>
|
26 |
+
</routers>
|
27 |
+
</admin>
|
28 |
+
</config>
|
app/code/local/Ifuturz/Gallery/Block/Abstract.php
ADDED
@@ -0,0 +1,213 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
abstract class Ifuturz_Gallery_Block_Abstract extends Mage_Catalog_Block_Product_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Gallery Product Items Collection
|
7 |
+
*
|
8 |
+
* @var Ifuturz_Gallery_Model_Mysql4_Product_Collection
|
9 |
+
*/
|
10 |
+
protected $_collection;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Gallery Model
|
14 |
+
*
|
15 |
+
* @var Ifuturz_Gallery_Model_Gallery
|
16 |
+
*/
|
17 |
+
protected $_gallery;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Retrieve Gallery Data Helper
|
21 |
+
*
|
22 |
+
* @return Ifuturz_Gallery_Helper_Data
|
23 |
+
*/
|
24 |
+
protected function _getHelper()
|
25 |
+
{
|
26 |
+
return Mage::helper('gallery');
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Retrieve Customer Session instance
|
31 |
+
*
|
32 |
+
* @return Mage_Customer_Model_Session
|
33 |
+
*/
|
34 |
+
protected function _getCustomerSession()
|
35 |
+
{
|
36 |
+
return Mage::getSingleton('customer/session');
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Retrieve Gallery model
|
41 |
+
*
|
42 |
+
* @return Ifuturz_Gallery_Model_Gallery
|
43 |
+
*/
|
44 |
+
protected function _getGallery()
|
45 |
+
{
|
46 |
+
if (is_null($this->_gallery)) {
|
47 |
+
if (Mage::registry('shared_gallery')) {
|
48 |
+
$this->_gallery = Mage::registry('shared_gallery');
|
49 |
+
}
|
50 |
+
elseif (Mage::registry('gallery')) {
|
51 |
+
$this->_gallery = Mage::registry('gallery');
|
52 |
+
}
|
53 |
+
else {
|
54 |
+
$this->_gallery = Mage::getModel('gallery/gallery');
|
55 |
+
if ($this->_getCustomerSession()->isLoggedIn()) {
|
56 |
+
$this->_gallery->loadByCustomer($this->_getCustomerSession()->getCustomer());
|
57 |
+
}
|
58 |
+
}
|
59 |
+
}
|
60 |
+
return $this->_gallery;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Prepare additional conditions to collection
|
65 |
+
*
|
66 |
+
* @param Ifuturz_Gallery_Model_Mysql4_Product_Collection $collection
|
67 |
+
* @return Ifuturz_Gallery_Block_Customer_Gallery
|
68 |
+
*/
|
69 |
+
protected function _prepareCollection($collection)
|
70 |
+
{
|
71 |
+
return $this;
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Retrieve Gallery Product Items collection
|
76 |
+
*
|
77 |
+
* @return Ifuturz_Gallery_Model_Mysql4_Product_Collection
|
78 |
+
*/
|
79 |
+
public function getGalleryItems()
|
80 |
+
{
|
81 |
+
if (is_null($this->_collection)) {
|
82 |
+
$attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
|
83 |
+
$this->_collection = $this->_getGallery()
|
84 |
+
->getProductCollection()
|
85 |
+
->addAttributeToSelect($attributes)
|
86 |
+
->addStoreFilter()
|
87 |
+
->addUrlRewrite();
|
88 |
+
|
89 |
+
Mage::getSingleton('catalog/product_visibility')
|
90 |
+
->addVisibleInSiteFilterToCollection($this->_collection);
|
91 |
+
|
92 |
+
$this->_prepareCollection($this->_collection);
|
93 |
+
}
|
94 |
+
|
95 |
+
return $this->_collection;
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Back compatibility retrieve gallery product items
|
100 |
+
*
|
101 |
+
* @deprecated
|
102 |
+
* @return Ifuturz_Gallery_Model_Mysql4_Product_Collection
|
103 |
+
*/
|
104 |
+
public function getGallery()
|
105 |
+
{
|
106 |
+
return $this->getGalleryItems();
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Retrieve URL for Removing item from gallery
|
111 |
+
*
|
112 |
+
* @param Mage_Catalog_Model_Product $item
|
113 |
+
* @return string
|
114 |
+
*/
|
115 |
+
public function getItemRemoveUrl($product)
|
116 |
+
{
|
117 |
+
return $this->_getHelper()->getRemoveUrl($product);
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Retrieve Add Item to shopping cart URL
|
122 |
+
*
|
123 |
+
* @param Mage_Catalog_Model_Product $product
|
124 |
+
* @return string
|
125 |
+
*/
|
126 |
+
public function getItemAddToCartUrl($product)
|
127 |
+
{
|
128 |
+
return $this->_getHelper()->getAddToCartUrl($product);
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Retrieve URL for adding Product to gallery
|
133 |
+
*
|
134 |
+
* @param Mage_Catalog_Model_Product $product
|
135 |
+
* @return string
|
136 |
+
*/
|
137 |
+
public function getAddToGalleryUrl($product)
|
138 |
+
{
|
139 |
+
return $this->_getHelper()->getAddUrl($product);
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Retrieve Escaped Description for Gallery Item
|
144 |
+
*
|
145 |
+
* @param Mage_Catalog_Model_Product $item
|
146 |
+
* @return string
|
147 |
+
*/
|
148 |
+
public function getEscapedDescription($item)
|
149 |
+
{
|
150 |
+
if ($item->getGalleryItemDescription()) {
|
151 |
+
return $this->htmlEscape($item->getGalleryItemDescription());
|
152 |
+
}
|
153 |
+
return ' ';
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Check Gallery item has description
|
158 |
+
*
|
159 |
+
* @param Mage_Catalog_Model_Product $item
|
160 |
+
* @return bool
|
161 |
+
*/
|
162 |
+
public function hasDescription($item)
|
163 |
+
{
|
164 |
+
return trim($item->getGalleryItemDescription()) != '';
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Retrieve formated Date
|
169 |
+
*
|
170 |
+
* @param string $date
|
171 |
+
* @return string
|
172 |
+
*/
|
173 |
+
public function getFormatedDate($date)
|
174 |
+
{
|
175 |
+
return $this->formatDate($date, Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Check is the gallery has a salable product(s)
|
180 |
+
*
|
181 |
+
* @return bool
|
182 |
+
*/
|
183 |
+
public function isSaleable()
|
184 |
+
{
|
185 |
+
foreach ($this->getGalleryItems() as $item) {
|
186 |
+
if ($item->isSaleable()) {
|
187 |
+
return true;
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
return false;
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Retrieve gallery loaded items count
|
196 |
+
*
|
197 |
+
* @return int
|
198 |
+
*/
|
199 |
+
public function getGalleryItemsCount()
|
200 |
+
{
|
201 |
+
return $this->getGalleryItems()->count();
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Check is the gallery has items
|
206 |
+
*
|
207 |
+
* @return bool
|
208 |
+
*/
|
209 |
+
public function hasGalleryItems()
|
210 |
+
{
|
211 |
+
return $this->getGalleryItemsCount() > 0;
|
212 |
+
}
|
213 |
+
}
|
app/code/local/Ifuturz/Gallery/Block/Customer/Gallery.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ifuturz_Gallery_Block_Customer_Gallery extends Ifuturz_Gallery_Block_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Preparing global layout
|
7 |
+
*
|
8 |
+
* @return Ifuturz_Gallery_Block_Customer_Gallery
|
9 |
+
*/
|
10 |
+
protected function _prepareLayout()
|
11 |
+
{
|
12 |
+
parent::_prepareLayout();
|
13 |
+
$headBlock = $this->getLayout()->getBlock('head');
|
14 |
+
if ($headBlock) {
|
15 |
+
$headBlock->setTitle($this->__('My Gallery'));
|
16 |
+
}
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Retrieve Back URL
|
21 |
+
*
|
22 |
+
* @return string
|
23 |
+
*/
|
24 |
+
public function getBackUrl()
|
25 |
+
{
|
26 |
+
if ($this->getRefererUrl()) {
|
27 |
+
return $this->getRefererUrl();
|
28 |
+
}
|
29 |
+
return $this->getUrl('customer/account/');
|
30 |
+
}
|
31 |
+
}
|
app/code/local/Ifuturz/Gallery/Block/Customer/Sharing.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ifuturz_Gallery_Block_Customer_Sharing extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Entered Data cache
|
7 |
+
*
|
8 |
+
* @param array
|
9 |
+
*/
|
10 |
+
protected $_enteredData = null;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Prepare Global Layout
|
14 |
+
*
|
15 |
+
* @return Ifuturz_Gallery_Block_Customer_Sharing
|
16 |
+
*/
|
17 |
+
protected function _prepareLayout()
|
18 |
+
{
|
19 |
+
$headBlock = $this->getLayout()->getBlock('head');
|
20 |
+
if ($headBlock) {
|
21 |
+
$headBlock->setTitle($this->__('Gallery Sharing'));
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Retrieve Send Form Action URL
|
27 |
+
*
|
28 |
+
* @return string
|
29 |
+
*/
|
30 |
+
public function getSendUrl()
|
31 |
+
{
|
32 |
+
return $this->getUrl('*/*/send');
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Retrieve Entered Data by key
|
37 |
+
*
|
38 |
+
* @param string $key
|
39 |
+
* @return mixed
|
40 |
+
*/
|
41 |
+
public function getEnteredData($key)
|
42 |
+
{
|
43 |
+
if (is_null($this->_enteredData)) {
|
44 |
+
$this->_enteredData = Mage::getSingleton('gallery/session')
|
45 |
+
->getData('sharing_form', true);
|
46 |
+
}
|
47 |
+
|
48 |
+
if (!$this->_enteredData || !isset($this->_enteredData[$key])) {
|
49 |
+
return null;
|
50 |
+
}
|
51 |
+
else {
|
52 |
+
return $this->htmlEscape($this->_enteredData[$key]);
|
53 |
+
}
|
54 |
+
}
|
55 |
+
}
|
app/code/local/Ifuturz/Gallery/Block/Customer/Sidebar.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ifuturz_Gallery_Block_Customer_Sidebar extends Ifuturz_Gallery_Block_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Add sidebar conditions to collection
|
7 |
+
*
|
8 |
+
* @param Ifuturz_Gallery_Model_Mysql4_Product_Collection $collection
|
9 |
+
* @return Ifuturz_Gallery_Block_Customer_Gallery
|
10 |
+
*/
|
11 |
+
protected function _prepareCollection($collection)
|
12 |
+
{
|
13 |
+
$collection->setPage(1, 3);
|
14 |
+
$collection->addAttributeToSort('added_at', 'desc');
|
15 |
+
|
16 |
+
return $this;
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Prepare before to html
|
21 |
+
*
|
22 |
+
* @return string
|
23 |
+
*/
|
24 |
+
protected function _toHtml()
|
25 |
+
{
|
26 |
+
if ($this->_getHelper()->hasItems()) {
|
27 |
+
return parent::_toHtml();
|
28 |
+
}
|
29 |
+
|
30 |
+
return '';
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Can Display gallery
|
35 |
+
*
|
36 |
+
* @return bool
|
37 |
+
*/
|
38 |
+
public function getCanDisplayGallery()
|
39 |
+
{
|
40 |
+
return $this->_getCustomerSession()->isLoggedIn();
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Retrieve URL for removing item from gallery
|
45 |
+
*
|
46 |
+
* @deprecated back compatibility alias for getItemRemoveUrl
|
47 |
+
* @param Ifuturz_Gallery_Model_Item $item
|
48 |
+
* @return string
|
49 |
+
*/
|
50 |
+
public function getRemoveItemUrl($item)
|
51 |
+
{
|
52 |
+
return $this->getItemRemoveUrl($item);
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Retrieve URL for adding product to shopping cart and remove item from gallery
|
57 |
+
*
|
58 |
+
* @deprecated
|
59 |
+
* @param Mage_Catalog_Model_Product $product
|
60 |
+
* @return string
|
61 |
+
*/
|
62 |
+
public function getAddToCartItemUrl($product)
|
63 |
+
{
|
64 |
+
return $this->getItemAddToCartUrl($product);
|
65 |
+
}
|
66 |
+
}
|
app/code/local/Ifuturz/Gallery/Block/Links.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ifuturz_Gallery_Block_Links extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Add link on gallery page in parent block
|
7 |
+
*
|
8 |
+
* @return Ifuturz_Gallery_Block_Links
|
9 |
+
*/
|
10 |
+
public function addGalleryLink()
|
11 |
+
{
|
12 |
+
$parentBlock = $this->getParentBlock();
|
13 |
+
if ($parentBlock && $this->helper('gallery')->isAllow()) {
|
14 |
+
$count = $this->helper('gallery')->getItemCount();
|
15 |
+
if ($count > 1) {
|
16 |
+
$text = $this->__('My Gallery (%d items)', $count);
|
17 |
+
}
|
18 |
+
else if ($count == 1) {
|
19 |
+
$text = $this->__('My Gallery (%d item)', $count);
|
20 |
+
}
|
21 |
+
else {
|
22 |
+
$text = $this->__('My Gallery');
|
23 |
+
}
|
24 |
+
$parentBlock->addLink($text, 'gallery', $text, true, array(), 30, null, 'class="top-link-gallery"');
|
25 |
+
}
|
26 |
+
return $this;
|
27 |
+
}
|
28 |
+
}
|
app/code/local/Ifuturz/Gallery/Block/Share/Email/Items.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ifuturz_Gallery_Block_Share_Email_Items extends Ifuturz_Gallery_Block_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Initialize template
|
7 |
+
*
|
8 |
+
*/
|
9 |
+
public function __construct()
|
10 |
+
{
|
11 |
+
parent::__construct();
|
12 |
+
$this->setTemplate('gallery/email/items.phtml');
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Retrieve Product View URL
|
17 |
+
*
|
18 |
+
* @param Mage_Catalog_Model_Product $product
|
19 |
+
* @param array $additional
|
20 |
+
* @return string
|
21 |
+
*/
|
22 |
+
public function getProductUrl($product, $additional = array())
|
23 |
+
{
|
24 |
+
$additional['_store_to_url'] = true;
|
25 |
+
return parent::getProductUrl($product, $additional);
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Retrieve URL for add product to shopping cart
|
30 |
+
*
|
31 |
+
* @param Mage_Catalog_Model_Product $product
|
32 |
+
* @param array $additional
|
33 |
+
* @return string
|
34 |
+
*/
|
35 |
+
public function getAddToCartUrl($product, $additional = array())
|
36 |
+
{
|
37 |
+
$additional['nocookie'] = 1;
|
38 |
+
$additional['_store_to_url'] = true;
|
39 |
+
return parent::getAddToCartUrl($product, $additional);
|
40 |
+
}
|
41 |
+
}
|
app/code/local/Ifuturz/Gallery/Block/Share/Email/Rss.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ifuturz_Gallery_Block_Share_Email_Rss extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setTemplate('gallery/email/rss.phtml');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Ifuturz/Gallery/Block/Share/Gallery.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ifuturz_Gallery_Block_Share_Gallery extends Ifuturz_Gallery_Block_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Customer instance
|
7 |
+
*
|
8 |
+
* @var Mage_Customer_Model_Customer
|
9 |
+
*/
|
10 |
+
protected $_customer = null;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Prepare global layout
|
14 |
+
*
|
15 |
+
* @return Ifuturz_Gallery_Block_Share_Gallery
|
16 |
+
*
|
17 |
+
*/
|
18 |
+
protected function _prepareLayout()
|
19 |
+
{
|
20 |
+
parent::_prepareLayout();
|
21 |
+
|
22 |
+
$headBlock = $this->getLayout()->getBlock('head');
|
23 |
+
if ($headBlock) {
|
24 |
+
$headBlock->setTitle($this->getHeader());
|
25 |
+
}
|
26 |
+
return $this;
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Retrieve Shared Gallery Customer instance
|
31 |
+
*
|
32 |
+
* @return Mage_Customer_Model_Customer
|
33 |
+
*/
|
34 |
+
public function getGalleryCustomer()
|
35 |
+
{
|
36 |
+
if (is_null($this->_customer)) {
|
37 |
+
$this->_customer = Mage::getModel('customer/customer')
|
38 |
+
->load($this->_getGallery()->getCustomerId());
|
39 |
+
}
|
40 |
+
|
41 |
+
return $this->_customer;
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Retrieve Page Header
|
46 |
+
*
|
47 |
+
* @return string
|
48 |
+
*/
|
49 |
+
public function getHeader()
|
50 |
+
{
|
51 |
+
return Mage::helper('gallery')->__("%s's Gallery", $this->htmlEscape($this->getGalleryCustomer()->getFirstname()));
|
52 |
+
}
|
53 |
+
}
|
app/code/local/Ifuturz/Gallery/Controller/Abstract.php
ADDED
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
abstract class Ifuturz_Gallery_Controller_Abstract extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Retrieve current gallery instance
|
7 |
+
*
|
8 |
+
* @return Ifuturz_Gallery_Model_Gallery|false
|
9 |
+
*/
|
10 |
+
abstract protected function _getGallery();
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Add all items from gallery to shopping cart
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
public function allcartAction()
|
17 |
+
{
|
18 |
+
$gallery = $this->_getGallery();
|
19 |
+
if (!$gallery) {
|
20 |
+
$this->_forward('noRoute');
|
21 |
+
return ;
|
22 |
+
}
|
23 |
+
$isOwner = $gallery->isOwner(Mage::getSingleton('customer/session')->getCustomerId());
|
24 |
+
|
25 |
+
$messages = array();
|
26 |
+
$addedItems = array();
|
27 |
+
$notSalable = array();
|
28 |
+
$hasOptions = array();
|
29 |
+
$isGrouped = array();
|
30 |
+
|
31 |
+
$cart = Mage::getSingleton('checkout/cart');
|
32 |
+
$collection = $gallery->getItemCollection();
|
33 |
+
|
34 |
+
foreach ($collection as $item) {
|
35 |
+
/** @var Ifuturz_Gallery_Model_Item */
|
36 |
+
try {
|
37 |
+
if ($item->addToCart($cart, $isOwner)) {
|
38 |
+
$addedItems[] = $item->getProduct();
|
39 |
+
}
|
40 |
+
|
41 |
+
} catch (Mage_Core_Exception $e) {
|
42 |
+
if ($e->getCode() == Ifuturz_Gallery_Model_Item::EXCEPTION_CODE_NOT_SALABLE) {
|
43 |
+
$notSalable[] = $item;
|
44 |
+
} else if ($e->getCode() == Ifuturz_Gallery_Model_Item::EXCEPTION_CODE_HAS_REQUIRED_OPTIONS) {
|
45 |
+
$hasOptions[] = $item;
|
46 |
+
} else if ($e->getCode() == Ifuturz_Gallery_Model_Item::EXCEPTION_CODE_IS_GROUPED_PRODUCT) {
|
47 |
+
$isGrouped[] = $item;
|
48 |
+
} else {
|
49 |
+
$messages[] = $e->getMessage();
|
50 |
+
}
|
51 |
+
} catch (Exception $e) {
|
52 |
+
Mage::logException($e);
|
53 |
+
$messages[] = Mage::helper('gallery')->__('Cannot add the item to shopping cart.');
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
if ($isOwner) {
|
58 |
+
$indexUrl = Mage::helper('gallery')->getListUrl();
|
59 |
+
} else {
|
60 |
+
$indexUrl = Mage::getUrl('gallery/shared', array('code' => $gallery->getSharingCode()));
|
61 |
+
}
|
62 |
+
if (Mage::helper('checkout/cart')->getShouldRedirectToCart()) {
|
63 |
+
$redirectUrl = Mage::helper('checkout/cart')->getCartUrl();
|
64 |
+
} else if ($this->_getRefererUrl()) {
|
65 |
+
$redirectUrl = $this->_getRefererUrl();
|
66 |
+
} else {
|
67 |
+
$redirectUrl = $indexUrl;
|
68 |
+
}
|
69 |
+
|
70 |
+
if ($notSalable) {
|
71 |
+
$products = array();
|
72 |
+
foreach ($notSalable as $item) {
|
73 |
+
$products[] = '"' . $item->getProduct()->getName() . '"';
|
74 |
+
}
|
75 |
+
$messages[] = Mage::helper('gallery')->__('Unable to add the following product(s) to shopping cart: %s.', join(', ', $products));
|
76 |
+
}
|
77 |
+
|
78 |
+
if ($isGrouped) {
|
79 |
+
$products = array();
|
80 |
+
foreach ($isGrouped as $item) {
|
81 |
+
$products[] = '"' . $item->getProduct()->getName() . '"';
|
82 |
+
}
|
83 |
+
$messages[] = Mage::helper('gallery')->__('Product(s) %s are grouped. Each of them can be added to cart separately only.', join(', ', $products));
|
84 |
+
}
|
85 |
+
|
86 |
+
if ($hasOptions) {
|
87 |
+
$products = array();
|
88 |
+
foreach ($hasOptions as $item) {
|
89 |
+
$products[] = '"' . $item->getProduct()->getName() . '"';
|
90 |
+
}
|
91 |
+
$messages[] = Mage::helper('gallery')->__('Product(s) %s have required options. Each of them can be added to cart separately only.', join(', ', $products));
|
92 |
+
}
|
93 |
+
|
94 |
+
if ($messages) {
|
95 |
+
$isMessageSole = (count($messages) == 1);
|
96 |
+
if ($isMessageSole && count($hasOptions) == 1) {
|
97 |
+
$item = $hasOptions[0];
|
98 |
+
if ($isOwner) {
|
99 |
+
$item->delete();
|
100 |
+
}
|
101 |
+
$redirectUrl = $item->getProductUrl();
|
102 |
+
} elseif ($isMessageSole && count($isGrouped) == 1) {
|
103 |
+
$item = $isGrouped[0];
|
104 |
+
if ($isOwner) {
|
105 |
+
$item->delete();
|
106 |
+
}
|
107 |
+
$redirectUrl = $item->getProductUrl();
|
108 |
+
} else {
|
109 |
+
$gallerySession = Mage::getSingleton('gallery/session');
|
110 |
+
foreach ($messages as $message) {
|
111 |
+
$gallerySession->addError($message);
|
112 |
+
}
|
113 |
+
$redirectUrl = $indexUrl;
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
+
if ($addedItems) {
|
118 |
+
// save gallery model for setting date of last update
|
119 |
+
try {
|
120 |
+
$gallery->save();
|
121 |
+
}
|
122 |
+
catch (Exception $e) {
|
123 |
+
Mage::getSingleton('gallery/session')->addError($this->__('Cannot update gallery'));
|
124 |
+
$redirectUrl = $indexUrl;
|
125 |
+
}
|
126 |
+
|
127 |
+
$products = array();
|
128 |
+
foreach ($addedItems as $product) {
|
129 |
+
$products[] = '"' . $product->getName() . '"';
|
130 |
+
}
|
131 |
+
|
132 |
+
Mage::getSingleton('checkout/session')->addSuccess(
|
133 |
+
Mage::helper('gallery')->__('%d product(s) have been added to shopping cart: %s.', count($addedItems), join(', ', $products))
|
134 |
+
);
|
135 |
+
}
|
136 |
+
// save cart and collect totals
|
137 |
+
$cart->save()->getQuote()->collectTotals();
|
138 |
+
|
139 |
+
Mage::helper('gallery')->calculate();
|
140 |
+
|
141 |
+
$this->_redirectUrl($redirectUrl);
|
142 |
+
}
|
143 |
+
}
|
app/code/local/Ifuturz/Gallery/Helper/Data.php
ADDED
@@ -0,0 +1,305 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ifuturz_Gallery_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Customer Gallery instance
|
7 |
+
*
|
8 |
+
* @var Ifuturz_Gallery_Model_Gallery
|
9 |
+
*/
|
10 |
+
protected $_gallery = null;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Gallery Product Items Collection
|
14 |
+
*
|
15 |
+
* @var Ifuturz_Gallery_Model_Mysql4_Product_Collection
|
16 |
+
*/
|
17 |
+
protected $_productCollection = null;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Retrieve customer login status
|
21 |
+
*
|
22 |
+
* @return bool
|
23 |
+
*/
|
24 |
+
protected function _isCustomerLogIn()
|
25 |
+
{
|
26 |
+
return Mage::getSingleton('customer/session')->isLoggedIn();
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Retrieve logged in customer
|
31 |
+
*
|
32 |
+
* @return Mage_Customer_Model_Customer
|
33 |
+
*/
|
34 |
+
protected function _getCurrentCustomer()
|
35 |
+
{
|
36 |
+
return Mage::getSingleton('customer/session')->getCustomer();
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Retrieve gallery by logged in customer
|
41 |
+
*
|
42 |
+
* @return Ifuturz_Gallery_Model_Gallery
|
43 |
+
*/
|
44 |
+
public function getGallery()
|
45 |
+
{
|
46 |
+
if (is_null($this->_gallery)) {
|
47 |
+
$this->_gallery = Mage::getModel('gallery/gallery')
|
48 |
+
->loadByCustomer($this->_getCurrentCustomer());
|
49 |
+
}
|
50 |
+
return $this->_gallery;
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Retrieve gallery items availability
|
55 |
+
*
|
56 |
+
* @return bool
|
57 |
+
*/
|
58 |
+
public function hasItems()
|
59 |
+
{
|
60 |
+
return $this->getItemCount() > 0;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Retrieve gallery item count
|
65 |
+
*
|
66 |
+
* @return int
|
67 |
+
*/
|
68 |
+
public function getItemCount()
|
69 |
+
{
|
70 |
+
if (!Mage::getSingleton('customer/session')->hasGalleryItemCount()) {
|
71 |
+
$this->calculate();
|
72 |
+
}
|
73 |
+
|
74 |
+
return Mage::getSingleton('customer/session')->getGalleryItemCount();
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Retrieve gallery product items collection
|
79 |
+
*
|
80 |
+
* alias for getProductCollection
|
81 |
+
*
|
82 |
+
* @return Ifuturz_Gallery_Model_Mysql4_Product_Collection
|
83 |
+
*/
|
84 |
+
public function getItemCollection()
|
85 |
+
{
|
86 |
+
return $this->getProductCollection();
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Retrieve gallery product items collection
|
91 |
+
*
|
92 |
+
* @return Ifuturz_Gallery_Model_Mysql4_Product_Collection
|
93 |
+
*/
|
94 |
+
public function getProductCollection()
|
95 |
+
{
|
96 |
+
if (is_null($this->_productCollection)) {
|
97 |
+
$this->_productCollection = $this->getGallery()
|
98 |
+
->getProductCollection();
|
99 |
+
|
100 |
+
Mage::getSingleton('catalog/product_visibility')
|
101 |
+
->addVisibleInSiteFilterToCollection($this->_productCollection);
|
102 |
+
}
|
103 |
+
return $this->_productCollection;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Retrieve Item Store for URL
|
108 |
+
*
|
109 |
+
* @param Mage_Catalog_Model_Product|Ifuturz_Gallery_Model_Item $item
|
110 |
+
* @return Mage_Core_Model_Store
|
111 |
+
*/
|
112 |
+
protected function _getUrlStore($item)
|
113 |
+
{
|
114 |
+
$storeId = null;
|
115 |
+
if ($item instanceof Mage_Catalog_Model_Product) {
|
116 |
+
if ($item->isVisibleInSiteVisibility()) {
|
117 |
+
$storeId = $item->getStoreId();
|
118 |
+
}
|
119 |
+
else if ($item->hasUrlDataObject()) {
|
120 |
+
$storeId = $item->getUrlDataObject()->getStoreId();
|
121 |
+
}
|
122 |
+
}
|
123 |
+
return Mage::app()->getStore($storeId);
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Retrieve URL for removing item from gallery
|
128 |
+
*
|
129 |
+
* @param Mage_Catalog_Model_Product|Ifuturz_Gallery_Model_Item $item
|
130 |
+
* @return string
|
131 |
+
*/
|
132 |
+
public function getRemoveUrl($item)
|
133 |
+
{
|
134 |
+
return $this->_getUrl('gallery/index/remove', array(
|
135 |
+
'item' => $item->getGalleryItemId()
|
136 |
+
));
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Retrieve url for adding product to gallery
|
141 |
+
*
|
142 |
+
* @param Mage_Catalog_Model_Product|Ifuturz_Gallery_Model_Item $product
|
143 |
+
* @return string|boolean
|
144 |
+
*/
|
145 |
+
public function getAddUrl($item)
|
146 |
+
{
|
147 |
+
return $this->getAddUrlWithParams($item);
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* Retrieve url for adding product to gallery with params
|
152 |
+
*
|
153 |
+
* @param Mage_Catalog_Model_Product|Ifuturz_Gallery_Model_Item $product
|
154 |
+
* @param array $param
|
155 |
+
* @return string|boolean
|
156 |
+
*/
|
157 |
+
public function getAddUrlWithParams($item, array $params = array())
|
158 |
+
{
|
159 |
+
$productId = null;
|
160 |
+
if ($item instanceof Mage_Catalog_Model_Product) {
|
161 |
+
$productId = $item->getEntityId();
|
162 |
+
}
|
163 |
+
if ($item instanceof Ifuturz_Gallery_Model_Item) {
|
164 |
+
$productId = $item->getProductId();
|
165 |
+
}
|
166 |
+
|
167 |
+
if ($productId) {
|
168 |
+
$params['product'] = $productId;
|
169 |
+
return $this->_getUrlStore($item)->getUrl('gallery/index/add', $params);
|
170 |
+
}
|
171 |
+
|
172 |
+
return false;
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Retrieve URL for adding item to shoping cart
|
177 |
+
*
|
178 |
+
* @param Mage_Catalog_Model_Product|Ifuturz_Gallery_Model_Item $item
|
179 |
+
* @return string
|
180 |
+
*/
|
181 |
+
public function getAddToCartUrl($item)
|
182 |
+
{
|
183 |
+
$urlParamName = Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED;
|
184 |
+
$continueUrl = Mage::helper('core')->urlEncode(Mage::getUrl('*/*/*', array(
|
185 |
+
'_current' => true,
|
186 |
+
'_use_rewrite' => true,
|
187 |
+
'_store_to_url' => true,
|
188 |
+
)));
|
189 |
+
|
190 |
+
return $this->_getUrlStore($item)->getUrl('gallery/index/cart', array(
|
191 |
+
'item' => $item->getGalleryItemId(),
|
192 |
+
$urlParamName => $continueUrl
|
193 |
+
));
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Retrieve url for adding item to shoping cart with b64 referer
|
198 |
+
*
|
199 |
+
* @deprecated
|
200 |
+
* @param Mage_Catalog_Model_Product|Ifuturz_Gallery_Model_Item $item
|
201 |
+
* @return string
|
202 |
+
*/
|
203 |
+
public function getAddToCartUrlBase64($item)
|
204 |
+
{
|
205 |
+
return $this->getAddToCartUrl($item);
|
206 |
+
}
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Retrieve customer gallery url
|
210 |
+
*
|
211 |
+
* @return string
|
212 |
+
*/
|
213 |
+
public function getListUrl()
|
214 |
+
{
|
215 |
+
return $this->_getUrl('gallery');
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Check is allow gallery module
|
220 |
+
*
|
221 |
+
* @return bool
|
222 |
+
*/
|
223 |
+
public function isAllow()
|
224 |
+
{
|
225 |
+
if ($this->isModuleOutputEnabled() && Mage::getStoreConfig('gallery/general/active')) {
|
226 |
+
return true;
|
227 |
+
}
|
228 |
+
return false;
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* Check is allow gallery action in shopping cart
|
233 |
+
*
|
234 |
+
* @return bool
|
235 |
+
*/
|
236 |
+
public function isAllowInCart()
|
237 |
+
{
|
238 |
+
return $this->isAllow() && $this->_isCustomerLogIn();
|
239 |
+
}
|
240 |
+
|
241 |
+
/**
|
242 |
+
* Retrieve customer name
|
243 |
+
*
|
244 |
+
* @return string
|
245 |
+
*/
|
246 |
+
public function getCustomerName()
|
247 |
+
{
|
248 |
+
return $this->_getCurrentCustomer()->getName();
|
249 |
+
}
|
250 |
+
|
251 |
+
/**
|
252 |
+
* Retrieve RSS URL
|
253 |
+
*
|
254 |
+
* @return string
|
255 |
+
*/
|
256 |
+
public function getRssUrl()
|
257 |
+
{
|
258 |
+
$customer = $this->_getCurrentCustomer();
|
259 |
+
$key = $customer->getId().','.$customer->getEmail();
|
260 |
+
return $this->_getUrl('rss/index/gallery', array('data' => Mage::helper('core')->urlEncode($key), '_secure' => false));
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
* Is allow RSS
|
265 |
+
*
|
266 |
+
* @return bool
|
267 |
+
*/
|
268 |
+
public function isRssAllow()
|
269 |
+
{
|
270 |
+
if (Mage::getStoreConfig('rss/gallery/active')) {
|
271 |
+
return true;
|
272 |
+
}
|
273 |
+
return false;
|
274 |
+
}
|
275 |
+
|
276 |
+
/**
|
277 |
+
* Retrieve default empty comment message
|
278 |
+
*
|
279 |
+
* @return string
|
280 |
+
*/
|
281 |
+
public function defaultCommentString()
|
282 |
+
{
|
283 |
+
return $this->__('Please, enter your comments...');
|
284 |
+
}
|
285 |
+
|
286 |
+
/**
|
287 |
+
* Calculate count of gallery items and put value to customer session.
|
288 |
+
* Method called after gallery modifications and trigger 'gallery_items_renewed' event.
|
289 |
+
*
|
290 |
+
* @return Ifuturz_Gallery_Helper_Data
|
291 |
+
*/
|
292 |
+
public function calculate()
|
293 |
+
{
|
294 |
+
if (!$this->_isCustomerLogIn()) {
|
295 |
+
$count = 0;
|
296 |
+
}
|
297 |
+
else {
|
298 |
+
$count = $this->getProductCollection()
|
299 |
+
->getSize();
|
300 |
+
}
|
301 |
+
Mage::getSingleton('customer/session')->setGalleryItemCount($count);
|
302 |
+
Mage::dispatchEvent('gallery_items_renewed');
|
303 |
+
return $this;
|
304 |
+
}
|
305 |
+
}
|
app/code/local/Ifuturz/Gallery/Model/Gallery.php
ADDED
@@ -0,0 +1,281 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ifuturz_Gallery_Model_Gallery extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Gallery item collection
|
7 |
+
*
|
8 |
+
* @var Ifuturz_Gallery_Model_Mysql4_Item_Collection
|
9 |
+
*/
|
10 |
+
protected $_itemCollection = null;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Store filter for gallery
|
14 |
+
*
|
15 |
+
* @var Mage_Core_Model_Store
|
16 |
+
*/
|
17 |
+
protected $_store = null;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Shared store ids (website stores)
|
21 |
+
*
|
22 |
+
* @var array
|
23 |
+
*/
|
24 |
+
protected $_storeIds = null;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Initialize resource model
|
28 |
+
*
|
29 |
+
*/
|
30 |
+
protected function _construct()
|
31 |
+
{
|
32 |
+
$this->_init('gallery/gallery');
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Load gallery by customer
|
37 |
+
*
|
38 |
+
* @param mixed $customer
|
39 |
+
* @param bool $create Create gallery if don't exists
|
40 |
+
* @return Ifuturz_Gallery_Model_Gallery
|
41 |
+
*/
|
42 |
+
public function loadByCustomer($customer, $create = false)
|
43 |
+
{
|
44 |
+
if ($customer instanceof Mage_Customer_Model_Customer) {
|
45 |
+
$customer = $customer->getId();
|
46 |
+
}
|
47 |
+
|
48 |
+
$customerIdFieldName = $this->_getResource()->getCustomerIdFieldName();
|
49 |
+
$this->_getResource()->load($this, $customer, $customerIdFieldName);
|
50 |
+
if (!$this->getId() && $create) {
|
51 |
+
$this->setCustomerId($customer);
|
52 |
+
$this->setSharingCode($this->_getSharingRandomCode());
|
53 |
+
$this->save();
|
54 |
+
}
|
55 |
+
|
56 |
+
return $this;
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Load by sharing code
|
61 |
+
*
|
62 |
+
* @param string $code
|
63 |
+
* @return Ifuturz_Gallery_Model_Gallery
|
64 |
+
*/
|
65 |
+
public function loadByCode($code)
|
66 |
+
{
|
67 |
+
$this->_getResource()->load($this, $code, 'sharing_code');
|
68 |
+
if(!$this->getShared()) {
|
69 |
+
$this->setId(null);
|
70 |
+
}
|
71 |
+
|
72 |
+
return $this;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Retrieve sharing code (random string)
|
77 |
+
*
|
78 |
+
* @return string
|
79 |
+
*/
|
80 |
+
protected function _getSharingRandomCode()
|
81 |
+
{
|
82 |
+
return Mage::helper('core')->uniqHash();
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Set date of last update for gallery
|
87 |
+
*
|
88 |
+
* @return Ifuturz_Gallery_Model_Gallery
|
89 |
+
*/
|
90 |
+
protected function _beforeSave()
|
91 |
+
{
|
92 |
+
parent::_beforeSave();
|
93 |
+
$this->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate());
|
94 |
+
return $this;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Retrieve gallery item collection
|
99 |
+
*
|
100 |
+
* @return Ifuturz_Gallery_Model_Mysql4_Item_Collection
|
101 |
+
*/
|
102 |
+
public function getItemCollection()
|
103 |
+
{
|
104 |
+
if (is_null($this->_itemCollection)) {
|
105 |
+
$this->_itemCollection = Mage::getResourceModel('gallery/item_collection')
|
106 |
+
->addGalleryFilter($this);
|
107 |
+
}
|
108 |
+
|
109 |
+
return $this->_itemCollection;
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Retrieve Product collection
|
114 |
+
*
|
115 |
+
* @return Ifuturz_Gallery_Model_Mysql4_Product_Collection
|
116 |
+
*/
|
117 |
+
public function getProductCollection()
|
118 |
+
{
|
119 |
+
$collection = $this->getData('product_collection');
|
120 |
+
if (is_null($collection)) {
|
121 |
+
$collection = Mage::getResourceModel('gallery/product_collection')
|
122 |
+
->setStoreId($this->getStore()->getId())
|
123 |
+
->addGalleryFilter($this)
|
124 |
+
->addGallerySortOrder();
|
125 |
+
$this->setData('product_collection', $collection);
|
126 |
+
}
|
127 |
+
return $collection;
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Add new item to gallery
|
132 |
+
*
|
133 |
+
* @param int $productId
|
134 |
+
* @return Ifuturz_Gallery_Model_Item
|
135 |
+
*/
|
136 |
+
public function addNewItem($productId)
|
137 |
+
{
|
138 |
+
$item = Mage::getModel('gallery/item');
|
139 |
+
$item->loadByProductGallery($this->getId(), $productId, $this->getSharedStoreIds());
|
140 |
+
|
141 |
+
if (!$item->getId()) {
|
142 |
+
$item->setProductId($productId)
|
143 |
+
->setGalleryId($this->getId())
|
144 |
+
->setAddedAt(now())
|
145 |
+
->setStoreId($this->getStore()->getId())
|
146 |
+
->save();
|
147 |
+
}
|
148 |
+
|
149 |
+
return $item;
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Set customer id
|
154 |
+
*
|
155 |
+
* @param int $customerId
|
156 |
+
* @return Ifuturz_Gallery_Model_Gallery
|
157 |
+
*/
|
158 |
+
public function setCustomerId($customerId)
|
159 |
+
{
|
160 |
+
return $this->setData($this->_getResource()->getCustomerIdFieldName(), $customerId);
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Retrieve customer id
|
165 |
+
*
|
166 |
+
* @return Ifuturz_Gallery_Model_Gallery
|
167 |
+
*/
|
168 |
+
public function getCustomerId()
|
169 |
+
{
|
170 |
+
return $this->getData($this->_getResource()->getCustomerIdFieldName());
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Retrieve data for save
|
175 |
+
*
|
176 |
+
* @return array
|
177 |
+
*/
|
178 |
+
public function getDataForSave()
|
179 |
+
{
|
180 |
+
$data = array();
|
181 |
+
$data[$this->_getResource()->getCustomerIdFieldName()] = $this->getCustomerId();
|
182 |
+
$data['shared'] = (int) $this->getShared();
|
183 |
+
$data['sharing_code']= $this->getSharingCode();
|
184 |
+
return $data;
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Retrieve shared store ids for current website or all stores if $current is false
|
189 |
+
*
|
190 |
+
* @param bool $current Use current website or not
|
191 |
+
* @return array
|
192 |
+
*/
|
193 |
+
public function getSharedStoreIds($current = true)
|
194 |
+
{
|
195 |
+
if (is_null($this->_storeIds)) {
|
196 |
+
if ($current) {
|
197 |
+
$this->_storeIds = $this->getStore()->getWebsite()->getStoreIds();
|
198 |
+
} else {
|
199 |
+
$_storeIds = array();
|
200 |
+
foreach (Mage::app()->getStores() as $store) {
|
201 |
+
$_storeIds[] = $store->getId();
|
202 |
+
}
|
203 |
+
$this->_storeIds = $_storeIds;
|
204 |
+
}
|
205 |
+
}
|
206 |
+
return $this->_storeIds;
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* Set shared store ids
|
211 |
+
*
|
212 |
+
* @param array $storeIds
|
213 |
+
* @return Ifuturz_Gallery_Model_Gallery
|
214 |
+
*/
|
215 |
+
public function setSharedStoreIds($storeIds)
|
216 |
+
{
|
217 |
+
$this->_storeIds = $storeIds;
|
218 |
+
return $this;
|
219 |
+
}
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Retrieve gallery store object
|
223 |
+
*
|
224 |
+
* @return Mage_Core_Model_Store
|
225 |
+
*/
|
226 |
+
public function getStore()
|
227 |
+
{
|
228 |
+
if (is_null($this->_store)) {
|
229 |
+
$this->setStore(Mage::app()->getStore());
|
230 |
+
}
|
231 |
+
return $this->_store;
|
232 |
+
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* Set gallery store
|
236 |
+
*
|
237 |
+
* @param Mage_Core_Model_Store $store
|
238 |
+
* @return Ifuturz_Gallery_Model_Gallery
|
239 |
+
*/
|
240 |
+
public function setStore($store)
|
241 |
+
{
|
242 |
+
$this->_store = $store;
|
243 |
+
return $this;
|
244 |
+
}
|
245 |
+
|
246 |
+
/**
|
247 |
+
* Retrieve gallery items count
|
248 |
+
*
|
249 |
+
* @return int
|
250 |
+
*/
|
251 |
+
public function getItemsCount()
|
252 |
+
{
|
253 |
+
return $this->_getResource()->fetchItemsCount($this);
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* Retrieve gallery has salable item(s)
|
258 |
+
*
|
259 |
+
* @return bool
|
260 |
+
*/
|
261 |
+
public function isSalable()
|
262 |
+
{
|
263 |
+
foreach ($this->getProductCollection() as $product) {
|
264 |
+
if ($product->getIsSalable()) {
|
265 |
+
return true;
|
266 |
+
}
|
267 |
+
}
|
268 |
+
return false;
|
269 |
+
}
|
270 |
+
|
271 |
+
/**
|
272 |
+
* Check customer is owner this gallery
|
273 |
+
*
|
274 |
+
* @param int $customerId
|
275 |
+
* @return bool
|
276 |
+
*/
|
277 |
+
public function isOwner($customerId)
|
278 |
+
{
|
279 |
+
return $customerId == $this->getCustomerId();
|
280 |
+
}
|
281 |
+
}
|
app/code/local/Ifuturz/Gallery/Model/Item.php
ADDED
@@ -0,0 +1,224 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ifuturz_Gallery_Model_Item extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
const EXCEPTION_CODE_NOT_SALABLE = 901;
|
6 |
+
const EXCEPTION_CODE_HAS_REQUIRED_OPTIONS = 902;
|
7 |
+
const EXCEPTION_CODE_IS_GROUPED_PRODUCT = 903;
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Prefix of model events names
|
11 |
+
*
|
12 |
+
* @var string
|
13 |
+
*/
|
14 |
+
protected $_eventPrefix = 'gallery_item';
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Parameter name in event
|
18 |
+
*
|
19 |
+
* In observe method you can use $observer->getEvent()->getItem() in this case
|
20 |
+
*
|
21 |
+
* @var string
|
22 |
+
*/
|
23 |
+
protected $_eventObject = 'item';
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Initialize resource model
|
27 |
+
*
|
28 |
+
*/
|
29 |
+
protected function _construct()
|
30 |
+
{
|
31 |
+
$this->_init('gallery/item');
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Retrieve resource instance wrapper
|
36 |
+
*
|
37 |
+
* @return Ifuturz_Gallery_Model_Mysql4_Item
|
38 |
+
*/
|
39 |
+
protected function _getResource()
|
40 |
+
{
|
41 |
+
return parent::_getResource();
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Validate wish list item data
|
46 |
+
*
|
47 |
+
* @throws Mage_Core_Exception
|
48 |
+
* @return bool
|
49 |
+
*/
|
50 |
+
public function validate()
|
51 |
+
{
|
52 |
+
if (!$this->getGalleryId()) {
|
53 |
+
Mage::throwException(Mage::helper('gallery')->__('Cannot specify gallery.'));
|
54 |
+
}
|
55 |
+
if (!$this->getProductId()) {
|
56 |
+
Mage::throwException(Mage::helper('gallery')->__('Cannot specify product.'));
|
57 |
+
}
|
58 |
+
|
59 |
+
return true;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Check required data
|
64 |
+
*
|
65 |
+
* @return Ifuturz_Gallery_Model_Item
|
66 |
+
*/
|
67 |
+
protected function _beforeSave()
|
68 |
+
{
|
69 |
+
parent::_beforeSave();
|
70 |
+
|
71 |
+
// validate required item data
|
72 |
+
$this->validate();
|
73 |
+
|
74 |
+
// set current store id if it is not defined
|
75 |
+
if (is_null($this->getStoreId())) {
|
76 |
+
$this->setStoreId(Mage::app()->getStore()->getId());
|
77 |
+
}
|
78 |
+
|
79 |
+
// set current date if added at data is not defined
|
80 |
+
if (is_null($this->getAddedAt())) {
|
81 |
+
$this->setAddedAt(Mage::getSingleton('core/date')->gmtDate());
|
82 |
+
}
|
83 |
+
|
84 |
+
return $this;
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Retrieve gallery item data as array
|
89 |
+
*
|
90 |
+
* @deprecated since 1.4.0.0
|
91 |
+
* @return array
|
92 |
+
*/
|
93 |
+
public function getDataForSave()
|
94 |
+
{
|
95 |
+
$data = array();
|
96 |
+
$data['product_id'] = $this->getProductId();
|
97 |
+
$data['gallery_id'] = $this->getGalleryId();
|
98 |
+
$data['added_at'] = $this->getAddedAt() ? $this->getAddedAt() : Mage::getSingleton('core/date')->gmtDate();
|
99 |
+
$data['description'] = $this->getDescription();
|
100 |
+
$data['store_id'] = $this->getStoreId() ? $this->getStoreId() : Mage::app()->getStore()->getId();
|
101 |
+
|
102 |
+
return $data;
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Load item by product, gallery and shared stores
|
107 |
+
*
|
108 |
+
* @param int $galleryId
|
109 |
+
* @param int $productId
|
110 |
+
* @param array $sharedStores
|
111 |
+
* @return Ifuturz_Gallery_Model_Item
|
112 |
+
*/
|
113 |
+
public function loadByProductGallery($galleryId, $productId, $sharedStores)
|
114 |
+
{
|
115 |
+
$this->_getResource()->loadByProductGallery($this, $galleryId, $productId, $sharedStores);
|
116 |
+
$this->_afterLoad();
|
117 |
+
$this->setOrigData();
|
118 |
+
|
119 |
+
return $this;
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Retrieve item product instance
|
124 |
+
*
|
125 |
+
* @throws Mage_Core_Exception
|
126 |
+
* @return Mage_Catalog_Model_Product
|
127 |
+
*/
|
128 |
+
public function getProduct()
|
129 |
+
{
|
130 |
+
$product = $this->_getData('product');
|
131 |
+
if (is_null($product)) {
|
132 |
+
if (!$this->getProductId()) {
|
133 |
+
Mage::throwException(Mage::helper('gallery')->__('Cannot specify product.'));
|
134 |
+
}
|
135 |
+
|
136 |
+
$product = Mage::getModel('catalog/product')
|
137 |
+
->load($this->getProductId());
|
138 |
+
|
139 |
+
$this->setData('product', $product);
|
140 |
+
}
|
141 |
+
return $product;
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Add or Move item product to shopping cart
|
146 |
+
*
|
147 |
+
* Return true if product was successful added or exception with code
|
148 |
+
* Return false for disabled or unvisible products
|
149 |
+
*
|
150 |
+
* @throws Mage_Core_Exception
|
151 |
+
* @param Mage_Checkout_Model_Cart $cart
|
152 |
+
* @param bool $delete delete the item after successful add to cart
|
153 |
+
* @return bool
|
154 |
+
*/
|
155 |
+
public function addToCart(Mage_Checkout_Model_Cart $cart, $delete = false)
|
156 |
+
{
|
157 |
+
$product = $this->getProduct();
|
158 |
+
|
159 |
+
if (Mage_Catalog_Model_Product_Type::TYPE_GROUPED == $product->getTypeId()) {
|
160 |
+
throw new Mage_Core_Exception(null, self::EXCEPTION_CODE_IS_GROUPED_PRODUCT);
|
161 |
+
}
|
162 |
+
|
163 |
+
$product->setQty(1);
|
164 |
+
$storeId = $this->getStoreId();
|
165 |
+
|
166 |
+
if ($product->getStatus() != Mage_Catalog_Model_Product_Status::STATUS_ENABLED) {
|
167 |
+
return false;
|
168 |
+
}
|
169 |
+
|
170 |
+
if (!$product->isVisibleInSiteVisibility()) {
|
171 |
+
if ($product->getStoreId() == $storeId) {
|
172 |
+
return false;
|
173 |
+
}
|
174 |
+
$urlData = Mage::getResourceSingleton('catalog/url')
|
175 |
+
->getRewriteByProductStore(array($product->getId() => $storeId));
|
176 |
+
if (!isset($urlData[$product->getId()])) {
|
177 |
+
return false;
|
178 |
+
}
|
179 |
+
$product->setUrlDataObject(new Varien_Object($urlData));
|
180 |
+
$visibility = $product->getUrlDataObject()->getVisibility();
|
181 |
+
if (!in_array($visibility, $product->getVisibleInSiteVisibilities())) {
|
182 |
+
return false;
|
183 |
+
}
|
184 |
+
}
|
185 |
+
|
186 |
+
if (!$product->isSalable()) {
|
187 |
+
throw new Mage_Core_Exception(null, self::EXCEPTION_CODE_NOT_SALABLE);
|
188 |
+
}
|
189 |
+
|
190 |
+
if ($product->getTypeInstance(true)->hasRequiredOptions($product)) {
|
191 |
+
throw new Mage_Core_Exception(null, self::EXCEPTION_CODE_HAS_REQUIRED_OPTIONS);
|
192 |
+
}
|
193 |
+
|
194 |
+
$cart->addProduct($product);
|
195 |
+
if (!$product->isVisibleInSiteVisibility()) {
|
196 |
+
$cart->getQuote()->getItemByProduct($product)->setStoreId($storeId);
|
197 |
+
}
|
198 |
+
|
199 |
+
if ($delete) {
|
200 |
+
$this->delete();
|
201 |
+
}
|
202 |
+
|
203 |
+
return true;
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Retrieve Product View Page URL
|
208 |
+
*
|
209 |
+
* If product has required options add special key to URL
|
210 |
+
*
|
211 |
+
* @return string
|
212 |
+
*/
|
213 |
+
public function getProductUrl()
|
214 |
+
{
|
215 |
+
$product = $this->getProduct();
|
216 |
+
$query = array();
|
217 |
+
|
218 |
+
if ($product->getTypeInstance(true)->hasRequiredOptions($product)) {
|
219 |
+
$query['options'] = 'cart';
|
220 |
+
}
|
221 |
+
|
222 |
+
return $product->getUrlModel()->getUrl($product, array('_query' => $query));
|
223 |
+
}
|
224 |
+
}
|
app/code/local/Ifuturz/Gallery/Model/Mysql4/Gallery.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ifuturz_Gallery_Model_Mysql4_Gallery extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
protected $_itemsCount = null;
|
7 |
+
|
8 |
+
protected $_customerIdFieldName = 'customer_id';
|
9 |
+
|
10 |
+
protected function _construct()
|
11 |
+
{
|
12 |
+
$this->_init('gallery/gallery', 'gallery_id');
|
13 |
+
}
|
14 |
+
|
15 |
+
public function getCustomerIdFieldName()
|
16 |
+
{
|
17 |
+
return $this->_customerIdFieldName;
|
18 |
+
}
|
19 |
+
|
20 |
+
public function setCustomerIdFieldName($fieldName)
|
21 |
+
{
|
22 |
+
$this->_customerIdFieldName = $fieldName;
|
23 |
+
return $this;
|
24 |
+
}
|
25 |
+
|
26 |
+
public function fetchItemsCount(Ifuturz_Gallery_Model_Gallery $gallery)
|
27 |
+
{
|
28 |
+
if (is_null($this->_itemsCount)) {
|
29 |
+
$collection = $gallery->getProductCollection()
|
30 |
+
//->addAttributeToFilter('store_id', array('in'=>$gallery->getSharedStoreIds()))
|
31 |
+
->addStoreFilter();
|
32 |
+
|
33 |
+
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
|
34 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInSiteFilterToCollection($collection);
|
35 |
+
|
36 |
+
$this->_itemsCount = $collection->getSize();
|
37 |
+
}
|
38 |
+
|
39 |
+
return $this->_itemsCount;
|
40 |
+
}
|
41 |
+
|
42 |
+
}
|
app/code/local/Ifuturz/Gallery/Model/Mysql4/Gallery/Collection.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ifuturz_Gallery_Model_Mysql4_Gallery_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Initialize resource
|
7 |
+
*/
|
8 |
+
protected function _construct()
|
9 |
+
{
|
10 |
+
$this->_init('gallery/gallery');
|
11 |
+
}
|
12 |
+
}
|
app/code/local/Ifuturz/Gallery/Model/Mysql4/Item.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ifuturz_Gallery_Model_Mysql4_Item extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Initialize connection and define main table
|
7 |
+
*
|
8 |
+
*/
|
9 |
+
protected function _construct()
|
10 |
+
{
|
11 |
+
$this->_init('gallery/item', 'gallery_item_id');
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Load item by gallery, product and shared stores
|
16 |
+
*
|
17 |
+
* @param Ifuturz_Gallery_Model_Item $object
|
18 |
+
* @param int $galleryId
|
19 |
+
* @param int $productId
|
20 |
+
* @param array $sharedStores
|
21 |
+
* @return Ifuturz_Gallery_Model_Mysql4_Item
|
22 |
+
*/
|
23 |
+
public function loadByProductGallery($object, $galleryId, $productId, $sharedStores)
|
24 |
+
{
|
25 |
+
$adapter = $this->_getReadAdapter();
|
26 |
+
$select = $adapter->select()
|
27 |
+
->from($this->getMainTable())
|
28 |
+
->where('gallery_id=?', $galleryId)
|
29 |
+
->where('product_id=?', $productId)
|
30 |
+
->where('store_id IN(?)', $sharedStores);
|
31 |
+
|
32 |
+
$data = $adapter->fetchRow($select);
|
33 |
+
if ($data) {
|
34 |
+
$object->setData($data);
|
35 |
+
}
|
36 |
+
|
37 |
+
$this->_afterLoad($object);
|
38 |
+
|
39 |
+
return $this;
|
40 |
+
}
|
41 |
+
}
|
app/code/local/Ifuturz/Gallery/Model/Mysql4/Item/Collection.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ifuturz_Gallery_Model_Mysql4_Item_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Initialize resource model for collection
|
7 |
+
*
|
8 |
+
*/
|
9 |
+
public function _construct()
|
10 |
+
{
|
11 |
+
$this->_init('gallery/item');
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Add filter by gallery object
|
16 |
+
*
|
17 |
+
* @param Ifuturz_Gallery_Model_Gallery $gallery
|
18 |
+
* @return Ifuturz_Gallery_Model_Mysql4_Item_Collection
|
19 |
+
*/
|
20 |
+
public function addGalleryFilter(Ifuturz_Gallery_Model_Gallery $gallery)
|
21 |
+
{
|
22 |
+
$this->addFieldToFilter('gallery_id', $gallery->getId());
|
23 |
+
|
24 |
+
return $this;
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Add filter by shared stores
|
29 |
+
*
|
30 |
+
* @param int|array $store
|
31 |
+
* @return Ifuturz_Gallery_Model_Mysql4_Item_Collection
|
32 |
+
*/
|
33 |
+
public function addStoreFilter($store)
|
34 |
+
{
|
35 |
+
$this->addFieldToFilter('store_id', array('in' => $store));
|
36 |
+
|
37 |
+
return $this;
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* This method will be not supported anymore
|
42 |
+
*
|
43 |
+
* @deprecated since 1.4.0.0
|
44 |
+
* @return Ifuturz_Gallery_Model_Mysql4_Item_Collection
|
45 |
+
*/
|
46 |
+
public function addStoreData()
|
47 |
+
{
|
48 |
+
return $this;
|
49 |
+
}
|
50 |
+
}
|
app/code/local/Ifuturz/Gallery/Model/Mysql4/Product/Collection.php
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ifuturz_Gallery_Model_Mysql4_Product_Collection
|
4 |
+
extends Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection
|
5 |
+
{
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Add days in whishlist filter of product collection
|
9 |
+
*
|
10 |
+
* @var boolean
|
11 |
+
*/
|
12 |
+
protected $_addDaysInGallery = false;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Get add days in whishlist filter of product collection flag
|
16 |
+
*
|
17 |
+
* @return boolean
|
18 |
+
*/
|
19 |
+
public function getDaysInGallery()
|
20 |
+
{
|
21 |
+
return $this->_addDaysInGallery;
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Set add days in whishlist filter of product collection flag
|
26 |
+
*
|
27 |
+
* @return Ifuturz_Gallery_Model_Mysql4_Product_Collection
|
28 |
+
*/
|
29 |
+
public function setDaysInGallery($flag)
|
30 |
+
{
|
31 |
+
$this->_addDaysInGallery = (bool) $flag;
|
32 |
+
return $this;
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Add gallery filter to collection
|
37 |
+
*
|
38 |
+
* @param Ifuturz_Gallery_Model_Gallery $gallery
|
39 |
+
* @return Ifuturz_Gallery_Model_Mysql4_Product_Collection
|
40 |
+
*/
|
41 |
+
public function addGalleryFilter(Ifuturz_Gallery_Model_Gallery $gallery)
|
42 |
+
{
|
43 |
+
$this->joinTable(
|
44 |
+
array('t_wi' => 'gallery/item'),
|
45 |
+
'product_id=entity_id',
|
46 |
+
array(
|
47 |
+
'product_id' => 'product_id',
|
48 |
+
'gallery_item_description' => 'description',
|
49 |
+
'item_store_id' => 'store_id',
|
50 |
+
'added_at' => 'added_at',
|
51 |
+
'gallery_id' => 'gallery_id',
|
52 |
+
'gallery_item_id' => 'gallery_item_id',
|
53 |
+
),
|
54 |
+
array(
|
55 |
+
'gallery_id' => $gallery->getId(),
|
56 |
+
'store_id' => array('in' => $gallery->getSharedStoreIds())
|
57 |
+
)
|
58 |
+
);
|
59 |
+
|
60 |
+
$this->_productLimitationFilters['store_table'] = 't_wi';
|
61 |
+
|
62 |
+
$this->setFlag('url_data_object', true);
|
63 |
+
$this->setFlag('do_not_use_category_id', true);
|
64 |
+
|
65 |
+
return $this;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Add gallery sort order
|
70 |
+
*
|
71 |
+
* @param string $attribute
|
72 |
+
* @param string $dir
|
73 |
+
* @return Ifuturz_Gallery_Model_Mysql4_Product_Collection
|
74 |
+
*/
|
75 |
+
public function addGallerySortOrder($attribute = 'added_at', $dir = 'desc')
|
76 |
+
{
|
77 |
+
$this->setOrder($attribute, $dir);
|
78 |
+
return $this;
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Reset sort order
|
83 |
+
*
|
84 |
+
* @return Ifuturz_Gallery_Model_Mysql4_Product_Collection
|
85 |
+
*/
|
86 |
+
public function resetSortOrder()
|
87 |
+
{
|
88 |
+
$this->getSelect()->reset(Zend_Db_Select::ORDER);
|
89 |
+
return $this;
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Add store data (days in gallery)
|
94 |
+
*
|
95 |
+
* @return Ifuturz_Gallery_Model_Mysql4_Product_Collection
|
96 |
+
*/
|
97 |
+
public function addStoreData()
|
98 |
+
{
|
99 |
+
if (!$this->getDaysInGallery()) {
|
100 |
+
return $this;
|
101 |
+
}
|
102 |
+
|
103 |
+
$this->setDaysInGallery(false);
|
104 |
+
|
105 |
+
$dayTable = 't_wi'; //$this->_getAttributeTableAlias('days_in_gallery');
|
106 |
+
|
107 |
+
$this->joinField('store_name', 'core/store', 'name', 'store_id=item_store_id');
|
108 |
+
$this->joinField('days_in_gallery',
|
109 |
+
'gallery/item',
|
110 |
+
"(TO_DAYS('" . (substr(Mage::getSingleton('core/date')->date(), 0, -2) . '00') . "') - TO_DAYS(DATE_ADD(".$dayTable.".added_at, INTERVAL " .(int) Mage::getSingleton('core/date')->getGmtOffset() . " SECOND)))",
|
111 |
+
'gallery_item_id=gallery_item_id'
|
112 |
+
);
|
113 |
+
|
114 |
+
return $this;
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Rewrite retrieve attribute field name for gallery attributes
|
119 |
+
*
|
120 |
+
* @param string $attributeCode
|
121 |
+
* @return Ifuturz_Gallery_Model_Mysql4_Product_Collection
|
122 |
+
*/
|
123 |
+
protected function _getAttributeFieldName($attributeCode)
|
124 |
+
{
|
125 |
+
if ($attributeCode == 'days_in_gallery') {
|
126 |
+
return $this->_joinFields[$attributeCode]['field'];
|
127 |
+
}
|
128 |
+
return parent::_getAttributeFieldName($attributeCode);
|
129 |
+
}
|
130 |
+
}
|
app/code/local/Ifuturz/Gallery/Model/Observer.php
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ifuturz_Gallery_Model_Observer extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Get customer gallery model instance
|
7 |
+
*
|
8 |
+
* @param int $customerId
|
9 |
+
* @return Ifuturz_Gallery_Model_Gallery || false
|
10 |
+
*/
|
11 |
+
protected function _getGallery($customerId)
|
12 |
+
{
|
13 |
+
if (!$customerId) {
|
14 |
+
return false;
|
15 |
+
}
|
16 |
+
return Mage::getModel('gallery/gallery')->loadByCustomer($customerId, true);
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Check move quote item to gallery request
|
21 |
+
*
|
22 |
+
* @param Varien_Event_Observer $observer
|
23 |
+
* @return Ifuturz_Gallery_Model_Observer
|
24 |
+
*/
|
25 |
+
public function processCartUpdateBefore($observer)
|
26 |
+
{
|
27 |
+
$cart = $observer->getEvent()->getCart();
|
28 |
+
$data = $observer->getEvent()->getInfo();
|
29 |
+
$productIds = array();
|
30 |
+
|
31 |
+
$gallery = $this->_getGallery($cart->getQuote()->getCustomerId());
|
32 |
+
if (!$gallery) {
|
33 |
+
return $this;
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Collect product ids marked for move to gallery
|
38 |
+
*/
|
39 |
+
foreach ($data as $itemId => $itemInfo) {
|
40 |
+
if (!empty($itemInfo['gallery'])) {
|
41 |
+
if ($item = $cart->getQuote()->getItemById($itemId)) {
|
42 |
+
$productId = $item->getProductId();
|
43 |
+
$productIds[] = $productId;
|
44 |
+
$cart->getQuote()->removeItem($itemId);
|
45 |
+
}
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
if (!empty($productIds)) {
|
50 |
+
foreach ($productIds as $productId) {
|
51 |
+
$gallery->addNewItem($productId);
|
52 |
+
}
|
53 |
+
$gallery->save();
|
54 |
+
Mage::helper('gallery')->calculate();
|
55 |
+
}
|
56 |
+
return $this;
|
57 |
+
}
|
58 |
+
|
59 |
+
public function processAddToCart($observer)
|
60 |
+
{
|
61 |
+
$request = $observer->getEvent()->getRequest();
|
62 |
+
$sharedGallery = Mage::getSingleton('checkout/session')->getSharedGallery();
|
63 |
+
$messages = Mage::getSingleton('checkout/session')->getGalleryPendingMessages();
|
64 |
+
$urls = Mage::getSingleton('checkout/session')->getGalleryPendingUrls();
|
65 |
+
$galleryIds = Mage::getSingleton('checkout/session')->getGalleryIds();
|
66 |
+
$singleGalleryId = Mage::getSingleton('checkout/session')->getSingleGalleryId();
|
67 |
+
|
68 |
+
if ($singleGalleryId) {
|
69 |
+
$galleryIds = array($singleGalleryId);
|
70 |
+
}
|
71 |
+
|
72 |
+
if (count($galleryIds) && $request->getParam('gallery_next')){
|
73 |
+
$galleryId = array_shift($galleryIds);
|
74 |
+
|
75 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
76 |
+
$gallery = Mage::getModel('gallery/gallery')
|
77 |
+
->loadByCustomer(Mage::getSingleton('customer/session')->getCustomer(), true);
|
78 |
+
} else if ($sharedGallery) {
|
79 |
+
$gallery = Mage::getModel('gallery/gallery')->loadByCode($sharedGallery);
|
80 |
+
} else {
|
81 |
+
return;
|
82 |
+
}
|
83 |
+
|
84 |
+
|
85 |
+
$gallery->getItemCollection()->load();
|
86 |
+
|
87 |
+
foreach($gallery->getItemCollection() as $galleryItem){
|
88 |
+
if ($galleryItem->getId() == $galleryId)
|
89 |
+
$galleryItem->delete();
|
90 |
+
}
|
91 |
+
Mage::getSingleton('checkout/session')->setGalleryIds($galleryIds);
|
92 |
+
Mage::getSingleton('checkout/session')->setSingleGalleryId(null);
|
93 |
+
}
|
94 |
+
|
95 |
+
if ($request->getParam('gallery_next') && count($urls)) {
|
96 |
+
$url = array_shift($urls);
|
97 |
+
$message = array_shift($messages);
|
98 |
+
|
99 |
+
Mage::getSingleton('checkout/session')->setGalleryPendingUrls($urls);
|
100 |
+
Mage::getSingleton('checkout/session')->setGalleryPendingMessages($messages);
|
101 |
+
|
102 |
+
Mage::getSingleton('checkout/session')->addError($message);
|
103 |
+
|
104 |
+
$observer->getEvent()->getResponse()->setRedirect($url);
|
105 |
+
Mage::getSingleton('checkout/session')->setNoCartRedirect(true);
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Customer login processing
|
111 |
+
*
|
112 |
+
* @param Varien_Event_Observer $observer
|
113 |
+
* @return Ifuturz_Gallery_Model_Observer
|
114 |
+
*/
|
115 |
+
public function customerLogin(Varien_Event_Observer $observer)
|
116 |
+
{
|
117 |
+
Mage::helper('gallery')->calculate();
|
118 |
+
|
119 |
+
return $this;
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Customer logout processing
|
124 |
+
*
|
125 |
+
* @param Varien_Event_Observer $observer
|
126 |
+
* @return Ifuturz_Gallery_Model_Observer
|
127 |
+
*/
|
128 |
+
public function customerLogout(Varien_Event_Observer $observer)
|
129 |
+
{
|
130 |
+
Mage::getSingleton('customer/session')->setGalleryItemCount(0);
|
131 |
+
|
132 |
+
return $this;
|
133 |
+
}
|
134 |
+
|
135 |
+
}
|
app/code/local/Ifuturz/Gallery/Model/Session.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ifuturz_Gallery_Model_Session extends Mage_Core_Model_Session_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
$this->init('gallery');
|
9 |
+
}
|
10 |
+
|
11 |
+
}
|
app/code/local/Ifuturz/Gallery/controllers/IndexController.php
ADDED
@@ -0,0 +1,364 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Ifuturz_Gallery_IndexController extends Ifuturz_Gallery_Controller_Abstract
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Action list where need check enabled cookie
|
6 |
+
*
|
7 |
+
* @var array
|
8 |
+
*/
|
9 |
+
protected $_cookieCheckActions = array('add');
|
10 |
+
|
11 |
+
public function preDispatch()
|
12 |
+
{
|
13 |
+
parent::preDispatch();
|
14 |
+
|
15 |
+
if (!Mage::getSingleton('customer/session')->authenticate($this)) {
|
16 |
+
$this->setFlag('', 'no-dispatch', true);
|
17 |
+
if(!Mage::getSingleton('customer/session')->getBeforeGalleryUrl()) {
|
18 |
+
Mage::getSingleton('customer/session')->setBeforeGalleryUrl($this->_getRefererUrl());
|
19 |
+
}
|
20 |
+
}
|
21 |
+
if (!Mage::getStoreConfigFlag('gallery/general/active')) {
|
22 |
+
$this->norouteAction();
|
23 |
+
return;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Retrieve gallery object
|
29 |
+
*
|
30 |
+
* @return Ifuturz_Gallery_Model_Gallery|false
|
31 |
+
*/
|
32 |
+
protected function _getGallery()
|
33 |
+
{
|
34 |
+
try {
|
35 |
+
$gallery = Mage::getModel('gallery/gallery')
|
36 |
+
->loadByCustomer(Mage::getSingleton('customer/session')->getCustomer(), true);
|
37 |
+
Mage::register('gallery', $gallery);
|
38 |
+
} catch (Mage_Core_Exception $e) {
|
39 |
+
Mage::getSingleton('gallery/session')->addError($e->getMessage());
|
40 |
+
} catch (Exception $e) {
|
41 |
+
Mage::getSingleton('gallery/session')->addException($e,
|
42 |
+
Mage::helper('gallery')->__('Cannot create gallery.')
|
43 |
+
);
|
44 |
+
return false;
|
45 |
+
}
|
46 |
+
return $gallery;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Display customer gallery
|
51 |
+
*/
|
52 |
+
public function indexAction()
|
53 |
+
{
|
54 |
+
$this->_getGallery();
|
55 |
+
$this->loadLayout();
|
56 |
+
|
57 |
+
$session = Mage::getSingleton('customer/session');
|
58 |
+
$block = $this->getLayout()->getBlock('customer.gallery');
|
59 |
+
$referer = $session->getAddActionReferer(true);
|
60 |
+
if ($block) {
|
61 |
+
$block->setRefererUrl($this->_getRefererUrl());
|
62 |
+
if ($referer) {
|
63 |
+
$block->setRefererUrl($referer);
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
$this->_initLayoutMessages('customer/session');
|
68 |
+
$this->_initLayoutMessages('checkout/session');
|
69 |
+
$this->_initLayoutMessages('catalog/session');
|
70 |
+
$this->_initLayoutMessages('gallery/session');
|
71 |
+
|
72 |
+
$this->renderLayout();
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Adding new item
|
77 |
+
*/
|
78 |
+
public function addAction()
|
79 |
+
{
|
80 |
+
$session = Mage::getSingleton('customer/session');
|
81 |
+
$gallery = $this->_getGallery();
|
82 |
+
if (!$gallery) {
|
83 |
+
$this->_redirect('*/');
|
84 |
+
return;
|
85 |
+
}
|
86 |
+
|
87 |
+
$productId = (int) $this->getRequest()->getParam('product');
|
88 |
+
if (!$productId) {
|
89 |
+
$this->_redirect('*/');
|
90 |
+
return;
|
91 |
+
}
|
92 |
+
|
93 |
+
$product = Mage::getModel('catalog/product')->load($productId);
|
94 |
+
if (!$product->getId() || !$product->isVisibleInCatalog()) {
|
95 |
+
$session->addError($this->__('Cannot specify product.'));
|
96 |
+
$this->_redirect('*/');
|
97 |
+
return;
|
98 |
+
}
|
99 |
+
|
100 |
+
try {
|
101 |
+
$gallery->addNewItem($product->getId());
|
102 |
+
$gallery->save();
|
103 |
+
|
104 |
+
Mage::dispatchEvent('gallery_add_product', array('gallery'=>$gallery, 'product'=>$product));
|
105 |
+
|
106 |
+
if ($referer = $session->getBeforeGalleryUrl()) {
|
107 |
+
$session->setBeforeGalleryUrl(null);
|
108 |
+
}
|
109 |
+
else {
|
110 |
+
$referer = $this->_getRefererUrl();
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Set referer to avoid referring to the compare popup window
|
115 |
+
*/
|
116 |
+
$session->setAddActionReferer($referer);
|
117 |
+
|
118 |
+
Mage::helper('gallery')->calculate();
|
119 |
+
|
120 |
+
$message = $this->__('%1$s has been added to your gallery. Click <a href="%2$s">here</a> to continue shopping', $product->getName(), $referer);
|
121 |
+
$session->addSuccess($message);
|
122 |
+
}
|
123 |
+
catch (Mage_Core_Exception $e) {
|
124 |
+
$session->addError($this->__('An error occurred while adding item to gallery: %s', $e->getMessage()));
|
125 |
+
}
|
126 |
+
catch (Exception $e) {
|
127 |
+
$session->addError($this->__('An error occurred while adding item to gallery.'));
|
128 |
+
}
|
129 |
+
$this->_redirect('*');
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Update gallery item comments
|
134 |
+
*/
|
135 |
+
public function updateAction()
|
136 |
+
{
|
137 |
+
if (!$this->_validateFormKey()) {
|
138 |
+
return $this->_redirect('*/*/');
|
139 |
+
}
|
140 |
+
$post = $this->getRequest()->getPost();
|
141 |
+
if($post && isset($post['description']) && is_array($post['description'])) {
|
142 |
+
$gallery = $this->_getGallery();
|
143 |
+
$updatedItems = 0;
|
144 |
+
|
145 |
+
foreach ($post['description'] as $itemId => $description) {
|
146 |
+
$item = Mage::getModel('gallery/item')->load($itemId);
|
147 |
+
$description = (string) $description;
|
148 |
+
if(!strlen($description) || $item->getGalleryId()!=$gallery->getId()) {
|
149 |
+
continue;
|
150 |
+
}
|
151 |
+
try {
|
152 |
+
$item->setDescription($description)
|
153 |
+
->save();
|
154 |
+
$updatedItems++;
|
155 |
+
}
|
156 |
+
catch (Exception $e) {
|
157 |
+
Mage::getSingleton('customer/session')->addError(
|
158 |
+
$this->__('Can\'t save description %s', Mage::helper('core')->htmlEscape($description))
|
159 |
+
);
|
160 |
+
}
|
161 |
+
}
|
162 |
+
|
163 |
+
// save gallery model for setting date of last update
|
164 |
+
if ($updatedItems) {
|
165 |
+
try {
|
166 |
+
$gallery->save();
|
167 |
+
}
|
168 |
+
catch (Exception $e) {
|
169 |
+
Mage::getSingleton('customer/session')->addError($this->__('Can\'t update gallery'));
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
if (isset($post['save_and_share'])) {
|
174 |
+
$this->_redirect('*/*/share');
|
175 |
+
return;
|
176 |
+
}
|
177 |
+
}
|
178 |
+
$this->_redirect('*');
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Remove item
|
183 |
+
*/
|
184 |
+
public function removeAction()
|
185 |
+
{
|
186 |
+
$gallery = $this->_getGallery();
|
187 |
+
$id = (int) $this->getRequest()->getParam('item');
|
188 |
+
$item = Mage::getModel('gallery/item')->load($id);
|
189 |
+
|
190 |
+
if($item->getGalleryId()==$gallery->getId()) {
|
191 |
+
try {
|
192 |
+
$item->delete();
|
193 |
+
$gallery->save();
|
194 |
+
}
|
195 |
+
catch (Mage_Core_Exception $e) {
|
196 |
+
Mage::getSingleton('customer/session')->addError(
|
197 |
+
$this->__('An error occurred while deleting the item from gallery: %s', $e->getMessage())
|
198 |
+
);
|
199 |
+
}
|
200 |
+
catch(Exception $e) {
|
201 |
+
Mage::getSingleton('customer/session')->addError(
|
202 |
+
$this->__('An error occurred while deleting the item from gallery.')
|
203 |
+
);
|
204 |
+
}
|
205 |
+
}
|
206 |
+
|
207 |
+
Mage::helper('gallery')->calculate();
|
208 |
+
|
209 |
+
$this->_redirectReferer(Mage::getUrl('*/*'));
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Add gallery item to shopping cart and remove from gallery
|
214 |
+
*
|
215 |
+
* If Product has required options - item removed from gallery and redirect
|
216 |
+
* to product view page with message about needed defined required options
|
217 |
+
*
|
218 |
+
*/
|
219 |
+
public function cartAction()
|
220 |
+
{
|
221 |
+
$gallery = $this->_getGallery();
|
222 |
+
if (!$gallery) {
|
223 |
+
return $this->_redirect('*/*');
|
224 |
+
}
|
225 |
+
|
226 |
+
$itemId = (int)$this->getRequest()->getParam('item');
|
227 |
+
/* @var $item Ifuturz_Gallery_Model_Item */
|
228 |
+
$item = Mage::getModel('gallery/item')->load($itemId);
|
229 |
+
|
230 |
+
if (!$item->getId() || $item->getGalleryId() != $gallery->getId()) {
|
231 |
+
return $this->_redirect('*/*');
|
232 |
+
}
|
233 |
+
|
234 |
+
/* @var $session Ifuturz_Gallery_Model_Session */
|
235 |
+
$session = Mage::getSingleton('gallery/session');
|
236 |
+
$cart = Mage::getSingleton('checkout/cart');
|
237 |
+
|
238 |
+
$redirectUrl = Mage::getUrl('*/*');
|
239 |
+
|
240 |
+
try {
|
241 |
+
$item->addToCart($cart, true);
|
242 |
+
$cart->save()-> getQuote()->collectTotals();
|
243 |
+
$gallery->save();
|
244 |
+
|
245 |
+
Mage::helper('gallery')->calculate();
|
246 |
+
|
247 |
+
if (Mage::helper('checkout/cart')->getShouldRedirectToCart()) {
|
248 |
+
$redirectUrl = Mage::helper('checkout/cart')->getCartUrl();
|
249 |
+
} else if ($this->_getRefererUrl()) {
|
250 |
+
$redirectUrl = $this->_getRefererUrl();
|
251 |
+
}
|
252 |
+
} catch (Mage_Core_Exception $e) {
|
253 |
+
if ($e->getCode() == Ifuturz_Gallery_Model_Item::EXCEPTION_CODE_NOT_SALABLE) {
|
254 |
+
$session->addError(Mage::helper('gallery')->__('This product(s) is currently out of stock'));
|
255 |
+
} else if ($e->getCode() == Ifuturz_Gallery_Model_Item::EXCEPTION_CODE_HAS_REQUIRED_OPTIONS) {
|
256 |
+
$redirectUrl = $item->getProductUrl();
|
257 |
+
$item->delete();
|
258 |
+
} else if ($e->getCode() == Ifuturz_Gallery_Model_Item::EXCEPTION_CODE_IS_GROUPED_PRODUCT) {
|
259 |
+
$redirectUrl = $item->getProductUrl();
|
260 |
+
$item->delete();
|
261 |
+
} else {
|
262 |
+
$session->addError($e->getMessage());
|
263 |
+
}
|
264 |
+
} catch (Exception $e) {
|
265 |
+
$session->addException($e, Mage::helper('gallery')->__('Cannot add item to shopping cart'));
|
266 |
+
}
|
267 |
+
|
268 |
+
Mage::helper('gallery')->calculate();
|
269 |
+
|
270 |
+
return $this->_redirectUrl($redirectUrl);
|
271 |
+
}
|
272 |
+
|
273 |
+
public function shareAction()
|
274 |
+
{
|
275 |
+
$this->loadLayout();
|
276 |
+
$this->_initLayoutMessages('customer/session');
|
277 |
+
$this->_initLayoutMessages('gallery/session');
|
278 |
+
$this->renderLayout();
|
279 |
+
}
|
280 |
+
|
281 |
+
public function sendAction()
|
282 |
+
{
|
283 |
+
if (!$this->_validateFormKey()) {
|
284 |
+
return $this->_redirect('*/*/');
|
285 |
+
}
|
286 |
+
|
287 |
+
$emails = explode(',', $this->getRequest()->getPost('emails'));
|
288 |
+
$message= nl2br(htmlspecialchars((string) $this->getRequest()->getPost('message')));
|
289 |
+
$error = false;
|
290 |
+
if (empty($emails)) {
|
291 |
+
$error = $this->__('Email address can\'t be empty.');
|
292 |
+
}
|
293 |
+
else {
|
294 |
+
foreach ($emails as $index => $email) {
|
295 |
+
$email = trim($email);
|
296 |
+
if (!Zend_Validate::is($email, 'EmailAddress')) {
|
297 |
+
$error = $this->__('Please input a valid email address.');
|
298 |
+
break;
|
299 |
+
}
|
300 |
+
$emails[$index] = $email;
|
301 |
+
}
|
302 |
+
}
|
303 |
+
if ($error) {
|
304 |
+
Mage::getSingleton('gallery/session')->addError($error);
|
305 |
+
Mage::getSingleton('gallery/session')->setSharingForm($this->getRequest()->getPost());
|
306 |
+
$this->_redirect('*/*/share');
|
307 |
+
return;
|
308 |
+
}
|
309 |
+
|
310 |
+
$translate = Mage::getSingleton('core/translate');
|
311 |
+
/* @var $translate Mage_Core_Model_Translate */
|
312 |
+
$translate->setTranslateInline(false);
|
313 |
+
|
314 |
+
try {
|
315 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
316 |
+
$gallery = $this->_getGallery();
|
317 |
+
|
318 |
+
/*if share rss added rss feed to email template*/
|
319 |
+
if ($this->getRequest()->getParam('rss_url')) {
|
320 |
+
$rss_url = $this->getLayout()->createBlock('gallery/share_email_rss')->toHtml();
|
321 |
+
$message .=$rss_url;
|
322 |
+
}
|
323 |
+
$galleryBlock = $this->getLayout()->createBlock('gallery/share_email_items')->toHtml();
|
324 |
+
|
325 |
+
$emails = array_unique($emails);
|
326 |
+
/* @var $emailModel Mage_Core_Model_Email_Template */
|
327 |
+
$emailModel = Mage::getModel('core/email_template');
|
328 |
+
|
329 |
+
foreach($emails as $email) {
|
330 |
+
$emailModel->sendTransactional(
|
331 |
+
Mage::getStoreConfig('gallery/email/email_template'),
|
332 |
+
Mage::getStoreConfig('gallery/email/email_identity'),
|
333 |
+
$email,
|
334 |
+
null,
|
335 |
+
array(
|
336 |
+
'customer' => $customer,
|
337 |
+
'salable' => $gallery->isSalable() ? 'yes' : '',
|
338 |
+
'items' => $galleryBlock,
|
339 |
+
'addAllLink' => Mage::getUrl('*/shared/allcart', array('code' => $gallery->getSharingCode())),
|
340 |
+
'viewOnSiteLink'=> Mage::getUrl('*/shared/index', array('code' => $gallery->getSharingCode())),
|
341 |
+
'message' => $message
|
342 |
+
));
|
343 |
+
}
|
344 |
+
|
345 |
+
$gallery->setShared(1);
|
346 |
+
$gallery->save();
|
347 |
+
|
348 |
+
$translate->setTranslateInline(true);
|
349 |
+
|
350 |
+
Mage::dispatchEvent('gallery_share', array('gallery'=>$gallery));
|
351 |
+
Mage::getSingleton('customer/session')->addSuccess(
|
352 |
+
$this->__('Your Gallery has been shared.')
|
353 |
+
);
|
354 |
+
$this->_redirect('*/*');
|
355 |
+
}
|
356 |
+
catch (Exception $e) {
|
357 |
+
$translate->setTranslateInline(true);
|
358 |
+
|
359 |
+
Mage::getSingleton('gallery/session')->addError($e->getMessage());
|
360 |
+
Mage::getSingleton('gallery/session')->setSharingForm($this->getRequest()->getPost());
|
361 |
+
$this->_redirect('*/*/share');
|
362 |
+
}
|
363 |
+
}
|
364 |
+
}
|
app/code/local/Ifuturz/Gallery/controllers/SharedController.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Ifuturz_Gallery_SharedController extends Ifuturz_Gallery_Controller_Abstract
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Retrieve gallery instance by requested code
|
6 |
+
*
|
7 |
+
* @return Ifuturz_Gallery_Model_Gallery|false
|
8 |
+
*/
|
9 |
+
protected function _getGallery()
|
10 |
+
{
|
11 |
+
$code = (string)$this->getRequest()->getParam('code');
|
12 |
+
if (empty($code)) {
|
13 |
+
return false;
|
14 |
+
}
|
15 |
+
|
16 |
+
$gallery = Mage::getModel('gallery/gallery')->loadByCode($code);
|
17 |
+
if (!$gallery->getId()) {
|
18 |
+
return false;
|
19 |
+
}
|
20 |
+
|
21 |
+
Mage::getSingleton('checkout/session')->setSharedGallery($code);
|
22 |
+
|
23 |
+
return $gallery;
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Shared gallery view page
|
28 |
+
*
|
29 |
+
*/
|
30 |
+
public function indexAction()
|
31 |
+
{
|
32 |
+
$gallery = $this->_getGallery();
|
33 |
+
$customerId = Mage::getSingleton('customer/session')->getCustomerId();
|
34 |
+
|
35 |
+
if ($gallery->getCustomerId() && $gallery->getCustomerId() == $customerId) {
|
36 |
+
$this->_redirectUrl(Mage::helper('gallery')->getListUrl());
|
37 |
+
return;
|
38 |
+
}
|
39 |
+
|
40 |
+
Mage::register('shared_gallery', $gallery);
|
41 |
+
|
42 |
+
$this->loadLayout();
|
43 |
+
$this->_initLayoutMessages('checkout/session');
|
44 |
+
$this->_initLayoutMessages('gallery/session');
|
45 |
+
$this->renderLayout();
|
46 |
+
}
|
47 |
+
}
|
app/code/local/Ifuturz/Gallery/etc/adminhtml.xml
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<admin>
|
6 |
+
<children>
|
7 |
+
<system>
|
8 |
+
<children>
|
9 |
+
<config>
|
10 |
+
<children>
|
11 |
+
<gallery translate="title" module="gallery">
|
12 |
+
<title>Gallery Section</title>
|
13 |
+
</gallery>
|
14 |
+
</children>
|
15 |
+
</config>
|
16 |
+
</children>
|
17 |
+
</system>
|
18 |
+
</children>
|
19 |
+
</admin>
|
20 |
+
</resources>
|
21 |
+
</acl>
|
22 |
+
</config>
|
app/code/local/Ifuturz/Gallery/etc/config.xml
ADDED
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
<modules>
|
5 |
+
<Ifuturz_Gallery>
|
6 |
+
<version>0.7.8</version>
|
7 |
+
</Ifuturz_Gallery>
|
8 |
+
</modules>
|
9 |
+
<global>
|
10 |
+
<blocks>
|
11 |
+
<gallery>
|
12 |
+
<class>Ifuturz_Gallery_Block</class>
|
13 |
+
</gallery>
|
14 |
+
</blocks>
|
15 |
+
<helpers>
|
16 |
+
<gallery>
|
17 |
+
<class>Ifuturz_Gallery_Helper</class>
|
18 |
+
</gallery>
|
19 |
+
</helpers>
|
20 |
+
<models>
|
21 |
+
<gallery>
|
22 |
+
<class>Ifuturz_Gallery_Model</class>
|
23 |
+
<resourceModel>gallery_mysql4</resourceModel>
|
24 |
+
</gallery>
|
25 |
+
<gallery_mysql4>
|
26 |
+
<class>Ifuturz_Gallery_Model_Mysql4</class>
|
27 |
+
<entities>
|
28 |
+
<gallery>
|
29 |
+
<table>gallery</table>
|
30 |
+
</gallery>
|
31 |
+
<item>
|
32 |
+
<table>gallery_item</table>
|
33 |
+
</item>
|
34 |
+
</entities>
|
35 |
+
</gallery_mysql4>
|
36 |
+
</models>
|
37 |
+
<resources>
|
38 |
+
<gallery_setup>
|
39 |
+
<setup>
|
40 |
+
<module>Ifuturz_Gallery</module>
|
41 |
+
</setup>
|
42 |
+
</gallery_setup>
|
43 |
+
</resources>
|
44 |
+
<template>
|
45 |
+
<email>
|
46 |
+
<gallery_email_email_template translate="label" module="gallery">
|
47 |
+
<label>Share Gallery</label>
|
48 |
+
<file>gallery_share.html</file>
|
49 |
+
<type>html</type>
|
50 |
+
</gallery_email_email_template>
|
51 |
+
</email>
|
52 |
+
</template>
|
53 |
+
<events>
|
54 |
+
<checkout_cart_update_items_before>
|
55 |
+
<observers>
|
56 |
+
<gallery>
|
57 |
+
<class>gallery/observer</class>
|
58 |
+
<method>processCartUpdateBefore</method>
|
59 |
+
</gallery>
|
60 |
+
</observers>
|
61 |
+
</checkout_cart_update_items_before>
|
62 |
+
<checkout_cart_add_product_complete>
|
63 |
+
<observers>
|
64 |
+
<gallery>
|
65 |
+
<class>gallery/observer</class>
|
66 |
+
<method>processAddToCart</method>
|
67 |
+
</gallery>
|
68 |
+
</observers>
|
69 |
+
</checkout_cart_add_product_complete>
|
70 |
+
</events>
|
71 |
+
</global>
|
72 |
+
<frontend>
|
73 |
+
<routers>
|
74 |
+
<gallery>
|
75 |
+
<use>standard</use>
|
76 |
+
<args>
|
77 |
+
<module>Ifuturz_Gallery</module>
|
78 |
+
<frontName>gallery</frontName>
|
79 |
+
</args>
|
80 |
+
</gallery>
|
81 |
+
</routers>
|
82 |
+
<translate>
|
83 |
+
<modules>
|
84 |
+
<Ifuturz_Gallery>
|
85 |
+
<files>
|
86 |
+
<default>Ifuturz_Gallery.csv</default>
|
87 |
+
</files>
|
88 |
+
</Ifuturz_Gallery>
|
89 |
+
</modules>
|
90 |
+
</translate>
|
91 |
+
<layout>
|
92 |
+
<updates>
|
93 |
+
<gallery module="Ifuturz_Gallery">
|
94 |
+
<file>gallery.xml</file>
|
95 |
+
</gallery>
|
96 |
+
</updates>
|
97 |
+
</layout>
|
98 |
+
<events>
|
99 |
+
<customer_login>
|
100 |
+
<observers>
|
101 |
+
<gallery>
|
102 |
+
<class>gallery/observer</class>
|
103 |
+
<method>customerLogin</method>
|
104 |
+
</gallery>
|
105 |
+
</observers>
|
106 |
+
</customer_login>
|
107 |
+
<customer_logout>
|
108 |
+
<observers>
|
109 |
+
<gallery>
|
110 |
+
<class>gallery/observer</class>
|
111 |
+
<method>customerLogout</method>
|
112 |
+
</gallery>
|
113 |
+
</observers>
|
114 |
+
</customer_logout>
|
115 |
+
</events>
|
116 |
+
<secure_url>
|
117 |
+
<gallery>/gallery/</gallery>
|
118 |
+
</secure_url>
|
119 |
+
</frontend>
|
120 |
+
<adminhtml>
|
121 |
+
<translate>
|
122 |
+
<modules>
|
123 |
+
<Ifuturz_Gallery>
|
124 |
+
<files>
|
125 |
+
<default>Ifuturz_Gallery.csv</default>
|
126 |
+
</files>
|
127 |
+
</Ifuturz_Gallery>
|
128 |
+
</modules>
|
129 |
+
</translate>
|
130 |
+
</adminhtml>
|
131 |
+
|
132 |
+
<default>
|
133 |
+
<gallery>
|
134 |
+
<general>
|
135 |
+
<active>1</active>
|
136 |
+
</general>
|
137 |
+
<email>
|
138 |
+
<email_identity>general</email_identity>
|
139 |
+
<email_template>gallery_email_email_template</email_template>
|
140 |
+
</email>
|
141 |
+
</gallery>
|
142 |
+
</default>
|
143 |
+
</config>
|
app/code/local/Ifuturz/Gallery/etc/system.xml
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<gallery translate="label" module="gallery">
|
5 |
+
<label>Gallery</label>
|
6 |
+
<tab>customer</tab>
|
7 |
+
<frontend_type>text</frontend_type>
|
8 |
+
<sort_order>140</sort_order>
|
9 |
+
<show_in_default>1</show_in_default>
|
10 |
+
<show_in_website>1</show_in_website>
|
11 |
+
<show_in_store>1</show_in_store>
|
12 |
+
<groups>
|
13 |
+
<email translate="label">
|
14 |
+
<label>Share Options</label>
|
15 |
+
<frontend_type>text</frontend_type>
|
16 |
+
<sort_order>2</sort_order>
|
17 |
+
<show_in_default>1</show_in_default>
|
18 |
+
<show_in_website>1</show_in_website>
|
19 |
+
<show_in_store>1</show_in_store>
|
20 |
+
<fields>
|
21 |
+
<email_identity translate="label">
|
22 |
+
<label>Email Sender</label>
|
23 |
+
<frontend_type>select</frontend_type>
|
24 |
+
<source_model>adminhtml/system_config_source_email_identity</source_model>
|
25 |
+
<sort_order>1</sort_order>
|
26 |
+
<show_in_default>1</show_in_default>
|
27 |
+
<show_in_website>1</show_in_website>
|
28 |
+
<show_in_store>1</show_in_store>
|
29 |
+
</email_identity>
|
30 |
+
<email_template translate="label">
|
31 |
+
<label>Email Template</label>
|
32 |
+
<frontend_type>select</frontend_type>
|
33 |
+
<source_model>adminhtml/system_config_source_email_template</source_model>
|
34 |
+
<sort_order>1</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>1</show_in_store>
|
38 |
+
</email_template>
|
39 |
+
</fields>
|
40 |
+
</email>
|
41 |
+
<general translate="label">
|
42 |
+
<label>General Options</label>
|
43 |
+
<frontend_type>text</frontend_type>
|
44 |
+
<sort_order>1</sort_order>
|
45 |
+
<show_in_default>1</show_in_default>
|
46 |
+
<show_in_website>1</show_in_website>
|
47 |
+
<show_in_store>1</show_in_store>
|
48 |
+
<fields>
|
49 |
+
<active translate="label">
|
50 |
+
<label>Enabled</label>
|
51 |
+
<frontend_type>select</frontend_type>
|
52 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
53 |
+
<sort_order>1</sort_order>
|
54 |
+
<show_in_default>1</show_in_default>
|
55 |
+
<show_in_website>1</show_in_website>
|
56 |
+
<show_in_store>1</show_in_store>
|
57 |
+
</active>
|
58 |
+
</fields>
|
59 |
+
</general>
|
60 |
+
</groups>
|
61 |
+
</gallery>
|
62 |
+
</sections>
|
63 |
+
</config>
|
app/code/local/Ifuturz/Gallery/sql/gallery_setup/mysql4-install-0.7.0.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
5 |
+
|
6 |
+
$installer->startSetup();
|
7 |
+
|
8 |
+
$installer->run("
|
9 |
+
|
10 |
+
-- DROP TABLE IF EXISTS {$this->getTable('gallery')};
|
11 |
+
CREATE TABLE {$this->getTable('gallery')} (
|
12 |
+
`gallery_id` int(10) unsigned NOT NULL auto_increment,
|
13 |
+
`customer_id` int(10) unsigned NOT NULL default '0',
|
14 |
+
`shared` tinyint(1) unsigned default '0',
|
15 |
+
`sharing_code` varchar(32) character set latin1 collate latin1_general_ci NOT NULL default '',
|
16 |
+
PRIMARY KEY (`gallery_id`),
|
17 |
+
UNIQUE KEY `FK_CUSTOMER` (`customer_id`)
|
18 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Gallery main';
|
19 |
+
|
20 |
+
-- DROP TABLE IF EXISTS {$this->getTable('gallery_item')};
|
21 |
+
CREATE TABLE {$this->getTable('gallery_item')} (
|
22 |
+
`gallery_item_id` int(10) unsigned NOT NULL auto_increment,
|
23 |
+
`gallery_id` int(10) unsigned NOT NULL default '0',
|
24 |
+
`product_id` int(10) unsigned NOT NULL default '0',
|
25 |
+
`store_id` int(10) unsigned NOT NULL default '0',
|
26 |
+
`added_at` datetime default NULL,
|
27 |
+
`description` text,
|
28 |
+
PRIMARY KEY (`gallery_item_id`),
|
29 |
+
KEY `FK_ITEM_GALLERY` (`gallery_id`),
|
30 |
+
KEY `FK_GALLERY_PRODUCT` (`product_id`),
|
31 |
+
KEY `FK_GALLERY_STORE` (`store_id`),
|
32 |
+
CONSTRAINT `FK_ITEM_GALLERY` FOREIGN KEY (`gallery_id`) REFERENCES {$this->getTable('gallery')} (`gallery_id`) ON DELETE CASCADE ON UPDATE CASCADE
|
33 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Gallery items';
|
34 |
+
|
35 |
+
");
|
36 |
+
|
37 |
+
$installer->endSetup();
|
app/code/local/Ifuturz/Gallery/sql/gallery_setup/mysql4-upgrade-0.7.0-0.7.1.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
5 |
+
|
6 |
+
$installer->startSetup();
|
7 |
+
|
8 |
+
$installer->run("
|
9 |
+
|
10 |
+
alter table {$this->getTable('gallery_item')} add constraint `FK_GALLERY_PRODUCT` foreign key (`product_id`) references {$this->getTable('catalog_product_entity')} (`entity_id`) on delete cascade on update cascade
|
11 |
+
;
|
12 |
+
|
13 |
+
");
|
14 |
+
|
15 |
+
$installer->endSetup();
|
app/code/local/Ifuturz/Gallery/sql/gallery_setup/mysql4-upgrade-0.7.1-0.7.2.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
$installer = $this;
|
5 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
6 |
+
|
7 |
+
$installer->startSetup();
|
8 |
+
|
9 |
+
$installer->run("
|
10 |
+
ALTER TABLE {$this->getTable('gallery_item')}
|
11 |
+
CHANGE `store_id` `store_id` smallint(5) unsigned NOT NULL;
|
12 |
+
ALTER TABLE {$this->getTable('gallery_item')}
|
13 |
+
ADD CONSTRAINT `FK_GALLERY_ITEM_STORE` FOREIGN KEY (`store_id`)
|
14 |
+
REFERENCES {$this->getTable('core_store')} (`store_id`)
|
15 |
+
ON UPDATE CASCADE
|
16 |
+
ON DELETE CASCADE;
|
17 |
+
");
|
18 |
+
$installer->endSetup();
|
app/code/local/Ifuturz/Gallery/sql/gallery_setup/mysql4-upgrade-0.7.2-0.7.4.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
$installer = $this;
|
5 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
6 |
+
|
7 |
+
$installer->startSetup();
|
8 |
+
|
9 |
+
$tableGallery = $this->getTable('gallery');
|
10 |
+
$tableCustomers = $this->getTable('customer/entity');
|
11 |
+
|
12 |
+
$installer->run("DELETE FROM {$tableGallery} WHERE customer_id NOT IN (SELECT entity_id FROM {$tableCustomers})");
|
13 |
+
|
14 |
+
$installer->run("
|
15 |
+
ALTER TABLE {$tableGallery}
|
16 |
+
ADD CONSTRAINT `FK_CUSTOMER` FOREIGN KEY (`customer_id`)
|
17 |
+
REFERENCES {$tableCustomers} (`entity_id`)
|
18 |
+
ON UPDATE CASCADE
|
19 |
+
ON DELETE CASCADE;
|
20 |
+
");
|
21 |
+
|
22 |
+
$installer->endSetup();
|
app/code/local/Ifuturz/Gallery/sql/gallery_setup/mysql4-upgrade-0.7.4-0.7.5.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->getConnection()->dropForeignKey($installer->getTable('gallery/item'), 'FK_GALLERY_ITEM_STORE');
|
8 |
+
$installer->getConnection()->dropForeignKey($installer->getTable('gallery/item'), 'FK_ITEM_GALLERY');
|
9 |
+
$installer->getConnection()->dropForeignKey($installer->getTable('gallery/item'), 'FK_GALLERY_PRODUCT');
|
10 |
+
$installer->getConnection()->dropForeignKey($installer->getTable('gallery/gallery'), 'FK_CUSTOMER');
|
11 |
+
|
12 |
+
$installer->getConnection()->dropKey($installer->getTable('gallery/item'), 'FK_ITEM_GALLERY');
|
13 |
+
$installer->getConnection()->dropKey($installer->getTable('gallery/item'), 'FK_GALLERY_PRODUCT');
|
14 |
+
$installer->getConnection()->dropKey($installer->getTable('gallery/item'), 'FK_GALLERY_STORE');
|
15 |
+
$installer->getConnection()->dropKey($installer->getTable('gallery/gallery'), 'FK_CUSTOMER');
|
16 |
+
|
17 |
+
$installer->getConnection()->modifyColumn($installer->getTable('gallery/item'), 'store_id',
|
18 |
+
'smallint UNSIGNED DEFAULT NULL');
|
19 |
+
|
20 |
+
$installer->getConnection()->addKey($installer->getTable('gallery/item'), 'IDX_GALLERY', 'gallery_id');
|
21 |
+
$installer->getConnection()->addKey($installer->getTable('gallery/item'), 'IDX_PRODUCT', 'product_id');
|
22 |
+
$installer->getConnection()->addKey($installer->getTable('gallery/item'), 'IDX_STORE', 'store_id');
|
23 |
+
$installer->getConnection()->addKey($installer->getTable('gallery/gallery'), 'UNQ_CUSTOMER', 'customer_id', 'unique');
|
24 |
+
$installer->getConnection()->addKey($installer->getTable('gallery/gallery'), 'IDX_IS_SHARED', 'shared');
|
25 |
+
|
26 |
+
$installer->getConnection()->addConstraint('FK_GALLERY_ITEM_STORE',
|
27 |
+
$installer->getTable('gallery/item'), 'store_id',
|
28 |
+
$installer->getTable('core/store'), 'store_id',
|
29 |
+
'set null', 'cascade'
|
30 |
+
);
|
31 |
+
$installer->getConnection()->addConstraint('FK_GALLERY_ITEM_GALLERY',
|
32 |
+
$installer->getTable('gallery/item'), 'gallery_id',
|
33 |
+
$installer->getTable('gallery/gallery'), 'gallery_id',
|
34 |
+
'cascade', 'cascade'
|
35 |
+
);
|
36 |
+
$installer->getConnection()->addConstraint('FK_GALLERY_ITEM_PRODUCT',
|
37 |
+
$installer->getTable('gallery/item'), 'product_id',
|
38 |
+
$installer->getTable('catalog/product'), 'entity_id',
|
39 |
+
'cascade', 'cascade'
|
40 |
+
);
|
41 |
+
$installer->getConnection()->addConstraint('FK_GALLERY_CUSTOMER',
|
42 |
+
$installer->getTable('gallery/gallery'), 'customer_id',
|
43 |
+
$installer->getTable('customer/entity'), 'entity_id',
|
44 |
+
'cascade', 'cascade'
|
45 |
+
);
|
46 |
+
|
47 |
+
$installer->endSetup();
|
app/code/local/Ifuturz/Gallery/sql/gallery_setup/mysql4-upgrade-0.7.5-0.7.6.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php
|
app/code/local/Ifuturz/Gallery/sql/gallery_setup/mysql4-upgrade-0.7.6-0.7.7.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
$installer->getConnection()->dropColumn($installer->getTable('gallery'), 'is_dirty');
|
6 |
+
$installer->endSetup();
|
app/code/local/Ifuturz/Gallery/sql/gallery_setup/mysql4-upgrade-0.7.7-0.7.8.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
$installer->getConnection()->addColumn($this->getTable('gallery'), 'updated_at', 'datetime NULL DEFAULT NULL');
|
6 |
+
$installer->endSetup();
|
app/code/local/Mage/Adminhtml/Block/Customer/Edit/Tab/Gallery.php
ADDED
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Mage_Adminhtml_Block_Customer_Edit_Tab_Gallery extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Default sort field
|
7 |
+
*
|
8 |
+
* @var string
|
9 |
+
*/
|
10 |
+
|
11 |
+
protected $_defaultSort = 'added_at';
|
12 |
+
/**
|
13 |
+
* Parent template name
|
14 |
+
*
|
15 |
+
* @var string
|
16 |
+
*/
|
17 |
+
protected $_parentTemplate;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Initialize Grid
|
21 |
+
*
|
22 |
+
*/
|
23 |
+
public function __construct()
|
24 |
+
{
|
25 |
+
parent::__construct();
|
26 |
+
$this->setId('galleryGrid');
|
27 |
+
$this->setUseAjax(true);
|
28 |
+
$this->_parentTemplate = $this->getTemplate();
|
29 |
+
$this->setTemplate('customer/tab/gallery.phtml');
|
30 |
+
$this->setEmptyText(Mage::helper('customer')->__('No Items Found'));
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Retrieve current customer object
|
35 |
+
*
|
36 |
+
* @return Mage_Customer_Model_Customer
|
37 |
+
*/
|
38 |
+
protected function _getCustomer()
|
39 |
+
{
|
40 |
+
return Mage::registry('current_customer');
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Prepare customer gallery product collection
|
45 |
+
*
|
46 |
+
* @return Mage_Adminhtml_Block_Customer_Edit_Tab_Gallery
|
47 |
+
*/
|
48 |
+
protected function _prepareCollection()
|
49 |
+
{
|
50 |
+
$gallery = Mage::getModel('gallery/gallery');
|
51 |
+
$collection = $gallery->loadByCustomer($this->_getCustomer())
|
52 |
+
->setSharedStoreIds($gallery->getSharedStoreIds(false))
|
53 |
+
->getProductCollection()
|
54 |
+
->resetSortOrder()
|
55 |
+
->addAttributeToSelect('name')
|
56 |
+
->addAttributeToSelect('price')
|
57 |
+
->addAttributeToSelect('small_image')
|
58 |
+
->setDaysInGallery(true)
|
59 |
+
->addStoreData();
|
60 |
+
|
61 |
+
$this->setCollection($collection);
|
62 |
+
|
63 |
+
return parent::_prepareCollection();
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Prepare Grid columns
|
68 |
+
*
|
69 |
+
* @return Mage_Adminhtml_Block_Customer_Edit_Tab_Gallery
|
70 |
+
*/
|
71 |
+
protected function _prepareColumns()
|
72 |
+
{
|
73 |
+
|
74 |
+
/*$this->addColumn('product_id', array(
|
75 |
+
'header' => Mage::helper('customer')->__('ID'),
|
76 |
+
'index' => 'product_id',
|
77 |
+
'type' => 'number',
|
78 |
+
'width' => '130px'
|
79 |
+
));*/
|
80 |
+
|
81 |
+
$this->addColumn('product_name', array(
|
82 |
+
'header' => Mage::helper('customer')->__('Product name'),
|
83 |
+
'index' => 'name'
|
84 |
+
));
|
85 |
+
|
86 |
+
$this->addColumn('description', array(
|
87 |
+
'header' => Mage::helper('customer')->__('User description'),
|
88 |
+
'index' => 'gallery_item_description',
|
89 |
+
'renderer' => 'adminhtml/customer_edit_tab_gallery_grid_renderer_description'
|
90 |
+
));
|
91 |
+
|
92 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
93 |
+
$this->addColumn('store', array(
|
94 |
+
'header' => Mage::helper('customer')->__('Added From'),
|
95 |
+
'index' => 'store_name',
|
96 |
+
'type' => 'store'
|
97 |
+
));
|
98 |
+
}
|
99 |
+
|
100 |
+
$this->addColumn('visible_in', array(
|
101 |
+
'header' => Mage::helper('customer')->__('Visible In'),
|
102 |
+
'index' => 'item_store_id',
|
103 |
+
'type' => 'store'
|
104 |
+
));
|
105 |
+
|
106 |
+
$this->addColumn('added_at', array(
|
107 |
+
'header' => Mage::helper('customer')->__('Date Added'),
|
108 |
+
'index' => 'added_at',
|
109 |
+
'gmtoffset' => true,
|
110 |
+
'type' => 'date'
|
111 |
+
));
|
112 |
+
|
113 |
+
$this->addColumn('days', array(
|
114 |
+
'header' => Mage::helper('customer')->__('Days in Gallery'),
|
115 |
+
'index' => 'days_in_gallery',
|
116 |
+
'type' => 'number'
|
117 |
+
));
|
118 |
+
|
119 |
+
$this->addColumn('action', array(
|
120 |
+
'header' => Mage::helper('customer')->__('Action'),
|
121 |
+
'index' => 'gallery_item_id',
|
122 |
+
'type' => 'action',
|
123 |
+
'filter' => false,
|
124 |
+
'sortable' => false,
|
125 |
+
'actions' => array(
|
126 |
+
array(
|
127 |
+
'caption' => Mage::helper('customer')->__('Delete'),
|
128 |
+
'url' => '#',
|
129 |
+
'onclick' => 'return galleryControl.removeItem($gallery_item_id);'
|
130 |
+
)
|
131 |
+
)
|
132 |
+
));
|
133 |
+
|
134 |
+
return parent::_prepareColumns();
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Retrieve Grid URL
|
139 |
+
*
|
140 |
+
* @return string
|
141 |
+
*/
|
142 |
+
public function getGridUrl()
|
143 |
+
{
|
144 |
+
return $this->getUrl('*/*/gallery', array('_current'=>true));
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Add column filter to collection
|
149 |
+
*
|
150 |
+
* @param Mage_Adminhtml_Block_Widget_Grid_Column $column
|
151 |
+
* @return Mage_Adminhtml_Block_Customer_Edit_Tab_Gallery
|
152 |
+
*/
|
153 |
+
protected function _addColumnFilterToCollection($column)
|
154 |
+
{
|
155 |
+
if($column->getId()=='store') {
|
156 |
+
$this->getCollection()->addFieldToFilter('item_store_id', $column->getFilter()->getCondition());
|
157 |
+
return $this;
|
158 |
+
}
|
159 |
+
|
160 |
+
if ($this->getCollection() && $column->getFilter()->getValue()) {
|
161 |
+
$this->getCollection()->addFieldToFilter($column->getIndex(), $column->getFilter()->getCondition());
|
162 |
+
}
|
163 |
+
|
164 |
+
return $this;
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Retrieve Grid Parent Block HTML
|
169 |
+
*
|
170 |
+
* @return string
|
171 |
+
*/
|
172 |
+
public function getGridParentHtml()
|
173 |
+
{
|
174 |
+
$templateName = Mage::getDesign()->getTemplateFilename($this->_parentTemplate, array('_relative'=>true));
|
175 |
+
return $this->fetchView($templateName);
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Retrieve Row click URL
|
180 |
+
*
|
181 |
+
* @return string
|
182 |
+
*/
|
183 |
+
public function getRowUrl($row)
|
184 |
+
{
|
185 |
+
return $this->getUrl('*/catalog_product/edit', array('id' => $row->getProductId()));
|
186 |
+
}
|
187 |
+
}
|
app/code/local/Mage/Adminhtml/Block/Customer/Edit/Tab/Gallery/Grid/Renderer/Description.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Mage_Adminhtml_Block_Customer_Edit_Tab_Gallery_Grid_Renderer_Description extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
3 |
+
{
|
4 |
+
|
5 |
+
public function render(Varien_Object $row)
|
6 |
+
{
|
7 |
+
return nl2br(htmlspecialchars($row->getData($this->getColumn()->getIndex())));
|
8 |
+
}
|
9 |
+
|
10 |
+
}
|
app/code/local/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Gallery.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Mage_Adminhtml_Block_Customer_Edit_Tab_View_Gallery extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setId('customer_view_gallery_grid');
|
10 |
+
$this->setSortable(false);
|
11 |
+
$this->setPagerVisibility(false);
|
12 |
+
$this->setFilterVisibility(false);
|
13 |
+
$this->setEmptyText(Mage::helper('customer')->__("There are no items in customer's gallery at the moment"));
|
14 |
+
}
|
15 |
+
|
16 |
+
protected function _prepareCollection()
|
17 |
+
{
|
18 |
+
$gallery = Mage::getModel('gallery/gallery');
|
19 |
+
$collection = $gallery->loadByCustomer(Mage::registry('current_customer'))
|
20 |
+
->setSharedStoreIds($gallery->getSharedStoreIds(false))
|
21 |
+
->getProductCollection()
|
22 |
+
->addAttributeToSelect('name')
|
23 |
+
->addStoreData();
|
24 |
+
|
25 |
+
$this->setCollection($collection);
|
26 |
+
|
27 |
+
return parent::_prepareCollection();
|
28 |
+
}
|
29 |
+
|
30 |
+
protected function _prepareColumns()
|
31 |
+
{
|
32 |
+
$this->addColumn('product_id', array(
|
33 |
+
'header' => Mage::helper('customer')->__('Product ID'),
|
34 |
+
'index' => 'product_id',
|
35 |
+
'type' => 'number',
|
36 |
+
'width' => '100px'
|
37 |
+
));
|
38 |
+
|
39 |
+
$this->addColumn('product_name', array(
|
40 |
+
'header' => Mage::helper('customer')->__('Product Name'),
|
41 |
+
'index' => 'name'
|
42 |
+
));
|
43 |
+
|
44 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
45 |
+
$this->addColumn('store', array(
|
46 |
+
'header' => Mage::helper('customer')->__('Added From'),
|
47 |
+
'index' => 'store_id',
|
48 |
+
'type' => 'store',
|
49 |
+
'width' => '160px',
|
50 |
+
));
|
51 |
+
}
|
52 |
+
|
53 |
+
$this->addColumn('added_at', array(
|
54 |
+
'header' => Mage::helper('customer')->__('Date Added'),
|
55 |
+
'index' => 'added_at',
|
56 |
+
'type' => 'date',
|
57 |
+
'width' => '140px',
|
58 |
+
));
|
59 |
+
|
60 |
+
$this->addColumn('days', array(
|
61 |
+
'header' => Mage::helper('customer')->__('Days in Gallery'),
|
62 |
+
'index' => 'days_in_gallery',
|
63 |
+
'type' => 'number',
|
64 |
+
'width' => '140px',
|
65 |
+
));
|
66 |
+
|
67 |
+
return parent::_prepareColumns();
|
68 |
+
}
|
69 |
+
|
70 |
+
public function getHeadersVisibility()
|
71 |
+
{
|
72 |
+
return ($this->getCollection()->getSize() > 0);
|
73 |
+
}
|
74 |
+
|
75 |
+
public function getRowUrl($row)
|
76 |
+
{
|
77 |
+
return $this->getUrl('*/catalog_product/edit', array('id' => $row->getProductId()));
|
78 |
+
}
|
79 |
+
|
80 |
+
}
|
81 |
+
|
app/design/frontend/default/default/layout/gallery.xml
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<layout version="0.1.0">
|
4 |
+
|
5 |
+
<!--
|
6 |
+
Default layout, loads most of the pages
|
7 |
+
-->
|
8 |
+
|
9 |
+
<default>
|
10 |
+
|
11 |
+
<reference name="top.links">
|
12 |
+
<block type="gallery/links" name="gallery_link">
|
13 |
+
<action method="addGalleryLink"></action>
|
14 |
+
</block>
|
15 |
+
</reference>
|
16 |
+
|
17 |
+
<!-- Mage_Gallery -->
|
18 |
+
<reference name="right">
|
19 |
+
<block type="gallery/customer_sidebar" name="gallery_sidebar" as="gallery" after="cart_sidebar" template="gallery/sidebar.phtml"/>
|
20 |
+
</reference>
|
21 |
+
|
22 |
+
</default>
|
23 |
+
|
24 |
+
<!--
|
25 |
+
Customer account pages, rendered for all tabs in dashboard
|
26 |
+
-->
|
27 |
+
|
28 |
+
<customer_account>
|
29 |
+
<!-- Mage_Gallery -->
|
30 |
+
<reference name="customer_account_navigation">
|
31 |
+
<action method="addLink" translate="label" module="gallery" ifconfig="gallery/general/active"><name>gallery</name><path>gallery/</path><label>My Gallery</label></action>
|
32 |
+
</reference>
|
33 |
+
</customer_account>
|
34 |
+
|
35 |
+
<!--
|
36 |
+
Customer account home dashboard layout
|
37 |
+
-->
|
38 |
+
|
39 |
+
<customer_account_index>
|
40 |
+
|
41 |
+
<reference name="right">
|
42 |
+
<action method="unsetChild"><name>gallery</name></action>
|
43 |
+
</reference>
|
44 |
+
</customer_account_index>
|
45 |
+
|
46 |
+
<!--
|
47 |
+
Gallery pages
|
48 |
+
-->
|
49 |
+
|
50 |
+
<gallery_index_index translate="label">
|
51 |
+
<label>Customer My Account My Gallery</label>
|
52 |
+
<!-- Mage_Gallery -->
|
53 |
+
<update handle="customer_account"/>
|
54 |
+
<reference name="my.account.wrapper">
|
55 |
+
<block type="gallery/customer_gallery" name="customer.gallery" template="gallery/view.phtml"/>
|
56 |
+
</reference>
|
57 |
+
<reference name="right">
|
58 |
+
<action method="unsetChild"><name>gallery_customer_sidebar</name></action>
|
59 |
+
</reference>
|
60 |
+
</gallery_index_index>
|
61 |
+
|
62 |
+
<gallery_index_share translate="label">
|
63 |
+
<label>Customer My Account Gallery Sharing Form</label>
|
64 |
+
<!-- Mage_Gallery -->
|
65 |
+
<update handle="customer_account"/>
|
66 |
+
<reference name="my.account.wrapper">
|
67 |
+
<block type="gallery/customer_sharing" name="gallery.sharing" template="gallery/sharing.phtml"/>
|
68 |
+
</reference>
|
69 |
+
<reference name="right">
|
70 |
+
<action method="unsetChild"><name>gallery_customer_sidebar</name></action>
|
71 |
+
</reference>
|
72 |
+
</gallery_index_share>
|
73 |
+
|
74 |
+
<gallery_shared_index translate="label">
|
75 |
+
<label>Customer Shared Gallery View</label>
|
76 |
+
<!-- Mage_Gallery -->
|
77 |
+
<reference name="content">
|
78 |
+
<block type="gallery/share_gallery" name="customer.gallery" template="gallery/shared.phtml"/>
|
79 |
+
</reference>
|
80 |
+
</gallery_shared_index>
|
81 |
+
</layout>
|
app/design/frontend/default/default/template/catalog/product/list.phtml
ADDED
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php
|
28 |
+
/**
|
29 |
+
* Product list template
|
30 |
+
*
|
31 |
+
* @see Mage_Catalog_Block_Product_List
|
32 |
+
*/
|
33 |
+
?>
|
34 |
+
<?php $_productCollection=$this->getLoadedProductCollection() ?>
|
35 |
+
<?php if(!$_productCollection->count()): ?>
|
36 |
+
<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
|
37 |
+
<?php else: ?>
|
38 |
+
<div class="category-products">
|
39 |
+
<?php echo $this->getToolbarHtml() ?>
|
40 |
+
<?php // List mode ?>
|
41 |
+
<?php if($this->getMode()!='grid'): ?>
|
42 |
+
<?php $_iterator = 0; ?>
|
43 |
+
<ol class="products-list" id="products-list">
|
44 |
+
<?php foreach ($_productCollection as $_product): ?>
|
45 |
+
<li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
|
46 |
+
<?php // Product Image ?>
|
47 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" /></a>
|
48 |
+
<?php // Product description ?>
|
49 |
+
<div class="product-shop">
|
50 |
+
<div class="f-fix">
|
51 |
+
<h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->htmlEscape($_product->getName())?></a></h2>
|
52 |
+
<?php if($_product->getRatingSummary()): ?>
|
53 |
+
<?php echo $this->getReviewsSummaryHtml($_product) ?>
|
54 |
+
<?php endif; ?>
|
55 |
+
<?php echo $this->getPriceHtml($_product, true) ?>
|
56 |
+
<?php if($_product->isSaleable()): ?>
|
57 |
+
<p><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
|
58 |
+
<?php else: ?>
|
59 |
+
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
|
60 |
+
<?php endif; ?>
|
61 |
+
<div class="desc std">
|
62 |
+
<?php echo nl2br($this->htmlEscape($_product->getShortDescription())) ?>
|
63 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>" class="link-more"><?php echo $this->__('Learn More') ?></a>
|
64 |
+
</div>
|
65 |
+
<ul class="add-to-links">
|
66 |
+
<?php if ($this->helper('wishlist')->isAllow()) : ?>
|
67 |
+
<li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
|
68 |
+
<?php endif; ?>
|
69 |
+
<?php if ($this->helper('gallery')->isAllow()) : ?>
|
70 |
+
<li><a href="<?php echo $this->helper('gallery')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Gallery') ?></a></li>
|
71 |
+
<?php endif; ?>
|
72 |
+
|
73 |
+
<?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
|
74 |
+
<li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
|
75 |
+
<?php endif; ?>
|
76 |
+
</ul>
|
77 |
+
</div>
|
78 |
+
</div>
|
79 |
+
</li>
|
80 |
+
<?php endforeach; ?>
|
81 |
+
</ol>
|
82 |
+
<script type="text/javascript">decorateList('products-list', 'none-recursive')</script>
|
83 |
+
|
84 |
+
<?php else: ?>
|
85 |
+
|
86 |
+
<?php // Grid Mode ?>
|
87 |
+
|
88 |
+
<?php $_collectionSize = $_productCollection->count() ?>
|
89 |
+
<?php $_columnCount = $this->getColumnCount(); ?>
|
90 |
+
<?php $i=0; foreach ($_productCollection as $_product): ?>
|
91 |
+
<?php if ($i++%$_columnCount==0): ?>
|
92 |
+
<ul class="products-grid">
|
93 |
+
<?php endif ?>
|
94 |
+
<li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
|
95 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')) ?>" /></a>
|
96 |
+
<h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a></h2>
|
97 |
+
<?php if($_product->getRatingSummary()): ?>
|
98 |
+
<?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
|
99 |
+
<?php endif; ?>
|
100 |
+
<?php echo $this->getPriceHtml($_product, true) ?>
|
101 |
+
<div class="actions">
|
102 |
+
<?php if($_product->isSaleable()): ?>
|
103 |
+
<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
|
104 |
+
<?php else: ?>
|
105 |
+
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
|
106 |
+
<?php endif; ?>
|
107 |
+
<ul class="add-to-links">
|
108 |
+
<?php if ($this->helper('wishlist')->isAllow()) : ?>
|
109 |
+
<li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
|
110 |
+
<?php endif; ?>
|
111 |
+
<?php if ($this->helper('gallery')->isAllow()) : ?>
|
112 |
+
<li><a href="<?php echo $this->helper('gallery')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Gallery') ?></a></li>
|
113 |
+
<?php endif; ?>
|
114 |
+
<?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
|
115 |
+
<li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
|
116 |
+
<?php endif; ?>
|
117 |
+
</ul>
|
118 |
+
</div>
|
119 |
+
</li>
|
120 |
+
<?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
|
121 |
+
</ul>
|
122 |
+
<?php endif ?>
|
123 |
+
<?php endforeach ?>
|
124 |
+
<script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
|
125 |
+
<?php endif; ?>
|
126 |
+
|
127 |
+
<div class="toolbar-bottom">
|
128 |
+
<?php echo $this->getToolbarHtml() ?>
|
129 |
+
</div>
|
130 |
+
</div>
|
131 |
+
<?php endif; ?>
|
app/design/frontend/default/default/template/gallery/email/items.phtml
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Gallery_Block_Share_Email_Items */
|
27 |
+
?>
|
28 |
+
<?php $l = $this->getGalleryItemsCount() ?>
|
29 |
+
<div style="border:1px solid #bebcb7; padding:15px; background:#f8f7f5;">
|
30 |
+
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
31 |
+
<tr>
|
32 |
+
<?php $i = 0; foreach ($this->getGalleryItems() as $item): $i++ ?>
|
33 |
+
<td width="32%">
|
34 |
+
<p align="center"><a href="<?php echo $this->getProductUrl($item) ?>"><img src="<?php echo $this->helper('catalog/image')->init($item, 'small_image')->resize(135); ?>" style="border:1px solid #ccc;" width="135" height="135" alt="" /></a></p>
|
35 |
+
<p align="center"><a href="<?php echo $this->getProductUrl($item) ?>" style="color:#203548;"><strong><?php echo $this->htmlEscape($item->getName()) ?></strong></a></p>
|
36 |
+
<?php if($this->hasDescription($item)): ?><p align="center"><?php echo $this->__('Comment') ?>:<br /><?php echo $this->getEscapedDescription($item) ?></p><?php endif; ?>
|
37 |
+
<p align="center"><a href="<?php echo $this->getProductUrl($item) ?>" style="color:#1E7EC8;"><?php echo $this->__('View Product') ?></a> <small>
|
38 |
+
<?php if ($item->getIsSalable()): ?>|</small> <a href="<?php echo $this->getAddToCartUrl($item) ?>" style="color:#DC6809;"><strong><?php echo $this->__('Add to Cart') ?></strong></a><?php endif;?>
|
39 |
+
</p></td>
|
40 |
+
<?php if ($i%3!=0): ?>
|
41 |
+
<td width="2%"></td>
|
42 |
+
<?php else: ?>
|
43 |
+
</tr>
|
44 |
+
<tr>
|
45 |
+
<td colspan="5"> </td>
|
46 |
+
</tr>
|
47 |
+
<?php if ($i<$l): ?>
|
48 |
+
<tr>
|
49 |
+
<?php endif ?>
|
50 |
+
<?php endif ?>
|
51 |
+
<?php endforeach ?>
|
52 |
+
</table>
|
53 |
+
</div>
|
app/design/frontend/default/default/template/gallery/email/rss.phtml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
?>
|
27 |
+
<div>
|
28 |
+
<?php echo $this->__("RSS link to %s's gallery",$this->helper('gallery')->getCustomerName()) ?>
|
29 |
+
<br />
|
30 |
+
<a href="<?php echo $this->helper('gallery')->getRssUrl(); ?>"><?php echo $this->helper('gallery')->getRssUrl(); ?></a>
|
31 |
+
</div>
|
app/design/frontend/default/default/template/gallery/shared.phtml
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Gallery_Block_Share_Gallery */
|
27 |
+
?>
|
28 |
+
<div class="my-gallery">
|
29 |
+
<div class="page-title">
|
30 |
+
<h1><?php echo $this->htmlEscape($this->getHeader()) ?></h1>
|
31 |
+
</div>
|
32 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
33 |
+
<?php if ($this->hasGalleryItems()): ?>
|
34 |
+
<form action="<?php echo $this->getUrl('*/*/update') ?>" method="post">
|
35 |
+
<fieldset>
|
36 |
+
<table class="data-table" id="gallery-table">
|
37 |
+
<col width="1" />
|
38 |
+
<col />
|
39 |
+
<col width="1" />
|
40 |
+
<thead>
|
41 |
+
<tr>
|
42 |
+
<th><?php echo $this->__('Product') ?></th>
|
43 |
+
<th><?php echo $this->__('Comment') ?></th>
|
44 |
+
<th> </th>
|
45 |
+
</tr>
|
46 |
+
</thead>
|
47 |
+
<tbody>
|
48 |
+
<?php foreach($this->getGalleryItems() as $item): ?>
|
49 |
+
<tr>
|
50 |
+
<td>
|
51 |
+
<a href="<?php echo $this->getProductUrl($item) ?>" title="<?php echo $this->htmlEscape($item->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($item, 'small_image')->resize(113); ?>" width="113" height="113" alt="<?php echo $this->htmlEscape($item->getName()) ?>" /></a>
|
52 |
+
<h3 class="product-name"><a href="<?php echo $this->getProductUrl($item) ?>" title="<?php echo $this->htmlEscape($item->getName()) ?>"><?php echo $this->htmlEscape($item->getName()) ?></a></h3>
|
53 |
+
<?php echo $this->getPriceHtml($item) ?>
|
54 |
+
</td>
|
55 |
+
<td><?php echo $this->getEscapedDescription($item) ?></td>
|
56 |
+
<td>
|
57 |
+
<ul class="add-to-links">
|
58 |
+
<?php if ($item->isSaleable()): ?>
|
59 |
+
<li><a href="#" onclick="setLocation('<?php echo $this->getAddToCartUrl($item) ?>'); return false;" class="link-cart"><?php echo $this->__('Add to Cart') ?></a></li>
|
60 |
+
<?php endif;?>
|
61 |
+
<li><a href="#" onclick="setLocation('<?php echo $this->getAddToGalleryUrl($item) ?>'); return false;" class="link-gallery"><?php echo $this->__('Add to Gallery') ?></a></li>
|
62 |
+
</ul>
|
63 |
+
</td>
|
64 |
+
</tr>
|
65 |
+
<?php endforeach ?>
|
66 |
+
</tbody>
|
67 |
+
</table>
|
68 |
+
<script type="text/javascript">decorateTable('gallery-table');</script>
|
69 |
+
</fieldset>
|
70 |
+
<?php if ($this->isSaleable()):?>
|
71 |
+
<div class="buttons-set">
|
72 |
+
<button type="button" title="<?php echo $this->__('Add All to Cart') ?>" onclick="setLocation('<?php echo $this->getUrl('*/*/allcart', array('_current'=>true)) ?>')" class="button"><span><span><?php echo $this->__('Add All to Cart') ?></span></span></button>
|
73 |
+
</div>
|
74 |
+
<?php endif;?>
|
75 |
+
</form>
|
76 |
+
<?php else: ?>
|
77 |
+
<p><?php echo $this->__('Gallery is empty now.') ?></p>
|
78 |
+
<?php endif ?>
|
79 |
+
</div>
|
app/design/frontend/default/default/template/gallery/sharing.phtml
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
?>
|
27 |
+
<div class="page-title">
|
28 |
+
<h1><?php echo $this->__('Share Your Gallery') ?></h1>
|
29 |
+
</div>
|
30 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
31 |
+
<form action="<?php echo $this->getSendUrl() ?>" id="form-validate" method="post">
|
32 |
+
<div class="fieldset">
|
33 |
+
<?php echo $this->getBlockHtml('formkey')?>
|
34 |
+
<h2 class="legend"><?php echo $this->__('Sharing Information') ?></h2>
|
35 |
+
<ul class="form-list">
|
36 |
+
<li class="wide">
|
37 |
+
<label for="email_address" class="required"><em>*</em><?php echo $this->__('Email addresses, separated by commas') ?></label>
|
38 |
+
<div class="input-box">
|
39 |
+
<textarea name="emails" cols="60" rows="5" id="email_address" class="validate-emails required-entry"><?php echo $this->getEnteredData('emails') ?></textarea>
|
40 |
+
</div>
|
41 |
+
</li>
|
42 |
+
<li class="wide">
|
43 |
+
<label for="message"><?php echo $this->__('Message') ?></label>
|
44 |
+
<div class="input-box">
|
45 |
+
<textarea id="message" name="message" cols="60" rows="5"><?php echo $this->getEnteredData('message') ?></textarea>
|
46 |
+
</div>
|
47 |
+
</li>
|
48 |
+
<?php if($this->helper('gallery')->isRssAllow()): ?>
|
49 |
+
<li class="control">
|
50 |
+
<input type="checkbox" name="rss_url" id="rss_url" value="1" title="<?php echo $this->__('Check this checkbox if you want to add a link to an rss feed to your gallery.') ?>" class="checkbox" /><label for="rss_url"><?php echo $this->__('Check this checkbox if you want to add a link to an rss feed to your gallery.') ?></label>
|
51 |
+
</li>
|
52 |
+
<?php endif; ?>
|
53 |
+
</ul>
|
54 |
+
</div>
|
55 |
+
<div class="buttons-set">
|
56 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
57 |
+
<p class="back-link"><a href="<?php echo $this->getUrl('*/')?>"><small>« </small><?php echo $this->__('Back')?></a></p>
|
58 |
+
<button type="submit" title="<?php echo $this->__('Share Gallery') ?>" class="button"><span><span><?php echo $this->__('Share Gallery') ?></span></span></button>
|
59 |
+
</div>
|
60 |
+
</form>
|
61 |
+
<script type="text/javascript">
|
62 |
+
//<![CDATA[
|
63 |
+
Validation.addAllThese([
|
64 |
+
['validate-emails', '<?php echo $this->__('Please enter a valid email addresses, separated by commas. For example johndoe@domain.com, johnsmith@domain.com.') ?>', function (v) {
|
65 |
+
if(Validation.get('IsEmpty').test(v)) {
|
66 |
+
return true;
|
67 |
+
}
|
68 |
+
|
69 |
+
var valid_regexp = /^[a-z0-9\._-]{1,30}@([a-z0-9_-]{1,30}\.){1,5}[a-z]{2,4}$/i;
|
70 |
+
var emails = v.split(',');
|
71 |
+
|
72 |
+
for (var i=0; i<emails.length; i++) {
|
73 |
+
if(!valid_regexp.test(emails[i].strip())) {
|
74 |
+
return false;
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
return true;
|
79 |
+
}]
|
80 |
+
]);
|
81 |
+
var dataForm = new VarienForm('form-validate', true);
|
82 |
+
//]]>
|
83 |
+
</script>
|
app/design/frontend/default/default/template/gallery/sidebar.phtml
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Gallery_Block_Customer_Sidebar */
|
27 |
+
?>
|
28 |
+
<?php if ($this->helper('gallery')->isAllow()) : ?>
|
29 |
+
<div class="block block-gallery">
|
30 |
+
<div class="block-title">
|
31 |
+
<strong><span><?php echo $this->__('My Gallery <small>(%d)</small>', $this->helper('gallery')->getItemCount()) ?></span></strong>
|
32 |
+
</div>
|
33 |
+
<div class="block-content">
|
34 |
+
<p class="block-subtitle"><?php echo $this->__('Last Added Items') ?></p>
|
35 |
+
<?php if ($this->hasGalleryItems()): ?>
|
36 |
+
<ol class="mini-products-list" id="gallery-sidebar">
|
37 |
+
<?php foreach ($this->getGalleryItems() as $_item): ?>
|
38 |
+
<li class="item">
|
39 |
+
<a href="<?php echo $this->getProductUrl($_item) ?>" title="<?php echo $this->htmlEscape($_item->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(50); ?>" width="50" height="50" alt="<?php echo $this->htmlEscape($_item->getName()) ?>" /></a>
|
40 |
+
<div class="product-details">
|
41 |
+
<a href="<?php echo $this->getItemRemoveUrl($_item) ?>" title="<?php echo $this->__('Remove This Item') ?>" onclick="return confirm('<?php echo $this->__('Are you sure you would like to remove this item from the gallery?') ?>');" class="btn-remove"><?php echo $this->__('Remove This Item') ?></a>
|
42 |
+
<p class="product-name"><a href="<?php echo $this->getProductUrl($_item) ?>"><?php echo $this->htmlEscape($_item->getName()) ?></a></p>
|
43 |
+
<?php echo $this->getPriceHtml($_item, false, '-gallery') ?>
|
44 |
+
<?php if ($_item->isSaleable()): ?>
|
45 |
+
<a href="<?php echo $this->getAddToCartItemUrl($_item) ?>" class="link-cart"><?php echo $this->__('Add to Cart') ?></a>
|
46 |
+
<?php endif; ?>
|
47 |
+
</div>
|
48 |
+
</li>
|
49 |
+
<?php endforeach; ?>
|
50 |
+
</ol>
|
51 |
+
<script type="text/javascript">decorateList('gallery-sidebar');</script>
|
52 |
+
<div class="actions">
|
53 |
+
<a href="<?php echo $this->helper('gallery')->getListUrl() ?>"><?php echo $this->__('Go to Gallery') ?></a>
|
54 |
+
</div>
|
55 |
+
<?php else: ?>
|
56 |
+
<p class="empty"><?php echo $this->__('You have no items in your gallery.') ?></p>
|
57 |
+
<?php endif ?>
|
58 |
+
</div>
|
59 |
+
</div>
|
60 |
+
<?php endif ?>
|
app/design/frontend/default/default/template/gallery/view.phtml
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Gallery_Block_Customer_Gallery */
|
27 |
+
?>
|
28 |
+
<div class="my-gallery">
|
29 |
+
<div class="page-title title-buttons">
|
30 |
+
<?php if ($this->helper('gallery')->isRssAllow() && $this->hasGalleryItems()): ?>
|
31 |
+
<a href="<?php echo $this->helper('gallery')->getRssUrl(); ?>" class="link-rss"><?php echo $this->__('RSS Feed') ?></a>
|
32 |
+
<?php endif; ?>
|
33 |
+
<h1><?php echo $this->__('My Gallery') ?></h1>
|
34 |
+
</div>
|
35 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
36 |
+
<?php if ($this->hasGalleryItems()): ?>
|
37 |
+
<form action="<?php echo $this->getUrl('*/*/update') ?>" method="post">
|
38 |
+
<fieldset style="padding: 10px;*padding: 10px;_padding: 10px;">
|
39 |
+
<?php echo $this->getBlockHtml('formkey')?>
|
40 |
+
<table class="data-table" id="gallery-table">
|
41 |
+
<col width="1" />
|
42 |
+
<col />
|
43 |
+
<col width="1" />
|
44 |
+
<col width="1" />
|
45 |
+
<col width="1" />
|
46 |
+
<thead>
|
47 |
+
<tr>
|
48 |
+
<th><?php echo $this->__('Product') ?></th>
|
49 |
+
<th><?php echo $this->__('Comment') ?></th>
|
50 |
+
<th class="a-center"><span class="nobr"><?php echo $this->__('Added On') ?></span></th>
|
51 |
+
<th class="a-center"><span class="nobr"><?php echo $this->__('Add to Cart') ?></span></th>
|
52 |
+
<th> </th>
|
53 |
+
</tr>
|
54 |
+
</thead>
|
55 |
+
<tbody>
|
56 |
+
<?php foreach ($this->getGalleryItems() as $item): ?>
|
57 |
+
<tr>
|
58 |
+
<td style="vertical-align: top;">
|
59 |
+
<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>
|
60 |
+
<h2 class="product-name"><a href="<?php echo $this->getProductUrl($item) ?>"><?php echo $this->htmlEscape($item->getName()) ?></a></h2>
|
61 |
+
<?php echo $this->getPriceHtml($item) ?>
|
62 |
+
</td>
|
63 |
+
<td style="vertical-align: top;">
|
64 |
+
<textarea name="description[<?php echo $item->getGalleryItemId() ?>]" 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('gallery')->defaultCommentString() ?></textarea>
|
65 |
+
</td>
|
66 |
+
<td style="vertical-align: top;">
|
67 |
+
<span class="nobr"><?php echo $this->getFormatedDate($item->getAddedAt()) ?></span>
|
68 |
+
</td>
|
69 |
+
<td class="a-center" style="vertical-align: top;">
|
70 |
+
<?php if($item->isSaleable()): ?>
|
71 |
+
<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>
|
72 |
+
<?php else: ?>
|
73 |
+
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
|
74 |
+
<?php endif; ?>
|
75 |
+
</td>
|
76 |
+
<td style="vertical-align: top;">
|
77 |
+
<a href="<?php echo $this->getItemRemoveUrl($item) ?>" title="<?php echo $this->__('Remove Item') ?>" onclick="return confirmRemoveGalleryItem();" class="btn-remove2"><?php echo $this->__('Remove item')?></a>
|
78 |
+
</td>
|
79 |
+
</tr>
|
80 |
+
<?php endforeach ?>
|
81 |
+
</tbody>
|
82 |
+
</table>
|
83 |
+
<script type="text/javascript">decorateTable('gallery-table')</script>
|
84 |
+
<div class="buttons-set">
|
85 |
+
<button type="submit" onclick="this.name='save_and_share'" title="<?php echo $this->__('Share Gallery') ?>" class="button btn-share"><span><span><?php echo $this->__('Share Gallery') ?></span></span></button>
|
86 |
+
<?php if($this->isSaleable()):?>
|
87 |
+
<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>
|
88 |
+
<?php endif;?>
|
89 |
+
<button type="submit" onclick="this.name='do'" title="<?php echo $this->__('Update Gallery') ?>" class="button btn-update"><span><span><?php echo $this->__('Update Gallery') ?></span></span></button>
|
90 |
+
</div>
|
91 |
+
</fieldset>
|
92 |
+
</form>
|
93 |
+
<?php else: ?>
|
94 |
+
<p><?php echo $this->__('You have no items in your gallery.') ?></p>
|
95 |
+
<?php endif ?>
|
96 |
+
<script type="text/javascript">
|
97 |
+
//<![CDATA[
|
98 |
+
function confirmRemoveGalleryItem() {
|
99 |
+
return confirm('<?php echo $this->__('Are you sure you want to remove this product from your gallery?') ?>');
|
100 |
+
}
|
101 |
+
|
102 |
+
function focusComment(obj) {
|
103 |
+
if( obj.value == '<?php echo $this->__('Please enter your comments...') ?>' ) {
|
104 |
+
obj.value = '';
|
105 |
+
} else if( obj.value == '' ) {
|
106 |
+
obj.value = '<?php echo $this->__('Please enter your comments...') ?>';
|
107 |
+
}
|
108 |
+
}
|
109 |
+
//]]>
|
110 |
+
</script>
|
111 |
+
</div>
|
112 |
+
<div class="buttons-set">
|
113 |
+
<p class="back-link"><a href="<?php echo $this->getBackUrl() ?>"><small>« </small><?php echo $this->__('Back') ?></a></p>
|
114 |
+
</div>
|
app/etc/modules/Ifuturz_All.xml
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Ifuturz_Adminhtml>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Ifuturz_Adminhtml>
|
8 |
+
<Ifuturz_Gallery>
|
9 |
+
<active>true</active>
|
10 |
+
<codePool>local</codePool>
|
11 |
+
</Ifuturz_Gallery>
|
12 |
+
</modules>
|
13 |
+
</config>
|
app/locale/en_US/Ifuturz_Gallery.csv
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"%1$s has been added to your gallery. Click <a href=""%2$s"">here</a> to continue shopping","%1$s has been added to your gallery. Click <a href=""%2$s"">here</a> to continue shopping"
|
2 |
+
"%d product(s) have been added to shopping cart: %s.","%d product(s) have been added to shopping cart: %s."
|
3 |
+
"%s's Gallery","%s's Gallery"
|
4 |
+
"* Required Fields","* Required Fields"
|
5 |
+
"Add All to Cart","Add All to Cart"
|
6 |
+
"Add to Cart","Add to Cart"
|
7 |
+
"Add to Gallery","Add to Gallery"
|
8 |
+
"Added On","Added On"
|
9 |
+
"An error occurred while adding item to gallery.","An error occurred while adding item to gallery."
|
10 |
+
"An error occurred while adding item to gallery: %s","An error occurred while adding item to gallery: %s"
|
11 |
+
"An error occurred while deleting the item from gallery.","An error occurred while deleting the item from gallery."
|
12 |
+
"An error occurred while deleting the item from gallery: %s","An error occurred while deleting the item from gallery: %s"
|
13 |
+
"Are you sure you want to remove this product from your gallery?","Are you sure you want to remove this product from your gallery?"
|
14 |
+
"Are you sure you would like to remove this item from the gallery?","Are you sure you would like to remove this item from the gallery?"
|
15 |
+
"Back","Back"
|
16 |
+
"Can\'t save description %s","Can\'t save description %s"
|
17 |
+
"Can\'t update gallery","Can\'t update gallery"
|
18 |
+
"Cannot add item to shopping cart","Cannot add item to shopping cart"
|
19 |
+
"Cannot add the item to shopping cart.","Cannot add the item to shopping cart."
|
20 |
+
"Cannot create gallery.","Cannot create gallery."
|
21 |
+
"Cannot specify product.","Cannot specify product."
|
22 |
+
"Cannot specify gallery.","Cannot specify gallery."
|
23 |
+
"Cannot update gallery","Cannot update gallery"
|
24 |
+
"Check this checkbox if you want to add a link to an rss feed to your gallery.","Check this checkbox if you want to add a link to an rss feed to your gallery."
|
25 |
+
"Comment","Comment"
|
26 |
+
"Comment:","Comment:"
|
27 |
+
"Customer My Account My Gallery","Customer My Account My Gallery"
|
28 |
+
"Customer My Account Gallery Sharing Form","Customer My Account Gallery Sharing Form"
|
29 |
+
"Customer Shared Gallery View","Customer Shared Gallery View"
|
30 |
+
"Email Sender","Email Sender"
|
31 |
+
"Email Template","Email Template"
|
32 |
+
"Email address can\'t be empty.","Email address can\'t be empty."
|
33 |
+
"Email addresses, separated by commas","Email addresses, separated by commas"
|
34 |
+
"Enabled","Enabled"
|
35 |
+
"General Options","General Options"
|
36 |
+
"Go to Gallery","Go to Gallery"
|
37 |
+
"Last Added Items","Last Added Items"
|
38 |
+
"Message","Message"
|
39 |
+
"My Gallery","My Gallery"
|
40 |
+
"My Gallery (%d item)","My Gallery (%d item)"
|
41 |
+
"My Gallery (%d items)","My Gallery (%d items)"
|
42 |
+
"My Gallery <small>(%d)</small>","My Gallery <small>(%d)</small>"
|
43 |
+
"Out of stock","Out of stock"
|
44 |
+
"Please enter a valid email addresses, separated by commas. For example johndoe@domain.com, johnsmith@domain.com.","Please enter a valid email addresses, separated by commas. For example johndoe@domain.com, johnsmith@domain.com."
|
45 |
+
"Please enter your comments...","Please enter your comments..."
|
46 |
+
"Please input a valid email address.","Please input a valid email address."
|
47 |
+
"Please, enter your comments...","Please, enter your comments..."
|
48 |
+
"Product","Product"
|
49 |
+
"Product(s) %s are grouped. Each of them can be added to cart separately only.","Product(s) %s are grouped. Each of them can be added to cart separately only."
|
50 |
+
"Product(s) %s have required options. Each of them can be added to cart separately only.","Product(s) %s have required options. Each of them can be added to cart separately only."
|
51 |
+
"RSS Feed","RSS Feed"
|
52 |
+
"RSS link to %s's gallery","RSS link to %s's gallery"
|
53 |
+
"Remove Item","Remove Item"
|
54 |
+
"Remove This Item","Remove This Item"
|
55 |
+
"Remove item","Remove item"
|
56 |
+
"Share Options","Share Options"
|
57 |
+
"Share Gallery","Share Gallery"
|
58 |
+
"Share Your Gallery","Share Your Gallery"
|
59 |
+
"Sharing Information","Sharing Information"
|
60 |
+
"This product(s) is currently out of stock","This product(s) is currently out of stock"
|
61 |
+
"Unable to add the following product(s) to shopping cart: %s.","Unable to add the following product(s) to shopping cart: %s."
|
62 |
+
"Update Gallery","Update Gallery"
|
63 |
+
"View Product","View Product"
|
64 |
+
"Gallery","Gallery"
|
65 |
+
"Gallery Section","Gallery Section"
|
66 |
+
"Gallery Sharing","Gallery Sharing"
|
67 |
+
"Gallery is empty now.","Gallery is empty now."
|
68 |
+
"You have no items in your gallery.","You have no items in your gallery."
|
69 |
+
"Your Gallery has been shared.","Your Gallery has been shared."
|
app/locale/en_US/template/email/gallery_share.html
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--@subject Take a look at {{var customer.name}}'s gallery @-->
|
2 |
+
<!--@vars
|
3 |
+
{"store url=\"\"":"Store Url",
|
4 |
+
"skin url=\"images/logo_email_new.gif\" _area='frontend'":"Email Logo Image",
|
5 |
+
"var message":"Gallery Message",
|
6 |
+
"var items":"Gallery Items"}
|
7 |
+
@-->
|
8 |
+
<!--@styles
|
9 |
+
body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
|
10 |
+
@-->
|
11 |
+
|
12 |
+
<div style="font:11px/1.35em Verdana, Arial, Helvetica, sans-serif;">
|
13 |
+
<table cellspacing="0" cellpadding="0" border="0" width="98%" style="margin-top:10px; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; margin-bottom:10px;">
|
14 |
+
<tr>
|
15 |
+
<td align="center" valign="top">
|
16 |
+
<!-- [ header starts here] -->
|
17 |
+
<table cellspacing="0" cellpadding="0" border="0" width="650">
|
18 |
+
<tr>
|
19 |
+
<td valign="top">
|
20 |
+
<p><a href="{{store url=""}}" style="color:#1E7EC8;"><img src="{{skin url="images/logo_email_new.gif" _area='frontend'}}" alt="{{var store.getFrontendName()}}" border="0"/></a></p></td>
|
21 |
+
</tr>
|
22 |
+
</table>
|
23 |
+
|
24 |
+
<!-- [ middle starts here] -->
|
25 |
+
<table cellspacing="0" cellpadding="0" border="0" width="650">
|
26 |
+
<tr>
|
27 |
+
<td valign="top">
|
28 |
+
<p>Hey,<br/>
|
29 |
+
Take a look at my gallery from Demo Store.</p>
|
30 |
+
|
31 |
+
<p>{{var message}}</p>
|
32 |
+
|
33 |
+
{{var items}}
|
34 |
+
|
35 |
+
<br/>
|
36 |
+
|
37 |
+
{{depend salable}}<p><strong><a href="{{var addAllLink}}" style="color:#DC6809;">Add all items to shopping cart</a></strong> |{{/depend}} <strong><a href="{{var viewOnSiteLink}}" style="color:#1E7EC8;">View all gallery items</a></strong></p>
|
38 |
+
|
39 |
+
<p>Thank you,<br/><strong>{{htmlescape var=$customer.name}}</strong></p>
|
40 |
+
|
41 |
+
|
42 |
+
</td>
|
43 |
+
</tr>
|
44 |
+
</table>
|
45 |
+
|
46 |
+
</td>
|
47 |
+
</tr>
|
48 |
+
</table>
|
49 |
+
</div>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>IfuturzAddgallery</name>
|
4 |
+
<version>0.1.0</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>Add to gallery</summary>
|
10 |
+
<description>Add to gallery</description>
|
11 |
+
<notes>Fixed minor bugs</notes>
|
12 |
+
<authors><author><name>urvisha</name><user>auto-converted</user><email>urvisha.patel@ifuturz.com</email></author></authors>
|
13 |
+
<date>2012-03-12</date>
|
14 |
+
<time>09:20:59</time>
|
15 |
+
<contents><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><file name="gallery_share.html" hash="82cd116463e2c0e6b8be3fe0f293109d"/></dir></dir><file name="Ifuturz_Gallery.csv" hash="19a2e8a181790d9141c64a103abf9a06"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="gallery.xml" hash="2e57efac77ab4e691695cfd6f130db1c"/></dir><dir name="template"><dir name="catalog"><dir name="product"><file name="list.phtml" hash="4111c4e2d8fefafab0d6456441f4c29f"/></dir></dir><dir name="gallery"><file name="shared.phtml" hash="1eb2031d6ecee170825e60e2c65d42e8"/><file name="sharing.phtml" hash="e502d679071c41652971fb4fd9de21e3"/><file name="sidebar.phtml" hash="1fedcd2164343130e2a8ecdc2b7152d8"/><file name="view.phtml" hash="2c5cf79c80430239489a950d30662786"/><dir name="email"><file name="items.phtml" hash="1a3881b9032ce6f399a4d508cb06d45e"/><file name="rss.phtml" hash="efcf12cd35f9df2db316ca5b6c07e411"/></dir></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="Ifuturz"><dir name="Adminhtml"><dir name="Block"><dir name="Customer"><dir name="Edit"><file name="Tabs.php" hash="01b4e78cdd22f4c54864eddf15040adf"/><dir name="Tab1234"><file name="Gallery.php" hash="b16059e6c454bfd4487160b246188e66"/><dir name="Gallery"><dir name="Grid"><dir name="Renderer"><file name="Description.php" hash="1191a72eee5ed919df3ea863c5112e61"/></dir></dir></dir><dir name="View"><file name="Gallery.php" hash="c44fbc02e22f66a4377881c64f8019bc"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="CustomerController.php" hash="e199694d42c8c1ebff1eb0b52d72c6ee"/></dir><dir name="etc"><file name="config.xml" hash="f80e1a022efae4789aa2091571a5976f"/></dir></dir><dir name="Gallery"><dir name="Block"><file name="Abstract.php" hash="695d9f348ba43a154b1f93055c523cd2"/><file name="Links.php" hash="3f77df4065beaa9573f72f703ff2e9a0"/><dir name="Customer"><file name="Gallery.php" hash="11b83232f27fa1b2ae04a7ba42a9433a"/><file name="Sharing.php" hash="8df6689bd441618969440ec803592877"/><file name="Sidebar.php" hash="09aa6f8f63d091ab20686ee66d42eba4"/></dir><dir name="Share"><file name="Gallery.php" hash="66c694d136086f5a79dd4fc8dbf6f475"/><dir name="Email"><file name="Items.php" hash="8342607af2681e588b91814cd1ce0d54"/><file name="Rss.php" hash="f549f32d92418e8f20ee80145ca4315c"/></dir></dir></dir><dir name="Controller"><file name="Abstract.php" hash="cd7fc08b17043f69e8c4c1b9eb83d954"/></dir><dir name="controllers"><file name="IndexController.php" hash="4edfeb77e156e3ce8b34c9bbb4c7585f"/><file name="SharedController.php" hash="d096ccabc7877f11a515f6bdf97eb1ff"/></dir><dir name="etc"><file name="adminhtml.xml" hash="a3d517a3d81a768041f3b0112c14d7d5"/><file name="config.xml" hash="49845ecf12f991c6dbf75dcaf8d3d509"/><file name="system.xml" hash="679c0279d5f81f443bf1a7e78127f667"/></dir><dir name="Helper"><file name="Data.php" hash="00f7243b407fbfe23b1511ee1c707716"/></dir><dir name="Model"><file name="Gallery.php" hash="ca0fc7286df42dc04d44ff67b5b97382"/><file name="Item.php" hash="be938e517993b3a4c714c2d1b37db9af"/><file name="Observer.php" hash="052d1205d085c32c892045ab9334118e"/><file name="Session.php" hash="2155b643e78ae3f001654d9b4ef8776f"/><dir name="Mysql4"><file name="Gallery.php" hash="cadece226359e93774fa315bdb3274d4"/><file name="Item.php" hash="f3af894186b2eab3e4a3b8316785f2c9"/><dir name="Gallery"><file name="Collection.php" hash="b2d94646bb6cecab7f844ec0d7f76bb7"/></dir><dir name="Item"><file name="Collection.php" hash="5d79896902e28f362f5d948b9b1b78a6"/></dir><dir name="Product"><file name="Collection.php" hash="2616a11af9aaa2dc51c4e4e04e257ca4"/></dir></dir></dir><dir name="sql"><dir name="gallery_setup"><file name="mysql4-install-0.7.0.php" hash="c8ea0c472cc4661ec211ca43bde948a6"/><file name="mysql4-upgrade-0.7.0-0.7.1.php" hash="ec22aa44a95d92772218cf8a59af6d0a"/><file name="mysql4-upgrade-0.7.1-0.7.2.php" hash="d4a234a91bda35e56439f9ee09a24637"/><file name="mysql4-upgrade-0.7.2-0.7.4.php" hash="fb3f8b73e4e997d196579ecde2ff6fd2"/><file name="mysql4-upgrade-0.7.4-0.7.5.php" hash="038debc781e6d4a539d00aa36b2097bf"/><file name="mysql4-upgrade-0.7.5-0.7.6.php" hash="f84214fc43f665c79b92dc7a092b364f"/><file name="mysql4-upgrade-0.7.6-0.7.7.php" hash="e7dfd177ce6e556241130de4ca1f55e0"/><file name="mysql4-upgrade-0.7.7-0.7.8.php" hash="1765bcdab7c6b3e74ca0f13015955981"/></dir></dir></dir></dir><dir name="Mage"><dir name="Adminhtml"><dir name="Block"><dir name="Customer"><dir name="Edit"><dir name="Tab"><file name="Gallery.php" hash="3e05089d557d997291a2032f89aba66a"/><dir name="Gallery"><dir name="Grid"><dir name="Renderer"><file name="Description.php" hash="cc88f9174dc550dba0f1056d489f32d1"/></dir></dir></dir><dir name="View"><file name="Gallery.php" hash="04d6f4e7f53b9825856092ab73b6f5c7"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ifuturz_All.xml" hash="dc3a055f4a67690bffb35f0e391d8fff"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies/>
|
18 |
+
</package>
|