Version Notes
Currently active are modules for BPAY, direct deposit, Australia Post, the addition of regions and postcodes, and the addition of ABN and phone number to the general configuration values (although currently not in use). Also supports creating product information feeds for the Shopbot, Getprice and MyShopping services.
Download this release
Release Info
Developer | Magento Core Team |
Extension | Fontis_Australia |
Version | 2.0.4 |
Comparing to | |
See all releases |
Code changes from version 2.0.3 to 2.0.4
- app/code/community/Fontis/Australia/Block/Bpay/Info.php.~1~ +0 -80
- app/code/community/Fontis/Australia/Model/Getprice/Child.php +45 -39
- app/code/community/Fontis/Australia/Model/Getprice/Cron.php +85 -30
- app/code/community/Fontis/Australia/Model/Myshopping/Child.php +61 -55
- app/code/community/Fontis/Australia/Model/Myshopping/Cron.php +71 -41
- app/code/community/Fontis/Australia/Model/Shopbot/Child.php +66 -60
- app/code/community/Fontis/Australia/Model/Shopbot/Cron.php +70 -21
- app/code/community/Fontis/Australia/Model/Shopbot/Cron.php~ +0 -290
- package.xml +5 -5
app/code/community/Fontis/Australia/Block/Bpay/Info.php.~1~
DELETED
@@ -1,80 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Fontis Australia Extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
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 license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* @category Fontis
|
16 |
-
* @package Fontis_Australia
|
17 |
-
* @author Chris Norton
|
18 |
-
* @copyright Copyright (c) 2008 Fontis Pty. Ltd. (http://www.fontis.com.au)
|
19 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
-
*/
|
21 |
-
|
22 |
-
|
23 |
-
class Fontis_Australia_Block_Bpay_Info extends Mage_Payment_Block_Info
|
24 |
-
{
|
25 |
-
|
26 |
-
protected $_billerCode;
|
27 |
-
protected $_ref;
|
28 |
-
|
29 |
-
protected function _construct()
|
30 |
-
{
|
31 |
-
parent::_construct();
|
32 |
-
$this->setTemplate('fontis/australia/payment/bpay/info.phtml');
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Gets the bank account name as set by the admin.
|
37 |
-
*
|
38 |
-
* @return string
|
39 |
-
*/
|
40 |
-
public function getBillerCode()
|
41 |
-
{
|
42 |
-
if (is_null($this->_billerCode)) {
|
43 |
-
$this->_convertAdditionalData();
|
44 |
-
}
|
45 |
-
return $this->_billerCode;
|
46 |
-
}
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Gets the ref code for this customer.
|
50 |
-
*
|
51 |
-
* @return string
|
52 |
-
*/
|
53 |
-
public function getRef()
|
54 |
-
{
|
55 |
-
Mage::log('Info: ' . print_r($this->getInfo(), true), null, 'bpay.log');
|
56 |
-
if (is_null($this->_ref)) {
|
57 |
-
$this->_convertAdditionalData();
|
58 |
-
}
|
59 |
-
return $this->_ref;
|
60 |
-
}
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Gets any additional data saved by the BPAY payment module.
|
64 |
-
*
|
65 |
-
* @return Fontis_Australia_Block_Bpay_Info
|
66 |
-
*/
|
67 |
-
protected function _convertAdditionalData()
|
68 |
-
{
|
69 |
-
$details = @unserialize($this->getInfo()->getAdditionalData());
|
70 |
-
if (is_array($details)) {
|
71 |
-
$this->_billerCode = isset($details['biller_code']) ? (string) $details['biller_code'] : '';
|
72 |
-
$this->_ref = isset($details['ref']) ? (string) $details['ref'] : '';
|
73 |
-
} else {
|
74 |
-
$this->_billerCode = '';
|
75 |
-
$this->_ref = '';
|
76 |
-
}
|
77 |
-
return $this;
|
78 |
-
}
|
79 |
-
|
80 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Fontis/Australia/Model/Getprice/Child.php
CHANGED
@@ -23,61 +23,67 @@ if (!isset($argv[1]) or !isset($argv[2]) or !isset($argv[3])) {
|
|
23 |
exit;
|
24 |
}
|
25 |
$mage_path = $argv[1];
|
26 |
-
$
|
27 |
$store_id = $argv[3];
|
28 |
|
29 |
// Start-up Magento stack
|
30 |
require_once $mage_path . '/app/Mage.php';
|
31 |
Mage::app($store_id);
|
32 |
|
33 |
-
// Load product, tax helper and generate final price information
|
34 |
-
$product = Mage::getModel('catalog/product')->load($product_id);
|
35 |
-
$tax = Mage::helper('tax');
|
36 |
-
$final_price = $tax->getPrice($product, $product->getFinalPrice(), true);
|
37 |
-
|
38 |
// This array is translated into XML when fed back to the cron parent PHP.
|
39 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
-
$array['num'] = $product->getEntityId();
|
42 |
-
$array['attribute1'] =
|
43 |
-
$array['upc'] = $product->getSku();
|
44 |
-
$array['product_url'] = $product->getProductUrl();
|
45 |
|
46 |
-
if (Mage::getStoreConfig('fontis_feeds/getpricefeed/manufacturer')) {
|
47 |
-
|
48 |
-
|
49 |
|
50 |
-
|
51 |
-
|
|
|
52 |
}
|
53 |
-
}
|
54 |
|
55 |
-
$category_found = false;
|
56 |
-
$array['category_name'] = '';
|
57 |
-
foreach($product->getCategoryCollection() as $c) {
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
|
67 |
-
|
68 |
-
|
|
|
|
|
69 |
}
|
70 |
-
$category_found = true;
|
71 |
}
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
}
|
76 |
|
77 |
-
|
78 |
-
$array['image'] = (string)Mage::helper('catalog/image')->init($product, 'image');
|
79 |
-
$array['price'] = $final_price;
|
80 |
-
$array['currency'] = Mage::getStoreConfig('fontis_feeds/getpricefeed/currency');
|
|
|
|
|
|
|
81 |
|
82 |
// Serialize and print as a string for the cron parent PHP code to grab.
|
83 |
-
echo
|
23 |
exit;
|
24 |
}
|
25 |
$mage_path = $argv[1];
|
26 |
+
$product_ids = $argv[2];
|
27 |
$store_id = $argv[3];
|
28 |
|
29 |
// Start-up Magento stack
|
30 |
require_once $mage_path . '/app/Mage.php';
|
31 |
Mage::app($store_id);
|
32 |
|
|
|
|
|
|
|
|
|
|
|
33 |
// This array is translated into XML when fed back to the cron parent PHP.
|
34 |
+
$products = array();
|
35 |
+
foreach(unserialize($product_ids) as $product_id) {
|
36 |
+
// Load product, tax helper and generate final price information
|
37 |
+
$product = Mage::getModel('catalog/product')->load($product_id);
|
38 |
+
$tax = Mage::helper('tax');
|
39 |
+
$final_price = $tax->getPrice($product, $product->getFinalPrice(), true);
|
40 |
+
|
41 |
+
// Array containing product data.
|
42 |
+
$array = array();
|
43 |
|
44 |
+
$array['num'] = $product->getEntityId();
|
45 |
+
$array['attribute1'] = $product->getName();
|
46 |
+
$array['upc'] = $product->getSku();
|
47 |
+
$array['product_url'] = $product->getProductUrl();
|
48 |
|
49 |
+
if (Mage::getStoreConfig('fontis_feeds/getpricefeed/manufacturer')) {
|
50 |
+
$manufacturer_name = $product->getResource()->
|
51 |
+
getAttribute('manufacturer')->getFrontend()->getValue($product);
|
52 |
|
53 |
+
if ($manufacturer_name != 'No') {
|
54 |
+
$array['manufacturer'] = $manufacturer_name;
|
55 |
+
}
|
56 |
}
|
|
|
57 |
|
58 |
+
$category_found = false;
|
59 |
+
$array['category_name'] = '';
|
60 |
+
foreach($product->getCategoryCollection() as $c) {
|
61 |
+
$children = $c->getData('children_count');
|
62 |
+
if ($children <= 0) {
|
63 |
+
$category_node[0] = $c->getName();
|
64 |
|
65 |
+
$loaded_categories = Mage::getModel('catalog/category')
|
66 |
+
->getCollection()
|
67 |
+
->addIdFilter(array($c->getId()))
|
68 |
+
->addAttributeToSelect(array('name'), 'inner')->load();
|
69 |
|
70 |
+
foreach($loaded_categories as $loaded_category) {
|
71 |
+
$array['category_name'] = $loaded_category->getName();
|
72 |
+
}
|
73 |
+
$category_found = true;
|
74 |
}
|
|
|
75 |
}
|
76 |
+
if (!$category_found) {
|
77 |
+
$array['category_name'] = Mage::getStoreConfig('fontis_feeds/getpricefeed/defaultcategory');
|
78 |
+
}
|
|
|
79 |
|
80 |
+
//$array['description'] = htmlspecialchars($product->getDescription());
|
81 |
+
$array['image'] = (string)Mage::helper('catalog/image')->init($product, 'image');
|
82 |
+
$array['price'] = $final_price;
|
83 |
+
$array['currency'] = Mage::getStoreConfig('fontis_feeds/getpricefeed/currency');
|
84 |
+
|
85 |
+
$products[] = $array;
|
86 |
+
}
|
87 |
|
88 |
// Serialize and print as a string for the cron parent PHP code to grab.
|
89 |
+
echo json_encode($products);
|
app/code/community/Fontis/Australia/Model/Getprice/Cron.php
CHANGED
@@ -19,40 +19,74 @@
|
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
22 |
-
|
|
|
|
|
|
|
23 |
{
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
27 |
}
|
28 |
|
29 |
-
|
|
|
|
|
30 |
{
|
31 |
-
$
|
32 |
-
$
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
} else {
|
43 |
-
|
|
|
|
|
44 |
}
|
|
|
|
|
45 |
}
|
46 |
}
|
47 |
|
48 |
class Fontis_Australia_Model_GetPrice_Cron
|
49 |
{
|
|
|
|
|
50 |
public static $doc;
|
51 |
public static $root_node;
|
52 |
public static $store;
|
|
|
|
|
53 |
|
54 |
protected function _construct()
|
55 |
{
|
|
|
56 |
}
|
57 |
|
58 |
protected function getPath()
|
@@ -77,7 +111,6 @@ class Fontis_Australia_Model_GetPrice_Cron
|
|
77 |
public static function update()
|
78 |
{
|
79 |
Mage::log('Fontis/Australia_Model_Getprice_Cron: entered update function');
|
80 |
-
session_start();
|
81 |
|
82 |
if (Mage::getStoreConfig('fontis_feeds/getpricefeed/active')) {
|
83 |
$io = new Varien_Io_File();
|
@@ -87,29 +120,35 @@ class Fontis_Australia_Model_GetPrice_Cron
|
|
87 |
|
88 |
foreach(Mage::app()->getStores() as $store) {
|
89 |
$clean_store_name = str_replace('+', '-', strtolower(urlencode($store->getName())));
|
90 |
-
|
91 |
-
|
|
|
92 |
$products_result = self::getProductsXml($store);
|
93 |
-
|
|
|
94 |
// Write the leaf categories xml file:
|
|
|
|
|
95 |
$io->write($clean_store_name . '-categories.xml', $categories_result['xml']);
|
96 |
|
97 |
-
// Write the entire products xml file:
|
98 |
-
$io->write($clean_store_name . '-products.xml', $products_result['xml']);
|
99 |
-
|
100 |
// Write for each leaf category, their products xml file:
|
101 |
foreach($categories_result['link_ids'] as $link_id) {
|
|
|
102 |
$subcategory_products_result = self::getProductsXml($store, $link_id);
|
103 |
$io->write($clean_store_name . '-products-'.$link_id.'.xml', $subcategory_products_result['xml']);
|
104 |
}
|
105 |
}
|
106 |
|
107 |
$io->close();
|
|
|
|
|
108 |
}
|
109 |
}
|
110 |
|
111 |
public function getCategoriesXml($store)
|
112 |
{
|
|
|
|
|
113 |
$result = array();
|
114 |
$categories = Mage::getModel('catalog/category')->getCollection()
|
115 |
->setStoreId($store->getId())
|
@@ -140,15 +179,16 @@ class Fontis_Australia_Model_GetPrice_Cron
|
|
140 |
$category_node = $doc->addChild('cat');
|
141 |
|
142 |
$title_node = $category_node->addChild('name');
|
143 |
-
$title_node[0] = $category->getName();
|
144 |
|
145 |
$link_node = $category_node->addChild('link');
|
146 |
-
$link_node[0] = Mage::getStoreConfig('web/unsecure/base_url') .
|
|
|
147 |
|
148 |
$result['link_ids'][] = $category->getId();
|
149 |
}
|
150 |
|
151 |
-
$result['xml'] = $doc
|
152 |
return $result;
|
153 |
}
|
154 |
|
@@ -167,13 +207,15 @@ class Fontis_Australia_Model_GetPrice_Cron
|
|
167 |
|
168 |
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
|
169 |
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
|
170 |
-
|
171 |
if ($cat_id != -1) {
|
172 |
$products->getSelect()->where("e.entity_id IN (
|
173 |
SELECT product_id FROM catalog_category_product WHERE category_id = ".$cat_id."
|
174 |
)");
|
175 |
}
|
176 |
|
|
|
|
|
177 |
$storeUrl = $store->getBaseUrl();
|
178 |
$shopName = $store->getName();
|
179 |
$date = date("d-m-Y", Mage::getModel('core/date')->timestamp(time()));
|
@@ -182,9 +224,22 @@ class Fontis_Australia_Model_GetPrice_Cron
|
|
182 |
self::$doc = new SimpleXMLElement('<store url="' . $storeUrl. '" date="'.$date.'" time="'.$time.'" name="' . $shopName . '"></store>');
|
183 |
self::$root_node = self::$doc->addChild('products');
|
184 |
|
185 |
-
Mage::getSingleton('core/resource_iterator')->walk($products->getSelect(), array('
|
|
|
|
|
186 |
|
187 |
-
$result['xml'] = self::$doc
|
188 |
return $result;
|
189 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
}
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
22 |
+
// Callback used by the Magento resource iterator walk() method. Adds a
|
23 |
+
// product ID to a static array and calls addProductXmlgetPrice() to
|
24 |
+
// generate XML when the array reaches the batch size.
|
25 |
+
function addProductXmlCallbackGetPrice($args)
|
26 |
{
|
27 |
+
Fontis_Australia_Model_GetPrice_Cron::$accumulator[] = $args['row']['entity_id'];
|
28 |
+
|
29 |
+
$length = count(Fontis_Australia_Model_GetPrice_Cron::$accumulator);
|
30 |
+
if($length >= Fontis_Australia_Model_GetPrice_Cron::BATCH_SIZE) {
|
31 |
+
addProductXmlGetPrice();
|
32 |
+
}
|
33 |
}
|
34 |
|
35 |
+
// Runs a subprocesss to create feed XML for the product IDs in the static
|
36 |
+
// array, then empties the array.
|
37 |
+
function addProductXmlGetPrice()
|
38 |
{
|
39 |
+
$length = count(Fontis_Australia_Model_GetPrice_Cron::$accumulator);
|
40 |
+
if($length > 0) {
|
41 |
+
Mage::log("Processing product IDs " . Fontis_Australia_Model_GetPrice_Cron::$accumulator[0] .
|
42 |
+
" to " . Fontis_Australia_Model_GetPrice_Cron::$accumulator[$length - 1]);
|
43 |
+
$store_id = Fontis_Australia_Model_GetPrice_Cron::$store->getId();
|
44 |
+
|
45 |
+
$data = exec("php " . Mage::getBaseDir() . "/app/code/community/Fontis/Australia/Model/Getprice/Child.php " .
|
46 |
+
Mage::getBaseDir() . " '" . serialize(Fontis_Australia_Model_GetPrice_Cron::$accumulator) .
|
47 |
+
"' " . $store_id);
|
48 |
+
Fontis_Australia_Model_GetPrice_Cron::$accumulator = array();
|
49 |
+
|
50 |
+
$array = json_decode($data, true);
|
51 |
+
|
52 |
+
if(is_array($array)) {
|
53 |
+
$codes = array();
|
54 |
+
foreach($array as $prod) {
|
55 |
+
Fontis_Australia_Model_GetPrice_Cron::$debugCount += 1;
|
56 |
+
$product_node = Fontis_Australia_Model_GetPrice_Cron::$root_node->addChild('product');
|
57 |
+
foreach($prod as $key => $val) {
|
58 |
+
if($key == 'Code') {
|
59 |
+
$codes[] = $val;
|
60 |
+
}
|
61 |
+
$product_node->addChild($key, htmlspecialchars($val));
|
62 |
+
}
|
63 |
+
}
|
64 |
+
if(!empty($codes)) {
|
65 |
+
Mage::log("Codes: ".implode(",", $codes));
|
66 |
+
}
|
67 |
} else {
|
68 |
+
Mage::log("Could not unserialize to array:");
|
69 |
+
Mage::log($data);
|
70 |
+
Mage::log($array);
|
71 |
}
|
72 |
+
|
73 |
+
Mage::log(strlen($data) . " characters returned");
|
74 |
}
|
75 |
}
|
76 |
|
77 |
class Fontis_Australia_Model_GetPrice_Cron
|
78 |
{
|
79 |
+
const BATCH_SIZE = 100;
|
80 |
+
|
81 |
public static $doc;
|
82 |
public static $root_node;
|
83 |
public static $store;
|
84 |
+
public static $accumulator;
|
85 |
+
public static $debugCount = 0;
|
86 |
|
87 |
protected function _construct()
|
88 |
{
|
89 |
+
self::$accumulator = array();
|
90 |
}
|
91 |
|
92 |
protected function getPath()
|
111 |
public static function update()
|
112 |
{
|
113 |
Mage::log('Fontis/Australia_Model_Getprice_Cron: entered update function');
|
|
|
114 |
|
115 |
if (Mage::getStoreConfig('fontis_feeds/getpricefeed/active')) {
|
116 |
$io = new Varien_Io_File();
|
120 |
|
121 |
foreach(Mage::app()->getStores() as $store) {
|
122 |
$clean_store_name = str_replace('+', '-', strtolower(urlencode($store->getName())));
|
123 |
+
|
124 |
+
// Write the entire products xml file:
|
125 |
+
Mage::log('Creating GetPrice products file...');
|
126 |
$products_result = self::getProductsXml($store);
|
127 |
+
$io->write($clean_store_name . '-products.xml', $products_result['xml']);
|
128 |
+
|
129 |
// Write the leaf categories xml file:
|
130 |
+
Mage::log('Creating GetPrice categories index file...');
|
131 |
+
$categories_result = self::getCategoriesXml($store);
|
132 |
$io->write($clean_store_name . '-categories.xml', $categories_result['xml']);
|
133 |
|
|
|
|
|
|
|
134 |
// Write for each leaf category, their products xml file:
|
135 |
foreach($categories_result['link_ids'] as $link_id) {
|
136 |
+
Mage::log("Creating GetPrice category file for ID {$categories_result['link_ids']}...");
|
137 |
$subcategory_products_result = self::getProductsXml($store, $link_id);
|
138 |
$io->write($clean_store_name . '-products-'.$link_id.'.xml', $subcategory_products_result['xml']);
|
139 |
}
|
140 |
}
|
141 |
|
142 |
$io->close();
|
143 |
+
} else {
|
144 |
+
Mage::log('Fontis/Australia_Model_Getprice_Cron: disabled');
|
145 |
}
|
146 |
}
|
147 |
|
148 |
public function getCategoriesXml($store)
|
149 |
{
|
150 |
+
$clean_store_name = str_replace('+', '-', strtolower(urlencode($store->getName())));
|
151 |
+
|
152 |
$result = array();
|
153 |
$categories = Mage::getModel('catalog/category')->getCollection()
|
154 |
->setStoreId($store->getId())
|
179 |
$category_node = $doc->addChild('cat');
|
180 |
|
181 |
$title_node = $category_node->addChild('name');
|
182 |
+
$title_node[0] = htmlspecialchars($category->getName());
|
183 |
|
184 |
$link_node = $category_node->addChild('link');
|
185 |
+
$link_node[0] = Mage::getStoreConfig('web/unsecure/base_url') .
|
186 |
+
Mage::getStoreConfig('fontis_feeds/getpricefeed/output') . "/$clean_store_name-products-" . $category->getId() . '.xml';
|
187 |
|
188 |
$result['link_ids'][] = $category->getId();
|
189 |
}
|
190 |
|
191 |
+
$result['xml'] = self::formatSimpleXML($doc);
|
192 |
return $result;
|
193 |
}
|
194 |
|
207 |
|
208 |
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
|
209 |
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
|
210 |
+
|
211 |
if ($cat_id != -1) {
|
212 |
$products->getSelect()->where("e.entity_id IN (
|
213 |
SELECT product_id FROM catalog_category_product WHERE category_id = ".$cat_id."
|
214 |
)");
|
215 |
}
|
216 |
|
217 |
+
$products->getSelect()->order('product_id');
|
218 |
+
|
219 |
$storeUrl = $store->getBaseUrl();
|
220 |
$shopName = $store->getName();
|
221 |
$date = date("d-m-Y", Mage::getModel('core/date')->timestamp(time()));
|
224 |
self::$doc = new SimpleXMLElement('<store url="' . $storeUrl. '" date="'.$date.'" time="'.$time.'" name="' . $shopName . '"></store>');
|
225 |
self::$root_node = self::$doc->addChild('products');
|
226 |
|
227 |
+
Mage::getSingleton('core/resource_iterator')->walk($products->getSelect(), array('addProductXmlCallbackGetPrice'), array('product' => $product));
|
228 |
+
// call XML generation function one last time to process remaining batch
|
229 |
+
addProductXmlGetPrice();
|
230 |
|
231 |
+
$result['xml'] = self::formatSimpleXML(self::$doc);
|
232 |
return $result;
|
233 |
}
|
234 |
+
|
235 |
+
public static function formatSimpleXML($doc)
|
236 |
+
{
|
237 |
+
$dom = new DOMDocument('1.0');
|
238 |
+
$dom->preserveWhiteSpace = false;
|
239 |
+
$dom->formatOutput = true;
|
240 |
+
$dom_sxml = dom_import_simplexml($doc);
|
241 |
+
$dom_sxml = $dom->importNode($dom_sxml, true);
|
242 |
+
$dom->appendChild($dom_sxml);
|
243 |
+
return $dom->saveXML();
|
244 |
+
}
|
245 |
}
|
app/code/community/Fontis/Australia/Model/Myshopping/Child.php
CHANGED
@@ -23,79 +23,85 @@ if (!isset($argv[1]) or !isset($argv[2]) or !isset($argv[3])) {
|
|
23 |
exit;
|
24 |
}
|
25 |
$mage_path = $argv[1];
|
26 |
-
$
|
27 |
$store_id = $argv[3];
|
28 |
|
29 |
// Start-up Magento stack
|
30 |
require_once $mage_path . '/app/Mage.php';
|
31 |
Mage::app($store_id);
|
32 |
|
33 |
-
// Load product, tax helper and generate final price information
|
34 |
-
$product = Mage::getModel('catalog/product')->load($product_id);
|
35 |
-
$tax = Mage::helper('tax');
|
36 |
-
$final_price = $tax->getPrice($product, $product->getFinalPrice(), true);
|
37 |
-
|
38 |
// This array is translated into XML when fed back to the cron parent PHP.
|
39 |
-
$
|
40 |
-
|
41 |
-
|
42 |
-
$
|
43 |
-
$
|
44 |
-
$
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
$array['
|
50 |
-
|
51 |
-
$
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
$array['Category'] = $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
}
|
63 |
-
$category_found = true;
|
64 |
}
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
}
|
69 |
|
70 |
-
if ($product->isSaleable()) {
|
71 |
-
|
72 |
-
} else {
|
73 |
-
|
74 |
-
}
|
75 |
|
76 |
-
$manufacturer_name = $product->getResource()->getAttribute('manufacturer')->getFrontend()->getValue($product);
|
77 |
|
78 |
-
if ($manufacturer_name == 'No') {
|
79 |
-
|
80 |
-
} else {
|
81 |
-
|
82 |
-
}
|
83 |
|
84 |
-
$linkedAttributes = @unserialize(Mage::getStoreConfig('fontis_feeds/myshoppingfeed/m_to_xml_attributes', $store_id));
|
85 |
-
if(!empty($linkedAttributes))
|
86 |
-
{
|
87 |
-
foreach($linkedAttributes as $la)
|
88 |
{
|
89 |
-
$
|
90 |
-
|
|
|
|
|
91 |
|
92 |
-
|
93 |
|
94 |
-
|
95 |
-
|
|
|
96 |
}
|
97 |
}
|
|
|
|
|
98 |
}
|
99 |
|
100 |
// Serialize and print as a string for the cron parent PHP code to grab.
|
101 |
-
echo
|
23 |
exit;
|
24 |
}
|
25 |
$mage_path = $argv[1];
|
26 |
+
$product_ids = $argv[2];
|
27 |
$store_id = $argv[3];
|
28 |
|
29 |
// Start-up Magento stack
|
30 |
require_once $mage_path . '/app/Mage.php';
|
31 |
Mage::app($store_id);
|
32 |
|
|
|
|
|
|
|
|
|
|
|
33 |
// This array is translated into XML when fed back to the cron parent PHP.
|
34 |
+
$products = array();
|
35 |
+
foreach(unserialize($product_ids) as $product_id) {
|
36 |
+
// Load product, tax helper and generate final price information
|
37 |
+
$product = Mage::getModel('catalog/product')->load($product_id);
|
38 |
+
$tax = Mage::helper('tax');
|
39 |
+
$final_price = $tax->getPrice($product, $product->getFinalPrice(), true);
|
40 |
+
|
41 |
+
// Array containing product data.
|
42 |
+
$array = array();
|
43 |
+
|
44 |
+
$array['Code'] = $product->getId();
|
45 |
+
$array['Name'] = utf8_encode(htmlspecialchars($product->getName()));
|
46 |
+
$array['Price'] = $final_price;
|
47 |
+
$array['Description'] = utf8_encode(substr(strip_tags($product->getShortDescription()), 0, 255));
|
48 |
+
$array['Product_URL'] = utf8_encode($product->getProductUrl());
|
49 |
+
$array['Image_URL'] = utf8_encode((string)Mage::helper('catalog/image')->init($product, 'image'));
|
50 |
+
|
51 |
+
$category_found = false;
|
52 |
+
$array['Category'] = "";
|
53 |
+
foreach($product->getCategoryCollection() as $c) {
|
54 |
+
$children = $c->getData('children_count');
|
55 |
+
if ($children <= 0) {
|
56 |
+
$array['Category'] = utf8_encode($c->getName());
|
57 |
+
|
58 |
+
$loaded_categories = Mage::getModel('catalog/category')
|
59 |
+
->getCollection()
|
60 |
+
->addIdFilter(array($c->getId()))
|
61 |
+
->addAttributeToSelect(array('name'), 'inner')->load();
|
62 |
+
|
63 |
+
foreach($loaded_categories as $loaded_category) {
|
64 |
+
$array['Category'] = utf8_encode($loaded_category->getName());
|
65 |
+
}
|
66 |
+
$category_found = true;
|
67 |
}
|
|
|
68 |
}
|
69 |
+
if (!$category_found) {
|
70 |
+
$array['Category'] = utf8_encode(Mage::getStoreConfig('fontis_feeds/myshoppingfeed/defaultcategory'));
|
71 |
+
}
|
|
|
72 |
|
73 |
+
if ($product->isSaleable()) {
|
74 |
+
$array['InStock'] = 'Y';
|
75 |
+
} else {
|
76 |
+
$array['InStock'] = 'N';
|
77 |
+
}
|
78 |
|
79 |
+
$manufacturer_name = utf8_encode($product->getResource()->getAttribute('manufacturer')->getFrontend()->getValue($product));
|
80 |
|
81 |
+
if ($manufacturer_name == 'No') {
|
82 |
+
$array['Brand'] = 'Generic';
|
83 |
+
} else {
|
84 |
+
$array['Brand'] = $manufacturer_name;
|
85 |
+
}
|
86 |
|
87 |
+
$linkedAttributes = @unserialize(Mage::getStoreConfig('fontis_feeds/myshoppingfeed/m_to_xml_attributes', $store_id));
|
88 |
+
if(!empty($linkedAttributes))
|
|
|
|
|
89 |
{
|
90 |
+
foreach($linkedAttributes as $la)
|
91 |
+
{
|
92 |
+
$magentoAtt = $la['magento'];
|
93 |
+
$xmlAtt = $la['xmlfeed'];
|
94 |
|
95 |
+
$value = $product->getResource()->getAttribute($magentoAtt)->getFrontend()->getValue($product);
|
96 |
|
97 |
+
if ($value != "") {
|
98 |
+
$array[$xmlAtt] = utf8_encode(htmlspecialchars($value));
|
99 |
+
}
|
100 |
}
|
101 |
}
|
102 |
+
|
103 |
+
$products[] = $array;
|
104 |
}
|
105 |
|
106 |
// Serialize and print as a string for the cron parent PHP code to grab.
|
107 |
+
echo json_encode($products);
|
app/code/community/Fontis/Australia/Model/Myshopping/Cron.php
CHANGED
@@ -19,38 +19,74 @@
|
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
22 |
-
|
|
|
|
|
|
|
23 |
{
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
27 |
}
|
28 |
|
29 |
-
|
|
|
|
|
30 |
{
|
31 |
-
$
|
32 |
-
$
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
44 |
}
|
45 |
|
46 |
class Fontis_Australia_Model_MyShopping_Cron
|
47 |
{
|
|
|
|
|
48 |
public static $doc;
|
49 |
public static $root_node;
|
50 |
public static $store;
|
|
|
|
|
51 |
|
52 |
protected function _construct()
|
53 |
{
|
|
|
54 |
}
|
55 |
|
56 |
protected function getPath()
|
@@ -69,8 +105,6 @@ class Fontis_Australia_Model_MyShopping_Cron
|
|
69 |
|
70 |
public static function update()
|
71 |
{
|
72 |
-
session_start();
|
73 |
-
|
74 |
Mage::log('Fontis/Australia_Model_MyShopping_Cron: entered update function');
|
75 |
if (Mage::getStoreConfig('fontis_feeds/myshoppingfeed/active')) {
|
76 |
$io = new Varien_Io_File();
|
@@ -81,11 +115,14 @@ class Fontis_Australia_Model_MyShopping_Cron
|
|
81 |
foreach(Mage::app()->getStores() as $store) {
|
82 |
Mage::log('for each store');
|
83 |
$clean_store_name = str_replace('+', '-', strtolower(urlencode($store->getName())));
|
|
|
84 |
$products_result = self::getProductsXml($store);
|
85 |
|
86 |
// Write the entire products xml file:
|
87 |
-
$
|
88 |
-
|
|
|
|
|
89 |
}
|
90 |
|
91 |
$io->close();
|
@@ -110,21 +147,6 @@ class Fontis_Australia_Model_MyShopping_Cron
|
|
110 |
$products->addStoreFilter();
|
111 |
$products->addAttributeToSelect('*');
|
112 |
|
113 |
-
$attributes_select_array = array('name', 'price', 'image', 'status');
|
114 |
-
$linkedAttributes = @unserialize(Mage::getStoreConfig('fontis_feeds/myshoppingfeed/m_to_xml_attributes', $store->getId()));
|
115 |
-
if(!empty($linkedAttributes))
|
116 |
-
{
|
117 |
-
foreach($linkedAttributes as $la)
|
118 |
-
{
|
119 |
-
if (strpos($la['magento'], 'FONTIS') === false) {
|
120 |
-
$attributes_select_array[] = $la['magento'];
|
121 |
-
}
|
122 |
-
}
|
123 |
-
}
|
124 |
-
|
125 |
-
$products->addAttributeToSelect($attributes_select_array, 'left');
|
126 |
-
$products->addAttributeToFilter('type_id', 'simple');
|
127 |
-
|
128 |
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
|
129 |
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
|
130 |
|
@@ -136,11 +158,19 @@ class Fontis_Australia_Model_MyShopping_Cron
|
|
136 |
self::$doc = new SimpleXMLElement('<productset></productset>');
|
137 |
self::$root_node = self::$doc;
|
138 |
|
139 |
-
Mage::log(
|
140 |
-
Mage::getSingleton('core/resource_iterator')->walk($products->getSelect(), array('
|
141 |
-
|
142 |
-
|
143 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
return $result;
|
145 |
}
|
146 |
}
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
22 |
+
// Callback used by the Magento resource iterator walk() method. Adds a
|
23 |
+
// product ID to a static array and calls addProductXmlMyShopping() to
|
24 |
+
// generate XML when the array reaches the batch size.
|
25 |
+
function addProductXmlCallbackMyShopping($args)
|
26 |
{
|
27 |
+
Fontis_Australia_Model_MyShopping_Cron::$accumulator[] = $args['row']['entity_id'];
|
28 |
+
|
29 |
+
$length = count(Fontis_Australia_Model_MyShopping_Cron::$accumulator);
|
30 |
+
if($length >= Fontis_Australia_Model_MyShopping_Cron::BATCH_SIZE) {
|
31 |
+
addProductXmlMyShopping();
|
32 |
+
}
|
33 |
}
|
34 |
|
35 |
+
// Runs a subprocesss to create feed XML for the product IDs in the static
|
36 |
+
// array, then empties the array.
|
37 |
+
function addProductXmlMyShopping()
|
38 |
{
|
39 |
+
$length = count(Fontis_Australia_Model_MyShopping_Cron::$accumulator);
|
40 |
+
if($length > 0) {
|
41 |
+
Mage::log("Processing product IDs " . Fontis_Australia_Model_MyShopping_Cron::$accumulator[0] .
|
42 |
+
" to " . Fontis_Australia_Model_MyShopping_Cron::$accumulator[$length - 1]);
|
43 |
+
$store_id = Fontis_Australia_Model_MyShopping_Cron::$store->getId();
|
44 |
+
|
45 |
+
$data = exec("php " . Mage::getBaseDir() . "/app/code/community/Fontis/Australia/Model/Myshopping/Child.php " .
|
46 |
+
Mage::getBaseDir() . " '" . serialize(Fontis_Australia_Model_MyShopping_Cron::$accumulator) .
|
47 |
+
"' " . $store_id);
|
48 |
+
Fontis_Australia_Model_MyShopping_Cron::$accumulator = array();
|
49 |
+
|
50 |
+
$array = json_decode($data, true);
|
51 |
+
|
52 |
+
if(is_array($array)) {
|
53 |
+
$codes = array();
|
54 |
+
foreach($array as $prod) {
|
55 |
+
Fontis_Australia_Model_MyShopping_Cron::$debugCount += 1;
|
56 |
+
$product_node = Fontis_Australia_Model_Myshopping_Cron::$root_node->addChild('product');
|
57 |
+
foreach($prod as $key => $val) {
|
58 |
+
if($key == 'Code') {
|
59 |
+
$codes[] = $val;
|
60 |
+
}
|
61 |
+
$product_node->addChild($key, htmlspecialchars($val));
|
62 |
+
}
|
63 |
+
}
|
64 |
+
if(!empty($codes)) {
|
65 |
+
Mage::log("Codes: ".implode(",", $codes));
|
66 |
+
}
|
67 |
+
} else {
|
68 |
+
Mage::log("Could not unserialize to array:");
|
69 |
+
Mage::log($data);
|
70 |
+
Mage::log($array);
|
71 |
+
}
|
72 |
+
|
73 |
+
Mage::log(strlen($data) . " characters returned");
|
74 |
}
|
75 |
}
|
76 |
|
77 |
class Fontis_Australia_Model_MyShopping_Cron
|
78 |
{
|
79 |
+
const BATCH_SIZE = 100;
|
80 |
+
|
81 |
public static $doc;
|
82 |
public static $root_node;
|
83 |
public static $store;
|
84 |
+
public static $accumulator;
|
85 |
+
public static $debugCount = 0;
|
86 |
|
87 |
protected function _construct()
|
88 |
{
|
89 |
+
self::$accumulator = array();
|
90 |
}
|
91 |
|
92 |
protected function getPath()
|
105 |
|
106 |
public static function update()
|
107 |
{
|
|
|
|
|
108 |
Mage::log('Fontis/Australia_Model_MyShopping_Cron: entered update function');
|
109 |
if (Mage::getStoreConfig('fontis_feeds/myshoppingfeed/active')) {
|
110 |
$io = new Varien_Io_File();
|
115 |
foreach(Mage::app()->getStores() as $store) {
|
116 |
Mage::log('for each store');
|
117 |
$clean_store_name = str_replace('+', '-', strtolower(urlencode($store->getName())));
|
118 |
+
Fontis_Australia_Model_MyShopping_Cron::$debugCount = 0;
|
119 |
$products_result = self::getProductsXml($store);
|
120 |
|
121 |
// Write the entire products xml file:
|
122 |
+
$filename = $clean_store_name . '-products.xml';
|
123 |
+
$io->write($filename, $products_result['xml']);
|
124 |
+
Mage::log("Wrote " . Fontis_Australia_Model_MyShopping_Cron::$debugCount
|
125 |
+
. " records to " . self::getPath() . $filename);
|
126 |
}
|
127 |
|
128 |
$io->close();
|
147 |
$products->addStoreFilter();
|
148 |
$products->addAttributeToSelect('*');
|
149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
|
151 |
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
|
152 |
|
158 |
self::$doc = new SimpleXMLElement('<productset></productset>');
|
159 |
self::$root_node = self::$doc;
|
160 |
|
161 |
+
Mage::log("About to walk {$products->getSize()} products...");
|
162 |
+
Mage::getSingleton('core/resource_iterator')->walk($products->getSelect(), array('addProductXmlCallbackMyShopping'));
|
163 |
+
// call XML generation function one last time to process remaining batch
|
164 |
+
addProductXmlMyShopping();
|
165 |
+
Mage::log('Walked');
|
166 |
+
|
167 |
+
$dom = new DOMDocument('1.0');
|
168 |
+
$dom->preserveWhiteSpace = false;
|
169 |
+
$dom->formatOutput = true;
|
170 |
+
$dom_sxml = dom_import_simplexml(self::$doc);
|
171 |
+
$dom_sxml = $dom->importNode($dom_sxml, true);
|
172 |
+
$dom->appendChild($dom_sxml);
|
173 |
+
$result['xml'] = $dom->saveXML();
|
174 |
return $result;
|
175 |
}
|
176 |
}
|
app/code/community/Fontis/Australia/Model/Shopbot/Child.php
CHANGED
@@ -23,85 +23,91 @@ if (!isset($argv[1]) or !isset($argv[2]) or !isset($argv[3])) {
|
|
23 |
exit;
|
24 |
}
|
25 |
$mage_path = $argv[1];
|
26 |
-
$
|
27 |
$store_id = $argv[3];
|
28 |
|
29 |
// Start-up Magento stack
|
30 |
require_once $mage_path . '/app/Mage.php';
|
31 |
Mage::app($store_id);
|
32 |
|
33 |
-
// Load product, tax helper and generate final price information
|
34 |
-
$product = Mage::getModel('catalog/product')->load($product_id);
|
35 |
-
$tax = Mage::helper('tax');
|
36 |
-
$final_price = $tax->getPrice($product, $product->getFinalPrice(), true);
|
37 |
-
|
38 |
// This array is translated into XML when fed back to the cron parent PHP.
|
39 |
-
$
|
40 |
-
|
41 |
-
|
42 |
-
$
|
43 |
-
$
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
-
$linkedAttributes = @unserialize(Mage::getStoreConfig('fontis_feeds/shopbotfeed/m_to_xml_attributes', $store_id));
|
52 |
-
if(!empty($linkedAttributes))
|
53 |
-
{
|
54 |
-
foreach($linkedAttributes as $la)
|
55 |
{
|
56 |
-
$
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
$manufacturer_name = $product->getResource()->
|
61 |
-
getAttribute('manufacturer')->getFrontend()->getValue($product);
|
62 |
-
|
63 |
-
if ($manufacturer_name != 'No') {
|
64 |
-
$array['manufacturer'] = $manufacturer_name;
|
65 |
-
}
|
66 |
|
67 |
-
|
68 |
-
|
|
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
} elseif ($magentoAtt == "FONTIS-category") {
|
74 |
-
$category_found = false;
|
75 |
-
$array['category_name'] = "";
|
76 |
-
foreach($product->getCategoryCollection() as $c) {
|
77 |
-
$children = $c->getData('children_count');
|
78 |
-
if ($children <= 0) {
|
79 |
-
$array['category_name'] = $c->getName();
|
80 |
-
|
81 |
-
$loaded_categories = Mage::getModel('catalog/category')
|
82 |
-
->getCollection()
|
83 |
-
->addIdFilter(array($c->getId()))
|
84 |
-
->addAttributeToSelect(array('name'), 'inner')->load();
|
85 |
|
86 |
-
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
}
|
89 |
-
$category_found = true;
|
90 |
}
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
}
|
95 |
|
96 |
-
|
97 |
-
|
98 |
|
99 |
-
|
100 |
-
|
|
|
101 |
}
|
102 |
}
|
103 |
}
|
|
|
|
|
104 |
}
|
105 |
|
106 |
// Serialize and print as a string for the cron parent PHP code to grab.
|
107 |
-
echo
|
23 |
exit;
|
24 |
}
|
25 |
$mage_path = $argv[1];
|
26 |
+
$product_ids = $argv[2];
|
27 |
$store_id = $argv[3];
|
28 |
|
29 |
// Start-up Magento stack
|
30 |
require_once $mage_path . '/app/Mage.php';
|
31 |
Mage::app($store_id);
|
32 |
|
|
|
|
|
|
|
|
|
|
|
33 |
// This array is translated into XML when fed back to the cron parent PHP.
|
34 |
+
$products = array();
|
35 |
+
foreach(unserialize($product_ids) as $product_id) {
|
36 |
+
// Load product, tax helper and generate final price information
|
37 |
+
$product = Mage::getModel('catalog/product')->load($product_id);
|
38 |
+
$tax = Mage::helper('tax');
|
39 |
+
$final_price = $tax->getPrice($product, $product->getFinalPrice(), true);
|
40 |
+
|
41 |
+
// Array containing product data.
|
42 |
+
$array = array();
|
43 |
+
|
44 |
+
$array['name'] = htmlspecialchars($product->getName());
|
45 |
+
$array['price'] = $final_price;
|
46 |
+
$array['link'] = $product->getProductUrl();
|
47 |
+
|
48 |
+
if ($product->isSaleable()) {
|
49 |
+
$array['availability'] = 'yes';
|
50 |
+
} else {
|
51 |
+
$array['availability'] = 'no';
|
52 |
+
}
|
53 |
|
54 |
+
$linkedAttributes = @unserialize(Mage::getStoreConfig('fontis_feeds/shopbotfeed/m_to_xml_attributes', $store_id));
|
55 |
+
if(!empty($linkedAttributes))
|
|
|
|
|
56 |
{
|
57 |
+
foreach($linkedAttributes as $la)
|
58 |
+
{
|
59 |
+
$magentoAtt = $la['magento'];
|
60 |
+
$xmlAtt = $la['xmlfeed'];
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
+
if ($magentoAtt == "manufacturer") {
|
63 |
+
$manufacturer_name = $product->getResource()->
|
64 |
+
getAttribute('manufacturer')->getFrontend()->getValue($product);
|
65 |
|
66 |
+
if ($manufacturer_name != 'No') {
|
67 |
+
$array['manufacturer'] = $manufacturer_name;
|
68 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
+
} elseif ($magentoAtt == "FONTIS-image-link") {
|
71 |
+
$array[$xmlAtt] = (string)Mage::helper('catalog/image')->init($product, 'image');
|
72 |
+
|
73 |
+
} elseif ($magentoAtt == "FONTIS-product-id") {
|
74 |
+
$array[$xmlAtt] = $product->getId();
|
75 |
+
|
76 |
+
} elseif ($magentoAtt == "FONTIS-category") {
|
77 |
+
$category_found = false;
|
78 |
+
$array['category_name'] = "";
|
79 |
+
foreach($product->getCategoryCollection() as $c) {
|
80 |
+
$children = $c->getData('children_count');
|
81 |
+
if ($children <= 0) {
|
82 |
+
$array['category_name'] = $c->getName();
|
83 |
+
|
84 |
+
$loaded_categories = Mage::getModel('catalog/category')
|
85 |
+
->getCollection()
|
86 |
+
->addIdFilter(array($c->getId()))
|
87 |
+
->addAttributeToSelect(array('name'), 'inner')->load();
|
88 |
+
|
89 |
+
foreach($loaded_categories as $loaded_category) {
|
90 |
+
$array['category_name'] = $loaded_category->getName();
|
91 |
+
}
|
92 |
+
$category_found = true;
|
93 |
}
|
|
|
94 |
}
|
95 |
+
if (!$category_found) {
|
96 |
+
$array['category_name'] = Mage::getStoreConfig('fontis_feeds/shopbotfeed/defaultcategory');
|
97 |
+
}
|
|
|
98 |
|
99 |
+
} else {
|
100 |
+
$value = $product->getResource()->getAttribute($magentoAtt)->getFrontend()->getValue($product);
|
101 |
|
102 |
+
if ($value != "") {
|
103 |
+
$array[$xmlAtt] = htmlspecialchars($value);
|
104 |
+
}
|
105 |
}
|
106 |
}
|
107 |
}
|
108 |
+
|
109 |
+
$products[] = $array;
|
110 |
}
|
111 |
|
112 |
// Serialize and print as a string for the cron parent PHP code to grab.
|
113 |
+
echo json_encode($products);
|
app/code/community/Fontis/Australia/Model/Shopbot/Cron.php
CHANGED
@@ -19,36 +19,75 @@
|
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
22 |
-
|
|
|
|
|
|
|
23 |
{
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
27 |
}
|
28 |
|
29 |
-
|
|
|
|
|
30 |
{
|
31 |
-
$
|
32 |
-
$
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
}
|
42 |
}
|
43 |
|
|
|
44 |
class Fontis_Australia_Model_ShopBot_Cron
|
45 |
{
|
|
|
|
|
46 |
public static $doc;
|
47 |
public static $root_node;
|
48 |
public static $store;
|
|
|
|
|
49 |
|
50 |
protected function _construct()
|
51 |
{
|
|
|
52 |
}
|
53 |
|
54 |
protected function getPath()
|
@@ -67,8 +106,6 @@ class Fontis_Australia_Model_ShopBot_Cron
|
|
67 |
|
68 |
public static function update()
|
69 |
{
|
70 |
-
session_start();
|
71 |
-
|
72 |
Mage::log('Fontis/Australia_Model_Shopbot_Cron: entered update function');
|
73 |
if (Mage::getStoreConfig('fontis_feeds/shopbotfeed/active')) {
|
74 |
$io = new Varien_Io_File();
|
@@ -79,10 +116,14 @@ class Fontis_Australia_Model_ShopBot_Cron
|
|
79 |
foreach(Mage::app()->getStores() as $store) {
|
80 |
Mage::log('for each store');
|
81 |
$clean_store_name = str_replace('+', '-', strtolower(urlencode($store->getName())));
|
|
|
82 |
$products_result = self::getProductsXml($store);
|
83 |
|
84 |
// Write the entire products xml file:
|
85 |
-
$
|
|
|
|
|
|
|
86 |
}
|
87 |
|
88 |
$io->close();
|
@@ -135,10 +176,18 @@ class Fontis_Australia_Model_ShopBot_Cron
|
|
135 |
self::$root_node = self::$doc->addChild('products');
|
136 |
|
137 |
Mage::log('about to walk');
|
138 |
-
Mage::getSingleton('core/resource_iterator')->walk($products->getSelect(), array('
|
|
|
|
|
139 |
Mage::log('walked');
|
140 |
-
|
141 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
return $result;
|
143 |
}
|
144 |
}
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
|
22 |
+
// Callback used by the Magento resource iterator walk() method. Adds a
|
23 |
+
// product ID to a static array and calls addProductXmlShopBot() to
|
24 |
+
// generate XML when the array reaches the batch size.
|
25 |
+
function addProductXmlCallbackShopBot($args)
|
26 |
{
|
27 |
+
Fontis_Australia_Model_ShopBot_Cron::$accumulator[] = $args['row']['entity_id'];
|
28 |
+
|
29 |
+
$length = count(Fontis_Australia_Model_ShopBot_Cron::$accumulator);
|
30 |
+
if($length >= Fontis_Australia_Model_ShopBot_Cron::BATCH_SIZE) {
|
31 |
+
addProductXmlShopBot();
|
32 |
+
}
|
33 |
}
|
34 |
|
35 |
+
// Runs a subprocesss to create feed XML for the product IDs in the static
|
36 |
+
// array, then empties the array.
|
37 |
+
function addProductXmlShopBot()
|
38 |
{
|
39 |
+
$length = count(Fontis_Australia_Model_ShopBot_Cron::$accumulator);
|
40 |
+
if($length > 0) {
|
41 |
+
Mage::log("Processing product IDs " . Fontis_Australia_Model_ShopBot_Cron::$accumulator[0] .
|
42 |
+
" to " . Fontis_Australia_Model_ShopBot_Cron::$accumulator[$length - 1]);
|
43 |
+
$store_id = Fontis_Australia_Model_ShopBot_Cron::$store->getId();
|
44 |
+
|
45 |
+
$data = exec("php " . Mage::getBaseDir() . "/app/code/community/Fontis/Australia/Model/Shopbot/Child.php " .
|
46 |
+
Mage::getBaseDir() . " '" . serialize(Fontis_Australia_Model_ShopBot_Cron::$accumulator) .
|
47 |
+
"' " . $store_id);
|
48 |
+
Fontis_Australia_Model_ShopBot_Cron::$accumulator = array();
|
49 |
+
|
50 |
+
$array = json_decode($data, true);
|
51 |
+
|
52 |
+
if(is_array($array)) {
|
53 |
+
$codes = array();
|
54 |
+
foreach($array as $prod) {
|
55 |
+
Fontis_Australia_Model_ShopBot_Cron::$debugCount += 1;
|
56 |
+
$product_node = Fontis_Australia_Model_ShopBot_Cron::$root_node->addChild('product');
|
57 |
+
foreach($prod as $key => $val) {
|
58 |
+
if($key == 'Code') {
|
59 |
+
$codes[] = $val;
|
60 |
+
}
|
61 |
+
$product_node->addChild($key, htmlspecialchars($val));
|
62 |
+
}
|
63 |
+
}
|
64 |
+
if(!empty($codes)) {
|
65 |
+
Mage::log("Codes: ".implode(",", $codes));
|
66 |
+
}
|
67 |
+
} else {
|
68 |
+
Mage::log("Could not unserialize to array:");
|
69 |
+
Mage::log($data);
|
70 |
+
Mage::log($array);
|
71 |
+
}
|
72 |
+
|
73 |
+
Mage::log(strlen($data) . " characters returned");
|
74 |
}
|
75 |
}
|
76 |
|
77 |
+
|
78 |
class Fontis_Australia_Model_ShopBot_Cron
|
79 |
{
|
80 |
+
const BATCH_SIZE = 100;
|
81 |
+
|
82 |
public static $doc;
|
83 |
public static $root_node;
|
84 |
public static $store;
|
85 |
+
public static $accumulator;
|
86 |
+
public static $debugCount = 0;
|
87 |
|
88 |
protected function _construct()
|
89 |
{
|
90 |
+
self::$accumulator = array();
|
91 |
}
|
92 |
|
93 |
protected function getPath()
|
106 |
|
107 |
public static function update()
|
108 |
{
|
|
|
|
|
109 |
Mage::log('Fontis/Australia_Model_Shopbot_Cron: entered update function');
|
110 |
if (Mage::getStoreConfig('fontis_feeds/shopbotfeed/active')) {
|
111 |
$io = new Varien_Io_File();
|
116 |
foreach(Mage::app()->getStores() as $store) {
|
117 |
Mage::log('for each store');
|
118 |
$clean_store_name = str_replace('+', '-', strtolower(urlencode($store->getName())));
|
119 |
+
Fontis_Australia_Model_ShopBot_Cron::$debugCount = 0;
|
120 |
$products_result = self::getProductsXml($store);
|
121 |
|
122 |
// Write the entire products xml file:
|
123 |
+
$filename = $clean_store_name . '-products.xml';
|
124 |
+
$io->write($filename, $products_result['xml']);
|
125 |
+
Mage::log("Wrote " . Fontis_Australia_Model_ShopBot_Cron::$debugCount
|
126 |
+
. " records to " . self::getPath() . $filename);
|
127 |
}
|
128 |
|
129 |
$io->close();
|
176 |
self::$root_node = self::$doc->addChild('products');
|
177 |
|
178 |
Mage::log('about to walk');
|
179 |
+
Mage::getSingleton('core/resource_iterator')->walk($products->getSelect(), array('addProductXmlCallbackShopBot'));
|
180 |
+
// call XML generation function one last time to process remaining batch
|
181 |
+
addProductXmlShopBot();
|
182 |
Mage::log('walked');
|
183 |
+
|
184 |
+
$dom = new DOMDocument('1.0');
|
185 |
+
$dom->preserveWhiteSpace = false;
|
186 |
+
$dom->formatOutput = true;
|
187 |
+
$dom_sxml = dom_import_simplexml(self::$doc);
|
188 |
+
$dom_sxml = $dom->importNode($dom_sxml, true);
|
189 |
+
$dom->appendChild($dom_sxml);
|
190 |
+
$result['xml'] = $dom->saveXML();
|
191 |
return $result;
|
192 |
}
|
193 |
}
|
app/code/community/Fontis/Australia/Model/Shopbot/Cron.php~
DELETED
@@ -1,290 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Fontis Australia Extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
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 license@magentocommerce.com and you will be sent a copy immediately.
|
14 |
-
*
|
15 |
-
* @category Fontis
|
16 |
-
* @package Fontis_Australia
|
17 |
-
* @author Tom Greenaway
|
18 |
-
* @copyright Copyright (c) 2009 Fontis Pty. Ltd. (http://www.fontis.com.au)
|
19 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
-
*/
|
21 |
-
|
22 |
-
function addProductXmlCallback($args)
|
23 |
-
{
|
24 |
-
$product = $args['product'];
|
25 |
-
$product->setData($args['row']);
|
26 |
-
addProductXml($product);
|
27 |
-
}
|
28 |
-
|
29 |
-
function addProductXml($product)
|
30 |
-
{
|
31 |
-
$store = Fontis_Australia_Model_ShopBot_Cron::$store;
|
32 |
-
|
33 |
-
Mage::log('walking');
|
34 |
-
|
35 |
-
$product_node = Fontis_Australia_Model_ShopBot_Cron::$root_node
|
36 |
-
->addChild('product');
|
37 |
-
|
38 |
-
$name_node = $product_node->addChild('name', $product->getName());
|
39 |
-
|
40 |
-
$price_node = $product_node->addChild('price', $product->getPrice());
|
41 |
-
|
42 |
-
$link_node = $product_node->addChild('link', $product->getProductUrl());
|
43 |
-
|
44 |
-
$availability_node = $product_node->addChild('availability');
|
45 |
-
if ($product->isSaleable()) {
|
46 |
-
$availability_node[0] = 'yes';
|
47 |
-
} else {
|
48 |
-
$availability_node[0] = 'no';
|
49 |
-
}
|
50 |
-
|
51 |
-
Mage::log('serialized area');
|
52 |
-
$linkedAttributes = @unserialize(Mage::getStoreConfig('fontis_feeds/shopbotfeed/m_to_xml_attributes', $store->getId()));
|
53 |
-
if(!empty($linkedAttributes))
|
54 |
-
{
|
55 |
-
foreach($linkedAttributes as $la)
|
56 |
-
{
|
57 |
-
$magentoAtt = $la['magento'];
|
58 |
-
$xmlAtt = $la['xmlfeed'];
|
59 |
-
|
60 |
-
if ($magentoAtt == "FONTIS-image-link") {
|
61 |
-
$image_node = $product_node->addChild($xmlAtt);
|
62 |
-
$image_node[0] = (string)Mage::helper('catalog/image')->init($product, 'image');
|
63 |
-
|
64 |
-
} elseif ($magentoAtt == "FONTIS-product-id") {
|
65 |
-
$id_node = $product_node->addChild($xmlAtt);
|
66 |
-
$id_node[0] = $product->getId();
|
67 |
-
|
68 |
-
} elseif ($magentoAtt == "FONTIS-category") {
|
69 |
-
$category_found = false;
|
70 |
-
$category_node = $product_node->addChild('category_name');
|
71 |
-
foreach($product->getCategoryCollection() as $c) {
|
72 |
-
$children = $c->getData('children_count');
|
73 |
-
if ($children <= 0) {
|
74 |
-
$category_node[0] = $c->getName();
|
75 |
-
|
76 |
-
$loaded_categories = Mage::getModel('catalog/category')
|
77 |
-
->getCollection()
|
78 |
-
->addIdFilter(array($c->getId()))
|
79 |
-
->addAttributeToSelect(array('name'), 'inner')->load();
|
80 |
-
|
81 |
-
foreach($loaded_categories as $loaded_category) {
|
82 |
-
$category_node[0] = $loaded_category->getName();
|
83 |
-
}
|
84 |
-
$category_found = true;
|
85 |
-
}
|
86 |
-
}
|
87 |
-
if (!$category_found) {
|
88 |
-
$category_node[0] = Mage::getStoreConfig('fontis_feeds/shopbotfeed/defaultcategory');
|
89 |
-
}
|
90 |
-
|
91 |
-
} else {
|
92 |
-
$value = $product->getResource()->getAttribute($magentoAtt)->getFrontend()->getValue($product);
|
93 |
-
|
94 |
-
if ($value != "") {
|
95 |
-
$extra_node = $product_node->addChild($xmlAtt);
|
96 |
-
$extra_node[0] = $value;
|
97 |
-
}
|
98 |
-
}
|
99 |
-
}
|
100 |
-
}
|
101 |
-
Mage::log('end of serialized area');
|
102 |
-
}
|
103 |
-
|
104 |
-
class Fontis_Australia_Model_ShopBot_Cron
|
105 |
-
{
|
106 |
-
public static $doc;
|
107 |
-
public static $root_node;
|
108 |
-
public static $store;
|
109 |
-
|
110 |
-
protected function _construct()
|
111 |
-
{
|
112 |
-
session_start();
|
113 |
-
}
|
114 |
-
|
115 |
-
protected function getPath()
|
116 |
-
{
|
117 |
-
$path = "";
|
118 |
-
$config_path = Mage::getStoreConfig('fontis_feeds/shopbotfeed/output');
|
119 |
-
|
120 |
-
if (substr($config_path, 0, 1) == "/") {
|
121 |
-
$path = $config_path . '/';
|
122 |
-
} else {
|
123 |
-
$path = Mage::getBaseDir() . '/' . $config_path . '/';
|
124 |
-
}
|
125 |
-
|
126 |
-
return str_replace('//', '/', $path);
|
127 |
-
}
|
128 |
-
|
129 |
-
public static function update()
|
130 |
-
{
|
131 |
-
Mage::log('Fontis/Australia_Model_Shopbot_Cron: entered update function');
|
132 |
-
if (Mage::getStoreConfig('fontis_feeds/shopbotfeed/active')) {
|
133 |
-
$io = new Varien_Io_File();
|
134 |
-
$io->setAllowCreateFolders(true);
|
135 |
-
|
136 |
-
$io->open(array('path' => self::getPath()));
|
137 |
-
|
138 |
-
foreach(Mage::app()->getStores() as $store) {
|
139 |
-
Mage::log('for each store');
|
140 |
-
$clean_store_name = str_replace('+', '-', strtolower(urlencode($store->getName())));
|
141 |
-
$products_result = self::getProductsXml($store);
|
142 |
-
|
143 |
-
// Write the entire products xml file:
|
144 |
-
$io->write($clean_store_name . '-products.xml', $products_result['xml']);
|
145 |
-
}
|
146 |
-
|
147 |
-
$io->close();
|
148 |
-
}
|
149 |
-
}
|
150 |
-
|
151 |
-
public function nonstatic()
|
152 |
-
{
|
153 |
-
self::update();
|
154 |
-
}
|
155 |
-
|
156 |
-
public function getProductsXml($store)
|
157 |
-
{
|
158 |
-
Mage::log('new getproductsxml');
|
159 |
-
Fontis_Australia_Model_ShopBot_Cron::$store = $store;
|
160 |
-
|
161 |
-
$result = array();
|
162 |
-
|
163 |
-
$product = Mage::getModel('catalog/product');
|
164 |
-
$products = $product->getCollection();
|
165 |
-
$products->setStoreId($store);
|
166 |
-
$products->addStoreFilter();
|
167 |
-
$products->addAttributeToSelect('*');
|
168 |
-
|
169 |
-
$attributes_select_array = array('name', 'price', 'image', 'status');
|
170 |
-
$linkedAttributes = @unserialize(Mage::getStoreConfig('fontis_feeds/shopbotfeed/m_to_xml_attributes', $store->getId()));
|
171 |
-
if(!empty($linkedAttributes))
|
172 |
-
{
|
173 |
-
foreach($linkedAttributes as $la)
|
174 |
-
{
|
175 |
-
if (strpos($la['magento'], 'FONTIS') === false) {
|
176 |
-
$attributes_select_array[] = $la['magento'];
|
177 |
-
}
|
178 |
-
}
|
179 |
-
}
|
180 |
-
Mage::log(var_export($attributes_select_array, true));
|
181 |
-
|
182 |
-
$products->addAttributeToSelect($attributes_select_array, 'left');
|
183 |
-
|
184 |
-
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
|
185 |
-
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
|
186 |
-
|
187 |
-
$storeUrl = $store->getBaseUrl();
|
188 |
-
$shopName = $store->getName();
|
189 |
-
$date = date("d-m-Y", Mage::getModel('core/date')->timestamp(time()));
|
190 |
-
$time = date("h:i:s", Mage::getModel('core/date')->timestamp(time()));
|
191 |
-
|
192 |
-
self::$doc = new SimpleXMLElement('<store url="' . $storeUrl. '" date="'.$date.'" time="'.$time.'" name="' . $shopName . '"></store>');
|
193 |
-
self::$root_node = self::$doc->addChild('products');
|
194 |
-
|
195 |
-
Mage::log('about to walk');
|
196 |
-
Mage::getSingleton('core/resource_iterator')->walk($products->getSelect(), array('addProductXmlCallback'), array('product' => $product));
|
197 |
-
Mage::log('walked');
|
198 |
-
|
199 |
-
$result['xml'] = self::$doc->asXml();
|
200 |
-
return $result;
|
201 |
-
}
|
202 |
-
|
203 |
-
public function getProductsXmlOLD($store)
|
204 |
-
{
|
205 |
-
$result = array();
|
206 |
-
|
207 |
-
$products = Mage::getModel('catalog/product')->getCollection()
|
208 |
-
->setStoreId($store->getId())
|
209 |
-
->addAttributeToSelect('*')->addAttributeToFilter('status', 1);
|
210 |
-
|
211 |
-
$products->load()->getItems();
|
212 |
-
|
213 |
-
$storeUrl = $store->getBaseUrl();
|
214 |
-
$shopName = $store->getName();
|
215 |
-
$date = date("d-m-Y", Mage::getModel('core/date')->timestamp(time()));
|
216 |
-
$time = date("h:i:s", Mage::getModel('core/date')->timestamp(time()));
|
217 |
-
|
218 |
-
$doc = new SimpleXMLElement('<store url="' . $storeUrl. '" date="'.$date.'" time="'.$time.'" name="' . $shopName . '"></store>');
|
219 |
-
$root_node = $doc->addChild('products');
|
220 |
-
|
221 |
-
foreach($products as $product) {
|
222 |
-
$product_node = $root_node->addChild('product');
|
223 |
-
|
224 |
-
$name_node = $product_node->addChild('name');
|
225 |
-
$name_node[0] = $product->getName();
|
226 |
-
|
227 |
-
$price_node = $product_node->addChild('price');
|
228 |
-
$price_node[0] = $product->getPrice();
|
229 |
-
|
230 |
-
$link_node = $product_node->addChild('link');
|
231 |
-
$link_node[0] = $product->getProductUrl();
|
232 |
-
|
233 |
-
$availability_node = $product_node->addChild('availability');
|
234 |
-
if ($product->isSaleable()) {
|
235 |
-
$availability_node[0] = 'yes';
|
236 |
-
} else {
|
237 |
-
$availability_node[0] = 'no';
|
238 |
-
}
|
239 |
-
|
240 |
-
$linkedAttributes = @unserialize(Mage::getStoreConfig('fontis_feeds/shopbotfeed/m_to_xml_attributes', $store->getId()));
|
241 |
-
if(!empty($linkedAttributes))
|
242 |
-
{
|
243 |
-
foreach($linkedAttributes as $la)
|
244 |
-
{
|
245 |
-
$magentoAtt = $la['magento'];
|
246 |
-
$xmlAtt = $la['xmlfeed'];
|
247 |
-
|
248 |
-
if ($magentoAtt == "FONTIS-image-link") {
|
249 |
-
$image_node = $product_node->addChild($xmlAtt);
|
250 |
-
$image_node[0] = (string)Mage::helper('catalog/image')->init($product, 'image');
|
251 |
-
|
252 |
-
} elseif ($magentoAtt == "FONTIS-product-id") {
|
253 |
-
$id_node = $product_node->addChild($xmlAtt);
|
254 |
-
$id_node[0] = $product->getId();
|
255 |
-
|
256 |
-
} elseif ($magentoAtt == "FONTIS-category") {
|
257 |
-
$category_found = false;
|
258 |
-
$category_node = $product_node->addChild($xmlAtt);
|
259 |
-
|
260 |
-
foreach($product->getCategoryCollection() as $c) {
|
261 |
-
$cat = Mage::getModel('catalog/category')->load($c->getId());
|
262 |
-
|
263 |
-
$children = $cat->getAllChildren(true);
|
264 |
-
|
265 |
-
if (count($children) <= 1) {
|
266 |
-
$category_node[0] = $cat->getName();
|
267 |
-
$category_found = true;
|
268 |
-
}
|
269 |
-
}
|
270 |
-
|
271 |
-
if (!$category_found) {
|
272 |
-
$category_node[0] = Mage::getStoreConfig('fontis_feeds/shopbotfeed/defaultcategory');
|
273 |
-
}
|
274 |
-
|
275 |
-
} else {
|
276 |
-
$value = $product->getResource()->getAttribute($magentoAtt)->getFrontend()->getValue($product);
|
277 |
-
|
278 |
-
if ($value != "") {
|
279 |
-
$extra_node = $product_node->addChild($xmlAtt);
|
280 |
-
$extra_node[0] = $value;
|
281 |
-
}
|
282 |
-
}
|
283 |
-
}
|
284 |
-
}
|
285 |
-
}
|
286 |
-
|
287 |
-
$result['xml'] = $doc->asXml();
|
288 |
-
return $result;
|
289 |
-
}
|
290 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Fontis_Australia</name>
|
4 |
-
<version>2.0.
|
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>Broad extension that provides functionality for Australian stores.</summary>
|
10 |
<description>This extension is intended to provide most of the functionality needed to run a Magento store in Australia. This includes all essential payment and shipping methods as well as small localisations such as adding the store's ABN, adding Australian states and territories to the region directory and adding in a postcode database.</description>
|
11 |
-
<notes>Currently active are modules for BPAY, direct deposit, Australia Post, the addition of regions and postcodes, and the addition of ABN and phone number to the general configuration values (although currently not in use).</notes>
|
12 |
<authors><author><name>Chris Norton</name><user>auto-converted</user><email>chris.norton@fontis.com.au</email></author><author><name>Lloyd Hazlett</name><user>auto-converted</user><email>hazzard43@fastmail.fm</email></author><author><name>Fontis</name><user>auto-converted</user><email>magento@fontis.com.au</email></author></authors>
|
13 |
-
<date>2010-04-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="fontis"><dir name="australia"><dir name="payment"><dir name="bpay"><file name="form.phtml" hash="7245a655eac2513f8cd6c1a825586936"/><file name="info.phtml" hash="d4836cf6f5316b76b56ddefc48b67d94"/></dir><dir name="directdeposit"><file name="form.phtml" hash="0e5272781aa7c4d25c1c243fcf00487e"/><file name="info.phtml" hash="38112ef511c67c91a3f2ad43da7929da"/></dir></dir><dir name="system"><dir name="config"><dir name="form"><dir name="field"><file name="array_dropdown.phtml" hash="bdce71494213de5fe194873b5d0bed56"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="fontis_australia.xml" hash="d33f99fc5dfc156de09254e95a2c82eb"/></dir><dir name="template"><dir name="fontis"><dir name="australia"><dir name="payment"><dir name="bpay"><file name="form.phtml" hash="3895f9afa025444eb9a1cdc38582069d"/><file name="info.phtml" hash="47d1e0cc3ae676dff49990eba0ac4608"/><file name="success.phtml" hash="115a1710b1f3b0ef3ecf0b957651bb43"/></dir><dir name="directdeposit"><file name="form.phtml" hash="8cf9d09e42ba30206aabf01a3ec38239"/><file name="info.phtml" hash="8bc98b2fd1d1943f17d2831a67c97db3"/><file name="success.phtml" hash="0545f8c3c9d37a2045a20f442991e8d7"/></dir></dir><file name="postcode-checkout.phtml" hash="51867acd43c4f8c982ab1fea103a579f"/><file name="postcode.phtml" hash="b0d7bfa170c7ca3bd4a256f0404d7189"/></dir></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Fontis"><dir name="Australia"><dir name="Block"><dir name="Bpay"><file name="Form.php" hash="958e11d14d7c87054a68d34b60c498d6"/><file name="Info.php" hash="a28f40be3c76637eb43ba80c61031512"
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Fontis_Australia</name>
|
4 |
+
<version>2.0.4</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>Broad extension that provides functionality for Australian stores.</summary>
|
10 |
<description>This extension is intended to provide most of the functionality needed to run a Magento store in Australia. This includes all essential payment and shipping methods as well as small localisations such as adding the store's ABN, adding Australian states and territories to the region directory and adding in a postcode database.</description>
|
11 |
+
<notes>Currently active are modules for BPAY, direct deposit, Australia Post, the addition of regions and postcodes, and the addition of ABN and phone number to the general configuration values (although currently not in use). Also supports creating product information feeds for the Shopbot, Getprice and MyShopping services.</notes>
|
12 |
<authors><author><name>Chris Norton</name><user>auto-converted</user><email>chris.norton@fontis.com.au</email></author><author><name>Lloyd Hazlett</name><user>auto-converted</user><email>hazzard43@fastmail.fm</email></author><author><name>Fontis</name><user>auto-converted</user><email>magento@fontis.com.au</email></author></authors>
|
13 |
+
<date>2010-04-16</date>
|
14 |
+
<time>06:07:28</time>
|
15 |
+
<contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="fontis"><dir name="australia"><dir name="payment"><dir name="bpay"><file name="form.phtml" hash="7245a655eac2513f8cd6c1a825586936"/><file name="info.phtml" hash="d4836cf6f5316b76b56ddefc48b67d94"/></dir><dir name="directdeposit"><file name="form.phtml" hash="0e5272781aa7c4d25c1c243fcf00487e"/><file name="info.phtml" hash="38112ef511c67c91a3f2ad43da7929da"/></dir></dir><dir name="system"><dir name="config"><dir name="form"><dir name="field"><file name="array_dropdown.phtml" hash="bdce71494213de5fe194873b5d0bed56"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="fontis_australia.xml" hash="d33f99fc5dfc156de09254e95a2c82eb"/></dir><dir name="template"><dir name="fontis"><dir name="australia"><dir name="payment"><dir name="bpay"><file name="form.phtml" hash="3895f9afa025444eb9a1cdc38582069d"/><file name="info.phtml" hash="47d1e0cc3ae676dff49990eba0ac4608"/><file name="success.phtml" hash="115a1710b1f3b0ef3ecf0b957651bb43"/></dir><dir name="directdeposit"><file name="form.phtml" hash="8cf9d09e42ba30206aabf01a3ec38239"/><file name="info.phtml" hash="8bc98b2fd1d1943f17d2831a67c97db3"/><file name="success.phtml" hash="0545f8c3c9d37a2045a20f442991e8d7"/></dir></dir><file name="postcode-checkout.phtml" hash="51867acd43c4f8c982ab1fea103a579f"/><file name="postcode.phtml" hash="b0d7bfa170c7ca3bd4a256f0404d7189"/></dir></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Fontis"><dir name="Australia"><dir name="Block"><dir name="Bpay"><file name="Form.php" hash="958e11d14d7c87054a68d34b60c498d6"/><file name="Info.php" hash="a28f40be3c76637eb43ba80c61031512"/></dir><dir name="Directdeposit"><file name="Form.php" hash="13589d5d85499678bdc62fde04107095"/><file name="Info.php" hash="0f31ac7451127c87813c823423a9057b"/></dir><file name="Autocomplete.php" hash="4f33f809dae969781ead580b13e9bd3a"/><file name="Myshopping.php" hash="1e9b9149a867136f541b765d54ba402b"/><file name="Shopbot.php" hash="fca48ea13a60bdd1b207913f536bce45"/></dir><dir name="controllers"><file name="AjaxController.php" hash="5fb086e3236446b6a6f10f4c78eb3fcb"/></dir><dir name="etc"><file name="config.xml" hash="000d6232e765380bd90a0eecbdd64b21"/><file name="system.xml" hash="bfcebc05a66fb2d2c0b4f13ebae6fc7a"/></dir><dir name="Helper"><file name="Bpay.php" hash="a2565444f18b28e70c8d29f802297057"/><file name="Data.php" hash="e493486d7a5ccd5589d99d08b136b819"/></dir><dir name="Model"><dir name="Config"><file name="CustomerGroupAccess.php" hash="e531a8049b9a877e01c2b806b065dbef"/><file name="CustomerGroups.php" hash="8014e56b1141cb9bbb63f807ec1c87a5"/></dir><dir name="Getprice"><file name="Child.php" hash="8d2a0464526986a20a8fb6d66f5c393f"/><file name="Cron.php" hash="17cd541d978413c0626ea11b14cc7bc8"/></dir><dir name="Myshopping"><file name="Child.php" hash="ba5f6c81fe010ca629bea5de7e0a1a94"/><file name="Cron.php" hash="a7a7f5301cbc5d3768eb202c1148d540"/></dir><dir name="Mysql4"><dir name="Shipping"><dir name="Carrier"><dir name="Eparcel"><file name="Collection.php" hash="87f450c6b318060b83e7d7d0662cdf50"/></dir><file name="Eparcel.php" hash="9614eed4296b17a429db745c289d42cf"/></dir></dir></dir><dir name="Payment"><file name="Bpay.php" hash="b60d9a61b06b100164fff49fc5113f71"/><file name="Directdeposit.php" hash="c80ba74494bfeea040dc2bf942cec5f0"/></dir><dir name="Shipping"><dir name="Carrier"><file name="Australiapost.php" hash="bde64f52effdf89143cb8aacf631ddf9"/><file name="Eparcel.php" hash="b65cd938b27b4666e22b6833ca738226"/></dir><dir name="Config"><file name="Eparcel.php" hash="8c754cdc86316dbee53db68f0e2652bc"/><file name="Eparcelcondition.php" hash="b8cc830ab6e0e397d32bf574f60b0500"/><file name="Weightunits.php" hash="e13ba9de393ae67420f863d4008c3c72"/></dir></dir><dir name="Shopbot"><file name="Child.php" hash="0b5fd4a11a35d29abc50c9a243849bd4"/><file name="Cron.php" hash="385a356a0b8f30dba623e4b2f804e79c"/></dir></dir><dir name="sql"><dir name="australia_setup"><file name="mysql4-install-0.7.0.php" hash="f475b13bb5319599c4a852cfb8788f9a"/><file name="mysql4-upgrade-1.2.1-1.2.2.php" hash="9a381c07ec9ee53e2ffaa7ea7da4559d"/><file name="postcodes.txt" hash="21083a0f94e200259c9b4540666b251e"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="images"><dir name="fontis"><file name="bpay.png" hash="481c9ee07049203aca13d6d2c2948cf7"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Fontis_Australia.xml" hash="a60b83cf1b1b449a16fe09da16342a4d"/></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|