Version Notes
A subscription is required.
Download this release
Release Info
Developer | Nextopia |
Extension | NextopiaConnect |
Version | 2.1.22 |
Comparing to | |
See all releases |
Version 2.1.22
- app/code/local/Nextopia/Connect/Block/Nconnect.php +10 -0
- app/code/local/Nextopia/Connect/Helper/Data.php +4 -0
- app/code/local/Nextopia/Connect/Model/Boolean.php +11 -0
- app/code/local/Nextopia/Connect/Model/Export.php +169 -0
- app/code/local/Nextopia/Connect/controllers/IndexController.php +12 -0
- app/code/local/Nextopia/Connect/etc/config.xml +69 -0
- app/code/local/Nextopia/Connect/etc/system.xml +61 -0
- app/design/frontend/base/default/layout/nextopiaconnect.xml +13 -0
- app/design/frontend/base/default/template/nextopia/nextopia_connect.phtml +5 -0
- app/etc/modules/Nextopia_Connect.xml +9 -0
- package.xml +18 -0
app/code/local/Nextopia/Connect/Block/Nconnect.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Nextopia_Connect_Block_Nconnect extends Mage_Core_Block_Abstract
|
4 |
+
{
|
5 |
+
protected function _toHtml()
|
6 |
+
{
|
7 |
+
|
8 |
+
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Nextopia/Connect/Helper/Data.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Nextopia_Connect_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
}
|
app/code/local/Nextopia/Connect/Model/Boolean.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Nextopia_Connect_Model_Boolean
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
return array(
|
7 |
+
array('value'=> 'True', 'label'=>Mage::helper('nconnect')->__('True')),
|
8 |
+
array('value'=> 'False', 'label'=>Mage::helper('nconnect')->__('False')),
|
9 |
+
);
|
10 |
+
}
|
11 |
+
}
|
app/code/local/Nextopia/Connect/Model/Export.php
ADDED
@@ -0,0 +1,169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// Uncomment to enable debugging
|
3 |
+
// ini_set('display_errors', '1');
|
4 |
+
// ini_set('error_reporting', E_ALL);
|
5 |
+
|
6 |
+
// Increase memory limit
|
7 |
+
// ini_set('memory_limit', '1024M');
|
8 |
+
|
9 |
+
|
10 |
+
class Nextopia_Connect_Model_Export
|
11 |
+
{
|
12 |
+
|
13 |
+
function run() {
|
14 |
+
|
15 |
+
// Varien_Profiler::enable();
|
16 |
+
// Mage::setIsDeveloperMode(true);
|
17 |
+
ini_set('display_errors', 1);
|
18 |
+
$per_page = isset($_GET['per'])? $_GET['per'] : 1000;
|
19 |
+
|
20 |
+
$connect_options = Mage::getStoreConfig('nconnect_options');
|
21 |
+
|
22 |
+
$include_non_saleable = isset($connect_options['settings']['include_non_saleable']) && $connect_options['settings']['include_non_saleable'] == 'True';
|
23 |
+
$include_out_of_stock = isset($connect_options['settings']['include_out_of_stock']) && $connect_options['settings']['include_out_of_stock'] == 'True';
|
24 |
+
|
25 |
+
$tags_to_strip = array('@<script[^>]*?>.*?</script>@si',
|
26 |
+
'@<style[^>]*?>.*?</style>@siU',
|
27 |
+
'@<[\/\!]*?[^<>]*?>@si',
|
28 |
+
'@<![\s\S]*?--[ ", "\n\r]*>@',
|
29 |
+
'/\s+/');
|
30 |
+
|
31 |
+
$category_names = array();
|
32 |
+
|
33 |
+
$host_url = $_SERVER['HTTP_HOST'];
|
34 |
+
$url_prefix = $host_url;
|
35 |
+
$image_prefix = $host_url . 'media/catalog/product/cache';
|
36 |
+
|
37 |
+
$num_products = Mage::getModel('catalog/product')->getCollection()
|
38 |
+
->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
|
39 |
+
->addAttributeToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
|
40 |
+
->getSize();
|
41 |
+
$num_pages = ceil($num_products / $per_page);
|
42 |
+
|
43 |
+
if (isset($_GET['debug']) && $_GET['debug'] == 'true') {
|
44 |
+
echo "num: $num_products pages: $num_pages\n";
|
45 |
+
}
|
46 |
+
|
47 |
+
$skip_products = array_flip(array()); // add any products here you don't want.
|
48 |
+
|
49 |
+
$add_fields = array(
|
50 |
+
'Url',
|
51 |
+
'Category'
|
52 |
+
);
|
53 |
+
|
54 |
+
$header_fields = array();
|
55 |
+
|
56 |
+
$split_fields = array(
|
57 |
+
', ' => array(
|
58 |
+
'availablesizes', 'availablecolors', 'shirttype'
|
59 |
+
),
|
60 |
+
'|' => array(
|
61 |
+
'aten_color', 'aten_size',
|
62 |
+
)
|
63 |
+
);
|
64 |
+
$header_emitted = false;
|
65 |
+
|
66 |
+
for ($cur_page = 1; $cur_page <= $num_pages; $cur_page++) {
|
67 |
+
|
68 |
+
$products = Mage::getModel('catalog/product')->getCollection()
|
69 |
+
->addAttributeToSelect('*')
|
70 |
+
->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
|
71 |
+
->addAttributeToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
|
72 |
+
->setCurPage($cur_page)
|
73 |
+
->setPageSize($per_page);
|
74 |
+
|
75 |
+
$items = array();
|
76 |
+
foreach ($products as $product) {
|
77 |
+
$is_salable = $product->getData('is_salable');
|
78 |
+
if (!$include_non_saleable && $is_salable == 0) {
|
79 |
+
continue;
|
80 |
+
}
|
81 |
+
if ($include_out_of_stock) {
|
82 |
+
$stock= Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty();
|
83 |
+
if ($stock == 0) {
|
84 |
+
continue;
|
85 |
+
}
|
86 |
+
}
|
87 |
+
$item = array();
|
88 |
+
$categories = array();
|
89 |
+
|
90 |
+
$data = $product->getData();
|
91 |
+
|
92 |
+
$attributes = $product->getAttributes();
|
93 |
+
|
94 |
+
foreach($attributes as $akey => $attribute) {
|
95 |
+
$value = $attribute->getFrontend()->getValue($product);
|
96 |
+
$item[$akey] = $value;
|
97 |
+
}
|
98 |
+
foreach($item as $fkey => $_) {
|
99 |
+
if (!$header_emitted && !in_array($fkey, $header_fields)) {
|
100 |
+
$header_fields[] = $fkey;
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
if (isset($skip_products[$item['entity_id']])) {
|
105 |
+
continue;
|
106 |
+
}
|
107 |
+
|
108 |
+
$item['Url'] = $url_prefix . $item['url_path'];
|
109 |
+
$item['image'] = $image_prefix . $item['image'];
|
110 |
+
$item['image'] = $Image = $product->getImageUrl();;
|
111 |
+
|
112 |
+
foreach($split_fields as $splitter => $split_field_list) {
|
113 |
+
foreach($split_field_list as $split_field) {
|
114 |
+
if (!empty($item[$split_field])) {
|
115 |
+
$item[$split_field] = str_replace($splitter, '||', $item[$split_field]);
|
116 |
+
}
|
117 |
+
}
|
118 |
+
}
|
119 |
+
|
120 |
+
if (!empty($data['short_description'])) {
|
121 |
+
$item['description'] = trim(preg_replace($tags_to_strip, ' ', $data['short_description']));
|
122 |
+
}
|
123 |
+
|
124 |
+
$category_ids = $product->getCategoryIds();
|
125 |
+
|
126 |
+
foreach($category_ids as $category_id) {
|
127 |
+
if (!isset($category_names[$category_id])) {
|
128 |
+
$category_names[$category_id] = Mage::getModel('catalog/category')
|
129 |
+
->load($category_id)->getName();
|
130 |
+
}
|
131 |
+
$categories[] = $category_names[$category_id];
|
132 |
+
}
|
133 |
+
|
134 |
+
$item['Category'] = implode('||', $categories);
|
135 |
+
|
136 |
+
|
137 |
+
$items[] = $item;
|
138 |
+
}
|
139 |
+
|
140 |
+
if (!$header_emitted) {
|
141 |
+
foreach($add_fields as $add_field) {
|
142 |
+
$header_fields[] = $add_field;
|
143 |
+
}
|
144 |
+
echo implode("\t", $header_fields) . "\n";
|
145 |
+
$header_emitted = true;
|
146 |
+
}
|
147 |
+
|
148 |
+
foreach($items as $item) {
|
149 |
+
$row = array();
|
150 |
+
foreach($header_fields as $field) {
|
151 |
+
if (!empty($item[$field])) {
|
152 |
+
$row[] = $this->csv_encode($item[$field]);
|
153 |
+
} else {
|
154 |
+
$row[] = '';
|
155 |
+
}
|
156 |
+
}
|
157 |
+
echo implode("\t", $row) . "\n";
|
158 |
+
}
|
159 |
+
}
|
160 |
+
|
161 |
+
|
162 |
+
}
|
163 |
+
|
164 |
+
private function csv_encode($str) {
|
165 |
+
$str = preg_replace('/\s+/', ' ', $str);
|
166 |
+
return str_replace('"', '""', $str);
|
167 |
+
}
|
168 |
+
|
169 |
+
}
|
app/code/local/Nextopia/Connect/controllers/IndexController.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Nextopia_Connect_IndexController extends Mage_Core_Controller_Front_Action {
|
4 |
+
public function indexAction() {
|
5 |
+
// $this->loadLayout();
|
6 |
+
//
|
7 |
+
// $this->renderLayout();
|
8 |
+
header('Content-type: text/plain');
|
9 |
+
$model = new Nextopia_Connect_Model_Export();
|
10 |
+
$model->run();
|
11 |
+
}
|
12 |
+
}
|
app/code/local/Nextopia/Connect/etc/config.xml
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<modules>
|
3 |
+
<Nextopia_Connect>
|
4 |
+
<version>2.1.22</version>
|
5 |
+
</Nextopia_Connect>
|
6 |
+
</modules>
|
7 |
+
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<nconnect>
|
11 |
+
<class>Nextopia_Connect_Model</class>
|
12 |
+
</nconnect>
|
13 |
+
</models>
|
14 |
+
<helpers>
|
15 |
+
<nconnect>
|
16 |
+
<class>Nextopia_Connect_Helper</class>
|
17 |
+
</nconnect>
|
18 |
+
</helpers>
|
19 |
+
|
20 |
+
<blocks>
|
21 |
+
<nconnect>
|
22 |
+
<class>Nextopia_Connect_Block</class>
|
23 |
+
</nconnect>
|
24 |
+
</blocks>
|
25 |
+
</global>
|
26 |
+
|
27 |
+
<frontend>
|
28 |
+
<routers>
|
29 |
+
<nconnect>
|
30 |
+
<use>standard</use>
|
31 |
+
<args>
|
32 |
+
<module>Nextopia_Connect</module>
|
33 |
+
<frontName>nconnect</frontName>
|
34 |
+
</args>
|
35 |
+
</nconnect>
|
36 |
+
</routers>
|
37 |
+
|
38 |
+
<layout>
|
39 |
+
<updates>
|
40 |
+
<nconnect>
|
41 |
+
<file>nextopiaconnect.xml</file>
|
42 |
+
</nconnect>
|
43 |
+
</updates>
|
44 |
+
</layout>
|
45 |
+
|
46 |
+
</frontend>
|
47 |
+
<adminhtml>
|
48 |
+
<acl>
|
49 |
+
<resources>
|
50 |
+
<admin>
|
51 |
+
<children>
|
52 |
+
<system>
|
53 |
+
<children>
|
54 |
+
<config>
|
55 |
+
<children>
|
56 |
+
<nconnect_options>
|
57 |
+
<title>Nextopia Configuration</title>
|
58 |
+
</nconnect_options>
|
59 |
+
</children>
|
60 |
+
</config>
|
61 |
+
</children>
|
62 |
+
</system>
|
63 |
+
</children>
|
64 |
+
</admin>
|
65 |
+
</resources>
|
66 |
+
</acl>
|
67 |
+
</adminhtml>
|
68 |
+
|
69 |
+
</config>
|
app/code/local/Nextopia/Connect/etc/system.xml
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<nextopiaconfig translate="label" module="nsearch">
|
5 |
+
<label><![CDATA[<img src="http://assets.ecomm-search.com/logo-black-text.png">]]></label>
|
6 |
+
<sort_order>99999</sort_order>
|
7 |
+
</nextopiaconfig>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<nconnect_options translate="label" module="nsearch">
|
11 |
+
<label>Nextopia Connect</label>
|
12 |
+
<tab>nextopiaconfig</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>1000</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
18 |
+
<groups>
|
19 |
+
<settings translate="label">
|
20 |
+
<label>Configuration Fields</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>1</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>1</show_in_website>
|
25 |
+
<show_in_store>1</show_in_store>
|
26 |
+
<fields>
|
27 |
+
<include_non_saleable>
|
28 |
+
<label>Include Non-Saleable</label>
|
29 |
+
<frontend_type>select</frontend_type>
|
30 |
+
<source_model>nconnect/Boolean</source_model>
|
31 |
+
<sort_order>1</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
<comment><![CDATA[]]></comment>
|
36 |
+
</include_non_saleable>
|
37 |
+
<include_out_of_stock>
|
38 |
+
<label>Include Out Of Stock Items</label>
|
39 |
+
<frontend_type>select</frontend_type>
|
40 |
+
<source_model>nconnect/Boolean</source_model>
|
41 |
+
<sort_order>2</sort_order>
|
42 |
+
<show_in_default>1</show_in_default>
|
43 |
+
<show_in_website>1</show_in_website>
|
44 |
+
<show_in_store>1</show_in_store>
|
45 |
+
<comment><![CDATA[]]></comment>
|
46 |
+
</include_out_of_stock>
|
47 |
+
<included_visibilities>
|
48 |
+
<label>Included visibilities</label>
|
49 |
+
<frontend_type>textarea</frontend_type>
|
50 |
+
<sort_order>3</sort_order>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>1</show_in_website>
|
53 |
+
<show_in_store>1</show_in_store>
|
54 |
+
<comment><![CDATA[]]></comment>
|
55 |
+
</included_visibilities>
|
56 |
+
</fields>
|
57 |
+
</settings>
|
58 |
+
</groups>
|
59 |
+
</nconnect_options>
|
60 |
+
</sections>
|
61 |
+
</config>
|
app/design/frontend/base/default/layout/nextopiaconnect.xml
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<nconnect_index_index translate="label">
|
4 |
+
<reference name="root">
|
5 |
+
<action method="setTemplate"><template>nextopia/nextopia_connect.phtml</template></action>
|
6 |
+
<remove name="core_profiler" />
|
7 |
+
</reference>
|
8 |
+
<reference name="content">
|
9 |
+
<block type="nconnect/nconnect" name="nconnect">
|
10 |
+
</block>
|
11 |
+
</reference>
|
12 |
+
</nconnect_index_index>
|
13 |
+
</layout>
|
app/design/frontend/base/default/template/nextopia/nextopia_connect.phtml
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
header('Content-type: text/plain');
|
4 |
+
|
5 |
+
echo $this->getChildHtml('content');
|
app/etc/modules/Nextopia_Connect.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version = "1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Nextopia_Connect>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Nextopia_Connect>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>NextopiaConnect</name>
|
4 |
+
<version>2.1.22</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>Proprietary</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>An extension to connect with Nextopia E-Commerce Search.</summary>
|
10 |
+
<description>This extension will connect you with Nextopia E-Commerce Search. A subscription is required.</description>
|
11 |
+
<notes>A subscription is required.</notes>
|
12 |
+
<authors><author><name>Nextopia</name><user>Nextopia</user><email>sanjay@nextopia.com</email></author></authors>
|
13 |
+
<date>2014-01-10</date>
|
14 |
+
<time>2014-01-10</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Nextopia"><dir name="Connect"><dir name="Block"><file name="Nconnect.php" hash="f4b7fb06dd2723fb961d38608d674643"/></dir><dir name="Helper"><file name="Data.php" hash="e6667f906308da327c11d806fdec4240"/></dir><dir name="Model"><file name="Boolean.php" hash="3845ad1f11f50fafbfabf607909fac08"/><file name="Export.php" hash="33d8c305f34a0b479e95733926bdad47"/></dir><dir name="controllers"><file name="IndexController.php" hash="26105cd789e07b301c4ffc8ba8ee0cb9"/></dir><dir name="etc"><file name="config.xml" hash="eacec999937fc53b815120966e74db48"/><file name="system.xml" hash="7215b1b30cb0001e8796f93d68cb810e"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="nextopiaconnect.xml" hash="e917264115fa91731d8e3d9ce2e2156c"/></dir><dir name="template"><dir name="nextopia"><file name="nextopia_connect.phtml" hash="da29e864a2a88a39020c7e46ecf465c8"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Nextopia_Connect.xml" hash="bb215edd4f858997dfa470bd8d0a990d"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|