Version Notes
Fix issue with rounded prices
Added wholesale price
Download this release
Release Info
| Developer | Kwaku |
| Extension | NowInStore_CatalogBuilder |
| Version | 1.2.2 |
| Comparing to | |
| See all releases | |
Code changes from version 1.1.1 to 1.2.2
- app/code/community/NowInStore/CatalogBuilder/controllers/AuthController.php +18 -0
- app/code/community/NowInStore/CatalogBuilder/controllers/CategoriesController.php +19 -7
- app/code/community/NowInStore/CatalogBuilder/controllers/ProductsController.php +75 -35
- app/code/community/NowInStore/CatalogBuilder/controllers/ProfileController.php +15 -0
- app/code/community/NowInStore/CatalogBuilder/etc/config.xml +1 -1
- package.xml +6 -5
app/code/community/NowInStore/CatalogBuilder/controllers/AuthController.php
CHANGED
|
@@ -1,8 +1,26 @@
|
|
| 1 |
<?php
|
|
|
|
|
|
|
|
|
|
| 2 |
class NowInStore_CatalogBuilder_AuthController extends Mage_Core_Controller_Front_Action
|
| 3 |
{
|
| 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");
|
| 1 |
<?php
|
| 2 |
+
error_reporting(E_ALL);
|
| 3 |
+
ini_set('display_errors', 1);
|
| 4 |
+
|
| 5 |
class NowInStore_CatalogBuilder_AuthController extends Mage_Core_Controller_Front_Action
|
| 6 |
{
|
| 7 |
public function indexAction()
|
| 8 |
{
|
| 9 |
+
$debug = $_GET['debug'];
|
| 10 |
+
if ($debug) {
|
| 11 |
+
Mage::setIsDeveloperMode(true);
|
| 12 |
+
ini_set('display_errors', 1);
|
| 13 |
+
ini_set('display_startup_errors', 1);
|
| 14 |
+
if ($debug == 'all')
|
| 15 |
+
error_reporting(E_ALL);
|
| 16 |
+
if ($debug == 'info')
|
| 17 |
+
error_reporting(E_ERROR | E_WARNING | E_PARSE);
|
| 18 |
+
if ($debug == 'warning')
|
| 19 |
+
error_reporting(E_ERROR | E_WARNING);
|
| 20 |
+
if ($debug == 'error')
|
| 21 |
+
error_reporting(E_ERROR);
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
$email = Mage::getStoreConfig('trans_email/ident_general/email');
|
| 25 |
$baseUrl = urlencode(Mage::getBaseUrl());
|
| 26 |
//$this->getResponse()->setRedirect("https://www.nowinstore.com/auth/magento/callback?baseUrl=$baseUrl");
|
app/code/community/NowInStore/CatalogBuilder/controllers/CategoriesController.php
CHANGED
|
@@ -3,19 +3,31 @@ class NowInStore_CatalogBuilder_CategoriesController extends Mage_Core_Controlle
|
|
| 3 |
{
|
| 4 |
public function indexAction()
|
| 5 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
$category_collection = Mage::getModel('catalog/category')
|
| 7 |
->getCollection()
|
| 8 |
->addAttributeToSelect('*')
|
| 9 |
->addIsActiveFilter();
|
| 10 |
$categories = array();
|
| 11 |
foreach($category_collection as $category) {
|
| 12 |
-
$
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
"name" => $category->getName()
|
| 17 |
-
));
|
| 18 |
-
}
|
| 19 |
}
|
| 20 |
$jsonData = json_encode($categories);
|
| 21 |
$this->getResponse()->setHeader('Content-type', 'application/json');
|
| 3 |
{
|
| 4 |
public function indexAction()
|
| 5 |
{
|
| 6 |
+
$debug = $_GET['debug'];
|
| 7 |
+
if ($debug) {
|
| 8 |
+
Mage::setIsDeveloperMode(true);
|
| 9 |
+
ini_set('display_errors', 1);
|
| 10 |
+
ini_set('display_startup_errors', 1);
|
| 11 |
+
if ($debug == 'all')
|
| 12 |
+
error_reporting(E_ALL);
|
| 13 |
+
if ($debug == 'info')
|
| 14 |
+
error_reporting(E_ERROR | E_WARNING | E_PARSE);
|
| 15 |
+
if ($debug == 'warning')
|
| 16 |
+
error_reporting(E_ERROR | E_WARNING);
|
| 17 |
+
if ($debug == 'error')
|
| 18 |
+
error_reporting(E_ERROR);
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
$category_collection = Mage::getModel('catalog/category')
|
| 22 |
->getCollection()
|
| 23 |
->addAttributeToSelect('*')
|
| 24 |
->addIsActiveFilter();
|
| 25 |
$categories = array();
|
| 26 |
foreach($category_collection as $category) {
|
| 27 |
+
array_push($categories, array(
|
| 28 |
+
"id" => $category->getId(),
|
| 29 |
+
"name" => $category->getName()
|
| 30 |
+
));
|
|
|
|
|
|
|
|
|
|
| 31 |
}
|
| 32 |
$jsonData = json_encode($categories);
|
| 33 |
$this->getResponse()->setHeader('Content-type', 'application/json');
|
app/code/community/NowInStore/CatalogBuilder/controllers/ProductsController.php
CHANGED
|
@@ -1,81 +1,121 @@
|
|
| 1 |
<?php
|
|
|
|
| 2 |
class NowInStore_CatalogBuilder_ProductsController extends Mage_Core_Controller_Front_Action
|
| 3 |
{
|
| 4 |
public function indexAction()
|
| 5 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
$page = $_GET['page'];
|
| 7 |
if (empty($page)) {
|
| 8 |
$page = 1;
|
| 9 |
}
|
| 10 |
$product_collection = Mage::getModel('catalog/product')
|
| 11 |
-
|
| 12 |
// ->addAttributeToFilter('is_active', 1)
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
|
| 19 |
-
$keywords =
|
| 20 |
if (!empty ($keywords)) {
|
| 21 |
-
$product_collection = $product_collection->addAttributeToFilter('lower_name', array('like' => '%'.strtolower($keywords).'%'));
|
| 22 |
}
|
| 23 |
|
| 24 |
-
$category_id =
|
| 25 |
if (!empty ($category_id)) {
|
| 26 |
$product_collection = $product_collection
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
if ($product->isConfigurable()) {
|
| 34 |
$productAttributeOptions = $product->getTypeInstance()->getConfigurableAttributesAsArray($product);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
}
|
| 36 |
-
$
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
| 42 |
}
|
| 43 |
}
|
|
|
|
|
|
|
|
|
|
| 44 |
array_push($products, array(
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
|
|
|
|
|
|
| 55 |
));
|
| 56 |
}
|
| 57 |
$jsonData = json_encode($products);
|
| 58 |
$this->getResponse()->setHeader('Content-type', 'application/json');
|
| 59 |
$this->getResponse()->setBody($jsonData);
|
| 60 |
}
|
|
|
|
| 61 |
public function countAction()
|
| 62 |
{
|
| 63 |
$product_collection = Mage::getModel('catalog/product')
|
| 64 |
-
|
| 65 |
// ->addAttributeToFilter('is_active', 1)
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
|
| 70 |
-
$query =
|
| 71 |
if (!empty ($query)) {
|
| 72 |
-
$product_collection = $product_collection->addAttributeToFilter('lower_name', array('like' => '%'.strtolower($query).'%'));
|
| 73 |
}
|
| 74 |
|
| 75 |
-
$category_id =
|
| 76 |
if (!empty ($category_id)) {
|
| 77 |
$product_collection = $product_collection
|
| 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()));
|
| 1 |
<?php
|
| 2 |
+
|
| 3 |
class NowInStore_CatalogBuilder_ProductsController extends Mage_Core_Controller_Front_Action
|
| 4 |
{
|
| 5 |
public function indexAction()
|
| 6 |
{
|
| 7 |
+
$debug = $_GET['debug'];
|
| 8 |
+
if ($debug) {
|
| 9 |
+
Mage::setIsDeveloperMode(true);
|
| 10 |
+
ini_set('display_errors', 1);
|
| 11 |
+
ini_set('display_startup_errors', 1);
|
| 12 |
+
if ($debug == 'all')
|
| 13 |
+
error_reporting(E_ALL);
|
| 14 |
+
if ($debug == 'info')
|
| 15 |
+
error_reporting(E_ERROR | E_WARNING | E_PARSE);
|
| 16 |
+
if ($debug == 'warning')
|
| 17 |
+
error_reporting(E_ERROR | E_WARNING);
|
| 18 |
+
if ($debug == 'error')
|
| 19 |
+
error_reporting(E_ERROR);
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
$page = $_GET['page'];
|
| 23 |
if (empty($page)) {
|
| 24 |
$page = 1;
|
| 25 |
}
|
| 26 |
$product_collection = Mage::getModel('catalog/product')
|
| 27 |
+
->getCollection()
|
| 28 |
// ->addAttributeToFilter('is_active', 1)
|
| 29 |
+
->addExpressionAttributeToSelect('lower_name', 'LOWER({{name}})', array('name'))
|
| 30 |
+
->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
|
| 31 |
+
->setPageSize(50)
|
| 32 |
+
->setCurPage($page)
|
| 33 |
+
->addAttributeToSelect(array('id', 'name', 'sku', 'price', 'group_price', 'image', 'description'));
|
| 34 |
|
| 35 |
+
$keywords = $_GET['keywords'];
|
| 36 |
if (!empty ($keywords)) {
|
| 37 |
+
$product_collection = $product_collection->addAttributeToFilter('lower_name', array('like' => '%' . strtolower($keywords) . '%'));
|
| 38 |
}
|
| 39 |
|
| 40 |
+
$category_id = $_GET['category_id'];
|
| 41 |
if (!empty ($category_id)) {
|
| 42 |
$product_collection = $product_collection
|
| 43 |
+
->joinField('category_id', 'catalog/category_product', 'category_id', 'product_id=entity_id', null, 'left')
|
| 44 |
->addAttributeToFilter('category_id', array('in' => $category_id));
|
| 45 |
}
|
| 46 |
$products = array();
|
| 47 |
$currency = Mage::app()->getStore()->getCurrentCurrencyCode();
|
| 48 |
+
$group_collection = Mage::getModel('customer/group')->getCollection();
|
| 49 |
+
$wholesaleGroup = null;
|
| 50 |
+
foreach ($group_collection as $group) {
|
| 51 |
+
if ($group->getCode() === 'Wholesale') {
|
| 52 |
+
$wholesaleGroup = $group;
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
foreach ($product_collection as $product) {
|
| 56 |
+
$attributeOptions = array();
|
| 57 |
if ($product->isConfigurable()) {
|
| 58 |
$productAttributeOptions = $product->getTypeInstance()->getConfigurableAttributesAsArray($product);
|
| 59 |
+
foreach ($productAttributeOptions as $productAttribute) {
|
| 60 |
+
foreach ($productAttribute['values'] as $attribute) {
|
| 61 |
+
$label = $productAttribute['label'];
|
| 62 |
+
$valueIndex = $attribute['value_index'];
|
| 63 |
+
$attributeOptions[$label][$valueIndex] = $attribute['store_label'];
|
| 64 |
+
}
|
| 65 |
+
}
|
| 66 |
}
|
| 67 |
+
$price = floatval($product->getPrice());
|
| 68 |
+
$wholesalePrice = 0;
|
| 69 |
+
$product->setCustomerGroupId($wholesaleGroup->getId());
|
| 70 |
+
$groupPrices = $product->getGroupPrice();
|
| 71 |
+
if (is_null($groupPrices)) {
|
| 72 |
+
$attribute = $product->getResource()->getAttribute('group_price');
|
| 73 |
+
if ($attribute) {
|
| 74 |
+
$attribute->getBackend()->afterLoad($product);
|
| 75 |
+
$groupPrices = $product->getData('group_price');
|
| 76 |
}
|
| 77 |
}
|
| 78 |
+
if (!is_null($groupPrices) || is_array($groupPrices)) {
|
| 79 |
+
$wholesalePrice = $groupPrices;
|
| 80 |
+
}
|
| 81 |
array_push($products, array(
|
| 82 |
+
"id" => $product->getId(),
|
| 83 |
+
"title" => $product->getName(),
|
| 84 |
+
"sku" => $product->getSku(),
|
| 85 |
+
"price" => $price,
|
| 86 |
+
"wholesale_price" => floatval($wholesalePrice),
|
| 87 |
+
"main_image" => $product->getImageUrl(),
|
| 88 |
+
"description" => $product->getDescription(),
|
| 89 |
+
"thumbnail_image" => (string)Mage::helper('catalog/image')->init($product, 'image')->resize(75),
|
| 90 |
+
"iso_currency_code" => $currency,
|
| 91 |
+
"g" => $wholesaleGroup->getId(),
|
| 92 |
+
"url" => $product->getProductUrl(),
|
| 93 |
+
"variations" => $attributeOptions
|
| 94 |
));
|
| 95 |
}
|
| 96 |
$jsonData = json_encode($products);
|
| 97 |
$this->getResponse()->setHeader('Content-type', 'application/json');
|
| 98 |
$this->getResponse()->setBody($jsonData);
|
| 99 |
}
|
| 100 |
+
|
| 101 |
public function countAction()
|
| 102 |
{
|
| 103 |
$product_collection = Mage::getModel('catalog/product')
|
| 104 |
+
->getCollection()
|
| 105 |
// ->addAttributeToFilter('is_active', 1)
|
| 106 |
+
->addExpressionAttributeToSelect('lower_name', 'LOWER({{name}})', array('name'))
|
| 107 |
+
->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)
|
| 108 |
+
->addAttributeToSelect(array('id', 'name', 'sku', 'price', 'image'));
|
| 109 |
|
| 110 |
+
$query = $_GET['query'];
|
| 111 |
if (!empty ($query)) {
|
| 112 |
+
$product_collection = $product_collection->addAttributeToFilter('lower_name', array('like' => '%' . strtolower($query) . '%'));
|
| 113 |
}
|
| 114 |
|
| 115 |
+
$category_id = $_GET['category_id'];
|
| 116 |
if (!empty ($category_id)) {
|
| 117 |
$product_collection = $product_collection
|
| 118 |
+
->joinField('category_id', 'catalog/category_product', 'category_id', 'product_id=entity_id', null, 'left')
|
| 119 |
->addAttributeToFilter('category_id', array('in' => $category_id));
|
| 120 |
}
|
| 121 |
$jsonData = json_encode(array("count" => $product_collection->count()));
|
app/code/community/NowInStore/CatalogBuilder/controllers/ProfileController.php
CHANGED
|
@@ -3,6 +3,21 @@ class NowInStore_CatalogBuilder_ProfileController extends Mage_Core_Controller_F
|
|
| 3 |
{
|
| 4 |
public function indexAction()
|
| 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(
|
| 3 |
{
|
| 4 |
public function indexAction()
|
| 5 |
{
|
| 6 |
+
$debug = $_GET['debug'];
|
| 7 |
+
if ($debug) {
|
| 8 |
+
Mage::setIsDeveloperMode(true);
|
| 9 |
+
ini_set('display_errors', 1);
|
| 10 |
+
ini_set('display_startup_errors', 1);
|
| 11 |
+
if ($debug == 'all')
|
| 12 |
+
error_reporting(E_ALL);
|
| 13 |
+
if ($debug == 'info')
|
| 14 |
+
error_reporting(E_ERROR | E_WARNING | E_PARSE);
|
| 15 |
+
if ($debug == 'warning')
|
| 16 |
+
error_reporting(E_ERROR | E_WARNING);
|
| 17 |
+
if ($debug == 'error')
|
| 18 |
+
error_reporting(E_ERROR);
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
$hostname = Mage::app()->getFrontController()->getRequest()->getHttpHost();
|
| 22 |
$address = str_replace("\r\n", "<br/>", Mage::getStoreConfig('general/store_information/address'));
|
| 23 |
$jsonData = json_encode(array(
|
app/code/community/NowInStore/CatalogBuilder/etc/config.xml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<NowInStore_CatalogBuilder>
|
| 5 |
-
<version>1.
|
| 6 |
</NowInStore_CatalogBuilder>
|
| 7 |
</modules>
|
| 8 |
<frontend>
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<NowInStore_CatalogBuilder>
|
| 5 |
+
<version>1.2.2</version>
|
| 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.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>GPL</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -12,11 +12,12 @@
|
|
| 12 |
Our blog and online-chat experts are on hand that share tips and tricks on how you can use catalogs and flyers to grow your sales. 
|
| 13 |

|
| 14 |
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.</description>
|
| 15 |
-
<notes>
|
|
|
|
| 16 |
<authors><author><name>Kwaku</name><user>Zigah</user><email>kwaku.zigah@nowinstore.com</email></author></authors>
|
| 17 |
-
<date>2016-
|
| 18 |
-
<time>
|
| 19 |
-
<contents><target name="magecommunity"><dir name="NowInStore"><dir name="CatalogBuilder"><dir name="controllers"><file name="AuthController.php" hash="083a894900d82e353543cd762da9e157"/><file name="CategoriesController.php" hash="abc588a995c3c8797b824e0c04c57295"/><file name="ProductsController.php" hash="
|
| 20 |
<compatible/>
|
| 21 |
<dependencies><required><php><min>5.2.0</min><max>5.6.21</max></php></required></dependencies>
|
| 22 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>NowInStore_CatalogBuilder</name>
|
| 4 |
+
<version>1.2.2</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>GPL</license>
|
| 7 |
<channel>community</channel>
|
| 12 |
Our blog and online-chat experts are on hand that share tips and tricks on how you can use catalogs and flyers to grow your sales. 
|
| 13 |

|
| 14 |
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.</description>
|
| 15 |
+
<notes>Fix issue with rounded prices
|
| 16 |
+
Added wholesale price</notes>
|
| 17 |
<authors><author><name>Kwaku</name><user>Zigah</user><email>kwaku.zigah@nowinstore.com</email></author></authors>
|
| 18 |
+
<date>2016-06-10</date>
|
| 19 |
+
<time>16:39:00</time>
|
| 20 |
+
<contents><target name="magecommunity"><dir name="NowInStore"><dir name="CatalogBuilder"><dir name="controllers"><file name="AuthController.php" hash="083a894900d82e353543cd762da9e157"/><file name="CategoriesController.php" hash="9e643060ad40ef54c13f2b72f943402b"/><file name="CategoriesController.php~" hash="abc588a995c3c8797b824e0c04c57295"/><file name="ProductsController.php" hash="0493192bbfe5bef8c3b0d312e607a1f0"/><file name="ProductsController.php~" hash="4feb53033fcc499c450917c2c645a0d4"/><file name="ProfileController.php" hash="f720bea41f8a18d7296d91a81f4a4722"/></dir><dir name="etc"><file name="adminhtml.xml" hash="3d7e6a6f47a3a37945603d5620a49c22"/><file name="config.xml" hash="b10c591395a3f476f452e06885322d65"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="NowInStore_CatalogBuilder.xml" hash="a087b751cea9700fd21fa59bb3d0a666"/></dir></target></contents>
|
| 21 |
<compatible/>
|
| 22 |
<dependencies><required><php><min>5.2.0</min><max>5.6.21</max></php></required></dependencies>
|
| 23 |
</package>
|
