ng_product - Version 1.0.1

Version Notes

1.0.1

Download this release

Release Info

Developer NG
Extension ng_product
Version 1.0.1
Comparing to
See all releases


Version 1.0.1

app/code/community/NG/Product/Helper/Data.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category NG
23
+ * @package NG_Product
24
+ */
25
+ class NG_Product_Helper_Data extends Mage_Core_Helper_Abstract {
26
+
27
+ public function getLinkLabel() {
28
+ return ucwords(Mage::getStoreConfig('ng_product/link/name'));
29
+ }
30
+
31
+ }
app/code/community/NG/Product/Model/System/Config/Source/required.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.'')
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.''.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 NG
22
+ * @package NG_Product
23
+ */
24
+ class NG_Product_Model_System_Config_Source_required
25
+ {
26
+ public function toOptionArray()
27
+ {
28
+ return array(
29
+ array('value' => 'name', 'label'=>Mage::helper('ng_product')->__('Name')),
30
+ array('value' => 'sku', 'label'=>Mage::helper('ng_product')->__('SKU')),
31
+ array('value' => 'description', 'label'=>Mage::helper('ng_product')->__('Description')),
32
+ array('value' => 'short_description', 'label'=>Mage::helper('ng_product')->__('Short Description')),
33
+ array('value' => 'weight', 'label'=>Mage::helper('ng_product')->__('Weight')),
34
+ array('value' => 'status', 'label'=>Mage::helper('ng_product')->__('Status')),
35
+ array('value' => 'url_key', 'label'=>Mage::helper('ng_product')->__('URL Key')),
36
+ array('value' => 'visibility', 'label'=>Mage::helper('ng_product')->__('Visibility')),
37
+ array('value' => 'price', 'label'=>Mage::helper('ng_product')->__('Price')),
38
+ array('value' => 'tax_class', 'label'=>Mage::helper('ng_product')->__('Tax Class')),
39
+ array('value' => 'meta_title', 'label'=>Mage::helper('ng_product')->__('Meta Title')),
40
+ array('value' => 'meta_keyword', 'label'=>Mage::helper('ng_product')->__('Meta Keywords')),
41
+ array('value' => 'meta_description', 'label'=>Mage::helper('ng_product')->__('Meta Description')),
42
+ array('value' => 'qty', 'label'=>Mage::helper('ng_product')->__('Qty')),
43
+ array('value' => 'manage_stock', 'label'=>Mage::helper('ng_product')->__('Manage Stock')),
44
+ array('value' => 'is_in_stock', 'label'=>Mage::helper('ng_product')->__('Is In Stock')),
45
+ array('value' => 'categories', 'label'=>Mage::helper('ng_product')->__('Categories')),
46
+ array('value' => 'websites', 'label'=>Mage::helper('ng_product')->__('Websites')),
47
+ array('value' => 'image', 'label'=>Mage::helper('ng_product')->__('Image')),
48
+ );
49
+ }
50
+ }
app/code/community/NG/Product/Model/System/Config/Source/yesno.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 NG
22
+ * @package NG_Product
23
+ */
24
+ class NG_Product_Model_System_Config_Source_yesno
25
+ {
26
+ public function toOptionArray()
27
+ {
28
+ return array(
29
+ array('value' => 1, 'label'=>Mage::helper('ng_product')->__('Enabled')),
30
+ array('value' => 0, 'label'=>Mage::helper('ng_product')->__('Disabled')),
31
+ );
32
+ }
33
+ }
app/code/community/NG/Product/controllers/Catalog/ProductController.php ADDED
@@ -0,0 +1,288 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once(Mage::getModuleDir('controllers', 'Mage_Catalog') . DS . 'ProductController.php');
4
+
5
+ class NG_Product_Catalog_ProductController extends Mage_Catalog_ProductController {
6
+
7
+ /**
8
+ * Current applied design settings
9
+ *
10
+ * @deprecated after 1.4.2.0-beta1
11
+ * @var array
12
+ */
13
+ protected $_designProductSettingsApplied = array();
14
+
15
+ /**
16
+ * Initialize requested product object
17
+ *
18
+ * @return Mage_Catalog_Model_Product
19
+ */
20
+ protected function _initProduct() {
21
+ $categoryId = (int) $this->getRequest()->getParam('category', false);
22
+ $productId = (int) $this->getRequest()->getParam('id');
23
+
24
+ $params = new Varien_Object();
25
+ $params->setCategoryId($categoryId);
26
+
27
+ return Mage::helper('catalog/product')->initProduct($productId, $this, $params);
28
+ }
29
+
30
+ /**
31
+ * Initialize product view layout
32
+ *
33
+ * @param Mage_Catalog_Model_Product $product
34
+ * @return Mage_Catalog_ProductController
35
+ */
36
+ protected function _initProductLayout($product) {
37
+ Mage::helper('catalog/product_view')->initProductLayout($product, $this);
38
+ return $this;
39
+ }
40
+
41
+ /**
42
+ * Recursively apply custom design settings to product if it's container
43
+ * category custom_use_for_products option is setted to 1.
44
+ * If not or product shows not in category - applyes product's internal settings
45
+ *
46
+ * @deprecated after 1.4.2.0-beta1, functionality moved to Mage_Catalog_Model_Design
47
+ * @param Mage_Catalog_Model_Category|Mage_Catalog_Model_Product $object
48
+ * @param Mage_Core_Model_Layout_Update $update
49
+ */
50
+ protected function _applyCustomDesignSettings($object, $update) {
51
+ if ($object instanceof Mage_Catalog_Model_Category) {
52
+ // lookup the proper category recursively
53
+ if ($object->getCustomUseParentSettings()) {
54
+ $parentCategory = $object->getParentCategory();
55
+ if ($parentCategory && $parentCategory->getId() && $parentCategory->getLevel() > 1) {
56
+ $this->_applyCustomDesignSettings($parentCategory, $update);
57
+ }
58
+ return;
59
+ }
60
+
61
+ // don't apply to the product
62
+ if (!$object->getCustomApplyToProducts()) {
63
+ return;
64
+ }
65
+ }
66
+
67
+ if ($this->_designProductSettingsApplied) {
68
+ return;
69
+ }
70
+
71
+ $date = $object->getCustomDesignDate();
72
+ if (array_key_exists('from', $date) && array_key_exists('to', $date) && Mage::app()->getLocale()->isStoreDateInInterval(null, $date['from'], $date['to'])
73
+ ) {
74
+ if ($object->getPageLayout()) {
75
+ $this->_designProductSettingsApplied['layout'] = $object->getPageLayout();
76
+ }
77
+ $this->_designProductSettingsApplied['update'] = $object->getCustomLayoutUpdate();
78
+ }
79
+ }
80
+
81
+ /**
82
+ * Product view action
83
+ */
84
+ public function viewAction() {
85
+ // Get initial data from request
86
+ $categoryId = (int) $this->getRequest()->getParam('category', false);
87
+ $productId = (int) $this->getRequest()->getParam('id');
88
+ $specifyOptions = $this->getRequest()->getParam('options');
89
+
90
+ // Prepare helper and params
91
+ $viewHelper = Mage::helper('catalog/product_view');
92
+
93
+ $params = new Varien_Object();
94
+ $params->setCategoryId($categoryId);
95
+ $params->setSpecifyOptions($specifyOptions);
96
+
97
+ // Render page
98
+ try {
99
+ $viewHelper->prepareAndRender($productId, $this, $params);
100
+ } catch (Exception $e) {
101
+ if ($e->getCode() == $viewHelper->ERR_NO_PRODUCT_LOADED) {
102
+ if (isset($_GET['store']) && !$this->getResponse()->isRedirect()) {
103
+ $this->_redirect('');
104
+ } elseif (!$this->getResponse()->isRedirect()) {
105
+ $this->_forward('noRoute');
106
+ }
107
+ } else {
108
+ Mage::logException($e);
109
+ $this->_forward('noRoute');
110
+ }
111
+ }
112
+ }
113
+
114
+ /**
115
+ * View product gallery action
116
+ */
117
+ public function galleryAction() {
118
+ if (!$this->_initProduct()) {
119
+ if (isset($_GET['store']) && !$this->getResponse()->isRedirect()) {
120
+ $this->_redirect('');
121
+ } elseif (!$this->getResponse()->isRedirect()) {
122
+ $this->_forward('noRoute');
123
+ }
124
+ return;
125
+ }
126
+ $this->loadLayout();
127
+ $this->renderLayout();
128
+ }
129
+
130
+ /**
131
+ * Display product image action
132
+ *
133
+ * @deprecated
134
+ */
135
+ public function imageAction() {
136
+ /*
137
+ * All logic has been cut to avoid possible malicious usage of the method
138
+ */
139
+ $this->_forward('noRoute');
140
+ }
141
+
142
+ /**
143
+ * upload product image action
144
+ * @return string|int
145
+ */
146
+ public function uploadPhotoAction() {
147
+ $io = new Varien_Io_File();
148
+ $io->checkAndCreateFolder(Mage::getBaseDir('media').DS.'catalog'.DS.'product'.DS.'images');
149
+
150
+ $uploaddir = Mage::getBaseDir() . '/media/catalog/product/images/';
151
+ $file_name = time() . '-' . $_FILES['image']['name'];
152
+ $file = $uploaddir . $file_name;
153
+
154
+ if (move_uploaded_file($_FILES['image']['tmp_name'], $file)) {
155
+ return $file_name;
156
+ } else {
157
+ return 0;
158
+ }
159
+ }
160
+
161
+ /**
162
+ * product add action
163
+ */
164
+ public function addfrontAction() {
165
+ ini_set("memory_limit", "5000M");
166
+ Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
167
+ $arr = array();
168
+ $dat = array_filter(Mage::getStoreConfig('ng_product/product_settings'));
169
+ $required = explode(',', Mage::getStoreConfig('ng_product/product_required_settings/required'));
170
+ foreach ($required as $key => $value) {
171
+ if(array_key_exists($value, $dat)){
172
+ $arr[] = $value;
173
+ }
174
+ }
175
+ $key = array_keys($_POST, '');
176
+ $result = array_intersect($arr, $key);
177
+
178
+ if (is_array($result) && !empty($result)) {
179
+ Mage::getSingleton('core/session')->addError('Product submition failed. Please fill all required fields.');
180
+ header('Location: ' . Mage::getBaseUrl() . 'product');
181
+ exit;
182
+ } else {
183
+ $name = !empty($_POST['name']) ? $_POST['name'] : '';
184
+ $sku = !empty($_POST['sku']) ? $_POST['sku'] : '';
185
+ $short_description = !empty($_POST['short_description']) ? $_POST['short_description'] : '';
186
+ $description = !empty($_POST['description']) ? $_POST['description'] : '';
187
+ $weight = !empty($_POST['weight']) ? $_POST['weight'] : '';
188
+ $status = !empty($_POST['status']) ? $_POST['status'] : '';
189
+ $url_key = !empty($_POST['url_key']) ? $_POST['url_key'] : '';
190
+ $visibility = !empty($_POST['visibility']) ? $_POST['visibility'] : '';
191
+ $price = !empty($_POST['price']) ? $_POST['price'] : '';
192
+ $tax_class = !empty($_POST['tax_class']) ? $_POST['tax_class'] : '';
193
+ $meta_title = !empty($_POST['meta_title']) ? $_POST['meta_title'] : '';
194
+ $meta_keyword = !empty($_POST['meta_keyword']) ? $_POST['meta_keyword'] : '';
195
+ $meta_description = !empty($_POST['meta_description']) ? $_POST['meta_description'] : '';
196
+ $qty = !empty($_POST['qty']) ? $_POST['qty'] : '';
197
+ $manage_stock = !empty($_POST['manage_stock']) ? $_POST['manage_stock'] : '';
198
+ $is_in_stock = !empty($_POST['is_in_stock']) ? $_POST['is_in_stock'] : '';
199
+ $categories = !empty($_POST['categories']) ? $_POST['categories'] : '';
200
+ $websites = !empty($_POST['websites']) ? $_POST['websites'] : '';
201
+ $terms = !empty($_POST['terms']) ? $_POST['terms'] : '';
202
+ $customer_group = !empty($_POST['customer_group']) ? $_POST['customer_group'] : '';
203
+ $customer_email = !empty($_POST['customer_email']) ? $_POST['customer_email'] : '';
204
+ $image = '';
205
+ if (isset($_FILES['image']) && !empty($_FILES['image'])) {
206
+ if ($filename = $this->uploadPhotoAction())
207
+ $image = $filename;
208
+ }
209
+
210
+ $customer_group = new Mage_Customer_Model_Group();
211
+ $allGroups = $customer_group->getCollection()->toOptionHash();
212
+ foreach ($allGroups as $key => $allGroup) {
213
+ $customerGroup[$key] = $allGroup;
214
+ }
215
+ $customer_group = array_search($customer_group, $customerGroup);
216
+
217
+ $soapUrl = Mage::getBaseUrl() . 'api/soap/?wsdl';
218
+ $client = new SoapClient($soapUrl);
219
+
220
+ $username = Mage::getStoreConfig('ng_product/product_credentials_settings/username');
221
+ $password = Mage::getStoreConfig('ng_product/product_credentials_settings/password');
222
+
223
+ $session = $client->login($username, $password);
224
+
225
+ $attributeSets = $client->call($session, 'product_attribute_set.list');
226
+ $attributeSet = current($attributeSets);
227
+
228
+ $product = new Mage_Catalog_Model_Product();
229
+
230
+ $productId = Mage::getModel('catalog/product')->getIdBySku($sku);
231
+ try {
232
+ $result = $client->call($session, 'catalog_product.create', array('simple', $attributeSet['set_id'], $sku, array(
233
+ 'categories' => array($categories),
234
+ 'websites' => array($websites),
235
+ 'name' => $name,
236
+ 'description' => $description,
237
+ 'short_description' => $short_description,
238
+ 'weight' => $weight,
239
+ 'status' => $status,
240
+ 'url_key' => str_replace(' ', '_', $url_key),
241
+ 'url_path' => str_replace(' ', '_', $url_key),
242
+ 'visibility' => $visibility,
243
+ 'price' => $price,
244
+ 'tax_class_id' => $tax_class,
245
+ 'meta_title' => $meta_title,
246
+ 'meta_keyword' => $meta_keyword,
247
+ 'meta_description' => $meta_description,
248
+ 'front_image' => $image
249
+ )));
250
+ } catch (SoapFault $fault) {
251
+ Mage::getSingleton('core/session')->addError($fault->getMessage());
252
+ header('Location: ' . Mage::getBaseUrl() . 'product');
253
+ exit;
254
+ }
255
+
256
+ $productId = Mage::getModel('catalog/product')->getIdBySku($sku);
257
+ $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productId);
258
+ $stockItemId = $stockItem->getId();
259
+ $stockItem->setData('manage_stock', $manage_stock);
260
+ $stockItem->setData('qty', $qty);
261
+ $stockItem->setData('is_in_stock', $is_in_stock);
262
+ $stockItem->save();
263
+
264
+ $product = Mage::getModel('catalog/product')->load($productId);
265
+
266
+ $imagePath = Mage::getBaseDir('media') . '/catalog/product/images/' . $image;
267
+ $imageResized = Mage::getBaseDir('media') . '/catalog/product/compress/' . $image;
268
+
269
+
270
+ if (!file_exists($imageResized) && file_exists($imagePath)) {
271
+ $imageObj = new Varien_Image($imagePath);
272
+ $imageObj->constrainOnly(TRUE);
273
+ $imageObj->keepAspectRatio(TRUE);
274
+ $imageObj->keepFrame(FALSE);
275
+ $imageObj->resize(600);
276
+ $imageObj->save($imageResized);
277
+
278
+ $product->setMediaGallery(array('images' => array(), 'values' => array()));
279
+ $product->addImageToMediaGallery($imageResized, array('image', 'small_image', 'thumbnail'), false, false);
280
+ $product->save();
281
+ }
282
+ Mage::getSingleton('core/session')->addSuccess('Product submition successful.');
283
+ header('Location: ' . Mage::getBaseUrl() . 'product');
284
+ exit;
285
+ }
286
+ }
287
+
288
+ }
app/code/community/NG/Product/controllers/IndexController.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category NG
23
+ * @package NG_Product
24
+ */
25
+ class NG_Product_IndexController extends Mage_Core_Controller_Front_Action {
26
+
27
+ public function preDispatch() {
28
+ parent::preDispatch();
29
+ $action = $this->getRequest()->getActionName();
30
+ $loginUrl = Mage::helper('customer')->getLoginUrl();
31
+
32
+ if (!Mage::getSingleton('customer/session')->authenticate($this, $loginUrl)) {
33
+ $this->setFlag('', self::FLAG_NO_DISPATCH, true);
34
+ }
35
+ }
36
+
37
+ public function indexAction() {
38
+ $this->loadLayout();
39
+ $this->renderLayout();
40
+ }
41
+
42
+ }
app/code/community/NG/Product/etc/adminhtml.xml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category NG
23
+ * @package NG_Product
24
+ */
25
+ -->
26
+ <config>
27
+ <acl>
28
+ <resources>
29
+ <admin>
30
+ <children>
31
+ <system>
32
+ <children>
33
+ <config>
34
+ <children>
35
+ <ng_product translate="title" module="ng_product">
36
+ <title>My Account Configuration</title>
37
+ </ng_product>
38
+ </children>
39
+ </config>
40
+ </children>
41
+ </system>
42
+ <ng_product translate="title" module="ng_product">
43
+ <title>My Account Configuration</title>
44
+ <children>
45
+ <link translate="title" module="ng_product">
46
+ <title>Link Name</title>
47
+ <sort_order>0</sort_order>
48
+ </link>
49
+ </children>
50
+ </ng_product>
51
+ </children>
52
+ </admin>
53
+ </resources>
54
+ </acl>
55
+ </config>
app/code/community/NG/Product/etc/config.xml ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category NG
23
+ * @package NG_Product
24
+ */
25
+ -->
26
+ <config>
27
+ <modules>
28
+ <NG_Product>
29
+ <version>1.0.0</version>
30
+ </NG_Product>
31
+ </modules>
32
+ <global>
33
+ <helpers>
34
+ <ng_product>
35
+ <class>NG_Product_Helper</class>
36
+ </ng_product>
37
+ </helpers>
38
+ <models>
39
+ <ng_product>
40
+ <class>NG_Product_Model</class>
41
+ </ng_product>
42
+ </models>
43
+ </global>
44
+ <frontend>
45
+ <layout>
46
+ <updates>
47
+ <ng_product>
48
+ <file>NG/product.xml</file>
49
+ </ng_product>
50
+ </updates>
51
+ </layout>
52
+ <routers>
53
+ <ng_product>
54
+ <use>standard</use>
55
+ <args>
56
+ <module>NG_Product</module>
57
+ <frontName>product</frontName>
58
+ </args>
59
+ </ng_product>
60
+ <customer>
61
+ <args>
62
+ <modules>
63
+ <ng before="Mage_Customer">NG_Product</ng>
64
+ </modules>
65
+ </args>
66
+ </customer>
67
+ <catalog>
68
+ <args>
69
+ <modules>
70
+ <ng_product before="Mage_Product_CatalogController">NG_Product_Catalog</ng_product>
71
+ </modules>
72
+ </args>
73
+ </catalog>
74
+ </routers>
75
+ </frontend>
76
+ </config>
app/code/community/NG/Product/etc/system.xml ADDED
@@ -0,0 +1,323 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category NG
23
+ * @package NG_Product
24
+ */
25
+ -->
26
+ <config>
27
+ <tabs>
28
+ <ng translate="label" module="ng_product">
29
+ <label>NG</label>
30
+ <sort_order>2000</sort_order>
31
+ </ng>
32
+ </tabs>
33
+ <sections>
34
+ <ng_product translate="label" module="ng_product">
35
+ <class>separator-top</class>
36
+ <label>Product Configuration</label>
37
+ <tab>ng</tab>
38
+ <frontend_type>text</frontend_type>
39
+ <sort_order>100</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>1</show_in_store>
43
+ <groups>
44
+ <link translate="label" module="ng_product">
45
+ <label>New Link Setting</label>
46
+ <frontend_type>text</frontend_type>
47
+ <sort_order>0</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>1</show_in_website>
50
+ <show_in_store>1</show_in_store>
51
+ <fields>
52
+ <enable translate="label">
53
+ <label>Enable</label>
54
+ <frontend_type>select</frontend_type>
55
+ <source_model>adminhtml/system_config_source_yesno</source_model>
56
+ <sort_order>0</sort_order>
57
+ <show_in_default>1</show_in_default>
58
+ <show_in_website>1</show_in_website>
59
+ <show_in_store>1</show_in_store>
60
+ </enable>
61
+ <name translate="label">
62
+ <label>Link Name</label>
63
+ <frontend_type>text</frontend_type>
64
+ <sort_order>1</sort_order>
65
+ <show_in_default>1</show_in_default>
66
+ <show_in_website>1</show_in_website>
67
+ <show_in_store>1</show_in_store>
68
+ <comment>Enter the name of link which you want to display in my account left navigation</comment>
69
+ </name>
70
+ </fields>
71
+ </link>
72
+ <product_required_settings translate="label" module="ng_product">
73
+ <label>Product Required Fields Settings</label>
74
+ <frontend_type>text</frontend_type>
75
+ <sort_order>1</sort_order>
76
+ <show_in_default>1</show_in_default>
77
+ <show_in_website>1</show_in_website>
78
+ <show_in_store>1</show_in_store>
79
+ <fields>
80
+ <required translate="label">
81
+ <label>Required Fields</label>
82
+ <frontend_type>multiselect</frontend_type>
83
+ <source_model>ng_product/system_config_source_required</source_model>
84
+ <sort_order>1</sort_order>
85
+ <show_in_default>1</show_in_default>
86
+ <show_in_website>1</show_in_website>
87
+ <show_in_store>1</show_in_store>
88
+ <comment>Select multiple fields to make them required.</comment>
89
+ </required>
90
+ </fields>
91
+ </product_required_settings>
92
+ <product_settings translate="label" module="ng_product">
93
+ <label>Add Product Settings</label>
94
+ <frontend_type>text</frontend_type>
95
+ <sort_order>2</sort_order>
96
+ <show_in_default>1</show_in_default>
97
+ <show_in_website>1</show_in_website>
98
+ <show_in_store>1</show_in_store>
99
+ <fields>
100
+ <name translate="label">
101
+ <label>Name</label>
102
+ <frontend_type>select</frontend_type>
103
+ <source_model>ng_product/system_config_source_yesno</source_model>
104
+ <sort_order>1</sort_order>
105
+ <show_in_default>1</show_in_default>
106
+ <show_in_website>1</show_in_website>
107
+ <show_in_store>1</show_in_store>
108
+ <tooltip>select Enabled for show 'Name' field in add product form.</tooltip>
109
+ </name>
110
+ <sku translate="label">
111
+ <label>SKU</label>
112
+ <frontend_type>select</frontend_type>
113
+ <source_model>ng_product/system_config_source_yesno</source_model>
114
+ <sort_order>2</sort_order>
115
+ <show_in_default>1</show_in_default>
116
+ <show_in_website>1</show_in_website>
117
+ <show_in_store>1</show_in_store>
118
+ <tooltip>select Enabled for show 'SKU' field in add product form.</tooltip>
119
+ </sku>
120
+ <description translate="label">
121
+ <label>Description</label>
122
+ <frontend_type>select</frontend_type>
123
+ <source_model>ng_product/system_config_source_yesno</source_model>
124
+ <sort_order>3</sort_order>
125
+ <show_in_default>1</show_in_default>
126
+ <show_in_website>1</show_in_website>
127
+ <show_in_store>1</show_in_store>
128
+ <tooltip>select Enabled for show 'Description' field in add product form.</tooltip>
129
+ </description>
130
+ <short_description translate="label">
131
+ <label>Short Description</label>
132
+ <frontend_type>select</frontend_type>
133
+ <source_model>ng_product/system_config_source_yesno</source_model>
134
+ <sort_order>4</sort_order>
135
+ <show_in_default>1</show_in_default>
136
+ <show_in_website>1</show_in_website>
137
+ <show_in_store>1</show_in_store>
138
+ <tooltip>select Enabled for show 'Short Description' field in add product form.</tooltip>
139
+ </short_description>
140
+ <weight translate="label">
141
+ <label>Weight</label>
142
+ <frontend_type>select</frontend_type>
143
+ <source_model>ng_product/system_config_source_yesno</source_model>
144
+ <sort_order>5</sort_order>
145
+ <show_in_default>1</show_in_default>
146
+ <show_in_website>1</show_in_website>
147
+ <show_in_store>1</show_in_store>
148
+ <tooltip>select Enabled for show 'Weight' field in add product form.</tooltip>
149
+ </weight>
150
+ <status translate="label">
151
+ <label>Status</label>
152
+ <frontend_type>select</frontend_type>
153
+ <source_model>ng_product/system_config_source_yesno</source_model>
154
+ <sort_order>6</sort_order>
155
+ <show_in_default>1</show_in_default>
156
+ <show_in_website>1</show_in_website>
157
+ <show_in_store>1</show_in_store>
158
+ <tooltip>select Enabled for show 'Status' field in add product form.</tooltip>
159
+ </status>
160
+ <url_key translate="label">
161
+ <label>URL Key</label>
162
+ <frontend_type>select</frontend_type>
163
+ <source_model>ng_product/system_config_source_yesno</source_model>
164
+ <sort_order>7</sort_order>
165
+ <show_in_default>1</show_in_default>
166
+ <show_in_website>1</show_in_website>
167
+ <show_in_store>1</show_in_store>
168
+ <tooltip>select Enabled for show 'URL Key' field in add product form.</tooltip>
169
+ </url_key>
170
+ <visibility translate="label">
171
+ <label>Visibility</label>
172
+ <frontend_type>select</frontend_type>
173
+ <source_model>ng_product/system_config_source_yesno</source_model>
174
+ <sort_order>8</sort_order>
175
+ <show_in_default>1</show_in_default>
176
+ <show_in_website>1</show_in_website>
177
+ <show_in_store>1</show_in_store>
178
+ <tooltip>select Enabled for show 'Visibility' field in add product form.</tooltip>
179
+ </visibility>
180
+ <price translate="label">
181
+ <label>Price</label>
182
+ <frontend_type>select</frontend_type>
183
+ <source_model>ng_product/system_config_source_yesno</source_model>
184
+ <sort_order>9</sort_order>
185
+ <show_in_default>1</show_in_default>
186
+ <show_in_website>1</show_in_website>
187
+ <show_in_store>1</show_in_store>
188
+ <tooltip>select Enabled for show 'Price' field in add product form.</tooltip>
189
+ </price>
190
+ <tax_class translate="label">
191
+ <label>Tax Class</label>
192
+ <frontend_type>select</frontend_type>
193
+ <source_model>ng_product/system_config_source_yesno</source_model>
194
+ <sort_order>10</sort_order>
195
+ <show_in_default>1</show_in_default>
196
+ <show_in_website>1</show_in_website>
197
+ <show_in_store>1</show_in_store>
198
+ <tooltip>select Enabled for show 'Tax Class' field in add product form.</tooltip>
199
+ </tax_class>
200
+ <meta_title translate="label">
201
+ <label>Meta Title</label>
202
+ <frontend_type>select</frontend_type>
203
+ <source_model>ng_product/system_config_source_yesno</source_model>
204
+ <sort_order>11</sort_order>
205
+ <show_in_default>1</show_in_default>
206
+ <show_in_website>1</show_in_website>
207
+ <show_in_store>1</show_in_store>
208
+ <tooltip>select Enabled for show 'Meta Title' field in add product form.</tooltip>
209
+ </meta_title>
210
+ <meta_keyword translate="label">
211
+ <label>Meta Keywords</label>
212
+ <frontend_type>select</frontend_type>
213
+ <source_model>ng_product/system_config_source_yesno</source_model>
214
+ <sort_order>12</sort_order>
215
+ <show_in_default>1</show_in_default>
216
+ <show_in_website>1</show_in_website>
217
+ <show_in_store>1</show_in_store>
218
+ <tooltip>select Enabled for show 'Meta Keywords' field in add product form.</tooltip>
219
+ </meta_keyword>
220
+ <meta_description translate="label">
221
+ <label>Meta Description</label>
222
+ <frontend_type>select</frontend_type>
223
+ <source_model>ng_product/system_config_source_yesno</source_model>
224
+ <sort_order>13</sort_order>
225
+ <show_in_default>1</show_in_default>
226
+ <show_in_website>1</show_in_website>
227
+ <show_in_store>1</show_in_store>
228
+ <tooltip>select Enabled for show 'Meta Description' field in add product form.</tooltip>
229
+ </meta_description>
230
+ <qty translate="label">
231
+ <label>Qty</label>
232
+ <frontend_type>select</frontend_type>
233
+ <source_model>ng_product/system_config_source_yesno</source_model>
234
+ <sort_order>14</sort_order>
235
+ <show_in_default>1</show_in_default>
236
+ <show_in_website>1</show_in_website>
237
+ <show_in_store>1</show_in_store>
238
+ <tooltip>select Enabled for show 'Qty' field in add product form.</tooltip>
239
+ </qty>
240
+ <manage_stock translate="label">
241
+ <label>Manage Stock</label>
242
+ <frontend_type>select</frontend_type>
243
+ <source_model>ng_product/system_config_source_yesno</source_model>
244
+ <sort_order>15</sort_order>
245
+ <show_in_default>1</show_in_default>
246
+ <show_in_website>1</show_in_website>
247
+ <show_in_store>1</show_in_store>
248
+ <tooltip>select Enabled for show 'Manage Stock' field in add product form.</tooltip>
249
+ </manage_stock>
250
+ <is_in_stock translate="label">
251
+ <label>Is In Stock</label>
252
+ <frontend_type>select</frontend_type>
253
+ <source_model>ng_product/system_config_source_yesno</source_model>
254
+ <sort_order>16</sort_order>
255
+ <show_in_default>1</show_in_default>
256
+ <show_in_website>1</show_in_website>
257
+ <show_in_store>1</show_in_store>
258
+ <tooltip>select Enabled for show 'Is In Stock' field in add product form.</tooltip>
259
+ </is_in_stock>
260
+ <categories translate="label">
261
+ <label>Categories</label>
262
+ <frontend_type>select</frontend_type>
263
+ <source_model>ng_product/system_config_source_yesno</source_model>
264
+ <sort_order>17</sort_order>
265
+ <show_in_default>1</show_in_default>
266
+ <show_in_website>1</show_in_website>
267
+ <show_in_store>1</show_in_store>
268
+ <tooltip>select Enabled for show 'Categories' field in add product form.</tooltip>
269
+ </categories>
270
+ <websites translate="label">
271
+ <label>Websites</label>
272
+ <frontend_type>select</frontend_type>
273
+ <source_model>ng_product/system_config_source_yesno</source_model>
274
+ <sort_order>18</sort_order>
275
+ <show_in_default>1</show_in_default>
276
+ <show_in_website>1</show_in_website>
277
+ <show_in_store>1</show_in_store>
278
+ <tooltip>select Enabled for show 'Websites' field in add product form.</tooltip>
279
+ </websites>
280
+ <image translate="label">
281
+ <label>Image</label>
282
+ <frontend_type>select</frontend_type>
283
+ <source_model>ng_product/system_config_source_yesno</source_model>
284
+ <sort_order>19</sort_order>
285
+ <show_in_default>1</show_in_default>
286
+ <show_in_website>1</show_in_website>
287
+ <show_in_store>1</show_in_store>
288
+ <tooltip>select Enabled for show 'Image' field in add product form.</tooltip>
289
+ </image>
290
+ </fields>
291
+ </product_settings>
292
+ <product_credentials_settings translate="label" module="ng_product">
293
+ <label>Credentials Settings</label>
294
+ <frontend_type>text</frontend_type>
295
+ <sort_order>3</sort_order>
296
+ <show_in_default>1</show_in_default>
297
+ <show_in_website>1</show_in_website>
298
+ <show_in_store>1</show_in_store>
299
+ <fields>
300
+ <username translate="label">
301
+ <label>Soap Username</label>
302
+ <frontend_type>text</frontend_type>
303
+ <sort_order>1</sort_order>
304
+ <show_in_default>1</show_in_default>
305
+ <show_in_website>1</show_in_website>
306
+ <show_in_store>1</show_in_store>
307
+ <comment>Enter username of soap api.</comment>
308
+ </username>
309
+ <password translate="label">
310
+ <label>Soap Password</label>
311
+ <frontend_type>password</frontend_type>
312
+ <sort_order>2</sort_order>
313
+ <show_in_default>1</show_in_default>
314
+ <show_in_website>1</show_in_website>
315
+ <show_in_store>1</show_in_store>
316
+ <comment>Enter password of soap api.</comment>
317
+ </password>
318
+ </fields>
319
+ </product_credentials_settings>
320
+ </groups>
321
+ </ng_product>
322
+ </sections>
323
+ </config>
app/design/frontend/base/default/layout/NG/product.xml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category NG
23
+ * @package NG_Product
24
+ */
25
+ -->
26
+ <layout>
27
+ <customer_account>
28
+ <reference name="customer_account_navigation">
29
+ <action method="addLink" ifconfig="ng_product/link/enable">
30
+ <name>product_add_section</name>
31
+ <path>product/index/index</path>
32
+ <label helper="ng_product/data/getLinkLabel" />
33
+ </action>
34
+ </reference>
35
+ </customer_account>
36
+
37
+ <ng_product_index_index>
38
+ <reference name="head">
39
+ <action method="addCss">
40
+ <stylesheet>css/ng/product.css</stylesheet>
41
+ </action>
42
+ </reference>
43
+ <update handle="customer_account" />
44
+ <reference name="my.account.wrapper">
45
+ <block type="core/template" name="ng_product_content" template="ng/add.phtml"/>
46
+ </reference>
47
+ </ng_product_index_index>
48
+ </layout>
app/design/frontend/base/default/template/NG/add.phtml ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) 2012 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
+ <?php
28
+ /**
29
+ * Create account form template
30
+ *
31
+ * @var $this Mage_Customer_Block_Form_Register
32
+ */
33
+ ?>
34
+
35
+
36
+ <div class = "dashboard">
37
+ <?php echo $this->getMessagesBlock()->getGroupedHtml()
38
+ ?>
39
+ <div class="box-account box-info">
40
+ <div class="box-head">
41
+ <h2><?php echo $this->__('Add Product') ?></h2>
42
+ </div>
43
+ </div>
44
+ </div>
45
+
46
+ <?php
47
+ $required = explode(',', Mage::getStoreConfig('ng_product/product_required_settings/required'));
48
+
49
+ $url = Mage::getBaseUrl() . 'catalog/product/addfront';
50
+ if (isset($_GET['image']) && !empty($_GET['image'])) {
51
+ $url = Mage::getBaseUrl() . 'catalog/product/editfront';
52
+ }
53
+ ?>
54
+ <form action="<?php echo $url; ?>" method="post" class="add-seller-product" id="form-validate" enctype="multipart/form-data" onsubmit="return validateForm();">
55
+ <?php if (Mage::getStoreConfig('ng_product/product_settings/name')) : ?>
56
+ <div>
57
+ <p class="paddT12">
58
+ <label class="label_area" for="name"><em>*</em>Name</label>
59
+ <input type="text" class="input_inner input-text <?php if (in_array("name", $required)) {echo "required-entry";}?>" maxlength="255" title="<?php echo $this->__('Image Name') ?>" name="name" id="name">
60
+ </p>
61
+ </div>
62
+ <?php endif; ?>
63
+ <?php if (Mage::getStoreConfig('ng_product/product_settings/sku')) : ?>
64
+ <div>
65
+ <p class="paddT12">
66
+ <label class="label_area" for="sku"><em>*</em>SKU</label>
67
+ <input type="text" class="input_inner input-text <?php if (in_array("sku", $required)) {echo "required-entry";}?>" maxlength="255" title="<?php echo $this->__('SKU') ?>" name="sku" id="sku">
68
+ </p>
69
+ </div>
70
+ <?php endif; ?>
71
+ <?php if (Mage::getStoreConfig('ng_product/product_settings/description')) : ?>
72
+ <div>
73
+ <p class="paddT12">
74
+ <label class="label_area" for="description"><em>*</em>Description</label>
75
+ <textarea name="description" id="description" class="input_inner_area input-text <?php if (in_array("description", $required)) {echo "required-entry";}?>" title="<?php echo $this->__('Description') ?>"></textarea>
76
+ </p>
77
+ </div>
78
+ <?php endif; ?>
79
+ <?php if (Mage::getStoreConfig('ng_product/product_settings/short_description')) : ?>
80
+ <div>
81
+ <p class="paddT12">
82
+ <label class="label_area" for="short_description"><em>*</em>Short Description</label>
83
+ <textarea name="short_description" id="short_description" class="input_inner_area input-text <?php if (in_array("short_description", $required)) {echo "required-entry";}?>" title="<?php echo $this->__('Short Description') ?>"></textarea>
84
+ </p>
85
+ </div>
86
+ <?php endif; ?>
87
+ <?php if (Mage::getStoreConfig('ng_product/product_settings/weight')) : ?>
88
+ <div>
89
+ <p class="paddT12">
90
+ <label class="label_area" for="weight"><em>*</em>Weight</label>
91
+ <input type="text" class="input_inner input-text <?php if (in_array("weight", $required)) {echo "required-entry";}?> validate-number validate-zero-or-greater" maxlength="255" title="<?php echo $this->__('Weight') ?>" name="weight" id="weight">
92
+ </p>
93
+ </div>
94
+ <?php endif; ?>
95
+ <?php if (Mage::getStoreConfig('ng_product/product_settings/status')) : ?>
96
+ <div>
97
+ <p class="paddT12">
98
+ <label class="label_area" for="status"><em>*</em>Status</label>
99
+ <select name="status" id="status" class="input_inner input-text <?php if (in_array("status", $required)) {echo "required-entry";}?>" style="width:292px;">
100
+ <option value="1">Enabled</option>
101
+ <option selected="selected" value="2">Disabled</option>
102
+ </select>
103
+ </p>
104
+ </div>
105
+ <?php endif; ?>
106
+ <?php if (Mage::getStoreConfig('ng_product/product_settings/url_key')) : ?>
107
+ <div>
108
+ <p class="paddT12">
109
+ <label class="label_area" for="url_key"><em>*</em>URL Key</label>
110
+ <input type="text" class="input_inner input-text <?php if (in_array("url_key", $required)) {echo "required-entry";}?>" maxlength="255" title="<?php echo $this->__('URL Key') ?>" name="url_key" id="url_key">
111
+ </p>
112
+ </div>
113
+ <?php endif; ?>
114
+ <?php if (Mage::getStoreConfig('ng_product/product_settings/visibility')) : ?>
115
+ <div>
116
+ <p class="paddT12">
117
+ <?php
118
+ $visibilityObj = new Mage_Catalog_Model_Product_Visibility();
119
+ $visibilityOptions = $visibilityObj->getAllOptions();
120
+ ?>
121
+ <label class="label_area" for="visibility"><em>*</em>Visibility</label>
122
+ <select name="visibility" id="visibility" class="input_inner input-text <?php if (in_array("visibility", $required)) {echo "required-entry";}?>" style="width:292px;">
123
+ <?php
124
+ foreach ($visibilityOptions as $options) {
125
+ echo '<option value="' . $options["value"] . '">' . $options["label"] . '</option>';
126
+ }
127
+ ?>
128
+ </select>
129
+ </p>
130
+ </div>
131
+ <?php endif; ?>
132
+ <?php if (Mage::getStoreConfig('ng_product/product_settings/price')) : ?>
133
+ <div>
134
+ <p class="paddT12">
135
+ <label class="label_area" for="price"><em>*</em>Price</label>
136
+ <input type="text" class="input_inner input-text <?php if (in_array("price", $required)) {echo "required-entry";}?> validate-number validate-zero-or-greater" maxlength="255" title="<?php echo $this->__('Price') ?>" name="price" id="price">
137
+ </p>
138
+ </div>
139
+ <?php endif; ?>
140
+ <?php if (Mage::getStoreConfig('ng_product/product_settings/tax_class')) : ?>
141
+ <div>
142
+ <p class="paddT12">
143
+ <?php
144
+ $taxClassObj = new Mage_Tax_Model_Class_Source_Product();
145
+ $taxClassOptions = $taxClassObj->getAllOptions()
146
+ ?>
147
+ <label class="label_area" for="tax_class"><em>*</em>Tax Class</label>
148
+ <select name="tax_class" id="tax_class" class="input_inner input-text <?php if (in_array("tax_class", $required)) {echo "required-entry";}?>" style="width:292px;">
149
+ <?php
150
+ foreach ($taxClassOptions as $options) {
151
+ echo '<option value="' . $options["value"] . '">' . $options["label"] . '</option>';
152
+ }
153
+ ?>
154
+ </select>
155
+ </p>
156
+ </div>
157
+ <?php endif; ?>
158
+ <?php if (Mage::getStoreConfig('ng_product/product_settings/meta_title')) : ?>
159
+ <div>
160
+ <p class="paddT12">
161
+ <label class="label_area" for="meta_title"><em>*</em>Meta Title</label>
162
+ <input type="text" class="input_inner input-text <?php if (in_array("meta_title", $required)) {echo "required-entry";}?>" maxlength="255" title="<?php echo $this->__('Meta Title') ?>" name="meta_title" id="meta_title">
163
+ </p>
164
+ </div>
165
+ <?php endif; ?>
166
+ <?php if (Mage::getStoreConfig('ng_product/product_settings/meta_keyword')) : ?>
167
+ <div>
168
+ <p class="paddT12">
169
+ <label class="label_area" for="meta_keyword"><em>*</em>Meta Keywords</label>
170
+ <textarea name="meta_keyword" id="meta_keyword" class="input_inner_area input-text <?php if (in_array("meta_keyword", $required)) {echo "required-entry";}?>" title="<?php echo $this->__('Meta Keyword') ?>"></textarea>
171
+ </p>
172
+ </div>
173
+ <?php endif; ?>
174
+ <?php if (Mage::getStoreConfig('ng_product/product_settings/meta_description')) : ?>
175
+ <div>
176
+ <p class="paddT12">
177
+ <label class="label_area" for="meta_description"><em>*</em>Meta Description</label>
178
+ <textarea name="meta_description" id="meta_description" class="input_inner_area input-text <?php if (in_array("meta_description", $required)) {echo "required-entry";}?>" title="<?php echo $this->__('Meta Description') ?>"></textarea>
179
+ </p>
180
+ </div>
181
+ <?php endif; ?>
182
+ <?php if (Mage::getStoreConfig('ng_product/product_settings/qty')) : ?>
183
+ <div>
184
+ <p class="paddT12">
185
+ <label class="label_area" for="qty"><em>*</em>Qty</label>
186
+ <input type="text" class="input_inner input-text <?php if (in_array("qty", $required)) {echo "required-entry";}?> validate-number validate-zero-or-greater" maxlength="255" title="<?php echo $this->__('Qty') ?>" name="qty" id="qty">
187
+ </p>
188
+ </div>
189
+ <?php endif; ?>
190
+ <?php if (Mage::getStoreConfig('ng_product/product_settings/manage_stock')) : ?>
191
+ <div>
192
+ <p class="paddT12">
193
+ <label class="label_area" for="manage_stock"><em>*</em>Manage Stock</label>
194
+ <select name="manage_stock" id="manage_stock" class="input_inner input-text <?php if (in_array("manage_stock", $required)) {echo "required-entry";}?>" style="width:292px;">
195
+ <option value="1">Yes</option>
196
+ <option value="0">No</option>
197
+ </select>
198
+ </p>
199
+ </div>
200
+ <?php endif; ?>
201
+ <?php if (Mage::getStoreConfig('ng_product/product_settings/is_in_stock')) : ?>
202
+ <div>
203
+ <p class="paddT12">
204
+ <label class="label_area" for="is_in_stock"><em>*</em>Is In Stock</label>
205
+ <select name="is_in_stock" id="is_in_stock" class="input_inner input-text <?php if (in_array("is_in_stock", $required)) {echo "required-entry";}?>" style="width:292px;">
206
+ <option value="1">In Stock</option>
207
+ <option selected="selected" value="0">Out of Stock</option>
208
+ </select>
209
+ </p>
210
+ </div>
211
+ <?php endif; ?>
212
+ <?php if (Mage::getStoreConfig('ng_product/product_settings/categories')) : ?>
213
+ <div>
214
+ <p class="paddT12">
215
+ <?php
216
+ $category = Mage::getModel('catalog/category');
217
+ $tree = $category->getTreeModel();
218
+ $tree->load();
219
+ $ids = $tree->getCollection()->getAllIds();
220
+ ?>
221
+ <label class="label_area" for="categories"><em>*</em>Categories</label>
222
+ <select name="categories" id="categories" class="input_inner input-text <?php if (in_array("categories", $required)) {echo "required-entry";}?>" style="width:292px;">
223
+ <?php
224
+ echo '<option value="">-- Please Select --</option>';
225
+ foreach ($ids as $id) {
226
+ $cat = Mage::getModel('catalog/category');
227
+ $cat->load($id);
228
+ if ($cat->getIsActive()) {
229
+ $dash = '';
230
+ if ($cat->getLevel() == 3)
231
+ $dash = "-";
232
+ if ($cat->getLevel() == 4)
233
+ $dash = "--";
234
+ if ($cat->getLevel() == 5)
235
+ $dash = "---";
236
+ echo '<option value="' . $cat->getId() . '">' . $dash . ucwords($cat->getName()) . '</option>';
237
+ }
238
+ }
239
+ ?>
240
+ </select>
241
+ </p>
242
+ </div>
243
+ <?php endif; ?>
244
+ <?php if (Mage::getStoreConfig('ng_product/product_settings/websites')) : ?>
245
+ <div>
246
+ <p class="paddT12">
247
+ <?php
248
+ $_websites = Mage::app()->getWebsites();
249
+ ?>
250
+ <label class="label_area" for="websites"><em>*</em>Websites</label>
251
+ <select name="websites" id="websites" class="input_inner input-text <?php if (in_array("websites", $required)) {echo "required-entry";}?>" style="width:292px;">
252
+ <?php
253
+ echo '<option value="">-- Please Select --</option>';
254
+ foreach ($_websites as $options) {
255
+ echo '<option value="' . $options["website_id"] . '">' . $options["name"] . '</option>';
256
+ }
257
+ ?>
258
+ </select>
259
+ </p>
260
+ </div>
261
+ <?php endif; ?>
262
+ <?php if (Mage::getStoreConfig('ng_product/product_settings/image')) : ?>
263
+ <div>
264
+ <p class="paddT12">
265
+ <label class="label_area" for="image"><em>*</em>Upload Image</label>
266
+ <input type="file" class="<?php if (in_array("image", $required)) {echo "required-entry";}?>" maxlength="255" title="<?php echo $this->__('Image') ?>" value="" name="image" id="btnUpload">
267
+ </p>
268
+ </div>
269
+ <?php endif; ?>
270
+ <div>
271
+ <input name="terms" type="checkbox" id="terms" value="agree" class="fleft input-text required-entry" style="width:20px"/>
272
+ <span class="paddL7 fleft" style="font-size:11px;"><strong>I have read and understood the terms and conditions.</strong></span> </p>
273
+ </div>
274
+ <span class="buy_now paddL15 fleft">
275
+ <input type="submit" style="height:23px;" title="<?php echo $this->__('Add Product') ?>" class="" value="<?php echo $this->__('Add Product') ?>" />
276
+ </span>
277
+ <input type="hidden" name="customer_group" id="customer_group" value="<?php echo Mage::getSingleton('customer/session')->getCustomerGroupId(); ?>" />
278
+ <input type="hidden" name="customer_email" id="customer_email" value="<?php echo Mage::getSingleton('customer/session')->getCustomer()->getEmail(); ?>" />
279
+ </form>
280
+
281
+ <script type="text/javascript">
282
+ //< ![CDATA[
283
+ var customForm = new VarienForm('form-validate');
284
+ //]]>
285
+ </script>
app/etc/modules/NG_Product.xml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category NG
23
+ * @package NG_Customer
24
+ */
25
+ -->
26
+ <config>
27
+ <modules>
28
+ <NG_Product>
29
+ <active>true</active>
30
+ <codePool>community</codePool>
31
+ </NG_Product>
32
+ </modules>
33
+ </config>
media/catalog/product/images/1434476196-Lighthouse.jpg ADDED
Binary file
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>ng_product</name>
4
+ <version>1.0.1</version>
5
+ <stability>stable</stability>
6
+ <license>MIT</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This extension is related to add simple product from frontend.</summary>
10
+ <description>This extension is related to add simple product from frontend my account section.</description>
11
+ <notes>1.0.1</notes>
12
+ <authors><author><name>NG</name><user>extensionsng</user><email>extensionsng@gmail.com</email></author></authors>
13
+ <date>2015-06-16</date>
14
+ <time>18:36:31</time>
15
+ <contents><target name="magecommunity"><dir name="NG"><dir name="Product"><dir name="Helper"><file name="Data.php" hash="5a4f25629efde2df669b045ddedc1934"/></dir><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="required.php" hash="6a892e015c9c57ab933dd3497ce47854"/><file name="yesno.php" hash="8f1179bfb6bc1b90928f8c13d3aec06d"/></dir></dir></dir></dir><dir name="controllers"><dir name="Catalog"><file name="ProductController.php" hash="1e2f76d4d788fd5b95c782d0be1933ce"/></dir><file name="IndexController.php" hash="8abfc439c2dc6e51bf8cf423b9ba5394"/></dir><dir name="etc"><file name="adminhtml.xml" hash="62f094d4373fd3205ba5fcc49798ffe0"/><file name="config.xml" hash="dce5df08bd8013fce7249bc2654f88e1"/><file name="system.xml" hash="e9505177d4cdcb263d47da5723ae0aa7"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="NG"><file name="product.xml" hash="bb99cc93b0ee90025729c7a0e00e98c7"/></dir></dir><dir name="template"><dir name="NG"><file name="add.phtml" hash="9282b27f2124a630b8f0c092447c48ef"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="NG_Product.xml" hash="8aef7fe15e1732e7dc5417ffcfbebba5"/></dir></target><target name="magemedia"><dir name="catalog"><dir name="product"><dir name="images"><file name="1434476196-Lighthouse.jpg" hash="8969288f4245120e7c3870287cce0ff3"/></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="NG"><file name="product.css" hash="29eba9a239d08d15c0a528ee9c137388"/></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>
skin/frontend/base/default/css/NG/product.css ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Magento
3
+ *
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Academic Free License (AFL 3.0)
7
+ * that is bundled with this package in the file LICENSE_AFL.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/afl-3.0.php
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to license@magentocommerce.com so we can send you a copy immediately.
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
17
+ * versions in the future. If you wish to customize Magento for your
18
+ * needs please refer to http://www.magentocommerce.com for more information.
19
+ *
20
+ * @category NG
21
+ * @package NG_Product
22
+ */
23
+ .add-seller-product .label_area{
24
+ float: left;
25
+ width: 30%;
26
+ }
27
+ .add-seller-product input[type = 'text']{
28
+ width: 67%;
29
+ }
30
+ .add-seller-product textarea{
31
+ width: 67%;
32
+ height: 150px;
33
+ }
34
+ .add-seller-product .validation-advice{
35
+ margin-left: 30%;
36
+ }