Version Notes
Improved API
Download this release
Release Info
Developer | Kwaku Zigah |
Extension | NowInStore_CatalogBuilder |
Version | 1.1.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.1.0
- app/code/local/NowInStore/CatalogBuilder/controllers/AuthController.php +11 -3
- app/code/local/NowInStore/CatalogBuilder/controllers/CategoriesController.php +4 -4
- app/code/local/NowInStore/CatalogBuilder/controllers/ProductsController.php +11 -8
- app/code/local/NowInStore/CatalogBuilder/controllers/ProfileController.php +3 -3
- app/code/local/NowInStore/CatalogBuilder/etc/config.xml +1 -1
- package.xml +6 -6
app/code/local/NowInStore/CatalogBuilder/controllers/AuthController.php
CHANGED
@@ -4,7 +4,15 @@ class NowInStore_CatalogBuilder_AuthController extends Mage_Core_Controller_Fron
|
|
4 |
public function indexAction()
|
5 |
{
|
6 |
$email = Mage::getStoreConfig('trans_email/ident_general/email');
|
7 |
-
$baseUrl = urlencode
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
}
|
10 |
-
}
|
4 |
public function indexAction()
|
5 |
{
|
6 |
$email = Mage::getStoreConfig('trans_email/ident_general/email');
|
7 |
+
$baseUrl = urlencode(Mage::getBaseUrl());
|
8 |
+
//$this->getResponse()->setRedirect("https://www.nowinstore.com/auth/magento/callback?baseUrl=$baseUrl");
|
9 |
+
$hostname = Mage::app()->getFrontController()->getRequest()->getHttpHost();
|
10 |
+
$address = str_replace("\r\n", "<br/>", Mage::getStoreConfig('general/store_information/address'));
|
11 |
+
$email = Mage::getStoreConfig('trans_email/ident_general/email');
|
12 |
+
$businessName = Mage::getStoreConfig('general/store_information/name');
|
13 |
+
$name = Mage::getStoreConfig('trans_email/ident_general/name');
|
14 |
+
$phone = Mage::getStoreConfig('general/store_information/phone');
|
15 |
+
$version = Mage::getVersion();
|
16 |
+
$this->getResponse()->setRedirect("https://www.nowinstore.com/auth/magento/callback?baseUrl=$baseUrl&hostname=$hostname&address=$address&email=$email&businessName=$businessName&name=$name&phone=$phone&version=$version");
|
17 |
}
|
18 |
+
}
|
app/code/local/NowInStore/CatalogBuilder/controllers/CategoriesController.php
CHANGED
@@ -7,18 +7,18 @@ class NowInStore_CatalogBuilder_CategoriesController extends Mage_Core_Controlle
|
|
7 |
->getCollection()
|
8 |
->addAttributeToSelect('*')
|
9 |
->addIsActiveFilter();
|
10 |
-
$categories =
|
11 |
foreach($category_collection as $category) {
|
12 |
$children = $category->getChildrenCategories()->toArray();
|
13 |
if (count($children) == 0) {
|
14 |
-
array_push($categories,
|
15 |
"id" => $category->getId(),
|
16 |
"name" => $category->getName()
|
17 |
-
|
18 |
}
|
19 |
}
|
20 |
$jsonData = json_encode($categories);
|
21 |
$this->getResponse()->setHeader('Content-type', 'application/json');
|
22 |
$this->getResponse()->setBody($jsonData);
|
23 |
}
|
24 |
-
}
|
7 |
->getCollection()
|
8 |
->addAttributeToSelect('*')
|
9 |
->addIsActiveFilter();
|
10 |
+
$categories = array();
|
11 |
foreach($category_collection as $category) {
|
12 |
$children = $category->getChildrenCategories()->toArray();
|
13 |
if (count($children) == 0) {
|
14 |
+
array_push($categories, array(
|
15 |
"id" => $category->getId(),
|
16 |
"name" => $category->getName()
|
17 |
+
));
|
18 |
}
|
19 |
}
|
20 |
$jsonData = json_encode($categories);
|
21 |
$this->getResponse()->setHeader('Content-type', 'application/json');
|
22 |
$this->getResponse()->setBody($jsonData);
|
23 |
}
|
24 |
+
}
|
app/code/local/NowInStore/CatalogBuilder/controllers/ProductsController.php
CHANGED
@@ -14,7 +14,7 @@ class NowInStore_CatalogBuilder_ProductsController extends Mage_Core_Controller_
|
|
14 |
->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
|
15 |
->setPageSize(50)
|
16 |
->setCurPage($page)
|
17 |
-
->addAttributeToSelect(
|
18 |
|
19 |
$keywords = $_GET['keywords'];
|
20 |
if (!empty ($keywords)) {
|
@@ -27,7 +27,7 @@ class NowInStore_CatalogBuilder_ProductsController extends Mage_Core_Controller_
|
|
27 |
->joinField('category_id','catalog/category_product','category_id','product_id=entity_id',null,'left')
|
28 |
->addAttributeToFilter('category_id', array('in' => $category_id));
|
29 |
}
|
30 |
-
$products =
|
31 |
$currency = Mage::app()->getStore()->getCurrentCurrencyCode();
|
32 |
foreach($product_collection as $product) {
|
33 |
if ($product->isConfigurable()) {
|
@@ -36,20 +36,23 @@ class NowInStore_CatalogBuilder_ProductsController extends Mage_Core_Controller_
|
|
36 |
$attributeOptions = array();
|
37 |
foreach ($productAttributeOptions as $productAttribute) {
|
38 |
foreach ($productAttribute['values'] as $attribute) {
|
39 |
-
$
|
|
|
|
|
40 |
}
|
41 |
}
|
42 |
-
array_push($products,
|
43 |
"id" => $product->getId(),
|
44 |
"title" => $product->getName(),
|
45 |
"sku" => $product->getSku(),
|
46 |
"price" => intval($product->getPrice()),
|
47 |
"main_image" => $product->getImageUrl(),
|
|
|
48 |
"thumbnail_image" => (string)Mage::helper('catalog/image')->init($product, 'image')->resize(75),
|
49 |
"iso_currency_code" => $currency,
|
50 |
"url" => $product->getProductUrl(),
|
51 |
"variations" => $attributeOptions
|
52 |
-
|
53 |
}
|
54 |
$jsonData = json_encode($products);
|
55 |
$this->getResponse()->setHeader('Content-type', 'application/json');
|
@@ -62,7 +65,7 @@ class NowInStore_CatalogBuilder_ProductsController extends Mage_Core_Controller_
|
|
62 |
// ->addAttributeToFilter('is_active', 1)
|
63 |
->addExpressionAttributeToSelect('lower_name', 'LOWER({{name}})', array('name'))
|
64 |
->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
|
65 |
-
->addAttributeToSelect(
|
66 |
|
67 |
$query = $_GET['query'];
|
68 |
if (!empty ($query)) {
|
@@ -75,8 +78,8 @@ class NowInStore_CatalogBuilder_ProductsController extends Mage_Core_Controller_
|
|
75 |
->joinField('category_id','catalog/category_product','category_id','product_id=entity_id',null,'left')
|
76 |
->addAttributeToFilter('category_id', array('in' => $category_id));
|
77 |
}
|
78 |
-
$jsonData = json_encode(
|
79 |
$this->getResponse()->setHeader('Content-type', 'application/json');
|
80 |
$this->getResponse()->setBody($jsonData);
|
81 |
}
|
82 |
-
}
|
14 |
->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
|
15 |
->setPageSize(50)
|
16 |
->setCurPage($page)
|
17 |
+
->addAttributeToSelect(array('id', 'name', 'sku', 'price', 'image', 'description'));
|
18 |
|
19 |
$keywords = $_GET['keywords'];
|
20 |
if (!empty ($keywords)) {
|
27 |
->joinField('category_id','catalog/category_product','category_id','product_id=entity_id',null,'left')
|
28 |
->addAttributeToFilter('category_id', array('in' => $category_id));
|
29 |
}
|
30 |
+
$products = array();
|
31 |
$currency = Mage::app()->getStore()->getCurrentCurrencyCode();
|
32 |
foreach($product_collection as $product) {
|
33 |
if ($product->isConfigurable()) {
|
36 |
$attributeOptions = array();
|
37 |
foreach ($productAttributeOptions as $productAttribute) {
|
38 |
foreach ($productAttribute['values'] as $attribute) {
|
39 |
+
$label = $productAttribute['label'];
|
40 |
+
$valueIndex = $attribute['value_index'];
|
41 |
+
$attributeOptions[$label][$valueIndex] = $attribute['store_label'];
|
42 |
}
|
43 |
}
|
44 |
+
array_push($products, array(
|
45 |
"id" => $product->getId(),
|
46 |
"title" => $product->getName(),
|
47 |
"sku" => $product->getSku(),
|
48 |
"price" => intval($product->getPrice()),
|
49 |
"main_image" => $product->getImageUrl(),
|
50 |
+
"description" => $product->getDescription(),
|
51 |
"thumbnail_image" => (string)Mage::helper('catalog/image')->init($product, 'image')->resize(75),
|
52 |
"iso_currency_code" => $currency,
|
53 |
"url" => $product->getProductUrl(),
|
54 |
"variations" => $attributeOptions
|
55 |
+
));
|
56 |
}
|
57 |
$jsonData = json_encode($products);
|
58 |
$this->getResponse()->setHeader('Content-type', 'application/json');
|
65 |
// ->addAttributeToFilter('is_active', 1)
|
66 |
->addExpressionAttributeToSelect('lower_name', 'LOWER({{name}})', array('name'))
|
67 |
->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
|
68 |
+
->addAttributeToSelect(array('id', 'name', 'sku', 'price', 'image'));
|
69 |
|
70 |
$query = $_GET['query'];
|
71 |
if (!empty ($query)) {
|
78 |
->joinField('category_id','catalog/category_product','category_id','product_id=entity_id',null,'left')
|
79 |
->addAttributeToFilter('category_id', array('in' => $category_id));
|
80 |
}
|
81 |
+
$jsonData = json_encode(array("count" => $product_collection->count()));
|
82 |
$this->getResponse()->setHeader('Content-type', 'application/json');
|
83 |
$this->getResponse()->setBody($jsonData);
|
84 |
}
|
85 |
+
}
|
app/code/local/NowInStore/CatalogBuilder/controllers/ProfileController.php
CHANGED
@@ -5,15 +5,15 @@ class NowInStore_CatalogBuilder_ProfileController extends Mage_Core_Controller_F
|
|
5 |
{
|
6 |
$hostname = Mage::app()->getFrontController()->getRequest()->getHttpHost();
|
7 |
$address = str_replace("\r\n", "<br/>", Mage::getStoreConfig('general/store_information/address'));
|
8 |
-
$jsonData = json_encode(
|
9 |
"business_name" => Mage::getStoreConfig('general/store_information/name'),
|
10 |
"name" => Mage::getStoreConfig('trans_email/ident_general/name'),
|
11 |
"email" => Mage::getStoreConfig('trans_email/ident_general/email'),
|
12 |
"baseUrl" => Mage::getBaseUrl(),
|
13 |
"phone" => Mage::getStoreConfig('general/store_information/phone'),
|
14 |
"address" => $address
|
15 |
-
|
16 |
$this->getResponse()->setHeader('Content-type', 'application/json');
|
17 |
$this->getResponse()->setBody($jsonData);
|
18 |
}
|
19 |
-
}
|
5 |
{
|
6 |
$hostname = Mage::app()->getFrontController()->getRequest()->getHttpHost();
|
7 |
$address = str_replace("\r\n", "<br/>", Mage::getStoreConfig('general/store_information/address'));
|
8 |
+
$jsonData = json_encode(array(
|
9 |
"business_name" => Mage::getStoreConfig('general/store_information/name'),
|
10 |
"name" => Mage::getStoreConfig('trans_email/ident_general/name'),
|
11 |
"email" => Mage::getStoreConfig('trans_email/ident_general/email'),
|
12 |
"baseUrl" => Mage::getBaseUrl(),
|
13 |
"phone" => Mage::getStoreConfig('general/store_information/phone'),
|
14 |
"address" => $address
|
15 |
+
));
|
16 |
$this->getResponse()->setHeader('Content-type', 'application/json');
|
17 |
$this->getResponse()->setBody($jsonData);
|
18 |
}
|
19 |
+
}
|
app/code/local/NowInStore/CatalogBuilder/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<NowInStore_CatalogBuilder>
|
5 |
-
<version>1.0
|
6 |
</NowInStore_CatalogBuilder>
|
7 |
</modules>
|
8 |
<frontend>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<NowInStore_CatalogBuilder>
|
5 |
+
<version>1.1.0</version> <!-- Version number of your module -->
|
6 |
</NowInStore_CatalogBuilder>
|
7 |
</modules>
|
8 |
<frontend>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>NowInStore_CatalogBuilder</name>
|
4 |
-
<version>1.0
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.gnu.org/licenses/gpl-3.0.en.html">GNU General Public License (GPL)</license>
|
7 |
<channel>community</channel>
|
@@ -14,11 +14,11 @@ Our catalog and flyer builder automatically creates professional and customizabl
|
|
14 |

|
15 |
With a few clicks, import all of your Magento products into a beautiful drag and drop interface. Easily choose and organize each page of your catalog or flyer, use different layouts, customize your front and back covers and add a wholesale contract and order forms.
|
16 |
</description>
|
17 |
-
<notes>
|
18 |
<authors><author><name>Kwaku Zigah</name><user>kwaku</user><email>kwaku.zigah@nowinstore.com</email></author></authors>
|
19 |
-
<date>2015-07-
|
20 |
-
<time>
|
21 |
-
<contents><target name="magelocal"><dir name="NowInStore"><dir name="CatalogBuilder"><dir name="controllers"><file name="AuthController.php" hash="d64acfc32d9db86b3bb89ac537e2ea91"/><file name="CategoriesController.php" hash="8ac0b1276609c3498926ffe9632a4977"/><file name="ProductsController.php" hash="36dfdb8cd9ff135b3538251aa899bafd"/><file name="ProfileController.php" hash="05679442c999971bad022b2f580331d9"/></dir><dir name="etc"><file name="adminhtml.xml" hash="3d7e6a6f47a3a37945603d5620a49c22"/><file name="config.xml" hash="
|
22 |
<compatible/>
|
23 |
-
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php
|
24 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>NowInStore_CatalogBuilder</name>
|
4 |
+
<version>1.1.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.gnu.org/licenses/gpl-3.0.en.html">GNU General Public License (GPL)</license>
|
7 |
<channel>community</channel>
|
14 |

|
15 |
With a few clicks, import all of your Magento products into a beautiful drag and drop interface. Easily choose and organize each page of your catalog or flyer, use different layouts, customize your front and back covers and add a wholesale contract and order forms.
|
16 |
</description>
|
17 |
+
<notes>Improved API</notes>
|
18 |
<authors><author><name>Kwaku Zigah</name><user>kwaku</user><email>kwaku.zigah@nowinstore.com</email></author></authors>
|
19 |
+
<date>2015-07-31</date>
|
20 |
+
<time>15:28:35</time>
|
21 |
+
<contents><target name="magelocal"><dir name="NowInStore"><dir name="CatalogBuilder"><dir name="controllers"><file name="AuthController.php" hash="d64acfc32d9db86b3bb89ac537e2ea91"/><file name="CategoriesController.php" hash="8ac0b1276609c3498926ffe9632a4977"/><file name="ProductsController.php" hash="36dfdb8cd9ff135b3538251aa899bafd"/><file name="ProfileController.php" hash="05679442c999971bad022b2f580331d9"/></dir><dir name="etc"><file name="adminhtml.xml" hash="3d7e6a6f47a3a37945603d5620a49c22"/><file name="config.xml" hash="ed9b0f31d97b98858f289bfac451de4d"/><file name="config.xml~" hash="fa9eaa937860779735ddee5bc4ec7f5f"/></dir></dir></dir></target></contents>
|
22 |
<compatible/>
|
23 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
24 |
</package>
|