Version Notes
Improvements to handling large product catalogs
Download this release
Release Info
| Developer | Magento Core Team |
| Extension | Atosho |
| Version | 1.1.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.2 to 1.1.0
app/code/community/Atosho/Integration/controllers/FeedController.php
CHANGED
|
@@ -35,32 +35,19 @@ class Atosho_Integration_FeedController extends Mage_Core_Controller_Front_Actio
|
|
| 35 |
|
| 36 |
$product = Mage::getModel('catalog/product');
|
| 37 |
|
| 38 |
-
$productCollection = $
|
| 39 |
-
->addAttributeToFilter('status', true)
|
| 40 |
->addAttributeToFilter('type_id', array('configurable', 'simple'));
|
|
|
|
| 41 |
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
}
|
| 45 |
-
$info['products'] = $productCollection->count();
|
| 46 |
-
|
| 47 |
-
$configurableCollection = $product->getCollection()
|
| 48 |
-
->addAttributeToFilter('type_id', 'configurable')
|
| 49 |
-
->addAttributeToFilter('status', true);
|
| 50 |
-
if (isset($params['store'])) {
|
| 51 |
-
$configurableCollection->addStoreFilter($params['store']);
|
| 52 |
-
}
|
| 53 |
if (isset($params['full'])) {
|
| 54 |
$configurableIds = $configurableCollection->getAllIds();
|
| 55 |
}
|
| 56 |
-
$info['configurable'] = $configurableCollection->
|
| 57 |
|
| 58 |
-
$simpleCollection = $
|
| 59 |
-
->addAttributeToFilter('type_id', 'simple')
|
| 60 |
-
->addAttributeToFilter('status', true);
|
| 61 |
-
if (isset($params['store'])) {
|
| 62 |
-
$simpleCollection->addStoreFilter($params['store']);
|
| 63 |
-
}
|
| 64 |
|
| 65 |
if (isset($params['full'])) {
|
| 66 |
$info['variant'] = 0;
|
|
@@ -82,7 +69,7 @@ class Atosho_Integration_FeedController extends Mage_Core_Controller_Front_Actio
|
|
| 82 |
$info['products'] = $info['configurable'] + $info['simple'];
|
| 83 |
}
|
| 84 |
else {
|
| 85 |
-
$info['simple'] = $simpleCollection->
|
| 86 |
}
|
| 87 |
$writer = new XMLWriter();
|
| 88 |
$writer->openURI('php://output');
|
|
@@ -109,8 +96,8 @@ class Atosho_Integration_FeedController extends Mage_Core_Controller_Front_Actio
|
|
| 109 |
foreach ($websites as $website) {
|
| 110 |
$websiteData = $website->getData();
|
| 111 |
$websiteData['basecurrency'] = $website->getBaseCurrencyCode();
|
| 112 |
-
$websiteData['products'] = $product->getCollection()->addWebsiteFilter($website->getId())->
|
| 113 |
-
$websiteData['active_products'] = $product->getCollection()->addWebsiteFilter($website->getId())->addAttributeToFilter('status', 1)->
|
| 114 |
$structure[$website->getId()] = $websiteData;
|
| 115 |
$groups = $website->getGroups();
|
| 116 |
foreach ($groups as $group) {
|
|
@@ -271,16 +258,16 @@ class Atosho_Integration_FeedController extends Mage_Core_Controller_Front_Actio
|
|
| 271 |
$writer->setIndent(true);
|
| 272 |
$writer->setIndentString("\t");
|
| 273 |
|
|
|
|
|
|
|
| 274 |
$writer->startElement('productlist');
|
| 275 |
foreach ($this->skus as $id => $product) {
|
| 276 |
-
if (!isset($params['activeonly']) || $product['status'] == 1) {
|
| 277 |
$writer->startElement('product');
|
| 278 |
$writer->writeAttribute('id', $id);
|
| 279 |
$writer->writeAttribute('sku', $product['sku']);
|
| 280 |
$writer->writeAttribute('type', $product['type']);
|
| 281 |
$writer->writeAttribute('status', (int) ($product['status'] == 1) );
|
| 282 |
$writer->endElement();
|
| 283 |
-
}
|
| 284 |
}
|
| 285 |
$writer->endElement();
|
| 286 |
|
|
@@ -295,7 +282,7 @@ class Atosho_Integration_FeedController extends Mage_Core_Controller_Front_Actio
|
|
| 295 |
$this->errors = array();
|
| 296 |
|
| 297 |
$this->prepare();
|
| 298 |
-
$this->
|
| 299 |
|
| 300 |
$product = Mage::getModel('catalog/product');
|
| 301 |
|
|
@@ -327,7 +314,7 @@ class Atosho_Integration_FeedController extends Mage_Core_Controller_Front_Actio
|
|
| 327 |
}
|
| 328 |
|
| 329 |
|
| 330 |
-
public function productsAction() {
|
| 331 |
set_error_handler(array($this, 'errorHandler'));
|
| 332 |
|
| 333 |
$this->errors = array();
|
|
@@ -335,25 +322,24 @@ class Atosho_Integration_FeedController extends Mage_Core_Controller_Front_Actio
|
|
| 335 |
$params = Mage::app()->getRequest()->getParams();
|
| 336 |
|
| 337 |
$this->prepare();
|
| 338 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 339 |
|
| 340 |
-
if (isset($params['
|
|
|
|
|
|
|
|
|
|
|
|
|
| 341 |
$productIds = explode(',', $params['ids']);
|
| 342 |
}
|
| 343 |
elseif (isset($params['skus'])) {
|
| 344 |
-
|
| 345 |
-
foreach ($this->skus as $id => $product) {
|
| 346 |
-
if ($sku == $product['sku']) {
|
| 347 |
-
$productIds[] = $id;
|
| 348 |
-
continue 2;
|
| 349 |
-
}
|
| 350 |
-
}
|
| 351 |
-
echo 'Product SKU "'.$sku.'" could not be found.';
|
| 352 |
-
exit;
|
| 353 |
-
}
|
| 354 |
}
|
| 355 |
else {
|
| 356 |
-
$productIds =
|
| 357 |
}
|
| 358 |
|
| 359 |
$product = Mage::getModel('catalog/product');
|
|
@@ -373,6 +359,29 @@ class Atosho_Integration_FeedController extends Mage_Core_Controller_Front_Actio
|
|
| 373 |
$products[$product->getId()] = $p;
|
| 374 |
//echo memory_get_usage(false).PHP_EOL;
|
| 375 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 376 |
|
| 377 |
// XML
|
| 378 |
$writer = new XMLWriter();
|
|
@@ -398,6 +407,24 @@ class Atosho_Integration_FeedController extends Mage_Core_Controller_Front_Actio
|
|
| 398 |
$writer->flush();
|
| 399 |
//print_r($products);
|
| 400 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 401 |
|
| 402 |
|
| 403 |
protected function generateProductList() {
|
|
@@ -405,24 +432,98 @@ class Atosho_Integration_FeedController extends Mage_Core_Controller_Front_Actio
|
|
| 405 |
|
| 406 |
// Get all IDs and matching SKUs
|
| 407 |
$this->skus = array();
|
| 408 |
-
$
|
| 409 |
->addAttributeToFilter('type_id', array('in' => array('simple', 'configurable')))
|
| 410 |
->addAttributeToSelect('sku')
|
| 411 |
->addAttributeToSelect('status');
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
'
|
| 422 |
-
'
|
|
|
|
| 423 |
);
|
| 424 |
}
|
| 425 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 426 |
}
|
| 427 |
|
| 428 |
|
|
@@ -446,6 +547,7 @@ class Atosho_Integration_FeedController extends Mage_Core_Controller_Front_Actio
|
|
| 446 |
if (substr($this->mediaUrl, -1) != '/') $this->mediaUrl .= '/';
|
| 447 |
|
| 448 |
$this->parentResource = Mage::getResourceSingleton('catalog/product_type_configurable');
|
|
|
|
| 449 |
|
| 450 |
// Get attributes
|
| 451 |
$product = Mage::getModel('catalog/product');
|
|
@@ -530,22 +632,33 @@ class Atosho_Integration_FeedController extends Mage_Core_Controller_Front_Actio
|
|
| 530 |
// If multiple parents, sort array to pick the first one
|
| 531 |
if (count($parentIds) > 1) {
|
| 532 |
sort($parentIds);
|
| 533 |
-
$
|
| 534 |
-
$this->errors[] = $error;
|
| 535 |
}
|
| 536 |
$parentId = reset($parentIds);
|
| 537 |
-
|
| 538 |
-
|
| 539 |
-
|
| 540 |
-
|
| 541 |
-
|
| 542 |
-
|
| 543 |
-
|
| 544 |
-
|
| 545 |
-
|
| 546 |
-
|
| 547 |
-
|
| 548 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 549 |
}
|
| 550 |
}
|
| 551 |
}
|
|
@@ -672,6 +785,7 @@ class Atosho_Integration_FeedController extends Mage_Core_Controller_Front_Actio
|
|
| 672 |
|
| 673 |
|
| 674 |
protected function writeProduct(&$writer, $p) {
|
|
|
|
| 675 |
if (isset($p['options'])) {
|
| 676 |
$writer->writeComment(print_r($p['options'], true));
|
| 677 |
}
|
| 35 |
|
| 36 |
$product = Mage::getModel('catalog/product');
|
| 37 |
|
| 38 |
+
$productCollection = $this->getProductCollection()
|
|
|
|
| 39 |
->addAttributeToFilter('type_id', array('configurable', 'simple'));
|
| 40 |
+
$info['products'] = $productCollection->getSize();
|
| 41 |
|
| 42 |
+
$configurableCollection = $this->getProductCollection()
|
| 43 |
+
->addAttributeToFilter('type_id', 'configurable');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
if (isset($params['full'])) {
|
| 45 |
$configurableIds = $configurableCollection->getAllIds();
|
| 46 |
}
|
| 47 |
+
$info['configurable'] = $configurableCollection->getSize();
|
| 48 |
|
| 49 |
+
$simpleCollection = $this->getProductCollection()
|
| 50 |
+
->addAttributeToFilter('type_id', 'simple');
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
if (isset($params['full'])) {
|
| 53 |
$info['variant'] = 0;
|
| 69 |
$info['products'] = $info['configurable'] + $info['simple'];
|
| 70 |
}
|
| 71 |
else {
|
| 72 |
+
$info['simple'] = $simpleCollection->getSize();
|
| 73 |
}
|
| 74 |
$writer = new XMLWriter();
|
| 75 |
$writer->openURI('php://output');
|
| 96 |
foreach ($websites as $website) {
|
| 97 |
$websiteData = $website->getData();
|
| 98 |
$websiteData['basecurrency'] = $website->getBaseCurrencyCode();
|
| 99 |
+
$websiteData['products'] = $product->getCollection()->addWebsiteFilter($website->getId())->getSize();
|
| 100 |
+
$websiteData['active_products'] = $product->getCollection()->addWebsiteFilter($website->getId())->addAttributeToFilter('status', 1)->getSize();
|
| 101 |
$structure[$website->getId()] = $websiteData;
|
| 102 |
$groups = $website->getGroups();
|
| 103 |
foreach ($groups as $group) {
|
| 258 |
$writer->setIndent(true);
|
| 259 |
$writer->setIndentString("\t");
|
| 260 |
|
| 261 |
+
$writer->writeComment('Peak: '.memory_get_peak_usage());
|
| 262 |
+
|
| 263 |
$writer->startElement('productlist');
|
| 264 |
foreach ($this->skus as $id => $product) {
|
|
|
|
| 265 |
$writer->startElement('product');
|
| 266 |
$writer->writeAttribute('id', $id);
|
| 267 |
$writer->writeAttribute('sku', $product['sku']);
|
| 268 |
$writer->writeAttribute('type', $product['type']);
|
| 269 |
$writer->writeAttribute('status', (int) ($product['status'] == 1) );
|
| 270 |
$writer->endElement();
|
|
|
|
| 271 |
}
|
| 272 |
$writer->endElement();
|
| 273 |
|
| 282 |
$this->errors = array();
|
| 283 |
|
| 284 |
$this->prepare();
|
| 285 |
+
$this->parentLoadMethod = 1;
|
| 286 |
|
| 287 |
$product = Mage::getModel('catalog/product');
|
| 288 |
|
| 314 |
}
|
| 315 |
|
| 316 |
|
| 317 |
+
public function productsAction() {
|
| 318 |
set_error_handler(array($this, 'errorHandler'));
|
| 319 |
|
| 320 |
$this->errors = array();
|
| 322 |
$params = Mage::app()->getRequest()->getParams();
|
| 323 |
|
| 324 |
$this->prepare();
|
| 325 |
+
|
| 326 |
+
$this->parentLoadMethod = (isset($params['parentloadmethod']) ? $params['parentloadmethod'] : 0);
|
| 327 |
+
if ($this->parentLoadMethod == 0) {
|
| 328 |
+
$this->parents = $this->getParentList();
|
| 329 |
+
}
|
| 330 |
|
| 331 |
+
if (isset($params['page'])) {
|
| 332 |
+
// Subsize page sizes when products have inactive parents
|
| 333 |
+
$productIds = $this->getProductIds();
|
| 334 |
+
}
|
| 335 |
+
elseif (isset($params['ids'])) {
|
| 336 |
$productIds = explode(',', $params['ids']);
|
| 337 |
}
|
| 338 |
elseif (isset($params['skus'])) {
|
| 339 |
+
$productIds = $this->getProductIds($params['skus']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 340 |
}
|
| 341 |
else {
|
| 342 |
+
$productIds = $this->getProductIds();
|
| 343 |
}
|
| 344 |
|
| 345 |
$product = Mage::getModel('catalog/product');
|
| 359 |
$products[$product->getId()] = $p;
|
| 360 |
//echo memory_get_usage(false).PHP_EOL;
|
| 361 |
}
|
| 362 |
+
|
| 363 |
+
// Fill in parentsku where parentid is defined
|
| 364 |
+
if ($this->parentLoadMethod == 2) {
|
| 365 |
+
$parentIds = array();
|
| 366 |
+
foreach ($products as $product) {
|
| 367 |
+
if (isset($product['parentid'])) {
|
| 368 |
+
$parentIds[] = $product['parentid'];
|
| 369 |
+
}
|
| 370 |
+
}
|
| 371 |
+
$ids = array_unique($parentIds);
|
| 372 |
+
$skus = $this->getParentList($ids);
|
| 373 |
+
|
| 374 |
+
foreach ($products as $key => $product) {
|
| 375 |
+
if (isset($product['parentid'])) {
|
| 376 |
+
if (isset($skus[$product['parentid']])) {
|
| 377 |
+
$products[$key]['parentsku'] = $skus[$product['parentid']];
|
| 378 |
+
}
|
| 379 |
+
else {
|
| 380 |
+
$products[$key]['active'] = 0;
|
| 381 |
+
}
|
| 382 |
+
}
|
| 383 |
+
}
|
| 384 |
+
}
|
| 385 |
|
| 386 |
// XML
|
| 387 |
$writer = new XMLWriter();
|
| 407 |
$writer->flush();
|
| 408 |
//print_r($products);
|
| 409 |
}
|
| 410 |
+
|
| 411 |
+
|
| 412 |
+
protected function getProductCollection() {
|
| 413 |
+
$params = Mage::app()->getRequest()->getParams();
|
| 414 |
+
|
| 415 |
+
$collection = Mage::getModel('catalog/product')->getCollection()
|
| 416 |
+
->addAttributeToSort('entity_id', 'asc')
|
| 417 |
+
->addAttributeToFilter('status', true)
|
| 418 |
+
->addAttributeToFilter('sku', array('neq' => ''));
|
| 419 |
+
if (isset($params['store'])) $collection->addStoreFilter($params['store']);
|
| 420 |
+
if (isset($params['attributeset'])) $collection->addAttributeToFilter('attribute_set_id', $params['attributeset']);
|
| 421 |
+
if (isset($params['category'])) {
|
| 422 |
+
$category = Mage::getModel('catalog/category')->load($params['category']);
|
| 423 |
+
$collection->addCategoryFilter($category);
|
| 424 |
+
}
|
| 425 |
+
|
| 426 |
+
return $collection;
|
| 427 |
+
}
|
| 428 |
|
| 429 |
|
| 430 |
protected function generateProductList() {
|
| 432 |
|
| 433 |
// Get all IDs and matching SKUs
|
| 434 |
$this->skus = array();
|
| 435 |
+
$collection = $this->getProductCollection()
|
| 436 |
->addAttributeToFilter('type_id', array('in' => array('simple', 'configurable')))
|
| 437 |
->addAttributeToSelect('sku')
|
| 438 |
->addAttributeToSelect('status');
|
| 439 |
+
|
| 440 |
+
$idsSelect = $collection->getSelect();
|
| 441 |
+
$idsSelect->reset(Varien_Db_Select::COLUMNS);
|
| 442 |
+
$idsSelect->columns(array('e.entity_id', 'e.sku', 'e.type_id'));
|
| 443 |
+
$idsSelect->resetJoinLeft();
|
| 444 |
+
$products = $collection->getConnection()->fetchAssoc($idsSelect);
|
| 445 |
+
|
| 446 |
+
foreach ($products as $product) {
|
| 447 |
+
$this->skus[$product['entity_id']] = array(
|
| 448 |
+
'sku' => $product['sku'],
|
| 449 |
+
'status' => 1,
|
| 450 |
+
'type' => $product['type_id'],
|
| 451 |
);
|
| 452 |
}
|
| 453 |
+
}
|
| 454 |
+
|
| 455 |
+
|
| 456 |
+
protected function getProductIds($skus = null) {
|
| 457 |
+
$params = Mage::app()->getRequest()->getParams();
|
| 458 |
+
|
| 459 |
+
$collection = $this->getProductCollection();
|
| 460 |
+
if (isset($params['type'])) {
|
| 461 |
+
$collection->addAttributeToFilter('type_id', array('in' => $params['type']));
|
| 462 |
+
}
|
| 463 |
+
else {
|
| 464 |
+
$collection->addAttributeToFilter('type_id', array('in' => array('simple', 'configurable')));
|
| 465 |
+
}
|
| 466 |
+
|
| 467 |
+
if (isset($params['page'])) {
|
| 468 |
+
$page = $params['page'];
|
| 469 |
+
$size = (isset($params['size']) ? $params['size'] : 100);
|
| 470 |
+
|
| 471 |
+
$idsSelect = $collection->getSelect();
|
| 472 |
+
$idsSelect->reset(Varien_Db_Select::COLUMNS);
|
| 473 |
+
$idsSelect->columns('e.entity_id');
|
| 474 |
+
$idsSelect->limit($size, ($page-1)*$size);
|
| 475 |
+
$idsSelect->resetJoinLeft();
|
| 476 |
+
return $collection->getConnection()->fetchCol($idsSelect);
|
| 477 |
+
}
|
| 478 |
+
else {
|
| 479 |
+
return $collection->getAllIds();
|
| 480 |
+
}
|
| 481 |
+
}
|
| 482 |
+
|
| 483 |
+
|
| 484 |
+
protected function getSkuById($id) {
|
| 485 |
+
if (is_array($id)) {
|
| 486 |
+
$collection = $this->getProductCollection()
|
| 487 |
+
->addAttributeToFilter('type_id', array('in' => array('simple', 'configurable')))
|
| 488 |
+
->addAttributeToSelect('sku')
|
| 489 |
+
->addIdFilter($id);
|
| 490 |
+
|
| 491 |
+
$idsSelect = $collection->getSelect();
|
| 492 |
+
$idsSelect->reset(Varien_Db_Select::COLUMNS);
|
| 493 |
+
$idsSelect->columns(array('e.entity_id', 'e.sku'));
|
| 494 |
+
$idsSelect->resetJoinLeft();
|
| 495 |
+
$skus = $collection->getConnection()->fetchPairs($idsSelect);
|
| 496 |
+
|
| 497 |
+
return $skus;
|
| 498 |
+
}
|
| 499 |
+
else {
|
| 500 |
+
$this->utilityProduct->reset();
|
| 501 |
+
$this->utilityProduct->load($id);
|
| 502 |
+
if (!$this->utilityProduct->getId()
|
| 503 |
+
|| $this->utilityProduct->getData('status') != 1
|
| 504 |
+
|| strlen($this->utilityProduct->getData('sku')) == 0) {
|
| 505 |
+
return false;
|
| 506 |
+
}
|
| 507 |
+
return $this->utilityProduct->getData('sku');
|
| 508 |
+
}
|
| 509 |
+
}
|
| 510 |
+
|
| 511 |
+
|
| 512 |
+
protected function getParentList($ids = null) {
|
| 513 |
+
$params = Mage::app()->getRequest()->getParams();
|
| 514 |
+
|
| 515 |
+
$collection = $this->getProductCollection()
|
| 516 |
+
->addAttributeToFilter('type_id', 'configurable')
|
| 517 |
+
->addAttributeToSelect('sku');
|
| 518 |
+
if (isset($ids)) $collection->addIdFilter($ids);
|
| 519 |
+
|
| 520 |
+
$idsSelect = $collection->getSelect();
|
| 521 |
+
$idsSelect->reset(Varien_Db_Select::COLUMNS);
|
| 522 |
+
$idsSelect->columns(array('e.entity_id', 'e.sku'));
|
| 523 |
+
$idsSelect->resetJoinLeft();
|
| 524 |
+
$parents = $collection->getConnection()->fetchPairs($idsSelect);
|
| 525 |
+
|
| 526 |
+
return $parents;
|
| 527 |
}
|
| 528 |
|
| 529 |
|
| 547 |
if (substr($this->mediaUrl, -1) != '/') $this->mediaUrl .= '/';
|
| 548 |
|
| 549 |
$this->parentResource = Mage::getResourceSingleton('catalog/product_type_configurable');
|
| 550 |
+
$this->utilityProduct = Mage::getModel('catalog/product');
|
| 551 |
|
| 552 |
// Get attributes
|
| 553 |
$product = Mage::getModel('catalog/product');
|
| 632 |
// If multiple parents, sort array to pick the first one
|
| 633 |
if (count($parentIds) > 1) {
|
| 634 |
sort($parentIds);
|
| 635 |
+
$this->errors[] = 'Product '.$product->getId().' has multiple parents: '.implode(', ', $parentIds);
|
|
|
|
| 636 |
}
|
| 637 |
$parentId = reset($parentIds);
|
| 638 |
+
switch ($this->parentLoadMethod) {
|
| 639 |
+
case 0:
|
| 640 |
+
if (isset($this->parents[$parentId])) {
|
| 641 |
+
$p['parentsku'] = $this->parents[$parentId];
|
| 642 |
+
} else {
|
| 643 |
+
// Disable child product if parent is disabled
|
| 644 |
+
//$this->errors[] = 'Product '.$product->getId().' ('.$sku.') has been disabled because its parent ('.$this->skus[$parentId]['sku'].') is disabled.';
|
| 645 |
+
//return null;
|
| 646 |
+
$p['active'] = 0;
|
| 647 |
+
}
|
| 648 |
+
break;
|
| 649 |
+
case 1:
|
| 650 |
+
$parentSku = $this->getSkuById($parentId);
|
| 651 |
+
if ($parentSku !== false) {
|
| 652 |
+
$p['parentsku'] = $parentSku;
|
| 653 |
+
}
|
| 654 |
+
else {
|
| 655 |
+
$p['active'] = 0;
|
| 656 |
+
}
|
| 657 |
+
|
| 658 |
+
break;
|
| 659 |
+
case 2:
|
| 660 |
+
$p['parentid'] = $parentId;
|
| 661 |
+
// parentid is converted to parentsku later
|
| 662 |
}
|
| 663 |
}
|
| 664 |
}
|
| 785 |
|
| 786 |
|
| 787 |
protected function writeProduct(&$writer, $p) {
|
| 788 |
+
if (!$p['active']) return;
|
| 789 |
if (isset($p['options'])) {
|
| 790 |
$writer->writeComment(print_r($p['options'], true));
|
| 791 |
}
|
app/code/community/Atosho/Integration/etc/config.xml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Atosho_Integration>
|
| 5 |
-
<version>1.0
|
| 6 |
</Atosho_Integration>
|
| 7 |
</modules>
|
| 8 |
<frontend>
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Atosho_Integration>
|
| 5 |
+
<version>1.1.0</version>
|
| 6 |
</Atosho_Integration>
|
| 7 |
</modules>
|
| 8 |
<frontend>
|
package.xml
CHANGED
|
@@ -1,18 +1,18 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Atosho</name>
|
| 4 |
-
<version>1.0
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>OSL-3.0</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Atosho.com product and order integration</summary>
|
| 10 |
<description>Exposes product catalog to Atosho in the form of an XML feed. Creates a new payment method called 'Atosho Payment' which indicates that an order has been paid through Atosho.</description>
|
| 11 |
-
<notes>Improvements to
|
| 12 |
<authors><author><name>Atosho</name><user>auto-converted</user><email>magento@atosho.com</email></author></authors>
|
| 13 |
-
<date>2012-05-
|
| 14 |
-
<time>
|
| 15 |
-
<contents><target name="mageetc"><dir name="modules"><file name="Atosho_All.xml" hash="80137c2c28f206ab9a22ffe1f9dbb58b"/></dir></target><target name="magecommunity"><dir name="Atosho"><dir name="Integration"><dir name="Model"><dir name="Mysql4"><file name="Setup.php" hash="814ccf08196d33a81a8a70485b7c6a2c"/></dir></dir><dir name="controllers"><file name="FeedController.php" hash="
|
| 16 |
<compatible/>
|
| 17 |
<dependencies/>
|
| 18 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Atosho</name>
|
| 4 |
+
<version>1.1.0</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>OSL-3.0</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Atosho.com product and order integration</summary>
|
| 10 |
<description>Exposes product catalog to Atosho in the form of an XML feed. Creates a new payment method called 'Atosho Payment' which indicates that an order has been paid through Atosho.</description>
|
| 11 |
+
<notes>Improvements to handling large product catalogs</notes>
|
| 12 |
<authors><author><name>Atosho</name><user>auto-converted</user><email>magento@atosho.com</email></author></authors>
|
| 13 |
+
<date>2012-05-31</date>
|
| 14 |
+
<time>12:17:16</time>
|
| 15 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Atosho_All.xml" hash="80137c2c28f206ab9a22ffe1f9dbb58b"/></dir></target><target name="magecommunity"><dir name="Atosho"><dir name="Integration"><dir name="Model"><dir name="Mysql4"><file name="Setup.php" hash="814ccf08196d33a81a8a70485b7c6a2c"/></dir></dir><dir name="controllers"><file name="FeedController.php" hash="8215f98098da3040a6024aee0418eb18"/></dir><dir name="etc"><file name="config.xml" hash="85e2bb36910f698d8fd2757498294cd5"/></dir><dir name="sql"><dir name="atosho_integration_setup"><file name="mysql4-install-1.0.2.php" hash="5f679110a69e5f933e4d4363f992e040"/></dir></dir></dir><dir name="AtoshoPayment"><dir name="Model"><file name="AtoshoPayment.php" hash="7d9afd8abc45ca252ccf36ed7f70c27f"/></dir><dir name="etc"><file name="config.xml" hash="30b5190de1b9b2cb1d3759995ca7c2ff"/><file name="system.xml" hash="ca3e25cb7ceef0da772eb88f91dd32cc"/></dir></dir><dir name="Shipping"><dir name="Model"><dir name="Carrier"><file name="Atosho.php" hash="dcd80ea031ec160eadadac847e80973b"/></dir></dir><dir name="etc"><file name="config.xml" hash="6770b1b833aa1454da307015fdbe5216"/><file name="system.xml" hash="96c2ade90fd06ab5bc3ef787a2af029a"/></dir></dir></dir></target></contents>
|
| 16 |
<compatible/>
|
| 17 |
<dependencies/>
|
| 18 |
</package>
|
