Version Notes
Stable Release.
Download this release
Release Info
Developer | Nowshop |
Extension | Ced_NowShop |
Version | 0.0.1 |
Comparing to | |
See all releases |
Version 0.0.1
- app/code/community/NowShop/NowShopPayment/Model/Nowshop.php +61 -0
- app/code/community/NowShop/NowShopPayment/etc/config.xml +79 -0
- app/code/community/NowShop/NowShopPayment/etc/system.xml-- +65 -0
- app/code/community/NowShop/NowShopShipping/Model/Carrier/Nowshop.php +51 -0
- app/code/community/NowShop/NowShopShipping/Model/Sales/Quote/Address.php +19 -0
- app/code/community/NowShop/NowShopShipping/Model/Shipping/Config.php +19 -0
- app/code/community/NowShop/NowShopShipping/etc/config.xml +76 -0
- app/code/community/NowShop/NowShopShipping/etc/system.xml-- +57 -0
- app/code/community/NowShop/Synchronize/Block/Adminhtml/Feed.php +26 -0
- app/code/community/NowShop/Synchronize/Block/Adminhtml/Feed/Categories.php +314 -0
- app/code/community/NowShop/Synchronize/Block/Adminhtml/Feed/Grid.php +1 -0
- app/code/community/NowShop/Synchronize/Block/Adminhtml/Feed/Renderer/Listed.php +1 -0
- app/code/community/NowShop/Synchronize/Block/Adminhtml/Feed/Renderer/Relisted.php +1 -0
- app/code/community/NowShop/Synchronize/Helper/Arraytoxml.php +172 -0
- app/code/community/NowShop/Synchronize/Helper/Data.php +101 -0
- app/code/community/NowShop/Synchronize/Model/Cfeed.php +36 -0
- app/code/community/NowShop/Synchronize/Model/Feed.php +48 -0
- app/code/community/NowShop/Synchronize/Model/Mysql4/Cfeed.php +1 -0
- app/code/community/NowShop/Synchronize/Model/Mysql4/Cfeed/Collection.php +1 -0
- app/code/community/NowShop/Synchronize/Model/Mysql4/Feed.php +1 -0
- app/code/community/NowShop/Synchronize/Model/Mysql4/Feed/Collection.php +1 -0
- app/code/community/NowShop/Synchronize/Model/Mysql4/Setup.php +1 -0
- app/code/community/NowShop/Synchronize/Model/System/Config/Source/Brand.php +59 -0
- app/code/community/NowShop/Synchronize/Model/System/Config/Source/Isocode.php +46 -0
- app/code/community/NowShop/Synchronize/controllers/Adminhtml/CategoryfeedController.php +178 -0
- app/code/community/NowShop/Synchronize/controllers/Adminhtml/ProductfeedController.php +417 -0
- app/code/community/NowShop/Synchronize/controllers/OrderController.php +524 -0
- app/code/community/NowShop/Synchronize/etc/adminhtml.xml +98 -0
- app/code/community/NowShop/Synchronize/etc/config.xml +124 -0
- app/code/community/NowShop/Synchronize/etc/system.xml +218 -0
- app/code/community/NowShop/Synchronize/etc/xsd/product_feed.xsd +196 -0
- app/code/community/NowShop/Synchronize/sql/nowshop_synchronize_setup/mysql4-install-0.0.1.php +34 -0
- app/code/community/NowShop/Synchronize/sql/nowshop_synchronize_setup/mysql4-upgrade-0.0.1-0.0.2.php +35 -0
- app/code/community/NowShop/Synchronize/sql/nowshop_synchronize_setup/mysql4-upgrade-0.0.2-0.0.3.php +30 -0
- app/design/adminhtml/default/default/layout/nowshop.xml +61 -0
- app/design/adminhtml/default/default/template/nowshop/categories.phtml +194 -0
- app/design/adminhtml/default/default/template/nowshop/feed.phtml +38 -0
- app/design/adminhtml/default/default/template/nowshop/grid.phtml +238 -0
- app/etc/modules/NowShop_NowShopPayment.xml +9 -0
- app/etc/modules/NowShop_NowShopShipping.xml +9 -0
- app/etc/modules/NowShop_Synchronize.xml +9 -0
- media/nowshop/categoryfeed/test.txt +1 -0
- media/nowshop/productfeed/test.txt +1 -0
- package.xml +18 -0
app/code/community/NowShop/NowShopPayment/Model/Nowshop.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* NowShop
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENS
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category NowShop
|
17 |
+
* @package NowShop_NowShopPayment
|
18 |
+
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
19 |
+
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
|
23 |
+
class NowShop_NowShopPayment_Model_Nowshop extends Mage_Payment_Model_Method_Abstract {
|
24 |
+
|
25 |
+
protected $_code = 'nowshop';
|
26 |
+
protected $_canAuthorize = true;
|
27 |
+
protected $_canCancelInvoice = false;
|
28 |
+
protected $_canCapture = false;
|
29 |
+
protected $_canCapturePartial = false;
|
30 |
+
protected $_canCreateBillingAgreement = false;
|
31 |
+
protected $_canFetchTransactionInfo = false;
|
32 |
+
protected $_canManageRecurringProfiles = false;
|
33 |
+
protected $_canOrder = false;
|
34 |
+
protected $_canRefund = false;
|
35 |
+
protected $_canRefundInvoicePartial = false;
|
36 |
+
protected $_canReviewPayment = false;
|
37 |
+
/* Setting for disable from front-end. */
|
38 |
+
/* START */
|
39 |
+
protected $_canUseCheckout = false;
|
40 |
+
protected $_canUseForMultishipping = false;
|
41 |
+
protected $_canUseInternal = true;
|
42 |
+
protected $_canVoid = false;
|
43 |
+
protected $_isGateway = false;
|
44 |
+
protected $_isInitializeNeeded = false;
|
45 |
+
|
46 |
+
/* END */
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Check whether payment method can be used
|
50 |
+
* @param Mage_Sales_Model_Quote
|
51 |
+
* @return bool
|
52 |
+
*/
|
53 |
+
public function isAvailable($quote = null) {
|
54 |
+
return true;
|
55 |
+
}
|
56 |
+
|
57 |
+
public function getCode(){
|
58 |
+
return $this->_code;
|
59 |
+
}
|
60 |
+
|
61 |
+
}
|
app/code/community/NowShop/NowShopPayment/etc/config.xml
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* NowShop
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENS
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category NowShop
|
17 |
+
* @package NowShop_NowShopPayment
|
18 |
+
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
19 |
+
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
-->
|
23 |
+
<config>
|
24 |
+
<modules>
|
25 |
+
<NowShop_NowShopPayment>
|
26 |
+
<version>1.0.0</version>
|
27 |
+
<author>ASHEESH SINGH (asheeshsingh@cedcoss.com)</author>
|
28 |
+
</NowShop_NowShopPayment>
|
29 |
+
</modules>
|
30 |
+
<global>
|
31 |
+
<blocks>
|
32 |
+
<nowshoppayment>
|
33 |
+
<class>NowShop_NowShopPayment_Block</class>
|
34 |
+
</nowshoppayment>
|
35 |
+
</blocks>
|
36 |
+
<models>
|
37 |
+
<nowshoppayment>
|
38 |
+
<class>NowShop_NowShopPayment_Model</class>
|
39 |
+
</nowshoppayment>
|
40 |
+
</models>
|
41 |
+
<resources>
|
42 |
+
<nowshoppayment_setup>
|
43 |
+
<setup>
|
44 |
+
<module>NowShop_NowShopPayment</module>
|
45 |
+
</setup>
|
46 |
+
<connection>
|
47 |
+
<use>core_setup</use>
|
48 |
+
</connection>
|
49 |
+
</nowshoppayment_setup>
|
50 |
+
<nowshoppayment_write>
|
51 |
+
<connection>
|
52 |
+
<use>core_write</use>
|
53 |
+
</connection>
|
54 |
+
</nowshoppayment_write>
|
55 |
+
<nowshoppayment_read>
|
56 |
+
<connection>
|
57 |
+
<use>core_read</use>
|
58 |
+
</connection>
|
59 |
+
</nowshoppayment_read>
|
60 |
+
</resources>
|
61 |
+
</global>
|
62 |
+
<default>
|
63 |
+
<payment>
|
64 |
+
<nowshop>
|
65 |
+
<active>1</active>
|
66 |
+
<model>nowshoppayment/nowshop</model>
|
67 |
+
<order_status>pending</order_status>
|
68 |
+
<title>Now Shop</title>
|
69 |
+
<payment_action>sale</payment_action>
|
70 |
+
<allowspecific>0</allowspecific>
|
71 |
+
</nowshop>
|
72 |
+
</payment>
|
73 |
+
<nowshop>
|
74 |
+
<setting>
|
75 |
+
<debug>0</debug>
|
76 |
+
</setting>
|
77 |
+
</nowshop>
|
78 |
+
</default>
|
79 |
+
</config>
|
app/code/community/NowShop/NowShopPayment/etc/system.xml--
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* NowShop
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENS
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category NowShop
|
17 |
+
* @package NowShop_NowShopPayment
|
18 |
+
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
19 |
+
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
-->
|
23 |
+
<config>
|
24 |
+
<sections>
|
25 |
+
<payment>
|
26 |
+
<groups>
|
27 |
+
<nowshop translate="label" module="payment">
|
28 |
+
<label>NowShop</label>
|
29 |
+
<sort_order>670</sort_order>
|
30 |
+
<show_in_default>1</show_in_default>
|
31 |
+
<show_in_website>1</show_in_website>
|
32 |
+
<show_in_store>1</show_in_store>
|
33 |
+
<fields>
|
34 |
+
<active translate="label">
|
35 |
+
<label>Enabled</label>
|
36 |
+
<frontend_type>select</frontend_type>
|
37 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
38 |
+
<sort_order>0</sort_order>
|
39 |
+
<show_in_default>1</show_in_default>
|
40 |
+
<show_in_website>1</show_in_website>
|
41 |
+
<show_in_store>1</show_in_store>
|
42 |
+
</active>
|
43 |
+
<title translate="label">
|
44 |
+
<label>Title</label>
|
45 |
+
<frontend_type>text</frontend_type>
|
46 |
+
<sort_order>1</sort_order>
|
47 |
+
<show_in_default>1</show_in_default>
|
48 |
+
<show_in_website>1</show_in_website>
|
49 |
+
<show_in_store>1</show_in_store>
|
50 |
+
</title>
|
51 |
+
<order_status translate="label">
|
52 |
+
<label>New order status</label>
|
53 |
+
<frontend_type>select</frontend_type>
|
54 |
+
<source_model>adminhtml/system_config_source_order_status</source_model>
|
55 |
+
<sort_order>2</sort_order>
|
56 |
+
<show_in_default>1</show_in_default>
|
57 |
+
<show_in_website>1</show_in_website>
|
58 |
+
<show_in_store>1</show_in_store>
|
59 |
+
</order_status>
|
60 |
+
</fields>
|
61 |
+
</nowshop>
|
62 |
+
</groups>
|
63 |
+
</payment>
|
64 |
+
</sections>
|
65 |
+
</config>
|
app/code/community/NowShop/NowShopShipping/Model/Carrier/Nowshop.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class NowShop_NowShopShipping_Model_Carrier_Nowshop extends Mage_Shipping_Model_Carrier_Abstract
|
4 |
+
implements Mage_Shipping_Model_Carrier_Interface {
|
5 |
+
|
6 |
+
protected $_code = 'nowshop';
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Collect rates for this shipping method based on information in $request
|
10 |
+
*
|
11 |
+
* @param Mage_Shipping_Model_Rate_Request $request
|
12 |
+
* @return Mage_Shipping_Model_Rate_Result
|
13 |
+
*/
|
14 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
|
15 |
+
if (!Mage::getStoreConfig('carriers/'.$this->_code.'/active')) {
|
16 |
+
return false;
|
17 |
+
}
|
18 |
+
$price = $this->getConfigData('price'); // set a default shipping price maybe 0
|
19 |
+
if(!price)
|
20 |
+
$price = 0;
|
21 |
+
$handling = Mage::getStoreConfig('carriers/'.$this->_code.'/handling');
|
22 |
+
$result = Mage::getModel('shipping/rate_result');
|
23 |
+
$show = true;
|
24 |
+
if($show){
|
25 |
+
$method = Mage::getModel('shipping/rate_result_method');
|
26 |
+
$method->setCarrier($this->_code);
|
27 |
+
$method->setMethod($this->_code);
|
28 |
+
$method->setCarrierTitle($this->getConfigData('title'));
|
29 |
+
$method->setMethodTitle($this->getConfigData('name'));
|
30 |
+
$method->setPrice($price);
|
31 |
+
$method->setCost($price);
|
32 |
+
$result->append($method);
|
33 |
+
|
34 |
+
}else{
|
35 |
+
$error = Mage::getModel('shipping/rate_result_error');
|
36 |
+
$error->setCarrier($this->_code);
|
37 |
+
$error->setCarrierTitle($this->getConfigData('name'));
|
38 |
+
$error->setErrorMessage($this->getConfigData('specificerrmsg'));
|
39 |
+
$result->append($error);
|
40 |
+
}
|
41 |
+
return $result;
|
42 |
+
}
|
43 |
+
|
44 |
+
public function getAllowedMethods() {
|
45 |
+
return array($this->_code => $this->getConfigData('title'));
|
46 |
+
}
|
47 |
+
|
48 |
+
public function getCode(){
|
49 |
+
return $this->_code;
|
50 |
+
}
|
51 |
+
}
|
app/code/community/NowShop/NowShopShipping/Model/Sales/Quote/Address.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class NowShop_NowShopShipping_Model_Sales_Quote_Address extends Mage_Sales_Model_Quote_Address
|
3 |
+
{
|
4 |
+
public function getShippingRatesCollection()
|
5 |
+
{
|
6 |
+
parent::getShippingRatesCollection();
|
7 |
+
$nowshopCode = Mage::getModel('nowshopshipping/carrier_nowshop')->getCode();
|
8 |
+
$removeRates = array();
|
9 |
+
foreach ($this->_rates as $key => $rate) {
|
10 |
+
if ($rate->getCarrier() == $nowshopCode) {
|
11 |
+
$removeRates[] = $key;
|
12 |
+
}
|
13 |
+
}
|
14 |
+
foreach ($removeRates as $key) {
|
15 |
+
$this->_rates->removeItemByKey($key);
|
16 |
+
}
|
17 |
+
return $this->_rates;
|
18 |
+
}
|
19 |
+
}
|
app/code/community/NowShop/NowShopShipping/Model/Shipping/Config.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class NowShop_NowShopShipping_Model_Shipping_Config extends Mage_Shipping_Model_Config
|
4 |
+
{
|
5 |
+
public function getActiveCarriers($store = null)
|
6 |
+
{
|
7 |
+
$carriers = parent::getActiveCarriers($store);
|
8 |
+
if (Mage::getDesign()->getArea() === Mage_Core_Model_App_Area::AREA_FRONTEND) {
|
9 |
+
$carriersCodes = array_keys($carriers);
|
10 |
+
$nowshopCode = Mage::getModel('nowshopshipping/carrier_nowshop')->getCode();
|
11 |
+
foreach ($carriersCodes as $carriersCode) {
|
12 |
+
if ($carriersCode == $nowshopCode) {
|
13 |
+
unset($carriers[$carriersCode]);
|
14 |
+
}
|
15 |
+
}
|
16 |
+
}
|
17 |
+
return $carriers;
|
18 |
+
}
|
19 |
+
}
|
app/code/community/NowShop/NowShopShipping/etc/config.xml
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* NowShop
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENS
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category NowShop
|
17 |
+
* @package NowShop_NowShopShipping
|
18 |
+
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
19 |
+
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
-->
|
23 |
+
<config>
|
24 |
+
<modules>
|
25 |
+
<NowShop_NowShopShipping>
|
26 |
+
<version>1.0.0</version>
|
27 |
+
<author>ASHEESH SINGH (asheeshsingh@cedcoss.com)</author>
|
28 |
+
</NowShop_NowShopShipping>
|
29 |
+
</modules>
|
30 |
+
<global>
|
31 |
+
<models>
|
32 |
+
<nowshopshipping>
|
33 |
+
<class>NowShop_NowShopShipping_Model</class>
|
34 |
+
</nowshopshipping>
|
35 |
+
<shipping>
|
36 |
+
<rewrite>
|
37 |
+
<config>NowShop_NowShopShipping_Model_Shipping_Config</config>
|
38 |
+
</rewrite>
|
39 |
+
</shipping>
|
40 |
+
<sales>
|
41 |
+
<rewrite>
|
42 |
+
<quote_address>NowShop_NowShopShipping_Model_Sales_Quote_Address</quote_address>
|
43 |
+
</rewrite>
|
44 |
+
</sales>
|
45 |
+
</models>
|
46 |
+
<resources>
|
47 |
+
<nowshopshipping_setup>
|
48 |
+
<setup>
|
49 |
+
<module>NowShop_NowShopShipping</module>
|
50 |
+
</setup>
|
51 |
+
<connection>
|
52 |
+
<use>core_setup</use>
|
53 |
+
</connection>
|
54 |
+
</nowshopshipping_setup>
|
55 |
+
<nowshopshipping_write>
|
56 |
+
<connection>
|
57 |
+
<use>core_write</use>
|
58 |
+
</connection>
|
59 |
+
</nowshopshipping_write>
|
60 |
+
<nowshopshipping_read>
|
61 |
+
<connection>
|
62 |
+
<use>core_read</use>
|
63 |
+
</connection>
|
64 |
+
</nowshopshipping_read>
|
65 |
+
</resources>
|
66 |
+
</global>
|
67 |
+
<default>
|
68 |
+
<carriers>
|
69 |
+
<nowshop>
|
70 |
+
<active>1</active>
|
71 |
+
<model>nowshopshipping/carrier_nowshop</model>
|
72 |
+
<title>Now Shop</title>
|
73 |
+
</nowshop>
|
74 |
+
</carriers>
|
75 |
+
</default>
|
76 |
+
</config>
|
app/code/community/NowShop/NowShopShipping/etc/system.xml--
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* NowShop
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENS
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category NowShop
|
17 |
+
* @package NowShop_NowShopShipping
|
18 |
+
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
19 |
+
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
-->
|
23 |
+
<config>
|
24 |
+
<sections>
|
25 |
+
<carriers>
|
26 |
+
<groups>
|
27 |
+
<nowshop translate="label" module="shipping">
|
28 |
+
<label>NowShop</label>
|
29 |
+
<frontend_type>text</frontend_type>
|
30 |
+
<sort_order>20</sort_order>
|
31 |
+
<show_in_default>1</show_in_default>
|
32 |
+
<show_in_website>1</show_in_website>
|
33 |
+
<show_in_store>1</show_in_store>
|
34 |
+
<fields>
|
35 |
+
<active translate="label">
|
36 |
+
<label>Enabled</label>
|
37 |
+
<frontend_type>select</frontend_type>
|
38 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
39 |
+
<sort_order>1</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 |
+
</active>
|
44 |
+
<title translate="label">
|
45 |
+
<label>Title</label>
|
46 |
+
<frontend_type>text</frontend_type>
|
47 |
+
<sort_order>2</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 |
+
</title>
|
52 |
+
</fields>
|
53 |
+
</nowshop>
|
54 |
+
</groups>
|
55 |
+
</carriers>
|
56 |
+
</sections>
|
57 |
+
</config>
|
app/code/community/NowShop/Synchronize/Block/Adminhtml/Feed.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
0 |
* Set template
|
1 |
*/
|
2 |
public function __construct()
|
3 |
{
|
4 |
parent::__construct();
|
5 |
$this->setTemplate('nowshop/feed.phtml');
|
6 |
}
|
7 |
/**
|
8 |
* Prepare button and grid
|
9 |
*
|
10 |
* @return Mage_Adminhtml_Block_Catalog_Product
|
11 |
*/
|
12 |
protected function _prepareLayout()
|
13 |
{
|
14 |
$this->setChild('ngrid', $this->getLayout()->createBlock('nowshop/adminhtml_feed_grid', 'product.grid'));
|
15 |
return parent::_prepareLayout();
|
16 |
}
|
17 |
/**
|
18 |
* Deprecated since 1.3.2
|
19 |
*
|
20 |
* @return string
|
21 |
*/
|
22 |
public function getAddNewButtonHtml()
|
23 |
{
|
24 |
return $this->getChildHtml('add_new_button');
|
25 |
}
|
26 |
/**
|
27 |
* Render grid
|
28 |
*
|
29 |
* @return string
|
30 |
*/
|
31 |
public function getGridHtml()
|
32 |
{
|
33 |
return $this->getChildHtml('ngrid');
|
34 |
}
|
35 |
/**
|
36 |
* Check whether it is single store mode
|
37 |
*
|
38 |
* @return bool
|
39 |
*/
|
40 |
public function isSingleStoreMode()
|
41 |
{
|
42 |
if (!Mage::app()->isSingleStoreMode()) {
|
43 |
return false;
|
44 |
}
|
45 |
return true;
|
46 |
}
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* NowShop
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENS
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to support@nowshop.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category NowShop
|
16 |
+
* @package NowShop_Synchronize
|
17 |
+
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
18 |
+
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
19 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
+
*/
|
21 |
+
/**
|
22 |
+
* Block for NowShop Feed
|
23 |
+
*/
|
24 |
+
class NowShop_Synchronize_Block_Adminhtml_Feed extends Mage_Adminhtml_Block_Widget_Container{
|
25 |
+
/**
|
26 |
* Set template
|
27 |
*/
|
28 |
public function __construct()
|
29 |
{
|
30 |
parent::__construct();
|
31 |
$this->setTemplate('nowshop/feed.phtml');
|
32 |
}
|
33 |
/**
|
34 |
* Prepare button and grid
|
35 |
*
|
36 |
* @return Mage_Adminhtml_Block_Catalog_Product
|
37 |
*/
|
38 |
protected function _prepareLayout()
|
39 |
{
|
40 |
$this->setChild('ngrid', $this->getLayout()->createBlock('nowshop/adminhtml_feed_grid', 'product.grid'));
|
41 |
return parent::_prepareLayout();
|
42 |
}
|
43 |
/**
|
44 |
* Deprecated since 1.3.2
|
45 |
*
|
46 |
* @return string
|
47 |
*/
|
48 |
public function getAddNewButtonHtml()
|
49 |
{
|
50 |
return $this->getChildHtml('add_new_button');
|
51 |
}
|
52 |
/**
|
53 |
* Render grid
|
54 |
*
|
55 |
* @return string
|
56 |
*/
|
57 |
public function getGridHtml()
|
58 |
{
|
59 |
return $this->getChildHtml('ngrid');
|
60 |
}
|
61 |
/**
|
62 |
* Check whether it is single store mode
|
63 |
*
|
64 |
* @return bool
|
65 |
*/
|
66 |
public function isSingleStoreMode()
|
67 |
{
|
68 |
if (!Mage::app()->isSingleStoreMode()) {
|
69 |
return false;
|
70 |
}
|
71 |
return true;
|
72 |
}
|
73 |
+
}
|
app/code/community/NowShop/Synchronize/Block/Adminhtml/Feed/Categories.php
ADDED
@@ -0,0 +1,314 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* NowShop
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENS
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category NowShop
|
17 |
+
* @package NowShop_Synchronize
|
18 |
+
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
19 |
+
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Block for NowShop feed categories
|
25 |
+
*/
|
26 |
+
class NowShop_Synchronize_Block_Adminhtml_Feed_Categories extends Mage_Adminhtml_Block_Catalog_Category_Tree
|
27 |
+
{
|
28 |
+
protected $_categoryIds;
|
29 |
+
protected $_selectedNodes = null;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Specify template to use
|
33 |
+
*/
|
34 |
+
public function __construct()
|
35 |
+
{
|
36 |
+
parent::__construct();
|
37 |
+
$this->setTemplate('nowshop/categories.phtml');
|
38 |
+
}
|
39 |
+
|
40 |
+
protected function _prepareLayout()
|
41 |
+
{
|
42 |
+
$buttonhtml = $this->getLayout()->createBlock('adminhtml/widget_button', 'nowshop.adminhtml.widget.button');
|
43 |
+
$buttonhtml->setData(array(
|
44 |
+
'label' => Mage::helper('nowshop')->__('Save And Generate Category Feed'),
|
45 |
+
'onclick' => "document.getElementById('nowshop_category_edit_form').submit();",
|
46 |
+
'class' => 'save'
|
47 |
+
));
|
48 |
+
$this->setChild('nowshopbuttonhtml', $buttonhtml);
|
49 |
+
return parent::_prepareLayout();
|
50 |
+
}
|
51 |
+
|
52 |
+
public function getButtonsHtml(){
|
53 |
+
return $this->getChildHtml('nowshopbuttonhtml');
|
54 |
+
}
|
55 |
+
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Checks when this block is readonly
|
59 |
+
*
|
60 |
+
* @return boolean
|
61 |
+
*/
|
62 |
+
public function isReadonly()
|
63 |
+
{
|
64 |
+
return false;
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Return array with category IDs which the product is assigned to
|
69 |
+
*
|
70 |
+
* @return array
|
71 |
+
*/
|
72 |
+
protected function getCategoryIds()
|
73 |
+
{
|
74 |
+
$categories = array();
|
75 |
+
$collection = Mage::getModel('nowshop/cfeed')->getCollection();
|
76 |
+
if(count($collection)>0){
|
77 |
+
foreach($collection as $row){
|
78 |
+
if($row->getId() && $row->getStatus()){
|
79 |
+
$categories[] = $row->getCategoryId();
|
80 |
+
}
|
81 |
+
}
|
82 |
+
}
|
83 |
+
return $categories;
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Forms string out of getCategoryIds()
|
88 |
+
*
|
89 |
+
* @return string
|
90 |
+
*/
|
91 |
+
public function getIdsString()
|
92 |
+
{
|
93 |
+
return implode(',', $this->getCategoryIds());
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Returns root node and sets 'checked' flag (if necessary)
|
98 |
+
*
|
99 |
+
* @return Varien_Data_Tree_Node
|
100 |
+
*/
|
101 |
+
public function getRootNode()
|
102 |
+
{
|
103 |
+
$root = $this->getRoot();
|
104 |
+
if ($root && in_array($root->getId(), $this->getCategoryIds())) {
|
105 |
+
$root->setChecked(true);
|
106 |
+
}
|
107 |
+
return $root;
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Returns root node
|
112 |
+
*
|
113 |
+
* @param Mage_Catalog_Model_Category|null $parentNodeCategory
|
114 |
+
* @param int $recursionLevel
|
115 |
+
* @return Varien_Data_Tree_Node
|
116 |
+
*/
|
117 |
+
public function getRoot($parentNodeCategory = null, $recursionLevel = 3)
|
118 |
+
{
|
119 |
+
if (!is_null($parentNodeCategory) && $parentNodeCategory->getId()) {
|
120 |
+
return $this->getNode($parentNodeCategory, $recursionLevel);
|
121 |
+
}
|
122 |
+
$root = Mage::registry('root');
|
123 |
+
if (is_null($root)) {
|
124 |
+
$storeId = (int) $this->getRequest()->getParam('store');
|
125 |
+
|
126 |
+
if ($storeId) {
|
127 |
+
$store = Mage::app()->getStore($storeId);
|
128 |
+
$rootId = $store->getRootCategoryId();
|
129 |
+
}
|
130 |
+
else {
|
131 |
+
$rootId = Mage_Catalog_Model_Category::TREE_ROOT_ID;
|
132 |
+
}
|
133 |
+
|
134 |
+
$ids = $this->getSelectedCategoriesPathIds($rootId);
|
135 |
+
$tree = Mage::getResourceSingleton('catalog/category_tree')
|
136 |
+
->loadByIds($ids, false, false);
|
137 |
+
|
138 |
+
if ($this->getCategory()) {
|
139 |
+
$tree->loadEnsuredNodes($this->getCategory(), $tree->getNodeById($rootId));
|
140 |
+
}
|
141 |
+
|
142 |
+
$tree->addCollectionData($this->getCategoryCollection());
|
143 |
+
|
144 |
+
$root = $tree->getNodeById($rootId);
|
145 |
+
|
146 |
+
if ($root && $rootId != Mage_Catalog_Model_Category::TREE_ROOT_ID) {
|
147 |
+
$root->setIsVisible(true);
|
148 |
+
if ($this->isReadonly()) {
|
149 |
+
$root->setDisabled(true);
|
150 |
+
}
|
151 |
+
}
|
152 |
+
elseif($root && $root->getId() == Mage_Catalog_Model_Category::TREE_ROOT_ID) {
|
153 |
+
$root->setName(Mage::helper('catalog')->__('Root'));
|
154 |
+
}
|
155 |
+
|
156 |
+
Mage::register('root', $root);
|
157 |
+
}
|
158 |
+
|
159 |
+
return $root;
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Returns array with configuration of current node
|
164 |
+
*
|
165 |
+
* @param Varien_Data_Tree_Node $node
|
166 |
+
* @param int $level How deep is the node in the tree
|
167 |
+
* @return array
|
168 |
+
*/
|
169 |
+
protected function _getNodeJson($node, $level = 1)
|
170 |
+
{
|
171 |
+
$item = parent::_getNodeJson($node, $level);
|
172 |
+
|
173 |
+
if ($this->_isParentSelectedCategory($node)) {
|
174 |
+
$item['expanded'] = true;
|
175 |
+
}
|
176 |
+
|
177 |
+
if (in_array($node->getId(), $this->getCategoryIds())) {
|
178 |
+
$item['checked'] = true;
|
179 |
+
}
|
180 |
+
|
181 |
+
if ($this->isReadonly()) {
|
182 |
+
$item['disabled'] = true;
|
183 |
+
}
|
184 |
+
|
185 |
+
return $item;
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* Returns whether $node is a parent (not exactly direct) of a selected node
|
190 |
+
*
|
191 |
+
* @param Varien_Data_Tree_Node $node
|
192 |
+
* @return bool
|
193 |
+
*/
|
194 |
+
protected function _isParentSelectedCategory($node)
|
195 |
+
{
|
196 |
+
$result = false;
|
197 |
+
// Contains string with all category IDs of children (not exactly direct) of the node
|
198 |
+
$allChildren = $node->getAllChildren();
|
199 |
+
if ($allChildren) {
|
200 |
+
$selectedCategoryIds = $this->getCategoryIds();
|
201 |
+
$allChildrenArr = explode(',', $allChildren);
|
202 |
+
for ($i = 0, $cnt = count($selectedCategoryIds); $i < $cnt; $i++) {
|
203 |
+
$isSelf = $node->getId() == $selectedCategoryIds[$i];
|
204 |
+
if (!$isSelf && in_array($selectedCategoryIds[$i], $allChildrenArr)) {
|
205 |
+
$result = true;
|
206 |
+
break;
|
207 |
+
}
|
208 |
+
}
|
209 |
+
}
|
210 |
+
|
211 |
+
return $result;
|
212 |
+
}
|
213 |
+
|
214 |
+
/**
|
215 |
+
* Returns array with nodes those are selected (contain current product)
|
216 |
+
*
|
217 |
+
* @return array
|
218 |
+
*/
|
219 |
+
protected function _getSelectedNodes()
|
220 |
+
{
|
221 |
+
if ($this->_selectedNodes === null) {
|
222 |
+
$this->_selectedNodes = array();
|
223 |
+
$root = $this->getRoot();
|
224 |
+
foreach ($this->getCategoryIds() as $categoryId) {
|
225 |
+
if ($root) {
|
226 |
+
$this->_selectedNodes[] = $root->getTree()->getNodeById($categoryId);
|
227 |
+
}
|
228 |
+
}
|
229 |
+
}
|
230 |
+
|
231 |
+
return $this->_selectedNodes;
|
232 |
+
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* Returns JSON-encoded array of category children
|
236 |
+
*
|
237 |
+
* @param int $categoryId
|
238 |
+
* @return string
|
239 |
+
*/
|
240 |
+
public function getCategoryChildrenJson($categoryId)
|
241 |
+
{
|
242 |
+
$category = Mage::getModel('catalog/category')->load($categoryId);
|
243 |
+
$node = $this->getRoot($category, 1)->getTree()->getNodeById($categoryId);
|
244 |
+
|
245 |
+
if (!$node || !$node->hasChildren()) {
|
246 |
+
return '[]';
|
247 |
+
}
|
248 |
+
|
249 |
+
$children = array();
|
250 |
+
foreach ($node->getChildren() as $child) {
|
251 |
+
$children[] = $this->_getNodeJson($child);
|
252 |
+
}
|
253 |
+
|
254 |
+
return Mage::helper('core')->jsonEncode($children);
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
* Returns URL for loading tree
|
259 |
+
*
|
260 |
+
* @param null $expanded
|
261 |
+
* @return string
|
262 |
+
*/
|
263 |
+
public function getLoadTreeUrl($expanded = null)
|
264 |
+
{
|
265 |
+
return $this->getUrl('*/*/categoriesJson', array('_current' => true));
|
266 |
+
}
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Return distinct path ids of selected categories
|
270 |
+
*
|
271 |
+
* @param mixed $rootId Root category Id for context
|
272 |
+
* @return array
|
273 |
+
*/
|
274 |
+
public function getSelectedCategoriesPathIds($rootId = false)
|
275 |
+
{
|
276 |
+
$ids = array();
|
277 |
+
$categoryIds = $this->getCategoryIds();
|
278 |
+
if (empty($categoryIds)) {
|
279 |
+
return array();
|
280 |
+
}
|
281 |
+
$collection = Mage::getResourceModel('catalog/category_collection');
|
282 |
+
|
283 |
+
if ($rootId) {
|
284 |
+
$collection->addFieldToFilter('parent_id', $rootId);
|
285 |
+
} else {
|
286 |
+
$collection->addFieldToFilter('entity_id', array('in'=>$categoryIds));
|
287 |
+
}
|
288 |
+
|
289 |
+
foreach ($collection as $item) {
|
290 |
+
if ($rootId && !in_array($rootId, $item->getPathIds())) {
|
291 |
+
continue;
|
292 |
+
}
|
293 |
+
foreach ($item->getPathIds() as $id) {
|
294 |
+
if (!in_array($id, $ids)) {
|
295 |
+
$ids[] = $id;
|
296 |
+
}
|
297 |
+
}
|
298 |
+
}
|
299 |
+
return $ids;
|
300 |
+
}
|
301 |
+
|
302 |
+
/**
|
303 |
+
* Check whether it is single store mode
|
304 |
+
*
|
305 |
+
* @return bool
|
306 |
+
*/
|
307 |
+
public function isSingleStoreMode()
|
308 |
+
{
|
309 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
310 |
+
return false;
|
311 |
+
}
|
312 |
+
return true;
|
313 |
+
}
|
314 |
+
}
|
app/code/community/NowShop/Synchronize/Block/Adminhtml/Feed/Grid.php
ADDED
@@ -0,0 +1 @@
|
|
|
|
0 |
* NowShop
|
1 |
*
|
2 |
* NOTICE OF LICENS
|
3 |
*
|
4 |
* This source file is subject to the Open Software License (OSL 3.0)
|
5 |
* that is bundled with this package in the file LICENSE.txt.
|
6 |
* It is also available through the world-wide-web at this URL:
|
7 |
* http://opensource.org/licenses/osl-3.0.php
|
8 |
* If you did not receive a copy of the license and are unable to
|
9 |
* obtain it through the world-wide-web, please send an email
|
10 |
* to support@nowshop.com so we can send you a copy immediately.
|
11 |
*
|
12 |
* @category NowShop
|
13 |
* @package NowShop_Synchronize
|
14 |
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
15 |
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
16 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
*/
|
18 |
|
19 |
* Block for NowShop feed grid
|
20 |
*/
|
21 |
|
22 |
$this->setUseAjax(true);
|
23 |
$this->setVarNameFilter('productfeed_filter');
|
24 |
{
|
25 |
$storeId = (int) $this->getRequest()->getParam('store', 0);
|
26 |
return Mage::app()->getStore($storeId);
|
27 |
}
|
28 |
protected function _prepareCollection()
|
29 |
{
|
30 |
$store = $this->_getStore();
|
31 |
$collection = Mage::getModel('catalog/product')->getCollection()
|
32 |
->addAttributeToSelect('sku')
|
33 |
->addAttributeToSelect('name')
|
34 |
->addAttributeToSelect('attribute_set_id')
|
35 |
->addAttributeToSelect('type_id');
|
36 |
if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
|
37 |
$collection->joinField('qty',
|
38 |
'cataloginventory/stock_item',
|
39 |
'qty',
|
40 |
'product_id=entity_id',
|
41 |
'{{table}}.stock_id=1',
|
42 |
'left');
|
43 |
}
|
44 |
if ($store->getId()) {
|
45 |
$adminStore = Mage_Core_Model_App::ADMIN_STORE_ID;
|
46 |
$collection->addStoreFilter($store);
|
47 |
$collection->joinAttribute(
|
48 |
'name',
|
49 |
'catalog_product/name',
|
50 |
'entity_id',
|
51 |
null,
|
52 |
'inner',
|
53 |
$adminStore
|
54 |
);
|
55 |
$collection->joinAttribute(
|
56 |
'custom_name',
|
57 |
'catalog_product/name',
|
58 |
'entity_id',
|
59 |
null,
|
60 |
'inner',
|
61 |
$store->getId()
|
62 |
);
|
63 |
$collection->joinAttribute(
|
64 |
'status',
|
65 |
'catalog_product/status',
|
66 |
'entity_id',
|
67 |
null,
|
68 |
'inner',
|
69 |
$store->getId()
|
70 |
);
|
71 |
$collection->joinAttribute(
|
72 |
'visibility',
|
73 |
'catalog_product/visibility',
|
74 |
'entity_id',
|
75 |
null,
|
76 |
'inner',
|
77 |
$store->getId()
|
78 |
);
|
79 |
$collection->joinAttribute(
|
80 |
'price',
|
81 |
'catalog_product/price',
|
82 |
'entity_id',
|
83 |
null,
|
84 |
'left',
|
85 |
$store->getId()
|
86 |
);
|
87 |
}
|
88 |
else {
|
89 |
$collection->addAttributeToSelect('price');
|
90 |
$collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner');
|
91 |
$collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner');
|
92 |
}
|
93 |
$this->setCollection($collection);
|
94 |
parent::_prepareCollection();
|
95 |
$this->getCollection()->addWebsiteNamesToResult();
|
96 |
return $this;
|
97 |
}
|
98 |
protected function _addColumnFilterToCollection($column)
|
99 |
{
|
100 |
if ($this->getCollection()) {
|
101 |
if ($column->getId() == 'websites') {
|
102 |
$this->getCollection()->joinField('websites',
|
103 |
'catalog/product_website',
|
104 |
'website_id',
|
105 |
'product_id=entity_id',
|
106 |
null,
|
107 |
'left'
|
108 |
}
|
109 |
}
|
110 |
return parent::_addColumnFilterToCollection($column);
|
111 |
}
|
112 |
protected function _prepareColumns()
|
113 |
{
|
114 |
$this->addColumn('entity_id',
|
115 |
array(
|
116 |
'header'=> Mage::helper('catalog')->__('ID'),
|
117 |
'width' => '50px',
|
118 |
'type' => 'number',
|
119 |
'index' => 'entity_id',
|
120 |
));
|
121 |
$this->addColumn('name',
|
122 |
array(
|
123 |
'header'=> Mage::helper('catalog')->__('Name'),
|
124 |
'index' => 'name',
|
125 |
));
|
126 |
$store = $this->_getStore();
|
127 |
if ($store->getId()) {
|
128 |
$this->addColumn('custom_name',
|
129 |
array(
|
130 |
'header'=> Mage::helper('catalog')->__('Name in %s', $store->getName()),
|
131 |
'index' => 'custom_name',
|
132 |
));
|
133 |
}
|
134 |
$this->addColumn('type',
|
135 |
array(
|
136 |
'header'=> Mage::helper('catalog')->__('Type'),
|
137 |
'width' => '60px',
|
138 |
'index' => 'type_id',
|
139 |
'type' => 'options',
|
140 |
'options' => array(
|
141 |
));
|
142 |
$sets = Mage::getResourceModel('eav/entity_attribute_set_collection')
|
143 |
->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId())
|
144 |
->load()
|
145 |
->toOptionHash();
|
146 |
$this->addColumn('set_name',
|
147 |
array(
|
148 |
'header'=> Mage::helper('catalog')->__('Attrib. Set Name'),
|
149 |
'width' => '100px',
|
150 |
'index' => 'attribute_set_id',
|
151 |
'type' => 'options',
|
152 |
'options' => $sets,
|
153 |
));
|
154 |
$this->addColumn('sku',
|
155 |
array(
|
156 |
'header'=> Mage::helper('catalog')->__('SKU'),
|
157 |
'width' => '80px',
|
158 |
'index' => 'sku',
|
159 |
));
|
160 |
$store = $this->_getStore();
|
161 |
$this->addColumn('price',
|
162 |
array(
|
163 |
'header'=> Mage::helper('catalog')->__('Price'),
|
164 |
'type' => 'price',
|
165 |
'currency_code' => $store->getBaseCurrency()->getCode(),
|
166 |
'index' => 'price',
|
167 |
));
|
168 |
if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
|
169 |
$this->addColumn('qty',
|
170 |
array(
|
171 |
'header'=> Mage::helper('catalog')->__('Qty'),
|
172 |
'width' => '100px',
|
173 |
'type' => 'number',
|
174 |
'index' => 'qty',
|
175 |
));
|
176 |
}
|
177 |
$this->addColumn('visibility',
|
178 |
array(
|
179 |
'header'=> Mage::helper('catalog')->__('Visibility'),
|
180 |
'width' => '70px',
|
181 |
'index' => 'visibility',
|
182 |
'type' => 'options',
|
183 |
'options' => Mage::getModel('catalog/product_visibility')->getOptionArray(),
|
184 |
));
|
185 |
$this->addColumn('status',
|
186 |
array(
|
187 |
'header'=> Mage::helper('catalog')->__('Status'),
|
188 |
'width' => '70px',
|
189 |
'index' => 'status',
|
190 |
'type' => 'options',
|
191 |
'options' => Mage::getSingleton('catalog/product_status')->getOptionArray(),
|
192 |
));
|
193 |
if (!Mage::app()->isSingleStoreMode()) {
|
194 |
$this->addColumn('websites',
|
195 |
array(
|
196 |
'header'=> Mage::helper('catalog')->__('Websites'),
|
197 |
'width' => '100px',
|
198 |
'sortable' => false,
|
199 |
'index' => 'websites',
|
200 |
'type' => 'options',
|
201 |
'options' => Mage::getModel('core/website')->getCollection()->toOptionHash(),
|
202 |
));
|
203 |
}
|
204 |
array(
|
205 |
'header'=> Mage::helper('nowshop')->__('Re-listing required?'),
|
206 |
'width' => '70px',
|
207 |
'index' => 'requiredrelisting',
|
208 |
'type' => 'options',
|
209 |
'options' => array(1=>Mage::helper('nowshop')->__('Yes'),-1=>Mage::helper('nowshop')->__('No')),
|
210 |
));
|
211 |
$this->addColumn('nowshop',
|
212 |
array(
|
213 |
'header'=> Mage::helper('nowshop')->__('On NowShop'),
|
214 |
'width' => '70px',
|
215 |
'index' => 'nowshop',
|
216 |
'type' => 'options',
|
217 |
'options' => Mage::helper('nowshop')->getStatuses(),
|
218 |
));
|
219 |
return parent::_prepareColumns();
|
220 |
}
|
221 |
protected function _prepareMassaction()
|
222 |
{
|
223 |
$this->setMassactionIdField('entity_id');
|
224 |
$this->getMassactionBlock()->setFormFieldName('product');
|
225 |
$statuses = array(
|
226 |
array_unshift($statuses, array('label'=>'', 'value'=>''));
|
227 |
$this->getMassactionBlock()->addItem('onnowshop', array(
|
228 |
'label'=> Mage::helper('nowshop')->__('On NowShop'),
|
229 |
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
|
230 |
'additional' => array(
|
231 |
'visibility' => array(
|
232 |
'name' => 'onnowshop',
|
233 |
'type' => 'select',
|
234 |
'class' => 'required-entry',
|
235 |
'label' => Mage::helper('catalog')->__('Status'),
|
236 |
'values' => $statuses
|
237 |
)
|
238 |
)
|
239 |
));
|
240 |
return $this;
|
241 |
}
|
242 |
public function getGridUrl()
|
243 |
{
|
244 |
return $this->getUrl('*/*/grid', array('_secure'=>true, '_current'=>true));
|
245 |
}
|
246 |
public function getRowUrl($row)
|
247 |
{
|
248 |
return "javascript:void(0)";
|
249 |
}
|
250 |
$this->_prepareGrid();
|
251 |
$this->getCollection()->setPageSize(0);
|
252 |
$this->getCollection()->load();
|
253 |
$this->_afterLoadCollection();
|
254 |
}
|
255 |
|
1 |
+
<?php
|
2 |
* NowShop
|
3 |
*
|
4 |
* NOTICE OF LICENS
|
5 |
*
|
6 |
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
* that is bundled with this package in the file LICENSE.txt.
|
8 |
* It is also available through the world-wide-web at this URL:
|
9 |
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
13 |
*
|
14 |
* @category NowShop
|
15 |
* @package NowShop_Synchronize
|
16 |
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
17 |
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
21 |
* Block for NowShop feed grid
|
22 |
*/
|
23 |
|
24 |
$this->setUseAjax(true);
|
25 |
$this->setVarNameFilter('productfeed_filter');
|
26 |
{
|
27 |
$storeId = (int) $this->getRequest()->getParam('store', 0);
|
28 |
return Mage::app()->getStore($storeId);
|
29 |
}
|
30 |
protected function _prepareCollection()
|
31 |
{
|
32 |
$store = $this->_getStore();
|
33 |
$collection = Mage::getModel('catalog/product')->getCollection()
|
34 |
->addAttributeToSelect('sku')
|
35 |
->addAttributeToSelect('name')
|
36 |
->addAttributeToSelect('attribute_set_id')
|
37 |
->addAttributeToSelect('type_id');
|
38 |
if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
|
39 |
$collection->joinField('qty',
|
40 |
'cataloginventory/stock_item',
|
41 |
'qty',
|
42 |
'product_id=entity_id',
|
43 |
'{{table}}.stock_id=1',
|
44 |
'left');
|
45 |
}
|
46 |
if ($store->getId()) {
|
47 |
$adminStore = Mage_Core_Model_App::ADMIN_STORE_ID;
|
48 |
$collection->addStoreFilter($store);
|
49 |
$collection->joinAttribute(
|
50 |
'name',
|
51 |
'catalog_product/name',
|
52 |
'entity_id',
|
53 |
null,
|
54 |
'inner',
|
55 |
$adminStore
|
56 |
);
|
57 |
$collection->joinAttribute(
|
58 |
'custom_name',
|
59 |
'catalog_product/name',
|
60 |
'entity_id',
|
61 |
null,
|
62 |
'inner',
|
63 |
$store->getId()
|
64 |
);
|
65 |
$collection->joinAttribute(
|
66 |
'status',
|
67 |
'catalog_product/status',
|
68 |
'entity_id',
|
69 |
null,
|
70 |
'inner',
|
71 |
$store->getId()
|
72 |
);
|
73 |
$collection->joinAttribute(
|
74 |
'visibility',
|
75 |
'catalog_product/visibility',
|
76 |
'entity_id',
|
77 |
null,
|
78 |
'inner',
|
79 |
$store->getId()
|
80 |
);
|
81 |
$collection->joinAttribute(
|
82 |
'price',
|
83 |
'catalog_product/price',
|
84 |
'entity_id',
|
85 |
null,
|
86 |
'left',
|
87 |
$store->getId()
|
88 |
);
|
89 |
}
|
90 |
else {
|
91 |
$collection->addAttributeToSelect('price');
|
92 |
$collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner');
|
93 |
$collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner');
|
94 |
}
|
95 |
$this->setCollection($collection);
|
96 |
parent::_prepareCollection();
|
97 |
$this->getCollection()->addWebsiteNamesToResult();
|
98 |
return $this;
|
99 |
}
|
100 |
protected function _addColumnFilterToCollection($column)
|
101 |
{
|
102 |
if ($this->getCollection()) {
|
103 |
if ($column->getId() == 'websites') {
|
104 |
$this->getCollection()->joinField('websites',
|
105 |
'catalog/product_website',
|
106 |
'website_id',
|
107 |
'product_id=entity_id',
|
108 |
null,
|
109 |
'left'
|
110 |
}
|
111 |
}
|
112 |
return parent::_addColumnFilterToCollection($column);
|
113 |
}
|
114 |
protected function _prepareColumns()
|
115 |
{
|
116 |
$this->addColumn('entity_id',
|
117 |
array(
|
118 |
'header'=> Mage::helper('catalog')->__('ID'),
|
119 |
'width' => '50px',
|
120 |
'type' => 'number',
|
121 |
'index' => 'entity_id',
|
122 |
));
|
123 |
$this->addColumn('name',
|
124 |
array(
|
125 |
'header'=> Mage::helper('catalog')->__('Name'),
|
126 |
'index' => 'name',
|
127 |
));
|
128 |
$store = $this->_getStore();
|
129 |
if ($store->getId()) {
|
130 |
$this->addColumn('custom_name',
|
131 |
array(
|
132 |
'header'=> Mage::helper('catalog')->__('Name in %s', $store->getName()),
|
133 |
'index' => 'custom_name',
|
134 |
));
|
135 |
}
|
136 |
$this->addColumn('type',
|
137 |
array(
|
138 |
'header'=> Mage::helper('catalog')->__('Type'),
|
139 |
'width' => '60px',
|
140 |
'index' => 'type_id',
|
141 |
'type' => 'options',
|
142 |
'options' => array(
|
143 |
));
|
144 |
$sets = Mage::getResourceModel('eav/entity_attribute_set_collection')
|
145 |
->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId())
|
146 |
->load()
|
147 |
->toOptionHash();
|
148 |
$this->addColumn('set_name',
|
149 |
array(
|
150 |
'header'=> Mage::helper('catalog')->__('Attrib. Set Name'),
|
151 |
'width' => '100px',
|
152 |
'index' => 'attribute_set_id',
|
153 |
'type' => 'options',
|
154 |
'options' => $sets,
|
155 |
));
|
156 |
$this->addColumn('sku',
|
157 |
array(
|
158 |
'header'=> Mage::helper('catalog')->__('SKU'),
|
159 |
'width' => '80px',
|
160 |
'index' => 'sku',
|
161 |
));
|
162 |
$store = $this->_getStore();
|
163 |
$this->addColumn('price',
|
164 |
array(
|
165 |
'header'=> Mage::helper('catalog')->__('Price'),
|
166 |
'type' => 'price',
|
167 |
'currency_code' => $store->getBaseCurrency()->getCode(),
|
168 |
'index' => 'price',
|
169 |
));
|
170 |
if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
|
171 |
$this->addColumn('qty',
|
172 |
array(
|
173 |
'header'=> Mage::helper('catalog')->__('Qty'),
|
174 |
'width' => '100px',
|
175 |
'type' => 'number',
|
176 |
'index' => 'qty',
|
177 |
));
|
178 |
}
|
179 |
$this->addColumn('visibility',
|
180 |
array(
|
181 |
'header'=> Mage::helper('catalog')->__('Visibility'),
|
182 |
'width' => '70px',
|
183 |
'index' => 'visibility',
|
184 |
'type' => 'options',
|
185 |
'options' => Mage::getModel('catalog/product_visibility')->getOptionArray(),
|
186 |
));
|
187 |
$this->addColumn('status',
|
188 |
array(
|
189 |
'header'=> Mage::helper('catalog')->__('Status'),
|
190 |
'width' => '70px',
|
191 |
'index' => 'status',
|
192 |
'type' => 'options',
|
193 |
'options' => Mage::getSingleton('catalog/product_status')->getOptionArray(),
|
194 |
));
|
195 |
if (!Mage::app()->isSingleStoreMode()) {
|
196 |
$this->addColumn('websites',
|
197 |
array(
|
198 |
'header'=> Mage::helper('catalog')->__('Websites'),
|
199 |
'width' => '100px',
|
200 |
'sortable' => false,
|
201 |
'index' => 'websites',
|
202 |
'type' => 'options',
|
203 |
'options' => Mage::getModel('core/website')->getCollection()->toOptionHash(),
|
204 |
));
|
205 |
}
|
206 |
array(
|
207 |
'header'=> Mage::helper('nowshop')->__('Re-listing required?'),
|
208 |
'width' => '70px',
|
209 |
'index' => 'requiredrelisting',
|
210 |
'type' => 'options',
|
211 |
'options' => array(1=>Mage::helper('nowshop')->__('Yes'),-1=>Mage::helper('nowshop')->__('No')),
|
212 |
));
|
213 |
$this->addColumn('nowshop',
|
214 |
array(
|
215 |
'header'=> Mage::helper('nowshop')->__('On NowShop'),
|
216 |
'width' => '70px',
|
217 |
'index' => 'nowshop',
|
218 |
'type' => 'options',
|
219 |
'options' => Mage::helper('nowshop')->getStatuses(),
|
220 |
));
|
221 |
return parent::_prepareColumns();
|
222 |
}
|
223 |
protected function _prepareMassaction()
|
224 |
{
|
225 |
$this->setMassactionIdField('entity_id');
|
226 |
$this->getMassactionBlock()->setFormFieldName('product');
|
227 |
$statuses = array(
|
228 |
array_unshift($statuses, array('label'=>'', 'value'=>''));
|
229 |
$this->getMassactionBlock()->addItem('onnowshop', array(
|
230 |
'label'=> Mage::helper('nowshop')->__('On NowShop'),
|
231 |
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
|
232 |
'additional' => array(
|
233 |
'visibility' => array(
|
234 |
'name' => 'onnowshop',
|
235 |
'type' => 'select',
|
236 |
'class' => 'required-entry',
|
237 |
'label' => Mage::helper('catalog')->__('Status'),
|
238 |
'values' => $statuses
|
239 |
)
|
240 |
)
|
241 |
));
|
242 |
return $this;
|
243 |
}
|
244 |
public function getGridUrl()
|
245 |
{
|
246 |
return $this->getUrl('*/*/grid', array('_secure'=>true, '_current'=>true));
|
247 |
}
|
248 |
public function getRowUrl($row)
|
249 |
{
|
250 |
return "javascript:void(0)";
|
251 |
}
|
252 |
$this->_prepareGrid();
|
253 |
$this->getCollection()->setPageSize(0);
|
254 |
$this->getCollection()->load();
|
255 |
$this->_afterLoadCollection();
|
256 |
}
|
257 |
|
app/code/community/NowShop/Synchronize/Block/Adminhtml/Feed/Renderer/Listed.php
ADDED
@@ -0,0 +1 @@
|
|
|
|
0 |
* NowShop
|
1 |
*
|
2 |
* NOTICE OF LICENS
|
3 |
*
|
4 |
* This source file is subject to the Open Software License (OSL 3.0)
|
5 |
* that is bundled with this package in the file LICENSE.txt.
|
6 |
* It is also available through the world-wide-web at this URL:
|
7 |
* http://opensource.org/licenses/osl-3.0.php
|
8 |
* If you did not receive a copy of the license and are unable to
|
9 |
* obtain it through the world-wide-web, please send an email
|
10 |
* to support@nowshop.com so we can send you a copy immediately.
|
11 |
*
|
12 |
* @category NowShop
|
13 |
* @package NowShop_Synchronize
|
14 |
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
15 |
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
16 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
*/
|
18 |
|
19 |
* Block for NowShop feed Renderer
|
20 |
*/
|
21 |
{
|
22 |
$status=$row->getNowshop();
|
23 |
}
|
1 |
+
<?php
|
2 |
* NowShop
|
3 |
*
|
4 |
* NOTICE OF LICENS
|
5 |
*
|
6 |
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
* that is bundled with this package in the file LICENSE.txt.
|
8 |
* It is also available through the world-wide-web at this URL:
|
9 |
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
13 |
*
|
14 |
* @category NowShop
|
15 |
* @package NowShop_Synchronize
|
16 |
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
17 |
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
21 |
* Block for NowShop feed Renderer
|
22 |
*/
|
23 |
{
|
24 |
$status=$row->getNowshop();
|
25 |
}
|
app/code/community/NowShop/Synchronize/Block/Adminhtml/Feed/Renderer/Relisted.php
ADDED
@@ -0,0 +1 @@
|
|
|
|
0 |
* NowShop
|
1 |
*
|
2 |
* NOTICE OF LICENS
|
3 |
*
|
4 |
* This source file is subject to the Open Software License (OSL 3.0)
|
5 |
* that is bundled with this package in the file LICENSE.txt.
|
6 |
* It is also available through the world-wide-web at this URL:
|
7 |
* http://opensource.org/licenses/osl-3.0.php
|
8 |
* If you did not receive a copy of the license and are unable to
|
9 |
* obtain it through the world-wide-web, please send an email
|
10 |
* to support@nowshop.com so we can send you a copy immediately.
|
11 |
*
|
12 |
* @category NowShop
|
13 |
* @package NowShop_Synchronize
|
14 |
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
15 |
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
16 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
*/
|
18 |
|
19 |
* Block for NowShop feed Renderer
|
20 |
*/
|
21 |
{
|
22 |
$status=$row->getRequiredrelisting();
|
23 |
}
|
1 |
+
<?php
|
2 |
* NowShop
|
3 |
*
|
4 |
* NOTICE OF LICENS
|
5 |
*
|
6 |
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
* that is bundled with this package in the file LICENSE.txt.
|
8 |
* It is also available through the world-wide-web at this URL:
|
9 |
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
13 |
*
|
14 |
* @category NowShop
|
15 |
* @package NowShop_Synchronize
|
16 |
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
17 |
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
21 |
* Block for NowShop feed Renderer
|
22 |
*/
|
23 |
{
|
24 |
$status=$row->getRequiredrelisting();
|
25 |
}
|
app/code/community/NowShop/Synchronize/Helper/Arraytoxml.php
ADDED
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* NowShop
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENS
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category NowShop
|
17 |
+
* @package NowShop_Synchronize
|
18 |
+
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
19 |
+
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
|
23 |
+
class NowShop_Synchronize_Helper_Arraytoxml {
|
24 |
+
|
25 |
+
private static $xml = null;
|
26 |
+
private static $encoding = 'UTF-8';
|
27 |
+
|
28 |
+
public function getSchema(){
|
29 |
+
$schema = Mage::getBaseDir().DS.'app'.DS.'code'.DS.'community'.DS.'NowShop'.DS.'Synchronize'.DS.'etc'.DS.'xsd'.DS.'product_feed.xsd';
|
30 |
+
return $schema;
|
31 |
+
}
|
32 |
+
|
33 |
+
public function formatedFileName($type='product',$diff = false){
|
34 |
+
$filename = Mage::getBaseDir('media').DS.'nowshop'.DS.$type.'feed'.DS;
|
35 |
+
$isocode = Mage::getStoreConfig('nowshop/setting/isocode');
|
36 |
+
if($type == 'category'){
|
37 |
+
$filename .= 'categories.';
|
38 |
+
}
|
39 |
+
$filename .= date('Ymdhis').'.'.$isocode;
|
40 |
+
if($diff)
|
41 |
+
$filename .= '.diff';
|
42 |
+
$filename .= '.xml';
|
43 |
+
return $filename;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Initialize the root XML node [optional]
|
48 |
+
* @param $version
|
49 |
+
* @param $encoding
|
50 |
+
* @param $format_output
|
51 |
+
*/
|
52 |
+
public static function init($version = '1.0', $encoding = 'UTF-8', $format_output = true) {
|
53 |
+
self::$xml = new DomDocument($version, $encoding);
|
54 |
+
self::$xml->formatOutput = $format_output;
|
55 |
+
self::$encoding = $encoding;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Convert an Array to XML
|
60 |
+
* @param string $node_name - name of the root node to be converted
|
61 |
+
* @param array $arr - aray to be converterd
|
62 |
+
* @return DomDocument
|
63 |
+
*/
|
64 |
+
public static function &createXML($node_name, $arr=array()) {
|
65 |
+
$xml = self::getXMLRoot();
|
66 |
+
$xml->appendChild(self::convert($node_name, $arr));
|
67 |
+
|
68 |
+
self::$xml = null; /* clear the xml node in the class for 2nd time use. */
|
69 |
+
return $xml;
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Convert an Array to XML
|
74 |
+
* @param string $node_name - name of the root node to be converted
|
75 |
+
* @param array $arr - aray to be converterd
|
76 |
+
* @return DOMNode
|
77 |
+
*/
|
78 |
+
private static function &convert($node_name, $arr=array()) {
|
79 |
+
|
80 |
+
/* print_arr($node_name); */
|
81 |
+
$xml = self::getXMLRoot();
|
82 |
+
$node = $xml->createElement($node_name);
|
83 |
+
|
84 |
+
if(is_array($arr)){
|
85 |
+
/* get the attributes first.; */
|
86 |
+
if(isset($arr['@attributes'])) {
|
87 |
+
foreach($arr['@attributes'] as $key => $value) {
|
88 |
+
if(!self::isValidTagName($key)) {
|
89 |
+
throw new Exception('[NowShop_Synchronize_Helper_Arraytoxml] Illegal character in attribute name. attribute: '.$key.' in node: '.$node_name);
|
90 |
+
}
|
91 |
+
$node->setAttribute($key, self::bool2str($value));
|
92 |
+
}
|
93 |
+
unset($arr['@attributes']); /* remove the key from the array once done. */
|
94 |
+
}
|
95 |
+
|
96 |
+
/* check if it has a value stored in @value, if yes store the value and return */
|
97 |
+
/* else check if its directly stored as string */
|
98 |
+
if(isset($arr['@value'])) {
|
99 |
+
$node->appendChild($xml->createTextNode(self::bool2str($arr['@value'])));
|
100 |
+
unset($arr['@value']); /* remove the key from the array once done. */
|
101 |
+
/* return from recursion, as a note with value cannot have child nodes. */
|
102 |
+
return $node;
|
103 |
+
} else if(isset($arr['@cdata'])) {
|
104 |
+
$node->appendChild($xml->createCDATASection(self::bool2str($arr['@cdata'])));
|
105 |
+
unset($arr['@cdata']); /* remove the key from the array once done. */
|
106 |
+
/*return from recursion, as a note with cdata cannot have child nodes. */
|
107 |
+
return $node;
|
108 |
+
}
|
109 |
+
}
|
110 |
+
|
111 |
+
/* create subnodes using recursion */
|
112 |
+
if(is_array($arr)){
|
113 |
+
/* recurse to get the node for that key */
|
114 |
+
foreach($arr as $key=>$value){
|
115 |
+
if(!self::isValidTagName($key)) {
|
116 |
+
throw new Exception('[NowShop_Synchronize_Helper_Arraytoxml] Illegal character in tag name. tag: '.$key.' in node: '.$node_name);
|
117 |
+
}
|
118 |
+
if(is_array($value) && is_numeric(key($value))) {
|
119 |
+
/* MORE THAN ONE NODE OF ITS KIND;
|
120 |
+
if the new array is numeric index, means it is array of nodes of the same kind
|
121 |
+
it should follow the parent key name
|
122 |
+
*/
|
123 |
+
foreach($value as $k=>$v){
|
124 |
+
$node->appendChild(self::convert($key, $v));
|
125 |
+
}
|
126 |
+
} else {
|
127 |
+
/* ONLY ONE NODE OF ITS KIND */
|
128 |
+
$node->appendChild(self::convert($key, $value));
|
129 |
+
}
|
130 |
+
unset($arr[$key]); /* remove the key from the array once done. */
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
/* after we are done with all the keys in the array (if it is one) */
|
135 |
+
/* we check if it has any text value, if yes, append it. */
|
136 |
+
if(!is_array($arr)) {
|
137 |
+
$node->appendChild($xml->createTextNode(self::bool2str($arr)));
|
138 |
+
}
|
139 |
+
|
140 |
+
return $node;
|
141 |
+
}
|
142 |
+
|
143 |
+
/*
|
144 |
+
* Get the root XML node, if there isn't one, create it.
|
145 |
+
*/
|
146 |
+
private static function getXMLRoot(){
|
147 |
+
if(empty(self::$xml)) {
|
148 |
+
self::init();
|
149 |
+
}
|
150 |
+
return self::$xml;
|
151 |
+
}
|
152 |
+
|
153 |
+
/*
|
154 |
+
* Get string representation of boolean value
|
155 |
+
*/
|
156 |
+
private static function bool2str($v){
|
157 |
+
/* convert boolean to text value. */
|
158 |
+
$v = $v === true ? 'true' : $v;
|
159 |
+
$v = $v === false ? 'false' : $v;
|
160 |
+
return $v;
|
161 |
+
}
|
162 |
+
|
163 |
+
/*
|
164 |
+
* Check if the tag name or attribute name contains illegal characters
|
165 |
+
* Ref: http://www.w3.org/TR/xml/#sec-common-syn
|
166 |
+
*/
|
167 |
+
private static function isValidTagName($tag){
|
168 |
+
$pattern = '/^[a-z_]+[a-z0-9\:\-\.\_]*[^:]*$/i';
|
169 |
+
return preg_match($pattern, $tag, $matches) && $matches[0] == $tag;
|
170 |
+
}
|
171 |
+
|
172 |
+
}
|
app/code/community/NowShop/Synchronize/Helper/Data.php
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* NowShop
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENS
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category NowShop
|
17 |
+
* @package NowShop_Synchronize
|
18 |
+
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
19 |
+
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
|
23 |
+
class NowShop_Synchronize_Helper_Data extends Mage_Core_Helper_Abstract{
|
24 |
+
|
25 |
+
const ALLOWED_TAGS_AT_NOWSHOP = '<strong><em><b><i><div><br><br/><p><ul><ol><li>';
|
26 |
+
public function getStatuses(){
|
27 |
+
return array(
|
28 |
+
'1' => $this->__("Listed"),
|
29 |
+
'-1' => $this->__("Not Listed")
|
30 |
+
);
|
31 |
+
}
|
32 |
+
public function getAttribute($attr = '',$value = ''){
|
33 |
+
$result = '';
|
34 |
+
if($attr!='' && $value!=''){
|
35 |
+
switch($attr){
|
36 |
+
case 'type' : switch($value){
|
37 |
+
case 'simple' : $result = 'simple';break;
|
38 |
+
case 'configurable' :
|
39 |
+
case 'bundle' :
|
40 |
+
case 'grouped' :
|
41 |
+
case 'virtual' :
|
42 |
+
case 'downloadable' : $result = 'master';break;
|
43 |
+
default : $result = $value;
|
44 |
+
} break;
|
45 |
+
case 'description' : $result = strip_tags($value, self::ALLOWED_TAGS_AT_NOWSHOP);
|
46 |
+
if($result==''){ $result = "default description"; }
|
47 |
+
break;
|
48 |
+
}
|
49 |
+
}
|
50 |
+
return $result;
|
51 |
+
}
|
52 |
+
|
53 |
+
public function getOrderStatus($status = ''){
|
54 |
+
switch($status){
|
55 |
+
case 'holded' :
|
56 |
+
case 'fraud' : return 'ordered'; break;
|
57 |
+
case 'pending' :
|
58 |
+
case 'pending_payment' :
|
59 |
+
case 'payment_review' :
|
60 |
+
case 'processing' : return 'confirmed'; break;
|
61 |
+
case 'complete' : return 'shipped'; break;
|
62 |
+
case 'canceled' :
|
63 |
+
case 'closed' : return 'cancelled'; break;
|
64 |
+
default: return 'ordered'; break;
|
65 |
+
}
|
66 |
+
|
67 |
+
}
|
68 |
+
|
69 |
+
public function uploadViaFtp($file=''){
|
70 |
+
if(!strlen(Mage::getStoreConfig('nowshop/ftp/host')) || !strlen(Mage::getStoreConfig('nowshop/ftp/username')) || !strlen(Mage::getStoreConfig('nowshop/ftp/password'))){
|
71 |
+
return false;
|
72 |
+
}
|
73 |
+
$ftp_server = Mage::getStoreConfig('nowshop/ftp/host');
|
74 |
+
$ftp_user_name = Mage::getStoreConfig('nowshop/ftp/username');
|
75 |
+
$ftp_user_pass = Mage::getStoreConfig('nowshop/ftp/password');
|
76 |
+
$remote_file_name = basename($file);
|
77 |
+
|
78 |
+
|
79 |
+
/* set up basic connection */
|
80 |
+
$conn_id = ftp_connect($ftp_server);
|
81 |
+
|
82 |
+
/* login with username and password */
|
83 |
+
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
|
84 |
+
|
85 |
+
/* upload a file */
|
86 |
+
/* Initiate */
|
87 |
+
$ret = ftp_nb_put($conn_id, $remote_file_name, $file, FTP_BINARY, ftp_size($remote_file_name));
|
88 |
+
|
89 |
+
while ($ret == FTP_MOREDATA) {
|
90 |
+
/* Continue uploading... */
|
91 |
+
$ret = ftp_nb_continue($conn_id);
|
92 |
+
}
|
93 |
+
if ($ret != FTP_FINISHED) {
|
94 |
+
ftp_close($conn_id);
|
95 |
+
return false;
|
96 |
+
}else{
|
97 |
+
ftp_close($conn_id);
|
98 |
+
return true;
|
99 |
+
}
|
100 |
+
}
|
101 |
+
}
|
app/code/community/NowShop/Synchronize/Model/Cfeed.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* NowShop
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENS
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category NowShop
|
17 |
+
* @package NowShop_Synchronize
|
18 |
+
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
19 |
+
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
|
23 |
+
/**
|
24 |
+
* NowShop Category Feed model
|
25 |
+
*/
|
26 |
+
|
27 |
+
class NowShop_Synchronize_Model_Cfeed extends Mage_Core_Model_Abstract{
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Initialize resource model
|
31 |
+
*/
|
32 |
+
protected function _construct()
|
33 |
+
{
|
34 |
+
$this->_init('nowshop/cfeed');
|
35 |
+
}
|
36 |
+
}
|
app/code/community/NowShop/Synchronize/Model/Feed.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* NowShop
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENS
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category NowShop
|
17 |
+
* @package NowShop_Synchronize
|
18 |
+
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
19 |
+
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
|
23 |
+
/**
|
24 |
+
* NowShop Feed model
|
25 |
+
*/
|
26 |
+
|
27 |
+
class NowShop_Synchronize_Model_Feed extends Mage_Core_Model_Abstract{
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Initialize resource model
|
31 |
+
*/
|
32 |
+
protected function _construct()
|
33 |
+
{
|
34 |
+
$this->_init('nowshop/feed');
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Load report by Product Id
|
39 |
+
*
|
40 |
+
* @return NowShop_Synchronize_Model_Feed
|
41 |
+
*/
|
42 |
+
public function loadByProductId($productId)
|
43 |
+
{
|
44 |
+
$this->getResource()->loadByProductId($this, $productId);
|
45 |
+
return $this;
|
46 |
+
}
|
47 |
+
|
48 |
+
}
|
app/code/community/NowShop/Synchronize/Model/Mysql4/Cfeed.php
ADDED
@@ -0,0 +1 @@
|
|
|
|
0 |
* NowShop
|
1 |
*
|
2 |
* NOTICE OF LICENS
|
3 |
*
|
4 |
* This source file is subject to the Open Software License (OSL 3.0)
|
5 |
* that is bundled with this package in the file LICENSE.txt.
|
6 |
* It is also available through the world-wide-web at this URL:
|
7 |
* http://opensource.org/licenses/osl-3.0.php
|
8 |
* If you did not receive a copy of the license and are unable to
|
9 |
* obtain it through the world-wide-web, please send an email
|
10 |
* to support@nowshop.com so we can send you a copy immediately.
|
11 |
*
|
12 |
* @category NowShop
|
13 |
* @package NowShop_Synchronize
|
14 |
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
15 |
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
16 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
*/
|
18 |
|
19 |
* NowShop Mysql4 Category Feed model
|
20 |
*/
|
21 |
|
1 |
+
<?php
|
2 |
* NowShop
|
3 |
*
|
4 |
* NOTICE OF LICENS
|
5 |
*
|
6 |
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
* that is bundled with this package in the file LICENSE.txt.
|
8 |
* It is also available through the world-wide-web at this URL:
|
9 |
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
13 |
*
|
14 |
* @category NowShop
|
15 |
* @package NowShop_Synchronize
|
16 |
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
17 |
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
21 |
* NowShop Mysql4 Category Feed model
|
22 |
*/
|
23 |
|
app/code/community/NowShop/Synchronize/Model/Mysql4/Cfeed/Collection.php
ADDED
@@ -0,0 +1 @@
|
|
|
|
0 |
* NowShop
|
1 |
*
|
2 |
* NOTICE OF LICENS
|
3 |
*
|
4 |
* This source file is subject to the Open Software License (OSL 3.0)
|
5 |
* that is bundled with this package in the file LICENSE.txt.
|
6 |
* It is also available through the world-wide-web at this URL:
|
7 |
* http://opensource.org/licenses/osl-3.0.php
|
8 |
* If you did not receive a copy of the license and are unable to
|
9 |
* obtain it through the world-wide-web, please send an email
|
10 |
* to support@nowshop.com so we can send you a copy immediately.
|
11 |
*
|
12 |
* @category NowShop
|
13 |
* @package NowShop_Synchronize
|
14 |
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
15 |
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
16 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
*/
|
18 |
|
19 |
* NowShop Category Feed Collection model
|
20 |
*/
|
21 |
|
22 |
protected function _construct()
|
23 |
{
|
24 |
$this->_init('nowshop/cfeed');
|
25 |
}
|
1 |
+
<?php
|
2 |
* NowShop
|
3 |
*
|
4 |
* NOTICE OF LICENS
|
5 |
*
|
6 |
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
* that is bundled with this package in the file LICENSE.txt.
|
8 |
* It is also available through the world-wide-web at this URL:
|
9 |
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
13 |
*
|
14 |
* @category NowShop
|
15 |
* @package NowShop_Synchronize
|
16 |
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
17 |
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
21 |
* NowShop Category Feed Collection model
|
22 |
*/
|
23 |
|
24 |
protected function _construct()
|
25 |
{
|
26 |
$this->_init('nowshop/cfeed');
|
27 |
}
|
app/code/community/NowShop/Synchronize/Model/Mysql4/Feed.php
ADDED
@@ -0,0 +1 @@
|
|
|
|
0 |
* NowShop
|
1 |
*
|
2 |
* NOTICE OF LICENS
|
3 |
*
|
4 |
* This source file is subject to the Open Software License (OSL 3.0)
|
5 |
* that is bundled with this package in the file LICENSE.txt.
|
6 |
* It is also available through the world-wide-web at this URL:
|
7 |
* http://opensource.org/licenses/osl-3.0.php
|
8 |
* If you did not receive a copy of the license and are unable to
|
9 |
* obtain it through the world-wide-web, please send an email
|
10 |
* to support@nowshop.com so we can send you a copy immediately.
|
11 |
*
|
12 |
* @category NowShop
|
13 |
* @package NowShop_Synchronize
|
14 |
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
15 |
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
16 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
*/
|
18 |
|
19 |
* NowShop Mysql4 Feed model
|
20 |
*/
|
21 |
|
22 |
*
|
23 |
* @param NowShop_Synchronize_Model_Feed $report
|
24 |
* @param string $orderId
|
25 |
* @param string $reportDate
|
26 |
* @return Mage_Paypal_Model_Resource_Report_Settlement
|
27 |
*/
|
28 |
public function loadByProductId(Ced_LayBuy_Model_Report $feed, $product_id)
|
29 |
{
|
30 |
$adapter = $this->_getReadAdapter();
|
31 |
$select = $adapter->select()
|
32 |
->from($this->getMainTable())
|
33 |
->where("product_id = :product_id AND status='1'");
|
34 |
$data = $adapter->fetchRow($select, array(':product_id' => $product_id));
|
35 |
if ($data) {
|
36 |
$feed->addData($data);
|
37 |
}
|
38 |
return $this;
|
39 |
}
|
1 |
+
<?php
|
2 |
* NowShop
|
3 |
*
|
4 |
* NOTICE OF LICENS
|
5 |
*
|
6 |
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
* that is bundled with this package in the file LICENSE.txt.
|
8 |
* It is also available through the world-wide-web at this URL:
|
9 |
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
13 |
*
|
14 |
* @category NowShop
|
15 |
* @package NowShop_Synchronize
|
16 |
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
17 |
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
21 |
* NowShop Mysql4 Feed model
|
22 |
*/
|
23 |
|
24 |
*
|
25 |
* @param NowShop_Synchronize_Model_Feed $report
|
26 |
* @param string $orderId
|
27 |
* @param string $reportDate
|
28 |
* @return Mage_Paypal_Model_Resource_Report_Settlement
|
29 |
*/
|
30 |
public function loadByProductId(Ced_LayBuy_Model_Report $feed, $product_id)
|
31 |
{
|
32 |
$adapter = $this->_getReadAdapter();
|
33 |
$select = $adapter->select()
|
34 |
->from($this->getMainTable())
|
35 |
->where("product_id = :product_id AND status='1'");
|
36 |
$data = $adapter->fetchRow($select, array(':product_id' => $product_id));
|
37 |
if ($data) {
|
38 |
$feed->addData($data);
|
39 |
}
|
40 |
return $this;
|
41 |
}
|
app/code/community/NowShop/Synchronize/Model/Mysql4/Feed/Collection.php
ADDED
@@ -0,0 +1 @@
|
|
|
|
0 |
* NowShop
|
1 |
*
|
2 |
* NOTICE OF LICENS
|
3 |
*
|
4 |
* This source file is subject to the Open Software License (OSL 3.0)
|
5 |
* that is bundled with this package in the file LICENSE.txt.
|
6 |
* It is also available through the world-wide-web at this URL:
|
7 |
* http://opensource.org/licenses/osl-3.0.php
|
8 |
* If you did not receive a copy of the license and are unable to
|
9 |
* obtain it through the world-wide-web, please send an email
|
10 |
* to support@nowshop.com so we can send you a copy immediately.
|
11 |
*
|
12 |
* @category NowShop
|
13 |
* @package NowShop_Synchronize
|
14 |
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
15 |
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
16 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
*/
|
18 |
|
19 |
* NowShop Feed Collection model
|
20 |
*/
|
21 |
|
22 |
protected function _construct()
|
23 |
{
|
24 |
$this->_init('nowshop/feed');
|
25 |
}
|
1 |
+
<?php
|
2 |
* NowShop
|
3 |
*
|
4 |
* NOTICE OF LICENS
|
5 |
*
|
6 |
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
* that is bundled with this package in the file LICENSE.txt.
|
8 |
* It is also available through the world-wide-web at this URL:
|
9 |
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
13 |
*
|
14 |
* @category NowShop
|
15 |
* @package NowShop_Synchronize
|
16 |
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
17 |
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
21 |
* NowShop Feed Collection model
|
22 |
*/
|
23 |
|
24 |
protected function _construct()
|
25 |
{
|
26 |
$this->_init('nowshop/feed');
|
27 |
}
|
app/code/community/NowShop/Synchronize/Model/Mysql4/Setup.php
ADDED
@@ -0,0 +1 @@
|
|
|
|
0 |
* NowShop
|
1 |
*
|
2 |
* NOTICE OF LICENS
|
3 |
*
|
4 |
* This source file is subject to the Open Software License (OSL 3.0)
|
5 |
* that is bundled with this package in the file LICENSE.txt.
|
6 |
* It is also available through the world-wide-web at this URL:
|
7 |
* http://opensource.org/licenses/osl-3.0.php
|
8 |
* If you did not receive a copy of the license and are unable to
|
9 |
* obtain it through the world-wide-web, please send an email
|
10 |
* to support@nowshop.com so we can send you a copy immediately.
|
11 |
*
|
12 |
* @category NowShop
|
13 |
* @package NowShop_Synchronize
|
14 |
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
15 |
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
16 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
*/
|
18 |
|
19 |
* NowShop Mysql4 Setup model
|
20 |
*/
|
21 |
|
1 |
+
<?php
|
2 |
* NowShop
|
3 |
*
|
4 |
* NOTICE OF LICENS
|
5 |
*
|
6 |
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
* that is bundled with this package in the file LICENSE.txt.
|
8 |
* It is also available through the world-wide-web at this URL:
|
9 |
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
13 |
*
|
14 |
* @category NowShop
|
15 |
* @package NowShop_Synchronize
|
16 |
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
17 |
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
21 |
* NowShop Mysql4 Setup model
|
22 |
*/
|
23 |
|
app/code/community/NowShop/Synchronize/Model/System/Config/Source/Brand.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* NowShop
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENS
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category NowShop
|
17 |
+
* @package NowShop_Synchronize
|
18 |
+
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
19 |
+
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
|
23 |
+
class NowShop_Synchronize_Model_System_Config_Source_Brand
|
24 |
+
{
|
25 |
+
const BY_DEFAULT_BRAND = 'retailer_store_name';
|
26 |
+
/**
|
27 |
+
* Options getter
|
28 |
+
*
|
29 |
+
* @return array
|
30 |
+
*/
|
31 |
+
public function toOptionArray($empty = false)
|
32 |
+
{
|
33 |
+
$option = array();
|
34 |
+
$attributes = Mage::getSingleton('eav/config')
|
35 |
+
->getEntityType(Mage_Catalog_Model_Product::ENTITY)
|
36 |
+
->getAttributeCollection();
|
37 |
+
if($store = Mage::app()->getRequest()->getParam('store')){
|
38 |
+
$storename = Mage::getStoreConfig('general/store_information/name',$store);
|
39 |
+
}else{
|
40 |
+
$storename = Mage::getStoreConfig('general/store_information/name');
|
41 |
+
}
|
42 |
+
$option[] = array('value'=>self::BY_DEFAULT_BRAND,'label'=>$storename);
|
43 |
+
if(count($attributes)>0){
|
44 |
+
foreach ($attributes as $attribute) {
|
45 |
+
/* print_r($attribute->getData());die; */
|
46 |
+
if(strlen($attribute->getData('frontend_label')))
|
47 |
+
$option[] = array('value'=>$attribute->getData('attribute_code'),'label'=>Mage::helper('catalog')->__('%s',$attribute->getData('frontend_label')));
|
48 |
+
}
|
49 |
+
}
|
50 |
+
return $option;
|
51 |
+
/* return array(
|
52 |
+
array('value' => self::EZ, 'label' => Mage::helper('nowshop')->__('Eurozone')),
|
53 |
+
array('value' => self::DK, 'label' => Mage::helper('nowshop')->__('Denmark')),
|
54 |
+
array('value' => self::NO, 'label' => Mage::helper('nowshop')->__('Nowrway')),
|
55 |
+
array('value' => self::SE, 'label' => Mage::helper('nowshop')->__('Sweden')),
|
56 |
+
array('value' => self::GB, 'label' => Mage::helper('nowshop')->__('United Kingdom')),
|
57 |
+
); */
|
58 |
+
}
|
59 |
+
}
|
app/code/community/NowShop/Synchronize/Model/System/Config/Source/Isocode.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* NowShop
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENS
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category NowShop
|
17 |
+
* @package NowShop_Synchronize
|
18 |
+
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
19 |
+
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
|
23 |
+
class NowShop_Synchronize_Model_System_Config_Source_Isocode
|
24 |
+
{
|
25 |
+
const EZ = 'EZ';
|
26 |
+
const DK = 'DK';
|
27 |
+
const GB = 'GB';
|
28 |
+
const NO = 'NO';
|
29 |
+
const SE = 'SE';
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Options getter
|
33 |
+
*
|
34 |
+
* @return array
|
35 |
+
*/
|
36 |
+
public function toOptionArray($empty = false)
|
37 |
+
{
|
38 |
+
return array(
|
39 |
+
array('value' => self::EZ, 'label' => Mage::helper('nowshop')->__('Eurozone')),
|
40 |
+
array('value' => self::DK, 'label' => Mage::helper('nowshop')->__('Denmark')),
|
41 |
+
array('value' => self::NO, 'label' => Mage::helper('nowshop')->__('Nowrway')),
|
42 |
+
array('value' => self::SE, 'label' => Mage::helper('nowshop')->__('Sweden')),
|
43 |
+
array('value' => self::GB, 'label' => Mage::helper('nowshop')->__('United Kingdom')),
|
44 |
+
);
|
45 |
+
}
|
46 |
+
}
|
app/code/community/NowShop/Synchronize/controllers/Adminhtml/CategoryfeedController.php
ADDED
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* NowShop
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENS
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category NowShop
|
17 |
+
* @package NowShop_Synchronize
|
18 |
+
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
19 |
+
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
|
23 |
+
class NowShop_Synchronize_Adminhtml_CategoryfeedController extends Mage_Adminhtml_Controller_Action {
|
24 |
+
|
25 |
+
protected $_ndebug = null;
|
26 |
+
protected $_tmpCatg = array();
|
27 |
+
protected $_cfeedData = array();
|
28 |
+
/**
|
29 |
+
* Initialize titles, navigation
|
30 |
+
* @return NowShop_Synchronize_Adminhtml_ProductFeedController
|
31 |
+
*/
|
32 |
+
protected function _initAction()
|
33 |
+
{
|
34 |
+
$this->_title($this->__('Sell On NowShop'));
|
35 |
+
$this->loadLayout()
|
36 |
+
->_setActiveMenu('nowshop')
|
37 |
+
->_addBreadcrumb($this->__('Sell On NowShop'),$this->__('Sell On NowShop'));
|
38 |
+
return $this;
|
39 |
+
}
|
40 |
+
|
41 |
+
public function indexAction(){
|
42 |
+
|
43 |
+
$this->_initAction();
|
44 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
45 |
+
$this->renderLayout();
|
46 |
+
}
|
47 |
+
|
48 |
+
public function saveAction(){
|
49 |
+
|
50 |
+
$this->_ndebug = Mage::getStoreConfig('nowshop/setting/debug');
|
51 |
+
$categoryIds = array_unique(explode(',',trim($this->getRequest()->getParam('category_ids'),',')));
|
52 |
+
$this->_tmpCatg = $categoryIds;
|
53 |
+
if(!is_array($categoryIds)) {
|
54 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select category(s)'));
|
55 |
+
} else {
|
56 |
+
try {
|
57 |
+
if(count($categoryIds)){
|
58 |
+
$data = array();
|
59 |
+
$this->_cfeedData = array();
|
60 |
+
$category = Mage::getModel('catalog/category');
|
61 |
+
$tree = $category->getTreeModel();
|
62 |
+
$tree->load();
|
63 |
+
$ids = $tree->getCollection()->getAllIds();
|
64 |
+
foreach($ids as $categoryId){
|
65 |
+
if(count($this->_tmpCatg)>0 && in_array($categoryId,$this->_tmpCatg)){
|
66 |
+
$this->_tmpCatg = array_diff($this->_tmpCatg,array($categoryId));
|
67 |
+
$this->_cfeedData[] = array('category_id'=>$categoryId,'status'=>1, 'updated_at'=>date('Y-m-d h:i:s',time()));
|
68 |
+
$category = Mage::getModel('catalog/category')->load($categoryId);
|
69 |
+
$info = $this->generateChildren($category,$categoryIds);
|
70 |
+
$data['category'][] = $info;
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
+
$xml = NowShop_Synchronize_Helper_Arraytoxml::createXML('categories', $data);
|
75 |
+
|
76 |
+
$arraytoxml = Mage::helper('nowshop/arraytoxml');
|
77 |
+
|
78 |
+
$diff = 0;
|
79 |
+
$fileName = $arraytoxml->formatedFileName('category',$diff);
|
80 |
+
if($xml->save($fileName) && $this->setListed($fileName,$this->_cfeedData)){
|
81 |
+
$this->_getSession()->addSuccess(
|
82 |
+
$this->__('Total of %d category(s) were successfully queued for listing on NowShop.', count($categoryIds))
|
83 |
+
);
|
84 |
+
$this->_getSession()->addSuccess(
|
85 |
+
$this->__("It will take atmost one day to list.").'To See Feed Click <a target="_blank" href="'.Mage::getBaseUrl('media',array('_secure'=>true)).'nowshop/categoryfeed/'.basename($fileName).'">Here</a>'
|
86 |
+
);
|
87 |
+
}else{
|
88 |
+
$this->_getSession()->addError(
|
89 |
+
$this->__('Total of %d category(s) were failed to queued.Please try again later', count($categoryIds))
|
90 |
+
);
|
91 |
+
}
|
92 |
+
|
93 |
+
}else{
|
94 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Selected item(s) are already in feed.Please try different categorys.'));
|
95 |
+
}
|
96 |
+
|
97 |
+
} catch (Exception $e) {
|
98 |
+
if($this->_ndebug){
|
99 |
+
$this->_getSession()->addError($e->getMessage());
|
100 |
+
}else{
|
101 |
+
$this->_getSession()->addError('Error in processing.');
|
102 |
+
}
|
103 |
+
}
|
104 |
+
}
|
105 |
+
$this->_redirect('*/*/index',array('_secure'=>true));
|
106 |
+
}
|
107 |
+
|
108 |
+
public function categoriesJsonAction()
|
109 |
+
{
|
110 |
+
$this->getResponse()->setBody(
|
111 |
+
$this->getLayout()->createBlock('nowshop/adminhtml_feed_categories')
|
112 |
+
->getCategoryChildrenJson($this->getRequest()->getParam('category'))
|
113 |
+
);
|
114 |
+
}
|
115 |
+
|
116 |
+
public function gridAction()
|
117 |
+
{
|
118 |
+
$this->loadLayout();
|
119 |
+
$this->renderLayout();
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* ACL check
|
124 |
+
* @return bool
|
125 |
+
*/
|
126 |
+
protected function _isAllowed()
|
127 |
+
{
|
128 |
+
switch ($this->getRequest()->getActionName()) {
|
129 |
+
case 'index':
|
130 |
+
case 'grid':
|
131 |
+
return Mage::getSingleton('admin/session')->isAllowed('nowshop/categoryfeed/view');
|
132 |
+
break;
|
133 |
+
case 'save':
|
134 |
+
return Mage::getSingleton('admin/session')->isAllowed('nowshop/categoryfeed/list');
|
135 |
+
break;
|
136 |
+
default:
|
137 |
+
return Mage::getSingleton('admin/session')->isAllowed('nowshop/categoryfeed');
|
138 |
+
break;
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
protected function setListed($fileName,$cfeedData = array()){
|
143 |
+
if(Mage::helper('nowshop')->uploadViaFtp($fileName)){
|
144 |
+
$coreResource = Mage::getSingleton('core/resource');
|
145 |
+
$cfeedTable = $coreResource->getTableName('nowshop/cfeed');
|
146 |
+
$conn = $coreResource->getConnection('write');
|
147 |
+
if($conn->query('TRUNCATE TABLE `'.$cfeedTable.'`') && $conn->insertMultiple($cfeedTable, $cfeedData))
|
148 |
+
return true;
|
149 |
+
}
|
150 |
+
return false;
|
151 |
+
}
|
152 |
+
|
153 |
+
|
154 |
+
protected function generateChildren($category,$categoryIds = array()){
|
155 |
+
$info = array(
|
156 |
+
'id' => $category->getId(),
|
157 |
+
'name' => $category->getName()
|
158 |
+
);
|
159 |
+
if($category->hasChildren()) {
|
160 |
+
$children = array();
|
161 |
+
$children = explode(',',$category->getChildren());
|
162 |
+
if(count($children)>0){
|
163 |
+
foreach($children as $child){
|
164 |
+
$child = Mage::getModel('catalog/category')->load($child);
|
165 |
+
if(is_object($child) && $child->getId() && in_array($child->getId(),$categoryIds)){
|
166 |
+
$this->_tmpCatg = array_diff($this->_tmpCatg,array($child->getId()));
|
167 |
+
$this->_cfeedData[] = array('category_id'=>$child->getId(),'status'=>1, 'updated_at'=>date('Y-m-d h:i:s',time()));
|
168 |
+
$cinfo[] = $this->generateChildren($child,$categoryIds);
|
169 |
+
}
|
170 |
+
}
|
171 |
+
if(count($cinfo))
|
172 |
+
$info['children']['category'] = $cinfo;
|
173 |
+
}
|
174 |
+
}
|
175 |
+
return $info;
|
176 |
+
}
|
177 |
+
}
|
178 |
+
?>
|
app/code/community/NowShop/Synchronize/controllers/Adminhtml/ProductfeedController.php
ADDED
@@ -0,0 +1,417 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* NowShop
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENS
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category NowShop
|
17 |
+
* @package NowShop_Synchronize
|
18 |
+
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
19 |
+
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
|
23 |
+
class NowShop_Synchronize_Adminhtml_ProductfeedController extends Mage_Adminhtml_Controller_Action {
|
24 |
+
|
25 |
+
const EXCULDED_ATTRIBUTES = 'name,description,price,short_description,sku,special_price,fixed_special_price,image,small_image,thumbnail,media_gallery,options_container';
|
26 |
+
protected $_ndebug = null;
|
27 |
+
/**
|
28 |
+
* Initialize titles, navigation
|
29 |
+
* @return NowShop_Synchronize_Adminhtml_ProductFeedController
|
30 |
+
*/
|
31 |
+
protected function _initAction()
|
32 |
+
{
|
33 |
+
$this->_title($this->__('Sell On NowShop'));
|
34 |
+
$this->loadLayout()
|
35 |
+
->_setActiveMenu('nowshop')
|
36 |
+
->_addBreadcrumb($this->__('Sell On NowShop'),$this->__('Sell On NowShop'));
|
37 |
+
return $this;
|
38 |
+
}
|
39 |
+
|
40 |
+
public function indexAction(){
|
41 |
+
$this->_initAction()
|
42 |
+
->renderLayout();
|
43 |
+
}
|
44 |
+
|
45 |
+
public function gridAction()
|
46 |
+
{
|
47 |
+
$this->loadLayout();
|
48 |
+
$this->renderLayout();
|
49 |
+
}
|
50 |
+
|
51 |
+
public function massStatusAction()
|
52 |
+
{
|
53 |
+
$this->_ndebug = Mage::getStoreConfig('nowshop/setting/debug');
|
54 |
+
$productIds = $this->getRequest()->getParam('product');
|
55 |
+
if(!is_array($productIds)) {
|
56 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
|
57 |
+
} else {
|
58 |
+
try {
|
59 |
+
|
60 |
+
$feed = Mage::getModel('nowshop/feed')->getCollection()
|
61 |
+
->addFieldToFilter('product_id',array('in'=>$productIds));
|
62 |
+
$feed->getSelect()->columns(
|
63 |
+
array('product_ids' => new Zend_Db_Expr(
|
64 |
+
"IFNULL(GROUP_CONCAT(DISTINCT main_table.product_id SEPARATOR ','), '')"
|
65 |
+
)));
|
66 |
+
$feed = $feed->getFirstItem()->load()->getData('product_ids');
|
67 |
+
$feed = explode(',',$feed);
|
68 |
+
$relistedIds = array_intersect($productIds,$feed);
|
69 |
+
/* $productIds = array_diff($productIds,$feed); */
|
70 |
+
|
71 |
+
$allowedCategoryIds = Mage::getModel('nowshop/cfeed')->getCollection()->addFieldToFilter('status',1);
|
72 |
+
$allowedCategoryIds->getSelect()->columns(
|
73 |
+
array('category_ids' => new Zend_Db_Expr(
|
74 |
+
"IFNULL(GROUP_CONCAT(DISTINCT main_table.category_id SEPARATOR ','), '')"
|
75 |
+
)));
|
76 |
+
$allowedCategoryIds = $allowedCategoryIds->getFirstItem()->load()->getData('category_ids');
|
77 |
+
$allowedCategoryIds = explode(',',$allowedCategoryIds);
|
78 |
+
|
79 |
+
if($this->getRequest()->getParam('onnowshop') == 'add' || $this->getRequest()->getParam('onnowshop') == 'adds'){
|
80 |
+
|
81 |
+
$loadedcollection = $this->getLayout()->getBlockSingleton("nowshop/adminhtml_feed_grid")->manualInit();
|
82 |
+
$store = $loadedcollection->getStore();
|
83 |
+
$currency = $store->getBaseCurrency()->getCode();
|
84 |
+
$taxHelper = Mage::helper('tax');
|
85 |
+
$isvatincluded = (int)$taxHelper->priceIncludesTax();
|
86 |
+
$baseurl = Mage::getBaseUrl();
|
87 |
+
$helper = Mage::helper('nowshop');
|
88 |
+
$brand = '';
|
89 |
+
$brandAttr = Mage::getStoreConfig('nowshop/productfeed/brand',$store);
|
90 |
+
if($brandAttr == NowShop_Synchronize_Model_System_Config_Source_Brand::BY_DEFAULT_BRAND){
|
91 |
+
$brand = Mage::getStoreConfig('general/store_information/name',$store);
|
92 |
+
}
|
93 |
+
$minDay = Mage::getStoreConfig('nowshop/productfeed/min',$store->getId());
|
94 |
+
$maxDay = Mage::getStoreConfig('nowshop/productfeed/max',$store->getId());
|
95 |
+
if(count($productIds)){
|
96 |
+
$data = array();
|
97 |
+
$infoData = array();
|
98 |
+
$feedData = array();
|
99 |
+
$existProductCollection = Mage::getModel('nowshop/feed')->getCollection()
|
100 |
+
->addFieldToSelect('product_xml_data')
|
101 |
+
->addFieldToFilter('product_id',array('nin'=>$relistedIds))
|
102 |
+
->addFieldToFilter('status',array('eq'=>1));
|
103 |
+
foreach($existProductCollection as $existProduct){
|
104 |
+
$data['product'][] = json_decode($existProduct->getData('product_xml_data'),true);
|
105 |
+
}
|
106 |
+
|
107 |
+
foreach($productIds as $productId){
|
108 |
+
|
109 |
+
$product = Mage::getModel('catalog/product')->load($productId);
|
110 |
+
$brandValue = '';
|
111 |
+
if($product->getStatus()==1){
|
112 |
+
$stockItem = $product->getStockItem();
|
113 |
+
$allowedQty = Mage::getStoreConfig('nowshop/productfeed/qty',$store->getId());
|
114 |
+
if($allowedQty >= 0){
|
115 |
+
$qty = (int)$allowedQty;
|
116 |
+
}else{
|
117 |
+
$qty = (int)$stockItem->getQty();
|
118 |
+
}
|
119 |
+
$info = array(
|
120 |
+
'sku' => $product->getSku(),
|
121 |
+
'type' => $helper->getAttribute('type',$product->getTypeId()),
|
122 |
+
'title' => $product->getName(),
|
123 |
+
'description' => array('@cdata'=>$helper->getAttribute('description',$product->getDescription())),
|
124 |
+
'url' => $baseurl.$product->getUrlPath(),
|
125 |
+
);
|
126 |
+
if(strlen($brand)){
|
127 |
+
$info['brand'] = $brand;
|
128 |
+
}elseif(strlen($brandAttr) && $brandValue = $product->getData($brandAttr)){
|
129 |
+
$info['brand'] = $brandValue;
|
130 |
+
}else{
|
131 |
+
$info['brand'] = Mage::getStoreConfig('general/store_information/name',$store);
|
132 |
+
}
|
133 |
+
|
134 |
+
if($product->getWeight())
|
135 |
+
$info['weight'] = $product->getWeight();
|
136 |
+
|
137 |
+
|
138 |
+
$info['shipping'] = array(
|
139 |
+
'@attributes' => array(
|
140 |
+
'min' => (int)$minDay,
|
141 |
+
'max' => (int)$maxDay,
|
142 |
+
)
|
143 |
+
);
|
144 |
+
|
145 |
+
if($product->getData('ean'))
|
146 |
+
$info['ean'] = $product->getData('ean');
|
147 |
+
if($product->getData('isbn10'))
|
148 |
+
$info['isbn10'] = $product->getData('isbn10');
|
149 |
+
if($product->getData('isbn13'))
|
150 |
+
$info['isbn13'] = $product->getData('isbn13');
|
151 |
+
$info['pricing'] = array(
|
152 |
+
'@attributes' => array(
|
153 |
+
'currency' => $currency,
|
154 |
+
'isvatincluded' => $isvatincluded,
|
155 |
+
),
|
156 |
+
'price' => $product->getFinalPrice(),
|
157 |
+
'originalprice' => $product->getPrice(),
|
158 |
+
);
|
159 |
+
if($info['type']!='master'){
|
160 |
+
$info['stock'] = array('quantity'=> $qty * $stockItem->getIsInStock());
|
161 |
+
$info['stock']['enablestocklimitation'] = $stockItem->getManageStock();
|
162 |
+
}else{
|
163 |
+
$info['stock'] = array('quantity'=> '1');
|
164 |
+
}
|
165 |
+
if($images = $product->getMediaGalleryImages()){
|
166 |
+
foreach($images as $image){
|
167 |
+
$info['images']['image'][] = array('@attributes' =>
|
168 |
+
array('url' => $image->getUrl())
|
169 |
+
);
|
170 |
+
}
|
171 |
+
}
|
172 |
+
$parents = array();
|
173 |
+
$variant = array();
|
174 |
+
$variants = array();
|
175 |
+
if($info['type']=='simple'){
|
176 |
+
$parents = $this->getParent($product->getId());
|
177 |
+
if(count($parents)>0){
|
178 |
+
$info['type'] = 'variant';
|
179 |
+
$parentsku = array();
|
180 |
+
$parentsku = $this->getParent($product->getId(),'sku');
|
181 |
+
$info['parentsku'] = $parentsku['sku'];
|
182 |
+
$variants = $this->getOptions($product, $parents);
|
183 |
+
}
|
184 |
+
}elseif($info['type']=='master'){
|
185 |
+
$variants = $this->getOptions($product);
|
186 |
+
}
|
187 |
+
if(count($variants)>0){
|
188 |
+
foreach($variants as $name=>$value){
|
189 |
+
if($value!=''){
|
190 |
+
$variant[] = array('@attributes' => array(
|
191 |
+
'name' => $name,
|
192 |
+
),
|
193 |
+
'@value' => $value,
|
194 |
+
);
|
195 |
+
}else{
|
196 |
+
$variant[] = array('@attributes' => array(
|
197 |
+
'name' => $name,
|
198 |
+
),
|
199 |
+
);
|
200 |
+
}
|
201 |
+
}
|
202 |
+
$info['variants']['variant'] = $variant;
|
203 |
+
}
|
204 |
+
$attributes = $this->attributes($product->getAttributeSetId());
|
205 |
+
|
206 |
+
foreach($attributes as $attribute){
|
207 |
+
if(!in_array($attribute->getData('attribute_code'),$EXCULDED_ATTRIBUTES) && ($value = $product->getData($attribute->getData('attribute_code'))) && $attribute->getData('frontend_label')){
|
208 |
+
$info['attributes']['attribute'][] = array('@attributes' => array(
|
209 |
+
'name' => $attribute->getData('frontend_label'),
|
210 |
+
),
|
211 |
+
'@value'=> $helper->getAttribute('description',$value),
|
212 |
+
);
|
213 |
+
}
|
214 |
+
}
|
215 |
+
if($categoryIds = $product->getCategoryIds()){
|
216 |
+
foreach($categoryIds as $id){
|
217 |
+
if(in_array($id,$allowedCategoryIds)){
|
218 |
+
$info['categories']['category'][] = array('@attributes' => array(
|
219 |
+
'id' => $id,
|
220 |
+
),
|
221 |
+
);
|
222 |
+
}
|
223 |
+
}
|
224 |
+
}
|
225 |
+
if(!in_array($productId,$relistedIds)){
|
226 |
+
$feedData[] = array('product_id'=>$productId,'status'=>1, 'updated_at'=>date('Y-m-d H:i:s',time()), 'product_xml_data'=>json_encode($info));
|
227 |
+
} else {
|
228 |
+
$infoData[$product->getId()] = json_encode($info);
|
229 |
+
}
|
230 |
+
|
231 |
+
$data['product'][] = $info;
|
232 |
+
}else{
|
233 |
+
$relistedIds = array_values(array_diff($relistedIds,array($product->getId())));
|
234 |
+
$productIds = array_values(array_diff($productIds,array($product->getId())));
|
235 |
+
}
|
236 |
+
}
|
237 |
+
|
238 |
+
$xml = NowShop_Synchronize_Helper_Arraytoxml::createXML('products', $data);
|
239 |
+
|
240 |
+
$arraytoxml = Mage::helper('nowshop/arraytoxml');
|
241 |
+
$schema = $arraytoxml->getSchema();
|
242 |
+
if($xml->schemaValidate($schema)){
|
243 |
+
$diff = 0;
|
244 |
+
$fileName = $arraytoxml->formatedFileName('product',$diff);
|
245 |
+
if($xml->save($fileName) && $this->setListed($fileName,$feedData) && $this->setReListed($relistedIds,$infoData)){
|
246 |
+
if($this->getRequest()->getParam('onnowshop') == 'adds'){
|
247 |
+
echo $this->__('Total of %d product(s) were successfully queued for listing on NowShop.', count($productIds)).'<br/>';
|
248 |
+
echo $this->__("It will take atmost one day to list.");
|
249 |
+
echo '<a href="'.Mage::helper('adminhtml')->getUrl('*/*/index',array('_secure'=>true)).'">Return to Admin</a><br/>';
|
250 |
+
echo '<iframe src="'.Mage::getBaseUrl('media',array('_secure'=>true)).'nowshop/productfeed/'.basename($fileName).'"></iframe>';
|
251 |
+
}else{
|
252 |
+
$this->_getSession()->addSuccess(
|
253 |
+
$this->__('Total of %d product(s) were successfully queued for listing on NowShop.', count($productIds))
|
254 |
+
);
|
255 |
+
$this->_getSession()->addSuccess(
|
256 |
+
$this->__("It will take atmost one day to list.").'To See Feed Click <a target="_blank" href="'.Mage::getBaseUrl('media',array('_secure'=>true)).'nowshop/productfeed/'.basename($fileName).'">Here</a>'
|
257 |
+
);
|
258 |
+
}
|
259 |
+
}else{
|
260 |
+
$this->_getSession()->addError(
|
261 |
+
$this->__('Total of %d product(s) were failed to queued.Please try again later', count($productIds))
|
262 |
+
);
|
263 |
+
}
|
264 |
+
}else{
|
265 |
+
$this->_getSession()->addError(
|
266 |
+
$this->__('Total of %d product(s) were failed to queued.', count($productIds))
|
267 |
+
);
|
268 |
+
$this->_getSession()->addError(
|
269 |
+
$this->__('The product feed content must according to <a target="_blank" href="https://nowshop.com/retailer/setup/products">NowShop Product Feed specification</a>')
|
270 |
+
);
|
271 |
+
$this->_getSession()->addError(
|
272 |
+
$this->__('An XML file you export for NowShop must be valid against this <a href="https://nowshop.com/product_feed.xsd">XML Schema</a>')
|
273 |
+
);
|
274 |
+
|
275 |
+
}
|
276 |
+
}else{
|
277 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Selected item(s) are already in feed.Please try different products.'));
|
278 |
+
}
|
279 |
+
}elseif($this->getRequest()->getParam('onnowshop') == 'remove'){
|
280 |
+
/* foreach ($productIds as $id) {
|
281 |
+
$product = Mage::getSingleton('nowshop/feed')
|
282 |
+
->loadByProductId($id)
|
283 |
+
->save();
|
284 |
+
|
285 |
+
} */
|
286 |
+
$this->_getSession()->addSuccess(
|
287 |
+
$this->__('Total of %d product(s) were successfully removed form listing queue.', count($productIds))
|
288 |
+
);
|
289 |
+
}else{
|
290 |
+
$this->_getSession()->addError(
|
291 |
+
$this->__('No action specified.')
|
292 |
+
);
|
293 |
+
}
|
294 |
+
} catch (Exception $e) {
|
295 |
+
if($this->_ndebug){
|
296 |
+
$this->_getSession()->addError($e->getMessage());
|
297 |
+
}else{
|
298 |
+
$this->_getSession()->addError('Error in processing.');
|
299 |
+
}
|
300 |
+
}
|
301 |
+
}
|
302 |
+
if($this->getRequest()->getParam('onnowshop') != 'adds'){
|
303 |
+
$this->_redirect('*/*/index',array('_secure'=>true));
|
304 |
+
}
|
305 |
+
}
|
306 |
+
|
307 |
+
/**
|
308 |
+
* ACL check
|
309 |
+
* @return bool
|
310 |
+
*/
|
311 |
+
protected function _isAllowed()
|
312 |
+
{
|
313 |
+
switch ($this->getRequest()->getActionName()) {
|
314 |
+
case 'index':
|
315 |
+
case 'grid':
|
316 |
+
return Mage::getSingleton('admin/session')->isAllowed('nowshop/productfeed/view');
|
317 |
+
break;
|
318 |
+
case 'massStatus':
|
319 |
+
return Mage::getSingleton('admin/session')->isAllowed('nowshop/productfeed/list');
|
320 |
+
break;
|
321 |
+
default:
|
322 |
+
return Mage::getSingleton('admin/session')->isAllowed('nowshop/productfeed');
|
323 |
+
break;
|
324 |
+
}
|
325 |
+
}
|
326 |
+
|
327 |
+
protected function getParent($productId = 0,$return = 'ids'){
|
328 |
+
$parentIds = array();
|
329 |
+
/* Check configurable */
|
330 |
+
$parentIds = Mage::getResourceSingleton('catalog/product_type_configurable')->getParentIdsByChild($productId);
|
331 |
+
|
332 |
+
/* Check bundle */
|
333 |
+
/* if(count($parentIds)==0){
|
334 |
+
$parentIds = Mage::getModel('bundle/product_type')->getParentIdsByChild($productId);
|
335 |
+
} */
|
336 |
+
|
337 |
+
/* Check grouped */
|
338 |
+
/* if(count($parentIds)==0){
|
339 |
+
$parentIds = Mage::getResourceSingleton('catalog/product_type_grouped')->getParentIdsByChild($productId);
|
340 |
+
} */
|
341 |
+
if($return == 'sku'){
|
342 |
+
$collection = Mage::getModel('catalog/product')->getCollection()
|
343 |
+
->addAttributeToSelect('sku')
|
344 |
+
->addAttributeToFilter('entity_id',$parentIds[0]);
|
345 |
+
$parentIds = $collection->getFirstItem()->getData();
|
346 |
+
}
|
347 |
+
return $parentIds;
|
348 |
+
}
|
349 |
+
|
350 |
+
protected function getOptions($product, $parentIds = array()){
|
351 |
+
$attributeValues = array();
|
352 |
+
if($product->getTypeId()=='simple'){
|
353 |
+
$productType = '';
|
354 |
+
$productId = 0;
|
355 |
+
$parent = array();
|
356 |
+
foreach($parentIds as $id){
|
357 |
+
$parentProduct = Mage::getModel('catalog/product')->load($id);
|
358 |
+
if(1 || $parentProduct->isSaleable()){
|
359 |
+
$productType = $parentProduct->getTypeId();
|
360 |
+
$productId = $parentProduct->getId();
|
361 |
+
$parent = $parentProduct;
|
362 |
+
break;
|
363 |
+
}
|
364 |
+
}
|
365 |
+
}elseif($product->getTypeId()=='configurable'){
|
366 |
+
$productType = 'configurable';
|
367 |
+
$productId = $product->getId();
|
368 |
+
$parent = $product;
|
369 |
+
}
|
370 |
+
if($productType!=''){
|
371 |
+
switch($productType){
|
372 |
+
case 'configurable' : foreach ($parent->getTypeInstance()->getConfigurableAttributes() as $attribute){
|
373 |
+
if(count($parentIds)>0){
|
374 |
+
$attributeValues[$attribute->getProductAttribute()->getAttributeCode()] = $product->getAttributeText($attribute->getProductAttribute()->getAttributeCode());
|
375 |
+
}else{
|
376 |
+
$attributeValues[$attribute->getProductAttribute()->getAttributeCode()] = '';
|
377 |
+
}
|
378 |
+
}
|
379 |
+
break;
|
380 |
+
}
|
381 |
+
}
|
382 |
+
return $attributeValues;
|
383 |
+
}
|
384 |
+
|
385 |
+
protected function setListed($fileName,$feedData = array()){
|
386 |
+
if(Mage::helper('nowshop')->uploadViaFtp($fileName)){
|
387 |
+
$coreResource = Mage::getSingleton('core/resource');
|
388 |
+
$feedTable = $coreResource->getTableName('nowshop/feed');
|
389 |
+
$conn = $coreResource->getConnection('write');
|
390 |
+
if($conn->insertMultiple($feedTable, $feedData))
|
391 |
+
return true;
|
392 |
+
}
|
393 |
+
return false;
|
394 |
+
}
|
395 |
+
|
396 |
+
protected function setReListed($feedData = array(), $infoData = array()){
|
397 |
+
if(count($feedData)>0 && count($infoData)>0){
|
398 |
+
foreach($feedData as $productId){
|
399 |
+
Mage::getModel('nowshop/feed')->loadByProductId($productId)
|
400 |
+
->setData('product_xml_data',$infoData[$productId])
|
401 |
+
->setUpdatedAt(date('Y-m-d H:i:s'))
|
402 |
+
->save();
|
403 |
+
}
|
404 |
+
return true;
|
405 |
+
}
|
406 |
+
return false;
|
407 |
+
}
|
408 |
+
|
409 |
+
protected function attributes($setId) {
|
410 |
+
$attributeCollection = Mage::getResourceModel('eav/entity_attribute_collection');
|
411 |
+
$attributeCollection
|
412 |
+
->setAttributeSetFilter($setId)
|
413 |
+
->addSetInfo()
|
414 |
+
->getData();
|
415 |
+
return $attributeCollection;
|
416 |
+
}
|
417 |
+
}
|
app/code/community/NowShop/Synchronize/controllers/OrderController.php
ADDED
@@ -0,0 +1,524 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* NowShop
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENS
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category NowShop
|
17 |
+
* @package NowShop_Synchronize
|
18 |
+
* @author Cedcoss core team.
|
19 |
+
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
|
23 |
+
class NowShop_Synchronize_OrderController extends Mage_Core_Controller_Front_Action {
|
24 |
+
|
25 |
+
protected $_storeId = null;
|
26 |
+
protected $_data = null;
|
27 |
+
protected $_priceTotal = null;
|
28 |
+
protected $_rowTotal = null;
|
29 |
+
protected $_shipPrice = null;
|
30 |
+
protected $_currencyCode = null;
|
31 |
+
protected $_currencyRates = null;
|
32 |
+
protected $_subTotal = 0.00;
|
33 |
+
protected $_nresponse = null;
|
34 |
+
protected $_debug = null;
|
35 |
+
protected $_rawdata = null;
|
36 |
+
|
37 |
+
private function getDigest($body = ''){
|
38 |
+
$relatedUri = isset($this->_data['server']['REQUEST_URI'])?$this->_data['server']['REQUEST_URI']:'';
|
39 |
+
$sharedKey = Mage::getStoreConfig('nowshop/order_api/key');
|
40 |
+
$string = $relatedUri.$body;
|
41 |
+
return Mage::getStoreConfig('nowshop/order_api/email').":".hash_hmac('sha256', $string, $sharedKey);
|
42 |
+
}
|
43 |
+
public function predispatch(){
|
44 |
+
$fp = fopen('php://input', 'r');
|
45 |
+
$this->_rawdata = stream_get_contents($fp);
|
46 |
+
$request = json_decode($this->_rawdata,true);
|
47 |
+
$this->_data = $request;
|
48 |
+
$this->_data['server'] = $_SERVER;
|
49 |
+
if(!isset($this->_data['id'])){
|
50 |
+
$this->_data['id'] = isset($_REQUEST['id'])?$_REQUEST['id']:'';
|
51 |
+
$this->_data['externalid'] = isset($_REQUEST['externalid'])?$_REQUEST['externalid']:'';
|
52 |
+
$this->_data['status'] = isset($_REQUEST['status'])?$_REQUEST['status']:'';
|
53 |
+
}
|
54 |
+
$this->_debug = Mage::getStoreConfig('nowshop/setting/debug');
|
55 |
+
if($this->_debug){
|
56 |
+
Mage::log('Request structure{{'.print_r($this->_data,true).'}}', null, 'nowshop.log');
|
57 |
+
}
|
58 |
+
if(isset($this->_data['server']['HTTP_X_NOWSHOP_AUTHENTICATION'])){
|
59 |
+
if($this->_data['server']['HTTP_X_NOWSHOP_AUTHENTICATION'] != $this->getDigest($this->_rawdata)){
|
60 |
+
header('HTTP/1.1 401 Unauthorized');
|
61 |
+
if($this->_debug){
|
62 |
+
$this->_nresponse['id'] = $this->_data['id'];
|
63 |
+
$this->_nresponse['externalid'] = isset($this->_data['externalid'])?$this->_data['externalid']:'';
|
64 |
+
$this->_nresponse['status'] = $this->__('HTTP_X_NOWSHOP_AUTHENTICATION not matched!');
|
65 |
+
}
|
66 |
+
echo $this->prepareResponse();die;
|
67 |
+
}
|
68 |
+
header('Content-Type: application/json; charset=UTF-8');
|
69 |
+
if($this->getRequest()->getActionName() == 'create'){
|
70 |
+
if(isset($this->_data['pricing']['shipping']['total'])){
|
71 |
+
$this->_shipPrice = $this->_data['pricing']['shipping']['total'];
|
72 |
+
if(isset($this->_data['pricing']['shipping']['vat']))
|
73 |
+
$this->_shipPrice += $this->_data['pricing']['shipping']['vat'];
|
74 |
+
}else{
|
75 |
+
$this->_shipPrice = 0.00;
|
76 |
+
}
|
77 |
+
$this->_currencyCode = isset($this->_data['pricing']['currency'])?(string)$this->_data['pricing']['currency']:(string)Mage::app()->getStore()->getCurrentCurrencyCode();
|
78 |
+
}
|
79 |
+
|
80 |
+
|
81 |
+
}else{
|
82 |
+
header("HTTP/1.1 403 Forbidden");
|
83 |
+
if($this->_debug){
|
84 |
+
$this->_nresponse['id'] = $this->_data['id'];
|
85 |
+
$this->_nresponse['externalid'] = isset($this->_data['externalid'])?$this->_data['externalid']:'';
|
86 |
+
$this->_nresponse['status'] = $this->__('HTTP_X_NOWSHOP_AUTHENTICATION not found!');
|
87 |
+
}
|
88 |
+
echo $this->prepareResponse();die;
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
public function getStoreId(){
|
93 |
+
if(empty($this->_storeId))
|
94 |
+
$this->_storeId = Mage::app()->getStore()->getId();
|
95 |
+
return $this->_storeId;
|
96 |
+
}
|
97 |
+
|
98 |
+
protected function _initProduct($item = array()){
|
99 |
+
$productSku = isset($item['sku'])?$item['sku']:'';
|
100 |
+
$product = Mage::getModel('catalog/product');
|
101 |
+
if(strlen($productSku))
|
102 |
+
$product = $product->loadByAttribute('sku',$productSku,'*');
|
103 |
+
return $product;
|
104 |
+
}
|
105 |
+
|
106 |
+
protected function _initOrder(){
|
107 |
+
$storeId = $this->getStoreId();
|
108 |
+
$reservedOrderId = Mage::getSingleton('eav/config')->getEntityType('order')->fetchNewIncrementId($storeId);
|
109 |
+
$baseCurrencyCode = Mage::app()->getBaseCurrencyCode();
|
110 |
+
$allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();
|
111 |
+
$rates = Mage::getModel('directory/currency')->getCurrencyRates($baseCurrencyCode, array_values($allowedCurrencies));
|
112 |
+
|
113 |
+
$this->_currencyRates = $rates;
|
114 |
+
$order = Mage::getModel('sales/order')
|
115 |
+
->setIncrementId($reservedOrderId)
|
116 |
+
->setStoreId($storeId)
|
117 |
+
->setQuoteId(0)
|
118 |
+
->setIsVirtual(0)
|
119 |
+
->setRemoteIp($_SERVER['REMOTE_ADDR'])
|
120 |
+
->setGlobalCurrencyCode($baseCurrencyCode)
|
121 |
+
->setBaseCurrencyCode($baseCurrencyCode)
|
122 |
+
->setStoreCurrencyCode($baseCurrencyCode)
|
123 |
+
->setOrderCurrencyCode($this->_currencyCode)
|
124 |
+
->setBaseToGlobalRate(isset($rates[$baseCurrencyCode])?$rates[$baseCurrencyCode]:1)
|
125 |
+
->setBaseToOrderRate(isset($rates[$this->_currencyCode])?$rates[$this->_currencyCode]:1)
|
126 |
+
->setStoreToBaseRate(isset($rates[$baseCurrencyCode])?$rates[$baseCurrencyCode]:1)
|
127 |
+
->setStoreToOrderRate(isset($rates[$this->_currencyCode])?$rates[$this->_currencyCode]:1);
|
128 |
+
if(isset($this->_data['created']) && $this->_data['created']){
|
129 |
+
$date = '';
|
130 |
+
$date = date('Y-m-d h:i:s',strtotime($this->_data['created']));
|
131 |
+
$order->setCreatedAt($date);
|
132 |
+
}
|
133 |
+
return $order;
|
134 |
+
}
|
135 |
+
|
136 |
+
protected function _addToCart($item = array()){
|
137 |
+
$storeId = $this->getStoreId();
|
138 |
+
$product = $this->_initProduct($item);
|
139 |
+
if(!is_object($product))
|
140 |
+
return false;
|
141 |
+
$this->_priceTotal = 0.00;
|
142 |
+
$this->_rowTotal = 0.00;
|
143 |
+
$vat = 0;
|
144 |
+
if(isset($item['unitprice'])){
|
145 |
+
$this->_priceTotal = isset($item['unitprice']['total'])?$item['unitprice']['total']:$product->getFinalPrice();
|
146 |
+
if(isset($item['unitprice']['vat']) && $item['unitprice']['vat']){
|
147 |
+
$this->_priceTotal -= $item['unitprice']['vat'];
|
148 |
+
}
|
149 |
+
}else{
|
150 |
+
$this->_priceTotal = $product->getFinalPrice();
|
151 |
+
}
|
152 |
+
|
153 |
+
$qty = $item['quantity']?$item['quantity']:1;
|
154 |
+
|
155 |
+
if(isset($item['totalprice'])){
|
156 |
+
$this->_rowTotal = isset($item['totalprice']['total'])?$item['totalprice']['total']:($product->getFinalPrice() * $qty);
|
157 |
+
if(isset($item['totalprice']['vat']) && $item['totalprice']['vat']){
|
158 |
+
$this->_rowTotal -= $item['totalprice']['vat'];
|
159 |
+
}
|
160 |
+
}else{
|
161 |
+
$this->_rowTotal = $product->getFinalPrice() * $qty;
|
162 |
+
}
|
163 |
+
|
164 |
+
$orderItem = Mage::getModel('sales/order_item')
|
165 |
+
->setStoreId($storeId)
|
166 |
+
->setQuoteItemId(0)
|
167 |
+
->setQuoteParentItemId(NULL)
|
168 |
+
->setProductId($product->getId())
|
169 |
+
->setProductType($product->getTypeId())
|
170 |
+
->setWeight($product->getWeight())
|
171 |
+
->setIsVirtual(0)
|
172 |
+
->setIsQtyDecimal(0)
|
173 |
+
->setQtyBackordered(NULL)
|
174 |
+
->setTotalQtyOrdered($qty)
|
175 |
+
->setQtyOrdered($qty)
|
176 |
+
->setName($product->getName())
|
177 |
+
->setSku($product->getSku())
|
178 |
+
->setPriceInclTax($this->_priceTotal)
|
179 |
+
->setBasePriceInclTax($this->_priceTotal/$this->_currencyRates[$this->_currencyCode])
|
180 |
+
->setPrice($this->_priceTotal)
|
181 |
+
->setBasePrice($this->_priceTotal/$this->_currencyRates[$this->_currencyCode])
|
182 |
+
->setOriginalPrice($this->_priceTotal)
|
183 |
+
->setBaseOriginalPrice($this->_priceTotal/$this->_currencyRates[$this->_currencyCode])
|
184 |
+
->setRowTotalInclTax($this->_rowTotal)
|
185 |
+
->setBaseRowTotalInclTax($this->_rowTotal/$this->_currencyRates[$this->_currencyCode])
|
186 |
+
->setRowTotal($this->_rowTotal)
|
187 |
+
->setBaseRowTotal($this->_rowTotal/$this->_currencyRates[$this->_currencyCode]);
|
188 |
+
$this->_subTotal += $this->_rowTotal;
|
189 |
+
|
190 |
+
if(isset($item['totalprice']['vat']) && $item['totalprice']['vat']){
|
191 |
+
$orderItem->setTaxAmount($item['totalprice']['vat'])
|
192 |
+
->setBaseTaxAmount($item['totalprice']['vat']/$this->_currencyRates[$this->_currencyCode]);
|
193 |
+
$this->_subTotal += $item['totalprice']['vat'];
|
194 |
+
}
|
195 |
+
|
196 |
+
return $orderItem;
|
197 |
+
}
|
198 |
+
|
199 |
+
protected function _billingAddress(){
|
200 |
+
$storeId = $this->getStoreId();
|
201 |
+
$billingAddress = Mage::getModel('sales/order_address')
|
202 |
+
->setStoreId($storeId)
|
203 |
+
->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_BILLING)
|
204 |
+
->setFirstname(isset($this->_data['customer']['billing']['firstname'])?$this->_data['customer']['billing']['firstname']:'')
|
205 |
+
->setLastname(isset($this->_data['customer']['billing']['lastname'])?$this->_data['customer']['billing']['lastname']:'')
|
206 |
+
->setEmail(isset($this->_data['customer']['billing']['email'])?$this->_data['customer']['billing']['email']:'')
|
207 |
+
->setStreet(isset($this->_data['customer']['billing']['address'])?$this->_data['customer']['billing']['address']:'')
|
208 |
+
->setCity(isset($this->_data['customer']['billing']['city'])?$this->_data['customer']['billing']['city']:'')
|
209 |
+
->setCountryId(isset($this->_data['customer']['billing']['country']['iso'])?$this->_data['customer']['billing']['country']['iso']:Mage::getStoreConfig('general/country/default',$storeId))
|
210 |
+
/* ->setRegion($billing->getRegion()) */
|
211 |
+
->setTelephone(isset($this->_data['customer']['billing']['telephone'])?$this->_data['customer']['billing']['telephone']:'')
|
212 |
+
/* ->setRegion_id($this->_data['region_id']) */
|
213 |
+
->setPostcode(isset($this->_data['customer']['billing']['postalcode'])?$this->_data['customer']['billing']['postalcode']:'');
|
214 |
+
return $billingAddress;
|
215 |
+
}
|
216 |
+
|
217 |
+
protected function _shippingAddress(){
|
218 |
+
$storeId = $this->getStoreId();
|
219 |
+
$shippingAddress = Mage::getModel('sales/order_address')
|
220 |
+
->setStoreId($storeId)
|
221 |
+
->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_SHIPPING)
|
222 |
+
->setFirstname(isset($this->_data['customer']['shipping']['name'])?$this->_data['customer']['shipping']['name']:'')
|
223 |
+
->setLastname('')
|
224 |
+
->setEmail(isset($this->_data['customer']['billing']['email'])?$this->_data['customer']['billing']['email']:'')
|
225 |
+
->setStreet(isset($this->_data['customer']['shipping']['address'])?$this->_data['customer']['shipping']['address']:'')
|
226 |
+
->setCity(isset($this->_data['customer']['shipping']['city'])?$this->_data['customer']['shipping']['city']:'')
|
227 |
+
->setCountryId(isset($this->_data['customer']['shipping']['country']['iso'])?$this->_data['customer']['shipping']['country']['iso']:Mage::getStoreConfig('general/country/default',$storeId))
|
228 |
+
/* ->setRegion($billing->getRegion()) */
|
229 |
+
->setTelephone(isset($this->_data['customer']['billing']['telephone'])?$this->_data['customer']['billing']['telephone']:'')
|
230 |
+
/* ->setRegion_id($this->_data['region_id']) */
|
231 |
+
->setPostcode(isset($this->_data['customer']['shipping']['postalcode'])?$this->_data['customer']['shipping']['postalcode']:'');
|
232 |
+
return $shippingAddress;
|
233 |
+
}
|
234 |
+
|
235 |
+
protected function _setPayment(){
|
236 |
+
$code = Mage::getModel('nowshoppayment/nowshop')->getCode();
|
237 |
+
$orderPayment = Mage::getModel('sales/order_payment')
|
238 |
+
->setStoreId($storeId)
|
239 |
+
->setMethod($code);
|
240 |
+
return $orderPayment;
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Check if customer email exists
|
245 |
+
*
|
246 |
+
* @param string $email
|
247 |
+
* @param int $websiteId
|
248 |
+
* @return false|Mage_Customer_Model_Customer
|
249 |
+
*/
|
250 |
+
protected function _customerEmailExists($email)
|
251 |
+
{
|
252 |
+
$websiteId = Mage::app()->getWebsite()->getId();
|
253 |
+
$customer = Mage::getModel('customer/customer');
|
254 |
+
|
255 |
+
if ($websiteId) {
|
256 |
+
$customer->setWebsiteId($websiteId);
|
257 |
+
}
|
258 |
+
$customer->loadByEmail($email);
|
259 |
+
if ($customer->getId()) {
|
260 |
+
return $customer;
|
261 |
+
}
|
262 |
+
return false;
|
263 |
+
}
|
264 |
+
|
265 |
+
public function createAction(){
|
266 |
+
if($this->_debug){
|
267 |
+
Mage::log('Create Request structure{{'.print_r($this->_data,true).'}}', null, 'nowshop.log');
|
268 |
+
}
|
269 |
+
try{
|
270 |
+
$order = $this->_initOrder();
|
271 |
+
$storeId = $this->getStoreId();
|
272 |
+
$transaction = Mage::getModel('core/resource_transaction');
|
273 |
+
|
274 |
+
/* Step 1: */
|
275 |
+
/* Add To Cart */
|
276 |
+
$totalQty = 0;
|
277 |
+
if(isset($this->_data['items']) && count($this->_data['items'])>0){
|
278 |
+
foreach($this->_data['items'] as $item){
|
279 |
+
$orderItem = array();
|
280 |
+
$orderItem = $this->_addToCart($item);
|
281 |
+
if($orderItem === false)
|
282 |
+
continue;
|
283 |
+
if($orderItem){
|
284 |
+
$totalQty += $orderItem->getTotalQtyOrdered();
|
285 |
+
$order->addItem($orderItem);
|
286 |
+
}
|
287 |
+
}
|
288 |
+
}
|
289 |
+
/* Validate order's items */
|
290 |
+
if(!count($order->getAllItems())){
|
291 |
+
if($this->_debug){
|
292 |
+
echo $this->__('Products SKU not matched!');die;
|
293 |
+
}else{
|
294 |
+
echo $this->prepareResponse();die;
|
295 |
+
}
|
296 |
+
}else{
|
297 |
+
$order->setTotalQtyOrdered($totalQty);
|
298 |
+
}
|
299 |
+
|
300 |
+
/* Step 2: */
|
301 |
+
/* set Customer data */
|
302 |
+
if($customer = $this->_customerEmailExists($this->_data['customer']['billing']['email'])){
|
303 |
+
/* print_r($customer->getData());die; */
|
304 |
+
$order->setCustomerIsGuest(0);
|
305 |
+
$order->setCustomerId($customer->getId());
|
306 |
+
$order->setCustomerGroupId($customer->getGroupId());
|
307 |
+
$order->setCustomerEmail($customer->getEmail());
|
308 |
+
$order->setCustomerFirstname($customer->getFirstname());
|
309 |
+
$order->setCustomerLastname($customer->getLastname());
|
310 |
+
}else{
|
311 |
+
$order->setCustomerIsGuest(1);
|
312 |
+
$order->setCustomerEmail(isset($this->_data['customer']['billing']['email'])?$this->_data['customer']['billing']['email']:'');
|
313 |
+
$order->setCustomerFirstname(isset($this->_data['customer']['billing']['firstname'])?$this->_data['customer']['billing']['firstname']:'');
|
314 |
+
$order->setCustomerLastname(isset($this->_data['customer']['billing']['lastname'])?$this->_data['customer']['billing']['lastname']:'');
|
315 |
+
}
|
316 |
+
|
317 |
+
/* echo $order->getCustomerIsGuest()."==".$order->getCustomerGroupId();die; */
|
318 |
+
/* Step 3: */
|
319 |
+
/* set Billing Address*/
|
320 |
+
$billingAddress = $this->_billingAddress();
|
321 |
+
$order->setBillingAddress($billingAddress);
|
322 |
+
|
323 |
+
/* Step 4: */
|
324 |
+
/* set shipping address */
|
325 |
+
$shippingAddress = $this->_shippingAddress();
|
326 |
+
$order->setShippingAddress($shippingAddress);
|
327 |
+
|
328 |
+
/* Step 5: */
|
329 |
+
/* Set Shipping information */
|
330 |
+
$code = Mage::getModel('nowshopshipping/carrier_nowshop')->getCode();
|
331 |
+
$order->setShippingAmount($this->_shipPrice)
|
332 |
+
->setBaseShippingAmount($this->_shipPrice/$this->_currencyRates[$this->_currencyCode])
|
333 |
+
->setBaseShippingTaxAmount(0.0000)
|
334 |
+
->setBaseShippingDiscountAmount(0.0000)
|
335 |
+
->setShippingMethod($code)
|
336 |
+
->setShippingDescription(Mage::getStoreConfig('carriers/nowshop/title',$storeId));
|
337 |
+
|
338 |
+
/* Step 6: */
|
339 |
+
/* set payment information */
|
340 |
+
$orderPayment = $this->_setPayment();
|
341 |
+
$order->setPayment($orderPayment);
|
342 |
+
|
343 |
+
/* Step 7: */
|
344 |
+
/* set Grand total*/
|
345 |
+
|
346 |
+
$grandtotal = $this->_subTotal+$this->_shipPrice;
|
347 |
+
$order->setBaseDiscountAmount(0.0000)
|
348 |
+
->setBaseTaxAmount(0.0000)
|
349 |
+
->setTaxAmount(0.0000)
|
350 |
+
->setBaseSubtotal($this->_subTotal/$this->_currencyRates[$this->_currencyCode])
|
351 |
+
->setBaseSubtotalInclTax($this->_subTotal/$this->_currencyRates[$this->_currencyCode])
|
352 |
+
->setSubtotalInclTax($this->_subTotal)
|
353 |
+
->setSubtotal($this->_subTotal)
|
354 |
+
->setBaseGrandTotal($grandtotal/$this->_currencyRates[$this->_currencyCode])
|
355 |
+
->setGrandTotal($grandtotal);
|
356 |
+
|
357 |
+
/* Step 8: */
|
358 |
+
/* Order Place start */
|
359 |
+
$transaction->addObject($order);
|
360 |
+
$transaction->addCommitCallback(array($order, 'place'));
|
361 |
+
$transaction->addCommitCallback(array($order, 'save'));
|
362 |
+
$transaction->save();
|
363 |
+
/* Step 9: */
|
364 |
+
/* Generate Invoice depend upon a setting from admin */
|
365 |
+
/* Start */
|
366 |
+
if(Mage::getStoreConfig('nowshop/order_api/can_invoice',$order->getStoreId())){
|
367 |
+
if($order->canInvoice()){
|
368 |
+
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
|
369 |
+
if ($invoice->getTotalQty()) {
|
370 |
+
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
|
371 |
+
$invoice->register();
|
372 |
+
$invoice->getOrder()->setIsInProcess(true);
|
373 |
+
$transactionSave = Mage::getModel('core/resource_transaction')
|
374 |
+
->addObject($invoice)
|
375 |
+
->addObject($invoice->getOrder());
|
376 |
+
$transactionSave->save();
|
377 |
+
if($order->getStatus() == 'pending'){
|
378 |
+
$order->setStatus('processing')
|
379 |
+
->setState('processing');
|
380 |
+
}
|
381 |
+
}
|
382 |
+
}
|
383 |
+
$order = $invoice->getOrder();
|
384 |
+
}
|
385 |
+
/* End */
|
386 |
+
|
387 |
+
/* Step 10 */
|
388 |
+
/* Send Order confirmation mail */
|
389 |
+
if(Mage::getStoreConfig('nowshop/order_api/can_email',$order->getStoreId())){
|
390 |
+
$order->sendNewOrderEmail();
|
391 |
+
$order->setEmailSent(true);
|
392 |
+
}
|
393 |
+
$order->save();
|
394 |
+
|
395 |
+
/* Step 11 */
|
396 |
+
/* Prepare and send response */
|
397 |
+
$this->_nresponse['id'] = $this->_data['id'];
|
398 |
+
$this->_nresponse['externalid'] = $order->getIncrementId();
|
399 |
+
$this->_nresponse['status'] = Mage::helper('nowshop')->getOrderStatus($order->getStatus());
|
400 |
+
$body = $this->prepareResponse();
|
401 |
+
$digest = $this->getDigest($body);
|
402 |
+
header('HTTP/1.1 201 OK');
|
403 |
+
header('X-NowShop-Authentication:'.$digest);
|
404 |
+
echo $body;
|
405 |
+
if($this->_debug){
|
406 |
+
Mage::log('Response of Create Order structure{{'.$body.'}}', null, 'nowshop.log');
|
407 |
+
}
|
408 |
+
}catch(Exception $e){
|
409 |
+
header('HTTP/1.1 500 Internal Server Error');
|
410 |
+
if($this->_debug){
|
411 |
+
$this->_nresponse['id'] = $this->_data['id'];
|
412 |
+
$this->_nresponse['externalid'] = isset($this->_data['externalid'])?$this->_data['externalid']:'';
|
413 |
+
$this->_nresponse['status'] = $e->getMessage();
|
414 |
+
}
|
415 |
+
echo $this->prepareResponse();die;
|
416 |
+
}
|
417 |
+
}
|
418 |
+
|
419 |
+
public function infoAction(){
|
420 |
+
try{
|
421 |
+
$response = array();
|
422 |
+
if($this->_debug){
|
423 |
+
Mage::log('Info Request structure{{'.print_r($this->_data,true).'}}', null, 'nowshop.log');
|
424 |
+
}
|
425 |
+
$id = isset($this->_data['id'])?$this->_data['id']:0;
|
426 |
+
$orderId = isset($this->_data['externalid'])?$this->_data['externalid']:0;
|
427 |
+
|
428 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
|
429 |
+
if($order && $order->getId()){
|
430 |
+
$response['id'] = $id;
|
431 |
+
$response['status'] = $order->getStatus();
|
432 |
+
$response['items'] = array();
|
433 |
+
foreach($order->getAllItems() as $item){
|
434 |
+
if($order->getStatus() == 'pending'){
|
435 |
+
$response['items'][] = array('sku'=>$item->getData('sku'),'quantity'=>(int)$item->getData('qty_ordered'));
|
436 |
+
}elseif($response['status'] == 'processing'){
|
437 |
+
$response['items'][] = array('sku'=>$item->getData('sku'),'quantity'=>(int)$item->getData('qty_invoiced'));
|
438 |
+
}elseif($response['status'] == 'complete'){
|
439 |
+
$response['items'][] = array('sku'=>$item->getData('sku'),'quantity'=>(int)$item->getData('qty_shipped'));
|
440 |
+
}elseif($response['status'] == 'canceled'){
|
441 |
+
$response['items'][] = array('sku'=>$item->getData('sku'),'quantity'=>(int)$item->getData('qty_canceled'));
|
442 |
+
}elseif($response['status'] == 'closed'){
|
443 |
+
$response['items'][] = array('sku'=>$item->getData('sku'),'quantity'=>(int)$item->getData('qty_refunded'));
|
444 |
+
}else{
|
445 |
+
$response['items'][] = array('sku'=>$item->getData('sku'),'quantity'=>(int)$item->getData('qty_ordered'));
|
446 |
+
}
|
447 |
+
}
|
448 |
+
$response['status'] = Mage::helper('nowshop')->getOrderStatus($response['status']);
|
449 |
+
}
|
450 |
+
$body = json_encode($response);
|
451 |
+
$digest = $this->getDigest($body);
|
452 |
+
header('HTTP/1.1 200 OK');
|
453 |
+
header('X-NowShop-Authentication:'.$digest);
|
454 |
+
echo $body;
|
455 |
+
if($this->_debug){
|
456 |
+
Mage::log('Response of Info Order structure{{'.$body.'}}', null, 'nowshop.log');
|
457 |
+
}
|
458 |
+
}catch(Exception $e){
|
459 |
+
header('HTTP/1.1 500 Internal Server Error');
|
460 |
+
if($this->_debug){
|
461 |
+
$this->_nresponse['id'] = $this->_data['id'];
|
462 |
+
$this->_nresponse['externalid'] = isset($this->_data['externalid'])?$this->_data['externalid']:'';
|
463 |
+
$this->_nresponse['status'] = $e->getMessage();
|
464 |
+
}
|
465 |
+
echo $this->prepareResponse();die;
|
466 |
+
}
|
467 |
+
}
|
468 |
+
|
469 |
+
public function cancelAction(){
|
470 |
+
try{
|
471 |
+
$response = array();
|
472 |
+
if($this->_debug){
|
473 |
+
Mage::log('Cancel Request structure{{'.print_r($this->_data,true).'}}', null, 'nowshop.log');
|
474 |
+
}
|
475 |
+
$id = isset($this->_data['id'])?$this->_data['id']:0;
|
476 |
+
$orderId = isset($this->_data['externalid'])?$this->_data['externalid']:0;
|
477 |
+
$status = isset($this->_data['status'])?$this->_data['status']:'';
|
478 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
|
479 |
+
if($order && $order->getId() && $status == 'cancelled'){
|
480 |
+
$response['id'] = $id;
|
481 |
+
if($order->canCancel()){
|
482 |
+
if($order->cancel()->save()){
|
483 |
+
$response['status'] = $status;
|
484 |
+
}else{
|
485 |
+
$response['status'] = Mage::helper('nowshop')->getOrderStatus($order->getStatus());
|
486 |
+
}
|
487 |
+
}elseif($order->getStatus() == 'canceled'){
|
488 |
+
$response['status'] = $status;
|
489 |
+
}else{
|
490 |
+
$response['status'] = Mage::helper('nowshop')->getOrderStatus($order->getStatus());
|
491 |
+
}
|
492 |
+
}
|
493 |
+
$body = json_encode($response);
|
494 |
+
$digest = $this->getDigest($body);
|
495 |
+
header('HTTP/1.1 200 OK');
|
496 |
+
header('X-NowShop-Authentication:'.$digest);
|
497 |
+
echo $body;
|
498 |
+
if($this->_debug){
|
499 |
+
Mage::log('Response of Cancel Order structure{{'.$body.'}}', null, 'nowshop.log');
|
500 |
+
}
|
501 |
+
}catch(Exception $e){
|
502 |
+
header('HTTP/1.1 500 Internal Server Error');
|
503 |
+
if($this->_debug){
|
504 |
+
$this->_nresponse['id'] = $this->_data['id'];
|
505 |
+
$this->_nresponse['externalid'] = isset($this->_data['externalid'])?$this->_data['externalid']:'';
|
506 |
+
$this->_nresponse['status'] = $e->getMessage();
|
507 |
+
}
|
508 |
+
echo $this->prepareResponse();die;
|
509 |
+
}
|
510 |
+
}
|
511 |
+
|
512 |
+
protected function prepareResponse(){
|
513 |
+
$result = '';
|
514 |
+
if(!empty($this->_nresponse)){
|
515 |
+
$result = json_encode($this->_nresponse);
|
516 |
+
}else{
|
517 |
+
$this->_nresponse['id'] = $this->_data['id'];
|
518 |
+
$this->_nresponse['externalid'] = isset($this->_data['externalid'])?$this->_data['externalid']:'';;
|
519 |
+
$this->_nresponse['status'] = 'failure';
|
520 |
+
$result = json_encode($this->_nresponse);
|
521 |
+
}
|
522 |
+
return $result;
|
523 |
+
}
|
524 |
+
}
|
app/code/community/NowShop/Synchronize/etc/adminhtml.xml
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* NowShop
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENS
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category NowShop
|
17 |
+
* @package NowShop_Synchronize
|
18 |
+
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
19 |
+
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
-->
|
23 |
+
<config>
|
24 |
+
<menu>
|
25 |
+
<nowshop module="nowshop" translate="title">
|
26 |
+
<title>Sell On NowShop</title>
|
27 |
+
<sort_order>80</sort_order>
|
28 |
+
<children>
|
29 |
+
<categoryfeed moduel="nowshop" translate="title">
|
30 |
+
<title>Categories Feed</title>
|
31 |
+
<sort_order>10</sort_order>
|
32 |
+
<action>nowshop/adminhtml_categoryfeed/index</action>
|
33 |
+
</categoryfeed>
|
34 |
+
<productfeed module="nowshop" translate="title">
|
35 |
+
<title>Products Feed</title>
|
36 |
+
<sort_order>20</sort_order>
|
37 |
+
<action>nowshop/adminhtml_productfeed/index</action>
|
38 |
+
</productfeed>
|
39 |
+
<settings module="nowshop" translate="title">
|
40 |
+
<title>Configuration</title>
|
41 |
+
<sort_order>30</sort_order>
|
42 |
+
<action>adminhtml/system_config/edit/section/nowshop_account/</action>
|
43 |
+
</settings>
|
44 |
+
|
45 |
+
</children>
|
46 |
+
</nowshop>
|
47 |
+
</menu>
|
48 |
+
<acl>
|
49 |
+
<resources>
|
50 |
+
</all>
|
51 |
+
<admin>
|
52 |
+
<system>
|
53 |
+
<children>
|
54 |
+
<config>
|
55 |
+
<children>
|
56 |
+
<nowshop_account>
|
57 |
+
<title>Now Shop System Settings</title>
|
58 |
+
<sort_order>10</sort_order>
|
59 |
+
</nowshop_account>
|
60 |
+
</children>
|
61 |
+
</config>
|
62 |
+
</children>
|
63 |
+
</system>
|
64 |
+
<nowshop module="nowshop" translate="title">
|
65 |
+
<title>Sell On NowShop</title>
|
66 |
+
<sort_order>20</sort_order>
|
67 |
+
<categoryfeed module="laybuy" translate="title">
|
68 |
+
<title>Categoryies Feed</title>
|
69 |
+
<children>
|
70 |
+
<view translate="title">
|
71 |
+
<title>View Categories</title>
|
72 |
+
<sort_order>10</sort_order>
|
73 |
+
</view>
|
74 |
+
<list translate="title">
|
75 |
+
<title>List Categories</title>
|
76 |
+
<sort_order>20</sort_order>
|
77 |
+
</list>
|
78 |
+
</children>
|
79 |
+
</categoryfeed>
|
80 |
+
<productfeed module="laybuy" translate="title">
|
81 |
+
<title>Products Feed</title>
|
82 |
+
<children>
|
83 |
+
<view translate="title">
|
84 |
+
<title>View Products</title>
|
85 |
+
</view>
|
86 |
+
<list translate="title">
|
87 |
+
<title>List Products</title>
|
88 |
+
<sort_order>20</sort_order>
|
89 |
+
</list>
|
90 |
+
</children>
|
91 |
+
</productfeed>
|
92 |
+
</children>
|
93 |
+
</nowshop>
|
94 |
+
</children>
|
95 |
+
</admin>
|
96 |
+
</resources>
|
97 |
+
</acl>
|
98 |
+
</config>
|
app/code/community/NowShop/Synchronize/etc/config.xml
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* NowShop
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENS
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category NowShop
|
17 |
+
* @package NowShop_Synchronize
|
18 |
+
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
19 |
+
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
-->
|
23 |
+
<config>
|
24 |
+
<modules>
|
25 |
+
<NowShop_Synchronize>
|
26 |
+
<version>0.0.3</version>
|
27 |
+
<author>ASHEESH SINGH (asheeshsingh@cedcoss.com)</author>
|
28 |
+
</NowShop_Synchronize>
|
29 |
+
</modules>
|
30 |
+
<frontend>
|
31 |
+
<routers>
|
32 |
+
<nowshop>
|
33 |
+
<use>standard</use>
|
34 |
+
<args>
|
35 |
+
<module>NowShop_Synchronize</module>
|
36 |
+
<frontName>nowshop</frontName>
|
37 |
+
</args>
|
38 |
+
</nowshop>
|
39 |
+
</routers>
|
40 |
+
</frontend>
|
41 |
+
<admin>
|
42 |
+
<routers>
|
43 |
+
<nowshop>
|
44 |
+
<use>admin</use>
|
45 |
+
<args>
|
46 |
+
<module>NowShop_Synchronize</module>
|
47 |
+
<frontName>nowshop</frontName>
|
48 |
+
</args>
|
49 |
+
</nowshop>
|
50 |
+
</routers>
|
51 |
+
</admin>
|
52 |
+
<adminhtml>
|
53 |
+
<translate>
|
54 |
+
<modules>
|
55 |
+
<nowshop>
|
56 |
+
<files>
|
57 |
+
<default>NowShop_Synchronize.csv</default>
|
58 |
+
</files>
|
59 |
+
</nowshop>
|
60 |
+
</modules>
|
61 |
+
</translate>
|
62 |
+
<layout>
|
63 |
+
<updates>
|
64 |
+
<nowshop>
|
65 |
+
<file>nowshop.xml</file>
|
66 |
+
</nowshop>
|
67 |
+
</updates>
|
68 |
+
</layout>
|
69 |
+
</adminhtml>
|
70 |
+
<global>
|
71 |
+
<helpers>
|
72 |
+
<nowshop>
|
73 |
+
<class>NowShop_Synchronize_Helper</class>
|
74 |
+
</nowshop>
|
75 |
+
</helpers>
|
76 |
+
<blocks>
|
77 |
+
<nowshop>
|
78 |
+
<class>NowShop_Synchronize_Block</class>
|
79 |
+
</nowshop>
|
80 |
+
</blocks>
|
81 |
+
<models>
|
82 |
+
<nowshop>
|
83 |
+
<class>NowShop_Synchronize_Model</class>
|
84 |
+
<resourceModel>nowshop_mysql4</resourceModel>
|
85 |
+
</nowshop>
|
86 |
+
<nowshop_mysql4>
|
87 |
+
<class>NowShop_Synchronize_Model_Mysql4</class>
|
88 |
+
<entities>
|
89 |
+
<feed>
|
90 |
+
<table>nowshop_product_feed</table>
|
91 |
+
</feed>
|
92 |
+
<cfeed>
|
93 |
+
<table>nowshop_category_feed</table>
|
94 |
+
</cfeed>
|
95 |
+
</entities>
|
96 |
+
</nowshop_mysql4>
|
97 |
+
</models>
|
98 |
+
<resources>
|
99 |
+
<nowshop_synchronize_setup>
|
100 |
+
<setup>
|
101 |
+
<module>NowShop_Synchronize</module>
|
102 |
+
<class>NowShop_Synchronize_Model_Mysql4_Setup</class>
|
103 |
+
</setup>
|
104 |
+
</nowshop_synchronize_setup>
|
105 |
+
</resources>
|
106 |
+
</global>
|
107 |
+
<default>
|
108 |
+
<nowshop>
|
109 |
+
<setting>
|
110 |
+
<isocode>GB</isocode>
|
111 |
+
</setting>
|
112 |
+
<productfeed>
|
113 |
+
<qty>10</qty>
|
114 |
+
<min>0</min>
|
115 |
+
<max>4</max>
|
116 |
+
<brand>retailer_store_name</brand>
|
117 |
+
</productfeed>
|
118 |
+
<order_api>
|
119 |
+
<can_invoice>0</can_invoice>
|
120 |
+
<can_email>0</can_email>
|
121 |
+
</order_api>
|
122 |
+
</nowshop>
|
123 |
+
</default>
|
124 |
+
</config>
|
app/code/community/NowShop/Synchronize/etc/system.xml
ADDED
@@ -0,0 +1,218 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* NowShop
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENS
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category NowShop
|
17 |
+
* @package NowShop_Synchronize
|
18 |
+
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
19 |
+
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
-->
|
23 |
+
<config>
|
24 |
+
<tabs>
|
25 |
+
<nowshop translate="label" module="nowshop">
|
26 |
+
<label>Now Shop Integration</label>
|
27 |
+
<sort_order>100</sort_order>
|
28 |
+
</nowshop>
|
29 |
+
</tabs>
|
30 |
+
<sections>
|
31 |
+
<nowshop_account translate="label" module="nowshop">
|
32 |
+
<label>Retailer Configuration</label>
|
33 |
+
<tab>nowshop</tab>
|
34 |
+
<frontend_type>text</frontend_type>
|
35 |
+
<sort_order>10</sort_order>
|
36 |
+
<show_in_default>1</show_in_default>
|
37 |
+
<show_in_website>1</show_in_website>
|
38 |
+
<show_in_store>1</show_in_store>
|
39 |
+
<groups>
|
40 |
+
<setting translate="label" module="nowshop">
|
41 |
+
<label>General Setting</label>
|
42 |
+
<sort_order>10</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>1</show_in_website>
|
45 |
+
<show_in_store>1</show_in_store>
|
46 |
+
<fields>
|
47 |
+
<debug translate="label" module="nowshop">
|
48 |
+
<label>Debug Mode</label>
|
49 |
+
<frontend_type>select</frontend_type>
|
50 |
+
<config_path>nowshop/setting/debug</config_path>
|
51 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
52 |
+
<sort_order>1</sort_order>
|
53 |
+
<show_in_default>1</show_in_default>
|
54 |
+
<show_in_website>1</show_in_website>
|
55 |
+
<show_in_store>1</show_in_store>
|
56 |
+
</debug>
|
57 |
+
<isocode translate="label" module="nowshop">
|
58 |
+
<label>Country</label>
|
59 |
+
<frontend_type>select</frontend_type>
|
60 |
+
<config_path>nowshop/setting/isocode</config_path>
|
61 |
+
<source_model>nowshop/system_config_source_isocode</source_model>
|
62 |
+
<sort_order>2</sort_order>
|
63 |
+
<show_in_default>1</show_in_default>
|
64 |
+
<show_in_website>1</show_in_website>
|
65 |
+
<show_in_store>1</show_in_store>
|
66 |
+
</isocode>
|
67 |
+
</fields>
|
68 |
+
</setting>
|
69 |
+
<ftp_credentials translate="label" module="nowshop">
|
70 |
+
<label>Retailer Ftp Credentials</label>
|
71 |
+
<sort_order>15</sort_order>
|
72 |
+
<show_in_default>1</show_in_default>
|
73 |
+
<show_in_website>0</show_in_website>
|
74 |
+
<show_in_store>0</show_in_store>
|
75 |
+
<fields>
|
76 |
+
<host translate="label" module="nowshop">
|
77 |
+
<label>Host</label>
|
78 |
+
<frontend_type>text</frontend_type>
|
79 |
+
<config_path>nowshop/ftp/host</config_path>
|
80 |
+
<sort_order>1</sort_order>
|
81 |
+
<show_in_default>1</show_in_default>
|
82 |
+
<show_in_website>0</show_in_website>
|
83 |
+
<show_in_store>0</show_in_store>
|
84 |
+
</host>
|
85 |
+
<username translate="label" module="nowshop">
|
86 |
+
<label>Ftp Username</label>
|
87 |
+
<frontend_type>text</frontend_type>
|
88 |
+
<config_path>nowshop/ftp/username</config_path>
|
89 |
+
<sort_order>2</sort_order>
|
90 |
+
<show_in_default>1</show_in_default>
|
91 |
+
<show_in_website>0</show_in_website>
|
92 |
+
<show_in_store>0</show_in_store>
|
93 |
+
</username>
|
94 |
+
<password translate="label" module="nowshop">
|
95 |
+
<label>Ftp Password</label>
|
96 |
+
<frontend_type>password</frontend_type>
|
97 |
+
<config_path>nowshop/ftp/password</config_path>
|
98 |
+
<comment><![CDATA[<button style="margin-top: 5px;" onclick="javascript:window.open('https://nowshop.com/settings/edit', 'apiwizard','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, ,left=100, top=100, width=380, height=470'); return false;" class="scalable" type="button" id="nowshop_retailer_ftp_wizard">
|
99 |
+
<span><span><span>Get Ftp Credentials from NowShop </span></span></span>
|
100 |
+
</button>
|
101 |
+
]]>
|
102 |
+
</comment>
|
103 |
+
<sort_order>3</sort_order>
|
104 |
+
<show_in_default>1</show_in_default>
|
105 |
+
<show_in_website>0</show_in_website>
|
106 |
+
<show_in_store>0</show_in_store>
|
107 |
+
</password>
|
108 |
+
</fields>
|
109 |
+
</ftp_credentials>
|
110 |
+
<product translate="label" module="nowshop">
|
111 |
+
<label>Product Feed Setting</label>
|
112 |
+
<sort_order>20</sort_order>
|
113 |
+
<show_in_default>1</show_in_default>
|
114 |
+
<show_in_website>1</show_in_website>
|
115 |
+
<show_in_store>1</show_in_store>
|
116 |
+
<fields>
|
117 |
+
<feed translate="label comment" module="nowshop">
|
118 |
+
<label>Default Allowed Qty</label>
|
119 |
+
<frontend_type>text</frontend_type>
|
120 |
+
<config_path>nowshop/productfeed/qty</config_path>
|
121 |
+
<sort_order>1</sort_order>
|
122 |
+
<comment>Default Quantity for Product feed generation.</comment>
|
123 |
+
<show_in_default>1</show_in_default>
|
124 |
+
<show_in_website>1</show_in_website>
|
125 |
+
<show_in_store>1</show_in_store>
|
126 |
+
</feed>
|
127 |
+
<allowed_brand translate="label comment" module="nowshop">
|
128 |
+
<label>Brand Attribute</label>
|
129 |
+
<frontend_type>select</frontend_type>
|
130 |
+
<source_model>nowshop/system_config_source_brand</source_model>
|
131 |
+
<config_path>nowshop/productfeed/brand</config_path>
|
132 |
+
<sort_order>2</sort_order>
|
133 |
+
<comment>Product's attributes which is used for brand in product feed generation.First brand option is your store name.</comment>
|
134 |
+
<show_in_default>1</show_in_default>
|
135 |
+
<show_in_website>0</show_in_website>
|
136 |
+
<show_in_store>1</show_in_store>
|
137 |
+
</allowed_brand>
|
138 |
+
<min translate="label comment" module="nowshop">
|
139 |
+
<label>Minimum Shipping day(s)</label>
|
140 |
+
<frontend_type>text</frontend_type>
|
141 |
+
<config_path>nowshop/productfeed/min</config_path>
|
142 |
+
<sort_order>3</sort_order>
|
143 |
+
<comment>Minimum number of days before the product is shipped.0 indicates same day shipping. </comment>
|
144 |
+
<show_in_default>1</show_in_default>
|
145 |
+
<show_in_website>1</show_in_website>
|
146 |
+
<show_in_store>1</show_in_store>
|
147 |
+
</min>
|
148 |
+
<max translate="label comment" module="nowshop">
|
149 |
+
<label>Maximum Shipping day(s)</label>
|
150 |
+
<frontend_type>text</frontend_type>
|
151 |
+
<config_path>nowshop/productfeed/max</config_path>
|
152 |
+
<sort_order>4</sort_order>
|
153 |
+
<comment>Maximum number of days before the product is shipped.0 indicates same day shipping. </comment>
|
154 |
+
<show_in_default>1</show_in_default>
|
155 |
+
<show_in_website>1</show_in_website>
|
156 |
+
<show_in_store>1</show_in_store>
|
157 |
+
</max>
|
158 |
+
</fields>
|
159 |
+
</product>
|
160 |
+
<order_api translate="label" module="nowshop">
|
161 |
+
<label>Order API</label>
|
162 |
+
<sort_order>30</sort_order>
|
163 |
+
<show_in_default>1</show_in_default>
|
164 |
+
<show_in_website>1</show_in_website>
|
165 |
+
<show_in_store>1</show_in_store>
|
166 |
+
<fields>
|
167 |
+
<email translate="label comment" module="nowshop">
|
168 |
+
<label>Email Associated with NowShop Retailer Account</label>
|
169 |
+
<frontend_type>text</frontend_type>
|
170 |
+
<config_path>nowshop/order_api/email</config_path>
|
171 |
+
<sort_order>1</sort_order>
|
172 |
+
<comment><![CDATA[<a target="_blank" href="http://nowshop.com/how_it_works">Start selling products on NowShop!</a>]]>
|
173 |
+
</comment>
|
174 |
+
<show_in_default>1</show_in_default>
|
175 |
+
<show_in_website>1</show_in_website>
|
176 |
+
<show_in_store>1</show_in_store>
|
177 |
+
</email>
|
178 |
+
<key translate="label comment" module="nowshop">
|
179 |
+
<label>Order API secret key</label>
|
180 |
+
<frontend_type>text</frontend_type>
|
181 |
+
<config_path>nowshop/order_api/key</config_path>
|
182 |
+
<sort_order>2</sort_order>
|
183 |
+
<comment><![CDATA[<button style="margin-top: 5px;" onclick="javascript:window.open('https://nowshop.com/settings/edit', 'apiwizard','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, ,left=100, top=100, width=380, height=470'); return false;" class="scalable" type="button" id="nowshop_retailer_wizard">
|
184 |
+
<span><span><span>Get Order Api Key from NowShop </span></span></span>
|
185 |
+
</button>
|
186 |
+
]]>
|
187 |
+
</comment>
|
188 |
+
<show_in_default>1</show_in_default>
|
189 |
+
<show_in_website>1</show_in_website>
|
190 |
+
<show_in_store>1</show_in_store>
|
191 |
+
</key>
|
192 |
+
<!-- <can_invoice>
|
193 |
+
<label>Invoice Order Paid by NowShop</label>
|
194 |
+
<frontend_type>select</frontend_type>
|
195 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
196 |
+
<config_path>nowshop/order_api/can_invoice</config_path>
|
197 |
+
<sort_order>3</sort_order>
|
198 |
+
<comment>Generate Invoice of Orders placed from NowShop.</comment>
|
199 |
+
<show_in_default>1</show_in_default>
|
200 |
+
<show_in_website>1</show_in_website>
|
201 |
+
<show_in_store>0</show_in_store>
|
202 |
+
</can_invoice> -->
|
203 |
+
<can_email>
|
204 |
+
<label>Send Order Email</label>
|
205 |
+
<frontend_type>select</frontend_type>
|
206 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
207 |
+
<config_path>nowshop/order_api/can_email</config_path>
|
208 |
+
<sort_order>4</sort_order>
|
209 |
+
<show_in_default>1</show_in_default>
|
210 |
+
<show_in_website>1</show_in_website>
|
211 |
+
<show_in_store>0</show_in_store>
|
212 |
+
</can_email>
|
213 |
+
</fields>
|
214 |
+
</order_api>
|
215 |
+
</groups>
|
216 |
+
</nowshop_account>
|
217 |
+
</sections>
|
218 |
+
</config>
|
app/code/community/NowShop/Synchronize/etc/xsd/product_feed.xsd
ADDED
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2 |
+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
|
3 |
+
|
4 |
+
<xsd:element name="products" type="products_type"/>
|
5 |
+
|
6 |
+
<xsd:complexType name="products_type">
|
7 |
+
<xsd:sequence minOccurs="1" maxOccurs="unbounded">
|
8 |
+
<xsd:element ref="product"/>
|
9 |
+
</xsd:sequence>
|
10 |
+
</xsd:complexType>
|
11 |
+
|
12 |
+
<xsd:element name="product" type="product_type"/>
|
13 |
+
|
14 |
+
<xsd:complexType name="product_type">
|
15 |
+
<xsd:all>
|
16 |
+
<xsd:element name="sku" type="xsd:string"/>
|
17 |
+
<xsd:element name="type" type="type_type"/>
|
18 |
+
<xsd:element name="title" type="xsd:string"/>
|
19 |
+
<xsd:element name="description" type="xsd:string"/>
|
20 |
+
<xsd:element name="parentsku" type="xsd:string" minOccurs="0" nillable="true"/>
|
21 |
+
<xsd:element name="brand" type="xsd:string"/>
|
22 |
+
<xsd:element name="shipping" type="shipping_type" minOccurs="0"/>
|
23 |
+
<xsd:element name="weight" type="weight_type" minOccurs="0"/>
|
24 |
+
<xsd:element name="url" type="http" minOccurs="0"/>
|
25 |
+
<xsd:element name="ean" type="ean_type" minOccurs="0" nillable="true"/>
|
26 |
+
<xsd:element name="isbn10" type="isbn10_type" minOccurs="0" nillable="true"/>
|
27 |
+
<xsd:element name="isbn13" type="isbn13_type" minOccurs="0" nillable="true"/>
|
28 |
+
<xsd:element name="pricing" type="pricing_type" minOccurs="0" nillable="true"/>
|
29 |
+
<xsd:element name="stock" type="stock_type" minOccurs="0" nillable="true"/>
|
30 |
+
<xsd:element name="images" type="images_type" minOccurs="0"/>
|
31 |
+
<xsd:element name="datasheet" type="datasheet_type" minOccurs="0" nillable="true"/>
|
32 |
+
<xsd:element name="attributes" type="attribute_type" minOccurs="0"/>
|
33 |
+
<xsd:element name="variants" type="variant_type" minOccurs="0" nillable="true"/>
|
34 |
+
<xsd:element name="categories" type="categories_type" minOccurs="0" nillable="true"/>
|
35 |
+
</xsd:all>
|
36 |
+
</xsd:complexType>
|
37 |
+
|
38 |
+
<xsd:simpleType name="type_type">
|
39 |
+
<xsd:restriction base="xsd:string">
|
40 |
+
<xsd:enumeration value="master"/>
|
41 |
+
<xsd:enumeration value="variant"/>
|
42 |
+
<xsd:enumeration value="simple"/>
|
43 |
+
</xsd:restriction>
|
44 |
+
</xsd:simpleType>
|
45 |
+
|
46 |
+
<xsd:complexType name="shipping_type">
|
47 |
+
<xsd:attribute name="min" type="xsd:nonNegativeInteger" use="required"></xsd:attribute>
|
48 |
+
<xsd:attribute name="max" type="xsd:nonNegativeInteger" use="required"></xsd:attribute>
|
49 |
+
</xsd:complexType>
|
50 |
+
|
51 |
+
<xsd:complexType name="weight_type">
|
52 |
+
<xsd:simpleContent>
|
53 |
+
<xsd:extension base="xsd:float">
|
54 |
+
<xsd:attribute name="unit">
|
55 |
+
<xsd:simpleType>
|
56 |
+
<xsd:restriction base="xsd:string">
|
57 |
+
<xsd:enumeration value="g"/>
|
58 |
+
<xsd:enumeration value="lb"/>
|
59 |
+
<xsd:enumeration value="kg"/>
|
60 |
+
</xsd:restriction>
|
61 |
+
</xsd:simpleType>
|
62 |
+
</xsd:attribute>
|
63 |
+
</xsd:extension>
|
64 |
+
</xsd:simpleContent>
|
65 |
+
</xsd:complexType>
|
66 |
+
|
67 |
+
<xsd:simpleType name="ean_type">
|
68 |
+
<xsd:restriction base="xsd:string">
|
69 |
+
<xsd:pattern value="\d{13}"/>
|
70 |
+
</xsd:restriction>
|
71 |
+
</xsd:simpleType>
|
72 |
+
|
73 |
+
<xsd:simpleType name="isbn10_type">
|
74 |
+
<xsd:restriction base="xsd:string">
|
75 |
+
<xsd:pattern value="\d{10}"/>
|
76 |
+
</xsd:restriction>
|
77 |
+
</xsd:simpleType>
|
78 |
+
|
79 |
+
<xsd:simpleType name="isbn13_type">
|
80 |
+
<xsd:union memberTypes="ean_type"/>
|
81 |
+
</xsd:simpleType>
|
82 |
+
|
83 |
+
<xsd:complexType name="pricing_type">
|
84 |
+
<xsd:all>
|
85 |
+
<xsd:element name="price" type="xsd:decimal"/>
|
86 |
+
<xsd:element name="originalprice" type="xsd:decimal" minOccurs="0" nillable="true"/>
|
87 |
+
<xsd:element name="shippingprice" type="xsd:decimal" minOccurs="0" nillable="true"/>
|
88 |
+
</xsd:all>
|
89 |
+
<xsd:attribute name="currency">
|
90 |
+
<xsd:simpleType>
|
91 |
+
<xsd:restriction base="xsd:string">
|
92 |
+
<xsd:enumeration value="NOK"/>
|
93 |
+
<xsd:enumeration value="SEK"/>
|
94 |
+
<xsd:enumeration value="DKK"/>
|
95 |
+
<xsd:enumeration value="EUR"/>
|
96 |
+
<xsd:enumeration value="USD"/>
|
97 |
+
<xsd:enumeration value="GBP"/>
|
98 |
+
</xsd:restriction>
|
99 |
+
</xsd:simpleType>
|
100 |
+
</xsd:attribute>
|
101 |
+
<xsd:attribute name="isvatincluded" type="xsd:boolean" use="required"/>
|
102 |
+
</xsd:complexType>
|
103 |
+
|
104 |
+
<xsd:complexType name="stock_type">
|
105 |
+
<xsd:all>
|
106 |
+
<xsd:element name="quantity" type="xsd:integer" minOccurs="0" nillable="true"/>
|
107 |
+
<xsd:element name="enablestocklimitation" type="xsd:boolean" minOccurs="0" nillable="true"/>
|
108 |
+
</xsd:all>
|
109 |
+
</xsd:complexType>
|
110 |
+
|
111 |
+
<xsd:simpleType name="http">
|
112 |
+
<xsd:restriction base="xsd:string">
|
113 |
+
<xsd:pattern value="(http|https)://.+"/>
|
114 |
+
</xsd:restriction>
|
115 |
+
</xsd:simpleType>
|
116 |
+
|
117 |
+
<xsd:simpleType name="optional_http">
|
118 |
+
<xsd:restriction base="xsd:string">
|
119 |
+
<xsd:pattern value="((http|https)://.+)?"/>
|
120 |
+
</xsd:restriction>
|
121 |
+
</xsd:simpleType>
|
122 |
+
|
123 |
+
<xsd:complexType name="images_type">
|
124 |
+
<xsd:sequence minOccurs="0" maxOccurs="unbounded">
|
125 |
+
<xsd:element name="image">
|
126 |
+
<xsd:complexType>
|
127 |
+
<xsd:attribute name="url" type="optional_http" use="required"/>
|
128 |
+
</xsd:complexType>
|
129 |
+
</xsd:element>
|
130 |
+
</xsd:sequence>
|
131 |
+
<xsd:attribute name="reusefrommaster" type="xsd:boolean"/>
|
132 |
+
</xsd:complexType>
|
133 |
+
|
134 |
+
<xsd:complexType name="datasheet_type">
|
135 |
+
<xsd:sequence maxOccurs="unbounded">
|
136 |
+
<xsd:element name="section">
|
137 |
+
<xsd:complexType>
|
138 |
+
<xsd:sequence maxOccurs="unbounded">
|
139 |
+
<xsd:element name="data">
|
140 |
+
<xsd:complexType>
|
141 |
+
<xsd:attribute name="name" type="xsd:string" use="required"/>
|
142 |
+
<xsd:attribute name="value" type="xsd:string" use="required"/>
|
143 |
+
<xsd:attribute name="description" type="xsd:string"/>
|
144 |
+
<xsd:attribute name="type" type="xsd:string"/>
|
145 |
+
</xsd:complexType>
|
146 |
+
</xsd:element>
|
147 |
+
</xsd:sequence>
|
148 |
+
<xsd:attribute name="name" type="xsd:string"/>
|
149 |
+
</xsd:complexType>
|
150 |
+
</xsd:element>
|
151 |
+
</xsd:sequence>
|
152 |
+
<xsd:attribute name="name" type="xsd:string"/>
|
153 |
+
</xsd:complexType>
|
154 |
+
|
155 |
+
<xsd:complexType name="attribute_type">
|
156 |
+
<xsd:sequence maxOccurs="unbounded">
|
157 |
+
<xsd:element name="attribute">
|
158 |
+
<xsd:complexType>
|
159 |
+
<xsd:simpleContent>
|
160 |
+
<xsd:extension base="xsd:string">
|
161 |
+
<xsd:attribute name="name" type="xsd:string" use="required"/>
|
162 |
+
</xsd:extension>
|
163 |
+
</xsd:simpleContent>
|
164 |
+
</xsd:complexType>
|
165 |
+
</xsd:element>
|
166 |
+
</xsd:sequence>
|
167 |
+
</xsd:complexType>
|
168 |
+
|
169 |
+
<xsd:complexType name="variant_type">
|
170 |
+
<xsd:sequence maxOccurs="unbounded">
|
171 |
+
<xsd:element name="variant">
|
172 |
+
<xsd:complexType>
|
173 |
+
<xsd:simpleContent>
|
174 |
+
<xsd:extension base="xsd:string">
|
175 |
+
<xsd:attribute name="name" type="xsd:string" use="required"/>
|
176 |
+
</xsd:extension>
|
177 |
+
</xsd:simpleContent>
|
178 |
+
</xsd:complexType>
|
179 |
+
</xsd:element>
|
180 |
+
</xsd:sequence>
|
181 |
+
</xsd:complexType>
|
182 |
+
|
183 |
+
<xsd:complexType name="categories_type">
|
184 |
+
<xsd:sequence maxOccurs="unbounded">
|
185 |
+
<xsd:element name="category">
|
186 |
+
<xsd:complexType>
|
187 |
+
<xsd:simpleContent>
|
188 |
+
<xsd:extension base="xsd:string">
|
189 |
+
<xsd:attribute name="id" type="xsd:string" use="required"/>
|
190 |
+
</xsd:extension>
|
191 |
+
</xsd:simpleContent>
|
192 |
+
</xsd:complexType>
|
193 |
+
</xsd:element>
|
194 |
+
</xsd:sequence>
|
195 |
+
</xsd:complexType>
|
196 |
+
</xsd:schema>
|
app/code/community/NowShop/Synchronize/sql/nowshop_synchronize_setup/mysql4-install-0.0.1.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* NowShop
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENS
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category NowShop
|
17 |
+
* @package NowShop_Synchronize
|
18 |
+
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
19 |
+
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
|
23 |
+
$installer = $this;
|
24 |
+
$installer->startSetup();
|
25 |
+
$installer->run("
|
26 |
+
CREATE TABLE IF NOT EXISTS `".$this->getTable('nowshop/feed')."` (
|
27 |
+
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
28 |
+
`product_id` text NOT NULL COMMENT 'PRODUCT ID',
|
29 |
+
`status` tinyint(4) NOT NULL DEFAULT '1' COMMENT 'STATUS',
|
30 |
+
`updated_at` datetime NOT NULL COMMENT 'UPDATED At',
|
31 |
+
PRIMARY KEY (`id`)
|
32 |
+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
33 |
+
");
|
34 |
+
$installer->endSetup();
|
app/code/community/NowShop/Synchronize/sql/nowshop_synchronize_setup/mysql4-upgrade-0.0.1-0.0.2.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* NowShop
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENS
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category NowShop
|
17 |
+
* @package NowShop_Synchronize
|
18 |
+
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
19 |
+
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
|
23 |
+
$installer = $this;
|
24 |
+
$installer->startSetup();
|
25 |
+
$installer->run("
|
26 |
+
CREATE TABLE IF NOT EXISTS `".$this->getTable('nowshop/cfeed')."` (
|
27 |
+
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
28 |
+
`category_id` text NOT NULL COMMENT 'CATEGORY ID',
|
29 |
+
`parent_id` text NOT NULL COMMENT 'PARENT CATEGORY ID',
|
30 |
+
`status` tinyint(4) NOT NULL DEFAULT '1' COMMENT 'STATUS',
|
31 |
+
`updated_at` datetime NOT NULL COMMENT 'UPDATED At',
|
32 |
+
PRIMARY KEY (`id`)
|
33 |
+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
34 |
+
");
|
35 |
+
$installer->endSetup();
|
app/code/community/NowShop/Synchronize/sql/nowshop_synchronize_setup/mysql4-upgrade-0.0.2-0.0.3.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* NowShop
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENS
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category NowShop
|
17 |
+
* @package NowShop_Synchronize
|
18 |
+
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
19 |
+
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
|
23 |
+
$installer = $this;
|
24 |
+
$installer->startSetup();
|
25 |
+
$installer->getConnection()->addColumn($this->getTable('nowshop/feed'), 'product_xml_data', array(
|
26 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
27 |
+
'nullable' => true,
|
28 |
+
'comment' => 'Product Xml Data',
|
29 |
+
));
|
30 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/nowshop.xml
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* NowShop
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENS
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category NowShop
|
17 |
+
* @package NowShop_Synchronize
|
18 |
+
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
19 |
+
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
-->
|
23 |
+
<layout>
|
24 |
+
<nowshop_adminhtml_productfeed_index>
|
25 |
+
<referense name="head">
|
26 |
+
<action method="setTitle" translate="title"><title>Sell on NowShop</title></action>
|
27 |
+
</referense>
|
28 |
+
<reference name="menu">
|
29 |
+
<action method="setActive"><menupath>nowshop/synchronize</menupath></action>
|
30 |
+
</reference>
|
31 |
+
<reference name="content">
|
32 |
+
<block type="nowshop/adminhtml_feed" name="products_feed_list">
|
33 |
+
<block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher">
|
34 |
+
<action method="setUseConfirm"><params>0</params></action>
|
35 |
+
</block>
|
36 |
+
</block>
|
37 |
+
</reference>
|
38 |
+
</nowshop_adminhtml_productfeed_index>
|
39 |
+
|
40 |
+
<nowshop_adminhtml_productfeed_grid>
|
41 |
+
<block type="core/text_list" name="root" output="toHtml">
|
42 |
+
<block type="nowshop/adminhtml_feed_grid" name="nowshop.productfeed.grid"/>
|
43 |
+
</block>
|
44 |
+
</nowshop_adminhtml_productfeed_grid>
|
45 |
+
|
46 |
+
<nowshop_adminhtml_categoryfeed_index>
|
47 |
+
<referense name="head">
|
48 |
+
<action method="setTitle" translate="title"><title>Sell on NowShop</title></action>
|
49 |
+
</referense>
|
50 |
+
<reference name="menu">
|
51 |
+
<action method="setActive"><menupath>nowshop/categoryfeed</menupath></action>
|
52 |
+
</reference>
|
53 |
+
<reference name="content">
|
54 |
+
<block type="nowshop/adminhtml_feed_categories" name="nowshop.adminhtml.feed.categories">
|
55 |
+
<block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher">
|
56 |
+
<action method="setUseConfirm"><params>0</params></action>
|
57 |
+
</block>
|
58 |
+
</block>
|
59 |
+
</reference>
|
60 |
+
</nowshop_adminhtml_categoryfeed_index>
|
61 |
+
</layout>
|
app/design/adminhtml/default/default/template/nowshop/categories.phtml
ADDED
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* NowShop
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENS
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category NowShop
|
17 |
+
* @package NowShop_Synchronize
|
18 |
+
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
19 |
+
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
?>
|
23 |
+
<div class="content-header">
|
24 |
+
<table cellspacing="0">
|
25 |
+
<tr>
|
26 |
+
<td style="width:50%;"><h3 class="icon-head head-categories"><?php echo Mage::helper('nowshop')->__('Manage Categories Feed') ?></h3></td>
|
27 |
+
<td class="a-right">
|
28 |
+
<?php echo $this->getButtonsHtml() ?>
|
29 |
+
</td>
|
30 |
+
</tr>
|
31 |
+
</table>
|
32 |
+
</div>
|
33 |
+
<?php if( !$this->isSingleStoreMode() ): ?>
|
34 |
+
<?php echo $this->getChildHtml('store_switcher');?>
|
35 |
+
<?php endif; ?>
|
36 |
+
<div>
|
37 |
+
<div class="entry-edit">
|
38 |
+
<div class="entry-edit-head">
|
39 |
+
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('catalog')->__('Categories') ?></h4>
|
40 |
+
</div>
|
41 |
+
<fieldset id="grop_fields">
|
42 |
+
<form name="nowshop_category_edit_form" id="nowshop_category_edit_form" enctype="multipart/form-data" method="post" action="<?php echo Mage::helper('adminhtml')->getUrl('nowshop/adminhtml_categoryfeed/save',array('_secure'=>true)); ?>">
|
43 |
+
<input type="hidden" name="form_key" value="<?php echo $this->getFormKey(); ?>" />
|
44 |
+
<input type="hidden" name="category_ids" id="product_categories" value="<?php echo $this->getIdsString() ?>">
|
45 |
+
</form>
|
46 |
+
<div id="product-categories" class="tree"></div>
|
47 |
+
</fieldset>
|
48 |
+
</div>
|
49 |
+
</div>
|
50 |
+
<?php if($this->getRootNode() && $this->getRootNode()->hasChildren()): ?>
|
51 |
+
<script type="text/javascript">
|
52 |
+
Ext.EventManager.onDocumentReady(function() {
|
53 |
+
var categoryLoader = new Ext.tree.TreeLoader({
|
54 |
+
dataUrl: '<?php echo $this->getLoadTreeUrl()?>'
|
55 |
+
});
|
56 |
+
|
57 |
+
categoryLoader.createNode = function(config) {
|
58 |
+
config.uiProvider = Ext.tree.CheckboxNodeUI;
|
59 |
+
var node;
|
60 |
+
if (config.children && !config.children.length) {
|
61 |
+
delete(config.children);
|
62 |
+
node = new Ext.tree.AsyncTreeNode(config);
|
63 |
+
|
64 |
+
} else {
|
65 |
+
node = new Ext.tree.TreeNode(config);
|
66 |
+
}
|
67 |
+
return node;
|
68 |
+
};
|
69 |
+
|
70 |
+
categoryLoader.on("beforeload", function(treeLoader, node) {
|
71 |
+
treeLoader.baseParams.category = node.attributes.id;
|
72 |
+
});
|
73 |
+
|
74 |
+
categoryLoader.on("load", function(treeLoader, node, config) {
|
75 |
+
varienWindowOnload();
|
76 |
+
});
|
77 |
+
|
78 |
+
var tree = new Ext.tree.TreePanel('product-categories', {
|
79 |
+
animate:true,
|
80 |
+
loader: categoryLoader,
|
81 |
+
enableDD:false,
|
82 |
+
containerScroll: true,
|
83 |
+
rootUIProvider: Ext.tree.CheckboxNodeUI,
|
84 |
+
selModel: new Ext.tree.CheckNodeMultiSelectionModel(),
|
85 |
+
rootVisible: '<?php echo $this->getRootNode()->getIsVisible() ?>'
|
86 |
+
});
|
87 |
+
|
88 |
+
tree.on('check', function(node) {
|
89 |
+
if(node.attributes.checked) {
|
90 |
+
categoryAdd(node.id);
|
91 |
+
} else {
|
92 |
+
categoryRemove(node.id);
|
93 |
+
}
|
94 |
+
varienElementMethods.setHasChanges(node.getUI().checkbox);
|
95 |
+
}, tree);
|
96 |
+
|
97 |
+
tree.on('check', checkHandler, tree);
|
98 |
+
|
99 |
+
// set the root node
|
100 |
+
var root = new Ext.tree.TreeNode({
|
101 |
+
text: '<?php echo $this->jsQuoteEscape($this->getRootNode()->getName()) ?>',
|
102 |
+
draggable:false,
|
103 |
+
checked:'<?php echo $this->getRootNode()->getChecked() ?>',
|
104 |
+
id:'<?php echo $this->getRootNode()->getId() ?>',
|
105 |
+
disabled: <?php echo ($this->getRootNode()->getDisabled() ? 'true' : 'false') ?>,
|
106 |
+
uiProvider: Ext.tree.CheckboxNodeUI
|
107 |
+
});
|
108 |
+
|
109 |
+
tree.setRootNode(root);
|
110 |
+
bildCategoryTree(root, <?php echo $this->getTreeJson() ?>);
|
111 |
+
tree.addListener('click', categoryClick.createDelegate(this));
|
112 |
+
|
113 |
+
// render the tree
|
114 |
+
tree.render();
|
115 |
+
root.expand();
|
116 |
+
//tree.expandAll();
|
117 |
+
});
|
118 |
+
|
119 |
+
function bildCategoryTree(parent, config){
|
120 |
+
if (!config) return null;
|
121 |
+
|
122 |
+
if (parent && config && config.length){
|
123 |
+
for (var i = 0; i < config.length; i++){
|
124 |
+
config[i].uiProvider = Ext.tree.CheckboxNodeUI;
|
125 |
+
var node;
|
126 |
+
var _node = Object.clone(config[i]);
|
127 |
+
if (_node.children && !_node.children.length) {
|
128 |
+
delete(_node.children);
|
129 |
+
node = new Ext.tree.AsyncTreeNode(_node);
|
130 |
+
} else {
|
131 |
+
node = new Ext.tree.TreeNode(config[i]);
|
132 |
+
}
|
133 |
+
parent.appendChild(node);
|
134 |
+
node.loader = node.getOwnerTree().loader;
|
135 |
+
if(config[i].children){
|
136 |
+
bildCategoryTree(node, config[i].children);
|
137 |
+
}
|
138 |
+
}
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
function categoryClick(node, e){
|
143 |
+
if (node.disabled) {
|
144 |
+
return;
|
145 |
+
}
|
146 |
+
node.getUI().check(!node.getUI().checked());
|
147 |
+
varienElementMethods.setHasChanges(Event.element(e), e);
|
148 |
+
};
|
149 |
+
function categoryAdd(id) {
|
150 |
+
var ids = $('product_categories').value.split(',');
|
151 |
+
ids.push(id);
|
152 |
+
$('product_categories').value = ids.join(',');
|
153 |
+
}
|
154 |
+
function categoryRemove(id) {
|
155 |
+
var ids = $('product_categories').value.split(',');
|
156 |
+
// bug #7654 fixed
|
157 |
+
while (-1 != ids.indexOf(id)) {
|
158 |
+
ids.splice(ids.indexOf(id), 1);
|
159 |
+
}
|
160 |
+
$('product_categories').value = ids.join(',');
|
161 |
+
}
|
162 |
+
function checkHandler(node)
|
163 |
+
{
|
164 |
+
if ( node.attributes.checked && node.parentNode ) {
|
165 |
+
var n = node.parentNode;
|
166 |
+
this.removeListener('check', checkHandler);
|
167 |
+
do {
|
168 |
+
if (n.parentNode == null) {
|
169 |
+
break;
|
170 |
+
} else {
|
171 |
+
n.ui.check(true);
|
172 |
+
}
|
173 |
+
} while (n = n.parentNode );
|
174 |
+
this.on('check', checkHandler);
|
175 |
+
}
|
176 |
+
if ( !node.isLeaf() && node.hasChildNodes() ) {
|
177 |
+
this.removeListener('check', checkHandler);
|
178 |
+
processChildren(node, node.attributes.checked);
|
179 |
+
this.on('check', checkHandler);
|
180 |
+
}
|
181 |
+
}
|
182 |
+
function processChildren(node, state)
|
183 |
+
{
|
184 |
+
if ( !node.hasChildNodes() ) return false;
|
185 |
+
for(var i = 0; i < node.childNodes.length; i++ ) {
|
186 |
+
node.childNodes[i].ui.check(state);
|
187 |
+
if ( node.childNodes[i].hasChildNodes() ) {
|
188 |
+
processChildren(node.childNodes[i], state);
|
189 |
+
}
|
190 |
+
}
|
191 |
+
return true;
|
192 |
+
}
|
193 |
+
</script>
|
194 |
+
<?php endif; ?>
|
app/design/adminhtml/default/default/template/nowshop/feed.phtml
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* NowShop
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENS
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category NowShop
|
17 |
+
* @package NowShop_Synchronize
|
18 |
+
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
19 |
+
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
?>
|
23 |
+
<div class="content-header">
|
24 |
+
<table cellspacing="0">
|
25 |
+
<tr>
|
26 |
+
<td style="width:50%;"><h3 class="icon-head head-products"><?php echo Mage::helper('nowshop')->__('Manage Products Feed') ?></h3></td>
|
27 |
+
<td class="a-right">
|
28 |
+
<?php echo $this->getButtonsHtml() ?>
|
29 |
+
</td>
|
30 |
+
</tr>
|
31 |
+
</table>
|
32 |
+
</div>
|
33 |
+
<?php if( !$this->isSingleStoreMode() ): ?>
|
34 |
+
<?php echo $this->getChildHtml('store_switcher');?>
|
35 |
+
<?php endif;?>
|
36 |
+
<div>
|
37 |
+
<?php echo $this->getGridHtml() ?>
|
38 |
+
</div>
|
app/design/adminhtml/default/default/template/nowshop/grid.phtml
ADDED
@@ -0,0 +1,238 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* NowShop
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENS
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-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 support@nowshop.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category NowShop
|
17 |
+
* @package NowShop_Synchronize
|
18 |
+
* @author Asheesh Singh<asheeshsingh@cedcoss.com>
|
19 |
+
* @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
?>
|
23 |
+
<?php
|
24 |
+
/**
|
25 |
+
* Template for NowShop_Synchronize_Block_Adminhtml_Feed_Grid
|
26 |
+
*
|
27 |
+
*/
|
28 |
+
$numColumns = sizeof($this->getColumns());
|
29 |
+
?>
|
30 |
+
<?php if($this->getCollection()): ?>
|
31 |
+
<?php if($this->canDisplayContainer()): ?>
|
32 |
+
<?php if($this->getGridHeader()): ?>
|
33 |
+
<div class="content-header">
|
34 |
+
<table cellspacing="0">
|
35 |
+
<tr>
|
36 |
+
<td style="width:50%;"><h2><?php echo $this->getGridHeader(); ?></h2></td>
|
37 |
+
</tr>
|
38 |
+
</table>
|
39 |
+
</div>
|
40 |
+
<?php endif ?>
|
41 |
+
|
42 |
+
<div id="<?php echo $this->getId() ?>">
|
43 |
+
<?php else: ?>
|
44 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
45 |
+
<?php endif; ?>
|
46 |
+
<?php if($this->getPagerVisibility() || $this->getExportTypes() || $this->getFilterVisibility()): ?>
|
47 |
+
<table cellspacing="0" class="actions">
|
48 |
+
<tr>
|
49 |
+
<?php if($this->getPagerVisibility()): ?>
|
50 |
+
<td class="pager">
|
51 |
+
<?php echo $this->__('Page') ?>
|
52 |
+
|
53 |
+
<?php $_curPage = $this->getCollection()->getCurPage() ?>
|
54 |
+
<?php $_lastPage = $this->getCollection()->getLastPageNumber() ?>
|
55 |
+
<?php if($_curPage>1): ?>
|
56 |
+
<a href="#" title="<?php echo $this->__('Previous page') ?>" onclick="<?php echo $this->getJsObjectName() ?>.setPage('<?php echo ($_curPage-1) ?>');return false;"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_left.gif') ?>" alt="Go to Previous page" class="arrow"/></a>
|
57 |
+
<?php else: ?>
|
58 |
+
<img src="<?php echo $this->getSkinUrl('images/pager_arrow_left_off.gif') ?>" alt="Go to Previous page" class="arrow"/>
|
59 |
+
<?php endif; ?>
|
60 |
+
|
61 |
+
<input type="text" name="<?php echo $this->getVarNamePage() ?>" value="<?php echo $_curPage ?>" class="input-text page" onkeypress="<?php echo $this->getJsObjectName() ?>.inputPage(event, '<?php echo $_lastPage ?>')"/>
|
62 |
+
|
63 |
+
<?php if($_curPage < $_lastPage): ?>
|
64 |
+
<a href="#" title="<?php echo $this->__('Next page') ?>" onclick="<?php echo $this->getJsObjectName() ?>.setPage('<?php echo ($_curPage+1) ?>');return false;"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_right.gif') ?>" alt="Go to Next page" class="arrow"/></a>
|
65 |
+
<?php else: ?>
|
66 |
+
<img src="<?php echo $this->getSkinUrl('images/pager_arrow_right_off.gif') ?>" alt="Go to Previous page" class="arrow"/>
|
67 |
+
<?php endif; ?>
|
68 |
+
|
69 |
+
<?php echo $this->__('of %s pages', $this->getCollection()->getLastPageNumber()) ?>
|
70 |
+
<span class="separator">|</span>
|
71 |
+
<?php echo $this->__('View') ?>
|
72 |
+
<select name="<?php echo $this->getVarNameLimit() ?>" onchange="<?php echo $this->getJsObjectName() ?>.loadByElement(this)">
|
73 |
+
<option value="20"<?php if($this->getCollection()->getPageSize()==20): ?> selected="selected"<?php endif; ?>>20</option>
|
74 |
+
<option value="30"<?php if($this->getCollection()->getPageSize()==30): ?> selected="selected"<?php endif; ?>>30</option>
|
75 |
+
<option value="50"<?php if($this->getCollection()->getPageSize()==50): ?> selected="selected"<?php endif; ?>>50</option>
|
76 |
+
<option value="100"<?php if($this->getCollection()->getPageSize()==100): ?> selected="selected"<?php endif; ?>>100</option>
|
77 |
+
<option value="200"<?php if($this->getCollection()->getPageSize()==200): ?> selected="selected"<?php endif; ?>>200</option>
|
78 |
+
</select>
|
79 |
+
<?php echo $this->__('per page') ?><span class="separator">|</span>
|
80 |
+
<?php echo $this->__('Total %d records found', $this->getCollection()->getSize()) ?>
|
81 |
+
<span id="<?php echo $this->getHtmlId() ?>-total-count" class="no-display"><?php echo $this->getCollection()->getSize() ?></span>
|
82 |
+
<?php if($this->getRssLists()): ?>
|
83 |
+
<?php foreach ($this->getRssLists() as $_rss): ?>
|
84 |
+
<span class="separator">|</span><a href="<?php echo $_rss->getUrl() ?>" class="link-feed"><?php echo $_rss->getLabel() ?></a>
|
85 |
+
<?php endforeach ?>
|
86 |
+
<?php endif; ?>
|
87 |
+
</td>
|
88 |
+
<?php endif ?>
|
89 |
+
<?php if($this->getExportTypes()): ?>
|
90 |
+
<td class="export a-right">
|
91 |
+
<img src="<?php echo $this->getSkinUrl('images/icon_export.gif') ?>" alt="" class="v-middle"/> <?php echo $this->__('Export to:') ?>
|
92 |
+
<select name="<?php echo $this->getId() ?>_export" id="<?php echo $this->getId() ?>_export" style="width:8em;">
|
93 |
+
<?php foreach ($this->getExportTypes() as $_type): ?>
|
94 |
+
<option value="<?php echo $_type->getUrl() ?>"><?php echo $_type->getLabel() ?></option>
|
95 |
+
<?php endforeach; ?>
|
96 |
+
</select>
|
97 |
+
<?php echo $this->getExportButtonHtml() ?>
|
98 |
+
</td>
|
99 |
+
<?php endif; ?>
|
100 |
+
<td class="filter-actions a-right">
|
101 |
+
<?php echo $this->getMainButtonsHtml() ?>
|
102 |
+
</td>
|
103 |
+
</tr>
|
104 |
+
</table>
|
105 |
+
<?php endif; ?>
|
106 |
+
<?php if($this->getMassactionBlock()->isAvailable()): ?>
|
107 |
+
<?php echo $this->getMassactionBlockHtml() ?>
|
108 |
+
<?php endif ?>
|
109 |
+
<div class="grid">
|
110 |
+
<div class="hor-scroll">
|
111 |
+
<table cellspacing="0" class="data" id="<?php echo $this->getId() ?>_table">
|
112 |
+
<?php foreach ($this->getColumns() as $_column): ?>
|
113 |
+
<col <?php echo $_column->getHtmlProperty() ?> />
|
114 |
+
<?php endforeach; ?>
|
115 |
+
<?php if ($this->getHeadersVisibility() || $this->getFilterVisibility()): ?>
|
116 |
+
<thead>
|
117 |
+
<?php if ($this->getHeadersVisibility()): ?>
|
118 |
+
<tr class="headings">
|
119 |
+
<?php foreach ($this->getColumns() as $_column): ?>
|
120 |
+
<th<?php echo $_column->getHeaderHtmlProperty() ?>><span class="nobr"><?php echo $_column->getHeaderHtml() ?></span></th>
|
121 |
+
<?php endforeach; ?>
|
122 |
+
</tr>
|
123 |
+
<?php endif; ?>
|
124 |
+
<?php if ($this->getFilterVisibility()): ?>
|
125 |
+
<tr class="filter">
|
126 |
+
<?php $i=0;foreach ($this->getColumns() as $_column): ?>
|
127 |
+
<th<?php echo $_column->getHeaderHtmlProperty() ?>><?php echo $_column->getFilterHtml() ?></th>
|
128 |
+
<?php endforeach; ?>
|
129 |
+
</tr>
|
130 |
+
<?php endif ?>
|
131 |
+
</thead>
|
132 |
+
<?php endif; ?>
|
133 |
+
<?php if ($this->getCountTotals()): ?>
|
134 |
+
<tfoot>
|
135 |
+
<tr class="totals">
|
136 |
+
<?php foreach ($this->getColumns() as $_column): ?>
|
137 |
+
<th class="<?php echo $_column->getCssProperty() ?>"><?php echo ($_column->hasTotalsLabel()) ? $_column->getTotalsLabel() : $_column->getRowField($_column->getGrid()->getTotals()) ?> </th>
|
138 |
+
<?php endforeach; ?>
|
139 |
+
</tr>
|
140 |
+
</tfoot>
|
141 |
+
<?php endif; ?>
|
142 |
+
|
143 |
+
<tbody>
|
144 |
+
<?php if (($this->getCollection()->getSize()>0) && (!$this->getIsCollapsed())): ?>
|
145 |
+
<?php foreach ($this->getCollection() as $_index=>$_item): ?>
|
146 |
+
<tr title="<?php echo $this->getRowUrl($_item) ?>"<?php if ($_class = $this->getRowClass($_item)):?> class="<?php echo $_class; ?>"<?php endif;?> >
|
147 |
+
<?php $i=0;foreach ($this->getColumns() as $_column): ?>
|
148 |
+
|
149 |
+
<?php if ($this->shouldRenderCell($_item, $_column)):?>
|
150 |
+
<?php $_rowspan = $this->getRowspan($_item, $_column);?>
|
151 |
+
<?php if($_column->getId() == 'massaction' && $_item->getRequiredrelisting()){ ?>
|
152 |
+
<?php
|
153 |
+
$productUpdatedAt = strtotime($_item->getUpdatedAt());
|
154 |
+
$feedUpdatedAt = strtotime($_item->getRequiredrelisting());
|
155 |
+
?>
|
156 |
+
<?php if($feedUpdatedAt<$productUpdatedAt){ ?>
|
157 |
+
<td <?php echo ($_rowspan ? 'rowspan="' . $_rowspan . '" ' : '') ?>class="<?php echo $_column->getCssProperty() ?> <?php echo ++$i==$numColumns?'last':'' ?>">
|
158 |
+
<?php echo (($_html = $_column->getRowField($_item)) != '' ? $_html : ' ') ?>
|
159 |
+
</td>
|
160 |
+
<?php if ($this->shouldRenderEmptyCell($_item, $_column)):?>
|
161 |
+
<td colspan="<?php echo $this->getEmptyCellColspan($_item)?>" class="last"><?php echo $this->getEmptyCellLabel()?></td>
|
162 |
+
<?php endif;?>
|
163 |
+
<?php }else{ ?>
|
164 |
+
<td <?php echo ($_rowspan ? 'rowspan="' . $_rowspan . '" ' : '') ?>class="<?php echo $_column->getCssProperty() ?> <?php echo ++$i==$numColumns?'last':'' ?>">
|
165 |
+
|
166 |
+
</td>
|
167 |
+
<?php } ?>
|
168 |
+
<?php }else{ ?>
|
169 |
+
<td <?php echo ($_rowspan ? 'rowspan="' . $_rowspan . '" ' : '') ?>class="<?php echo $_column->getCssProperty() ?> <?php echo ++$i==$numColumns?'last':'' ?>">
|
170 |
+
<?php echo (($_html = $_column->getRowField($_item)) != '' ? $_html : ' ') ?>
|
171 |
+
</td>
|
172 |
+
<?php if ($this->shouldRenderEmptyCell($_item, $_column)):?>
|
173 |
+
<td colspan="<?php echo $this->getEmptyCellColspan($_item)?>" class="last"><?php echo $this->getEmptyCellLabel()?></td>
|
174 |
+
<?php endif;?>
|
175 |
+
<?php } ?>
|
176 |
+
<?php endif;?>
|
177 |
+
|
178 |
+
<?php endforeach; ?>
|
179 |
+
</tr>
|
180 |
+
<?php if ($_multipleRows = $this->getMultipleRows($_item)):?>
|
181 |
+
<?php foreach ($_multipleRows as $_i):?>
|
182 |
+
<tr>
|
183 |
+
<?php $i=0;foreach ($this->getMultipleRowColumns($_i) as $_column): ?>
|
184 |
+
<td class="<?php echo $_column->getCssProperty() ?> <?php echo ++$i==$numColumns-1?'last':'' ?>">
|
185 |
+
<?php echo (($_html = $_column->getRowField($_i)) != '' ? $_html : ' ') ?>
|
186 |
+
</td>
|
187 |
+
<?php endforeach; ?>
|
188 |
+
</tr>
|
189 |
+
<?php endforeach;?>
|
190 |
+
<?php endif;?>
|
191 |
+
|
192 |
+
<?php if ($this->shouldRenderSubTotal($_item)): ?>
|
193 |
+
<tr class="subtotals">
|
194 |
+
<?php $i = 0; foreach ($this->getSubTotalColumns() as $_column): ?>
|
195 |
+
<td class="<?php echo $_column->getCssProperty() ?> <?php echo ++$i == $numColumns ? 'last' : '' ?>">
|
196 |
+
<?php echo ($_column->hasSubtotalsLabel() ? $_column->getSubtotalsLabel() :
|
197 |
+
$_column->getRowField($this->getSubTotalItem($_item))
|
198 |
+
);
|
199 |
+
?>
|
200 |
+
</td>
|
201 |
+
<?php endforeach; ?>
|
202 |
+
</tr>
|
203 |
+
<?php endif; ?>
|
204 |
+
<?php endforeach; ?>
|
205 |
+
<?php elseif ($this->getEmptyText()): ?>
|
206 |
+
<tr>
|
207 |
+
<td class="empty-text <?php echo $this->getEmptyTextClass() ?>" colspan="<?php echo $numColumns ?>"><?php echo $this->getEmptyText() ?></td>
|
208 |
+
</tr>
|
209 |
+
<?php endif; ?>
|
210 |
+
</tbody>
|
211 |
+
|
212 |
+
</table>
|
213 |
+
</div>
|
214 |
+
</div>
|
215 |
+
<?php if($this->canDisplayContainer()): ?>
|
216 |
+
</div>
|
217 |
+
<script type="text/javascript">
|
218 |
+
//<![CDATA[
|
219 |
+
<?php echo $this->getJsObjectName() ?> = new varienGrid('<?php echo $this->getId() ?>', '<?php echo $this->getGridUrl() ?>', '<?php echo $this->getVarNamePage() ?>', '<?php echo $this->getVarNameSort() ?>', '<?php echo $this->getVarNameDir() ?>', '<?php echo $this->getVarNameFilter() ?>');
|
220 |
+
<?php echo $this->getJsObjectName() ?>.useAjax = '<?php echo $this->getUseAjax() ?>';
|
221 |
+
<?php if($this->getRowClickCallback()): ?>
|
222 |
+
<?php echo $this->getJsObjectName() ?>.rowClickCallback = <?php echo $this->getRowClickCallback() ?>;
|
223 |
+
<?php endif; ?>
|
224 |
+
<?php if($this->getCheckboxCheckCallback()): ?>
|
225 |
+
<?php echo $this->getJsObjectName() ?>.checkboxCheckCallback = <?php echo $this->getCheckboxCheckCallback() ?>;
|
226 |
+
<?php endif; ?>
|
227 |
+
<?php if($this->getRowInitCallback()): ?>
|
228 |
+
<?php echo $this->getJsObjectName() ?>.initRowCallback = <?php echo $this->getRowInitCallback() ?>;
|
229 |
+
<?php echo $this->getJsObjectName() ?>.initGridRows();
|
230 |
+
<?php endif; ?>
|
231 |
+
<?php if($this->getMassactionBlock()->isAvailable()): ?>
|
232 |
+
<?php echo $this->getMassactionBlock()->getJavaScript() ?>
|
233 |
+
<?php endif ?>
|
234 |
+
<?php echo $this->getAdditionalJavaScript(); ?>
|
235 |
+
//]]>
|
236 |
+
</script>
|
237 |
+
<?php endif; ?>
|
238 |
+
<?php endif ?>
|
app/etc/modules/NowShop_NowShopPayment.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<NowShop_NowShopPayment>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</NowShop_NowShopPayment>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/etc/modules/NowShop_NowShopShipping.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<NowShop_NowShopShipping>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</NowShop_NowShopShipping>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/etc/modules/NowShop_Synchronize.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<NowShop_Synchronize>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</NowShop_Synchronize>
|
8 |
+
</modules>
|
9 |
+
</config>
|
media/nowshop/categoryfeed/test.txt
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
default test
|
media/nowshop/productfeed/test.txt
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
default text
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Ced_NowShop</name>
|
4 |
+
<version>0.0.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>NowShop Integration</summary>
|
10 |
+
<description>Sell on NowShop.</description>
|
11 |
+
<notes>Stable Release.</notes>
|
12 |
+
<authors><author><name>Nowshop</name><user>Nowshop</user><email>dan@nowshop.com</email></author><author><name>Asheesh Singh</name><user>asheeshsingh</user><email>asheeshsingh@cedcoss.com</email></author></authors>
|
13 |
+
<date>2014-06-02</date>
|
14 |
+
<time>11:44:05</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="NowShop"><dir><dir name="NowShopPayment"><dir name="Model"><file name="Nowshop.php" hash="7810c3318342e32bed3ece6bebc9fec5"/></dir><dir name="etc"><file name="config.xml" hash="92c93dd60cab7d0f0bae2737d9105437"/><file name="system.xml--" hash="fe50468fd403f28a90a5f167b2ca844d"/></dir></dir><dir name="NowShopShipping"><dir name="Model"><dir name="Carrier"><file name="Nowshop.php" hash="b298a471f0bb1020d2459decff5140b6"/></dir><dir name="Sales"><dir name="Quote"><file name="Address.php" hash="7b41cde8941657a2477efe542a492609"/></dir></dir><dir name="Shipping"><file name="Config.php" hash="c5280419a21742772a2ee2bdfd6ca41c"/></dir></dir><dir name="etc"><file name="config.xml" hash="f6aed07d83d59b1876e247f409c38446"/><file name="system.xml--" hash="f42eb1a9c76e87a25b35596f94738fa7"/></dir></dir><dir name="Synchronize"><dir name="Block"><dir name="Adminhtml"><dir name="Feed"><file name="Categories.php" hash="ef79b79d4ebe2cf73227e42117f0f4c4"/><file name="Grid.php" hash="8a7f63ef281a29058a1591c95222c334"/><dir name="Renderer"><file name="Listed.php" hash="7fd94eb87180cc162ea4cc77b48a4607"/><file name="Relisted.php" hash="9e0bf3a4c568f051f5c4b4e4e76bf522"/></dir></dir><file name="Feed.php" hash="e0b8b4fae1c4f0310410fbde3c23924e"/></dir></dir><dir name="Helper"><file name="Arraytoxml.php" hash="afc6c942e7ed8388e1beadeae0b190ce"/><file name="Data.php" hash="e3050cd7bf68c57b16733422def7420d"/></dir><dir name="Model"><file name="Cfeed.php" hash="4b2ae9d960e662fe40161b35e4b9c6ac"/><file name="Feed.php" hash="e433bcbb61ccc1298e3425738402b110"/><dir name="Mysql4"><dir name="Cfeed"><file name="Collection.php" hash="ed5a4387d19663d82f4f91bff890d446"/></dir><file name="Cfeed.php" hash="710e43c5830a12413a501b5019c0ee90"/><dir name="Feed"><file name="Collection.php" hash="c025fb1ea502042a5432cdf86f228a43"/></dir><file name="Feed.php" hash="a7e43caa7777333569d8f943a894ebe6"/><file name="Setup.php" hash="b21da92587897b12a1a04848a5d5721a"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Brand.php" hash="bc4ec0fdd6b67cbdb2cce98f2699bbae"/><file name="Isocode.php" hash="482cf305f0deb3af5e426964109dbd3a"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CategoryfeedController.php" hash="8845716c832fe441e0b8026f2e462bc4"/><file name="ProductfeedController.php" hash="83fdbab78abdbd7818b565c2a0bd3b38"/></dir><file name="OrderController.php" hash="cbc5b01bb8519647949ea80a31098d1c"/></dir><dir name="etc"><file name="adminhtml.xml" hash="9d13b6038e537cc351b7c9d7f0ca27e0"/><file name="config.xml" hash="6165c6baffe2f92f5c12b7f386b70e41"/><file name="system.xml" hash="c2a7c5afee37c07f104e5ffb2e56b883"/><dir name="xsd"><file name="product_feed.xsd" hash="c07e735a6696919adc95910101441b56"/></dir></dir><dir name="sql"><dir name="nowshop_synchronize_setup"><file name="mysql4-install-0.0.1.php" hash="4e39f52f4b59a8616fa441f56aa1cbf9"/><file name="mysql4-upgrade-0.0.1-0.0.2.php" hash="704bfc039f2a66a0e360a0b523c84a73"/><file name="mysql4-upgrade-0.0.2-0.0.3.php" hash="14199af61f956d982632d600ef1b8332"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="NowShop_NowShopPayment.xml" hash="333cd81914d0da258884511ef34f91eb"/><file name="NowShop_NowShopShipping.xml" hash="cf4415f704aafb1102db91d2d515bb6c"/><file name="NowShop_Synchronize.xml" hash="575e14f3e0906c155d025bbf70e1de33"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="nowshop.xml" hash="6de84482c216cf6d07f8e7d493e85bb4"/></dir><dir name="template"><dir name="nowshop"><file name="categories.phtml" hash="8ba76f2b6602f21bcf854161c8d3462b"/><file name="feed.phtml" hash="8a601e8f650f0dd7cafe4fa1be07ff81"/><file name="grid.phtml" hash="6b22801e0e7a8b5c19e0182a75854915"/></dir></dir></dir></dir></dir></target><target name="magemedia"><dir name="nowshop"><dir name="productfeed"><file name="test.txt" hash="6f187b66ae7a361b28988ee534a5b8ba"/></dir><dir name="categoryfeed"><file name="test.txt" hash="3c6f24cc8bba1983873f0aa978c025b3"/></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>
|