Version Notes
Should have url generation for Magento 1.13
Should have category generation for attributes file
Minor fix for attributes returning int values.
Download this release
Release Info
Developer | Hawksearch Inc. |
Extension | HawkSearch_Datafeed |
Version | 1.0.0.2 |
Comparing to | |
See all releases |
Code changes from version 1.0.0.0 to 1.0.0.2
app/code/community/Hawksearch/Datafeed/Model/Feed.php
CHANGED
@@ -21,6 +21,8 @@ class Hawksearch_Datafeed_Model_Feed extends Mage_Core_Model_Abstract {
|
|
21 |
$_feedPath,
|
22 |
$isLoggingEnabled,
|
23 |
$_totalProductCount,
|
|
|
|
|
24 |
$_optionType;
|
25 |
|
26 |
private $countryMap;
|
@@ -109,7 +111,7 @@ FROM
|
|
109 |
LEFT JOIN
|
110 |
$eavAttributeTable a ON v.attribute_id = a.attribute_id
|
111 |
WHERE
|
112 |
-
v.entity_type_id = $
|
113 |
AND
|
114 |
a.frontend_input IN ('select', 'multiselect')
|
115 |
AND a.attribute_code != 'msrp_enabled' AND a.attribute_code != 'msrp_display_actual_price_type' AND a.attribute_code != 'is_recurring' AND a.attribute_code != 'enable_googlecheckout' AND a.attribute_code != 'tax_class_id' AND a.attribute_code != 'visibility' AND a.attribute_code != 'status'
|
@@ -228,7 +230,7 @@ EOSQL;
|
|
228 |
'varchar',
|
229 |
'decimal',
|
230 |
'datetime',
|
231 |
-
'catalog_category_product',
|
232 |
);
|
233 |
|
234 |
$multiSelectValues = $this->getMultiSelectValues();
|
@@ -251,6 +253,7 @@ EOSQL;
|
|
251 |
// Loop through each of the catalog_product_entity_XXX tables separately. Despite tribal knowledge to the contrary
|
252 |
// among DB developers, in this specific case multiple queries happens to be faster than multiple joins.
|
253 |
foreach ($tables as $table) {
|
|
|
254 |
$done = false;
|
255 |
$offset = 0;
|
256 |
$valueTable = $productEntityValueTable . $table;
|
@@ -261,6 +264,8 @@ SELECT
|
|
261 |
e.entity_id,
|
262 |
e.sku,
|
263 |
a.attribute_code,
|
|
|
|
|
264 |
a.attribute_code As value
|
265 |
FROM
|
266 |
$productEntityTable e
|
@@ -278,17 +283,22 @@ EOSQL;
|
|
278 |
// overhead of being set up in the first place. This query takes less than 2 seconds each
|
279 |
// time it is called, compared to the over 5 minutes it took previously, when the temp
|
280 |
// table was a good idea.
|
281 |
-
$valColumn =
|
282 |
$eaovTable = '';
|
283 |
if ($table == 'int') {
|
284 |
-
$valColumn = "case when a.frontend_input = 'select' and (a.source_model = 'eav/entity_attribute_source_table' or a.source_model = '') then
|
285 |
-
$eaovTable = "LEFT JOIN $eavOptionValueTable
|
|
|
|
|
|
|
286 |
}
|
287 |
$selectQry = <<<EOSQL
|
288 |
SELECT
|
289 |
e.entity_id,
|
290 |
e.sku,
|
291 |
a.attribute_code,
|
|
|
|
|
292 |
$valColumn
|
293 |
FROM
|
294 |
$productEntityTable e
|
@@ -310,6 +320,8 @@ SELECT
|
|
310 |
e.entity_id,
|
311 |
e.sku,
|
312 |
a.attribute_code,
|
|
|
|
|
313 |
v.value
|
314 |
FROM
|
315 |
$productEntityTable e
|
@@ -355,9 +367,16 @@ EOSQL;
|
|
355 |
|
356 |
} else if (is_numeric($values[0])) {
|
357 |
foreach ($values as $val) {
|
358 |
-
if (!empty($multiSelectValues[$row['attribute_code']][$val])) {
|
359 |
//$content .= "\"" . $row['sku'] . "\"\t\"" . $row['attribute_code'] . "\"\t\"" . str_replace("\"", "\"\"", $multiSelectValues[$row['attribute_code']][$val]) . "\"\n";
|
360 |
$output->appendRow(array($row['sku'], $row['attribute_code'], $multiSelectValues[$row['attribute_code']][$val]));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
361 |
} else {
|
362 |
//$content .= "\"" . $row['sku'] . "\"\t\"" . $row['attribute_code'] . "\"\t\"" . str_replace("\"", "\"\"", $val) . "\"\n";
|
363 |
$output->appendRow(array($row['sku'], $row['attribute_code'], $val));
|
@@ -394,6 +413,52 @@ EOSQL;
|
|
394 |
}
|
395 |
}
|
396 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
397 |
return true;
|
398 |
}
|
399 |
|
@@ -440,7 +505,7 @@ EOSQL;
|
|
440 |
|
441 |
//$content = "category_id\tcategory_name\tparent_category_id\tsort_order\n1\tRoot\t0\t0\n";
|
442 |
$output = new CsvWriter($filename, $this->outputFileDelimiter, $this->bufferSize);
|
443 |
-
$output->appendRow(array('category_id', 'category_name', 'parent_category_id','sort_order'));
|
444 |
$output->appendRow(array('1', 'Root', '0', '0'));
|
445 |
|
446 |
while (!$done) {
|
@@ -534,8 +599,8 @@ EOSQL;
|
|
534 |
|
535 |
$disabled_sql = '';
|
536 |
$CONN = ' WHERE ';
|
537 |
-
if(!$allowDisabled){
|
538 |
-
$disabled_sql = "LEFT JOIN $productEntityIntTable AS T6 ON P.entity_id = T6.entity_id AND T6.attribute_id = '" . $attrCodes['status']. "'";
|
539 |
}
|
540 |
|
541 |
$brandAttribute = Mage::helper('hawksearch_datafeed/data')->getBrandAttribute();
|
@@ -543,8 +608,14 @@ EOSQL;
|
|
543 |
$brand_select = ", B5.value AS Brand";
|
544 |
$brand_sql = "LEFT JOIN " . $productEntityIntTable . " AS B5 ON P.entity_id = B5.entity_id AND B5.attribute_id = '" . $attrCodes[$brandAttribute] . "'";
|
545 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
546 |
|
547 |
-
$select_qry = "SELECT P.attribute_set_id, P.entity_id AS ProductID, P.type_id, P.sku, P.has_options, V.value AS Name, T1.value AS ProdDesc, T2.value AS ShortDesc, T3.value AS MetaKeyword, T5.value AS visibility, D.value AS Price, S.value AS Special_Price, SDF.value As Special_Date_From, SDT.value As Special_Date_To, ST.qty, ST.is_in_stock AS IsInStock, X.value AS Msrp" . $brand_select . ", R.parent_id AS GroupID
|
548 |
CASE
|
549 |
WHEN V2.Value IS NULL
|
550 |
THEN '/no-image.jpg'
|
@@ -553,7 +624,7 @@ EOSQL;
|
|
553 |
FROM $productEntityTable AS P
|
554 |
INNER JOIN " . $productEntityVarCharTable . " AS V ON P.entity_id = V.entity_id AND V.attribute_id = '" . $attrCodes['name'] . "'
|
555 |
INNER JOIN " . $catalogInventoryStockTable . " AS ST ON P.entity_id = ST.product_id
|
556 |
-
|
557 |
LEFT JOIN " . $productEntityVarCharTable . " AS V2 ON P.entity_id = V2.entity_id AND V2.attribute_id = '" . $attrCodes['image'] . "'
|
558 |
LEFT JOIN " . $productEntityTextTable . " AS T1 ON P.entity_id = T1.entity_id AND T1.attribute_id = '" . $attrCodes['description'] . "'
|
559 |
LEFT JOIN " . $productEntityTextTable . " AS T2 ON P.entity_id = T2.entity_id AND T2.attribute_id = '" . $attrCodes['short_description'] . "'
|
@@ -573,7 +644,7 @@ EOSQL;
|
|
573 |
$select_qry .= " $CONN ST.is_in_stock = 1";
|
574 |
$CONN = ' AND ';
|
575 |
}
|
576 |
-
if(!$allowDisabled) {
|
577 |
$select_qry .= " $CONN T6.value = 1 ";
|
578 |
$CONN = ' AND ';
|
579 |
}
|
@@ -761,7 +832,7 @@ EOSQL;
|
|
761 |
|
762 |
public function getCountryName($code) {
|
763 |
/* map friendly country_of_origin names */
|
764 |
-
if(!isset($this->countryMap)){
|
765 |
$options = Mage::getModel('directory/country')->getResourceCollection()->toOptionArray();
|
766 |
|
767 |
$this->countryMap = array();
|
@@ -771,7 +842,7 @@ EOSQL;
|
|
771 |
}
|
772 |
}
|
773 |
}
|
774 |
-
return isset($this->countryMap[$code]) ? $this->countryMap[$code]: $code;
|
775 |
}
|
776 |
|
777 |
public function generateFeed($price_feed = false) {
|
@@ -869,6 +940,7 @@ EOSQL;
|
|
869 |
return $this->_ajaxNotice;
|
870 |
}
|
871 |
}
|
|
|
872 |
/**
|
873 |
* CsvWriter
|
874 |
*
|
@@ -898,10 +970,10 @@ class CsvWriter {
|
|
898 |
}
|
899 |
|
900 |
public function appendRow(array $fields) {
|
901 |
-
if(!$this->outputOpen){
|
902 |
$this->openOutput();
|
903 |
}
|
904 |
-
if(false === fputcsv($this->outputFile, $fields, $this->delimiter)) {
|
905 |
throw new Exception("CsvWriter: failed to write row.");
|
906 |
}
|
907 |
}
|
@@ -910,7 +982,7 @@ class CsvWriter {
|
|
910 |
if (false === ($this->outputFile = fopen($this->finalDestinationPath, 'a'))) {
|
911 |
throw new Exception("CsvWriter: Failed to open destination file '$this->finalDestinationPath'.");
|
912 |
}
|
913 |
-
if(!is_null($this->bufferSize)) {
|
914 |
stream_set_write_buffer($this->outputFile, $this->bufferSize);
|
915 |
}
|
916 |
$this->outputOpen = true;
|
@@ -918,7 +990,7 @@ class CsvWriter {
|
|
918 |
|
919 |
public function closeOutput() {
|
920 |
if (!$this->outputOpen) {
|
921 |
-
if(false === fclose($this->outputFile)) {
|
922 |
throw new Exception("CsvWriter: Failed to close destination file'$this->finalDestinationPath'.");
|
923 |
}
|
924 |
$this->outputOpen = false;
|
21 |
$_feedPath,
|
22 |
$isLoggingEnabled,
|
23 |
$_totalProductCount,
|
24 |
+
$_imageHeight,
|
25 |
+
$_imageWidth,
|
26 |
$_optionType;
|
27 |
|
28 |
private $countryMap;
|
111 |
LEFT JOIN
|
112 |
$eavAttributeTable a ON v.attribute_id = a.attribute_id
|
113 |
WHERE
|
114 |
+
v.entity_type_id = $this->_entityTypeId
|
115 |
AND
|
116 |
a.frontend_input IN ('select', 'multiselect')
|
117 |
AND a.attribute_code != 'msrp_enabled' AND a.attribute_code != 'msrp_display_actual_price_type' AND a.attribute_code != 'is_recurring' AND a.attribute_code != 'enable_googlecheckout' AND a.attribute_code != 'tax_class_id' AND a.attribute_code != 'visibility' AND a.attribute_code != 'status'
|
230 |
'varchar',
|
231 |
'decimal',
|
232 |
'datetime',
|
233 |
+
// 'catalog_category_product',
|
234 |
);
|
235 |
|
236 |
$multiSelectValues = $this->getMultiSelectValues();
|
253 |
// Loop through each of the catalog_product_entity_XXX tables separately. Despite tribal knowledge to the contrary
|
254 |
// among DB developers, in this specific case multiple queries happens to be faster than multiple joins.
|
255 |
foreach ($tables as $table) {
|
256 |
+
//$output->appendRow(array('NOW', 'OUTPUTTING', $table));
|
257 |
$done = false;
|
258 |
$offset = 0;
|
259 |
$valueTable = $productEntityValueTable . $table;
|
264 |
e.entity_id,
|
265 |
e.sku,
|
266 |
a.attribute_code,
|
267 |
+
a.source_model,
|
268 |
+
a.attribute_id,
|
269 |
a.attribute_code As value
|
270 |
FROM
|
271 |
$productEntityTable e
|
283 |
// overhead of being set up in the first place. This query takes less than 2 seconds each
|
284 |
// time it is called, compared to the over 5 minutes it took previously, when the temp
|
285 |
// table was a good idea.
|
286 |
+
$valColumn = "v.value";
|
287 |
$eaovTable = '';
|
288 |
if ($table == 'int') {
|
289 |
+
$valColumn = "case when a.frontend_input = 'select' and (a.source_model = 'eav/entity_attribute_source_table' or a.source_model = '' or a.source_model IS NULL) then ov.value else v.value end AS value";
|
290 |
+
$eaovTable = "LEFT JOIN $eavOptionValueTable ov ON ov.option_id = v.value and ov.store_id = 0";
|
291 |
+
} elseif ($table == 'varchar') {
|
292 |
+
$valColumn = "case a.frontend_input when 'multiselect' then ov.value else v.value end AS value";
|
293 |
+
$eaovTable = "LEFT JOIN $eavOptionValueTable ov ON ov.option_id = v.value and ov.store_id = 0";
|
294 |
}
|
295 |
$selectQry = <<<EOSQL
|
296 |
SELECT
|
297 |
e.entity_id,
|
298 |
e.sku,
|
299 |
a.attribute_code,
|
300 |
+
a.source_model,
|
301 |
+
a.attribute_id,
|
302 |
$valColumn
|
303 |
FROM
|
304 |
$productEntityTable e
|
320 |
e.entity_id,
|
321 |
e.sku,
|
322 |
a.attribute_code,
|
323 |
+
a.source_model,
|
324 |
+
a.attribute_id,
|
325 |
v.value
|
326 |
FROM
|
327 |
$productEntityTable e
|
367 |
|
368 |
} else if (is_numeric($values[0])) {
|
369 |
foreach ($values as $val) {
|
370 |
+
if (false && !empty($multiSelectValues[$row['attribute_code']][$val])) {
|
371 |
//$content .= "\"" . $row['sku'] . "\"\t\"" . $row['attribute_code'] . "\"\t\"" . str_replace("\"", "\"\"", $multiSelectValues[$row['attribute_code']][$val]) . "\"\n";
|
372 |
$output->appendRow(array($row['sku'], $row['attribute_code'], $multiSelectValues[$row['attribute_code']][$val]));
|
373 |
+
} elseif ($table == 'int' && !empty($row['source_model'])) {
|
374 |
+
$source = Mage::getSingleton($row['source_model']);
|
375 |
+
if ($row['source_model'] == 'eav/entity_attribute_source_table') {
|
376 |
+
$attribute = Mage::getModel('eav/entity_attribute')->load($row['attribute_id']);
|
377 |
+
$source->setAttribute($attribute);
|
378 |
+
}
|
379 |
+
$output->appendRow(array($row['sku'], $row['attribute_code'], $source->getOptionText($row['value'])));
|
380 |
} else {
|
381 |
//$content .= "\"" . $row['sku'] . "\"\t\"" . $row['attribute_code'] . "\"\t\"" . str_replace("\"", "\"\"", $val) . "\"\n";
|
382 |
$output->appendRow(array($row['sku'], $row['attribute_code'], $val));
|
413 |
}
|
414 |
}
|
415 |
|
416 |
+
/* custom attribute code/category_id */
|
417 |
+
$collection = Mage::getModel('catalog/product')->getCollection();
|
418 |
+
$collection->addAttributeToSelect('sku');
|
419 |
+
$collection->addAttributeToFilter('visibility', array('neq' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE));
|
420 |
+
if (!Mage::helper('hawksearch_datafeed/data')->getAllowDisabledAttribute()) {
|
421 |
+
$collection->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
|
422 |
+
}
|
423 |
+
if(!Mage::helper('hawksearch_datafeed/data')->isIncludeOutOfStockItems()) {
|
424 |
+
/** @var Mage_CatalogInventory_Model_Stock $stockfilter */
|
425 |
+
$stockfilter = Mage::getSingleton('cataloginventory/stock');
|
426 |
+
$stockfilter->addInStockFilterToCollection($collection);
|
427 |
+
}
|
428 |
+
|
429 |
+
$collection->setPageSize($this->_batchSize);
|
430 |
+
$totalPages = $collection->getLastPageNumber();
|
431 |
+
|
432 |
+
$currentPage = 1;
|
433 |
+
do {
|
434 |
+
$collection->setCurPage($currentPage);
|
435 |
+
/** @var Mage_Catalog_Model_Product $product */
|
436 |
+
foreach ($collection as $product) {
|
437 |
+
foreach($product->getCategoryIds() as $id) {
|
438 |
+
$output->appendRow(array($product->getSku(), 'category_id', $id));
|
439 |
+
}
|
440 |
+
/* Example of custom attribute generation */
|
441 |
+
// $product->load('media_gallery');
|
442 |
+
// /** @var Varien_Data_Collection $images */
|
443 |
+
// $images = $product->getMediaGalleryImages();
|
444 |
+
// $image = $images->getLastItem();
|
445 |
+
// $imagePath = $image->getFile();
|
446 |
+
// $output->appendRow(array($product->getSku(), 'rollover_image', $imagePath));
|
447 |
+
|
448 |
+
/* Gallery images should come out sorted,
|
449 |
+
but if not, try this instead of getLastItem(): */
|
450 |
+
// $pos = 0;
|
451 |
+
// foreach ($images as $image) {
|
452 |
+
// if ($image->getPosition() >= $pos) {
|
453 |
+
// $pos = $image->getPosition();
|
454 |
+
// $imagePath = $image->getFile();
|
455 |
+
// }
|
456 |
+
// }
|
457 |
+
}
|
458 |
+
$collection->clear();
|
459 |
+
$currentPage++;
|
460 |
+
} while ($currentPage <= $totalPages);
|
461 |
+
|
462 |
return true;
|
463 |
}
|
464 |
|
505 |
|
506 |
//$content = "category_id\tcategory_name\tparent_category_id\tsort_order\n1\tRoot\t0\t0\n";
|
507 |
$output = new CsvWriter($filename, $this->outputFileDelimiter, $this->bufferSize);
|
508 |
+
$output->appendRow(array('category_id', 'category_name', 'parent_category_id', 'sort_order'));
|
509 |
$output->appendRow(array('1', 'Root', '0', '0'));
|
510 |
|
511 |
while (!$done) {
|
599 |
|
600 |
$disabled_sql = '';
|
601 |
$CONN = ' WHERE ';
|
602 |
+
if (!$allowDisabled) {
|
603 |
+
$disabled_sql = "LEFT JOIN $productEntityIntTable AS T6 ON P.entity_id = T6.entity_id AND T6.attribute_id = '" . $attrCodes['status'] . "'";
|
604 |
}
|
605 |
|
606 |
$brandAttribute = Mage::helper('hawksearch_datafeed/data')->getBrandAttribute();
|
608 |
$brand_select = ", B5.value AS Brand";
|
609 |
$brand_sql = "LEFT JOIN " . $productEntityIntTable . " AS B5 ON P.entity_id = B5.entity_id AND B5.attribute_id = '" . $attrCodes[$brandAttribute] . "'";
|
610 |
}
|
611 |
+
$urlfield = ", CONCAT(V1.value, '.html') AS Link";
|
612 |
+
$urljoin = "LEFT JOIN $productEntityUrlTable AS V1 ON P.entity_id = V1.entity_id AND V1.attribute_id = '" . $attrCodes['url_key'] . "'";
|
613 |
+
if (!Mage::getSingleton('core/resource')->getConnection('core_write')->isTableExists('catalog_product_entity_url_key')) {
|
614 |
+
$urlfield = '';
|
615 |
+
$urljoin = '';
|
616 |
+
}
|
617 |
|
618 |
+
$select_qry = "SELECT P.attribute_set_id, P.entity_id AS ProductID, P.type_id, P.sku, P.has_options, V.value AS Name, T1.value AS ProdDesc, T2.value AS ShortDesc, T3.value AS MetaKeyword, T5.value AS visibility, D.value AS Price, S.value AS Special_Price, SDF.value As Special_Date_From, SDT.value As Special_Date_To, ST.qty, ST.is_in_stock AS IsInStock, X.value AS Msrp" . $brand_select . ", R.parent_id AS GroupID $urlfield,
|
619 |
CASE
|
620 |
WHEN V2.Value IS NULL
|
621 |
THEN '/no-image.jpg'
|
624 |
FROM $productEntityTable AS P
|
625 |
INNER JOIN " . $productEntityVarCharTable . " AS V ON P.entity_id = V.entity_id AND V.attribute_id = '" . $attrCodes['name'] . "'
|
626 |
INNER JOIN " . $catalogInventoryStockTable . " AS ST ON P.entity_id = ST.product_id
|
627 |
+
" . $urljoin . "
|
628 |
LEFT JOIN " . $productEntityVarCharTable . " AS V2 ON P.entity_id = V2.entity_id AND V2.attribute_id = '" . $attrCodes['image'] . "'
|
629 |
LEFT JOIN " . $productEntityTextTable . " AS T1 ON P.entity_id = T1.entity_id AND T1.attribute_id = '" . $attrCodes['description'] . "'
|
630 |
LEFT JOIN " . $productEntityTextTable . " AS T2 ON P.entity_id = T2.entity_id AND T2.attribute_id = '" . $attrCodes['short_description'] . "'
|
644 |
$select_qry .= " $CONN ST.is_in_stock = 1";
|
645 |
$CONN = ' AND ';
|
646 |
}
|
647 |
+
if (!$allowDisabled) {
|
648 |
$select_qry .= " $CONN T6.value = 1 ";
|
649 |
$CONN = ' AND ';
|
650 |
}
|
832 |
|
833 |
public function getCountryName($code) {
|
834 |
/* map friendly country_of_origin names */
|
835 |
+
if (!isset($this->countryMap)) {
|
836 |
$options = Mage::getModel('directory/country')->getResourceCollection()->toOptionArray();
|
837 |
|
838 |
$this->countryMap = array();
|
842 |
}
|
843 |
}
|
844 |
}
|
845 |
+
return isset($this->countryMap[$code]) ? $this->countryMap[$code] : $code;
|
846 |
}
|
847 |
|
848 |
public function generateFeed($price_feed = false) {
|
940 |
return $this->_ajaxNotice;
|
941 |
}
|
942 |
}
|
943 |
+
|
944 |
/**
|
945 |
* CsvWriter
|
946 |
*
|
970 |
}
|
971 |
|
972 |
public function appendRow(array $fields) {
|
973 |
+
if (!$this->outputOpen) {
|
974 |
$this->openOutput();
|
975 |
}
|
976 |
+
if (false === fputcsv($this->outputFile, $fields, $this->delimiter)) {
|
977 |
throw new Exception("CsvWriter: failed to write row.");
|
978 |
}
|
979 |
}
|
982 |
if (false === ($this->outputFile = fopen($this->finalDestinationPath, 'a'))) {
|
983 |
throw new Exception("CsvWriter: Failed to open destination file '$this->finalDestinationPath'.");
|
984 |
}
|
985 |
+
if (!is_null($this->bufferSize)) {
|
986 |
stream_set_write_buffer($this->outputFile, $this->bufferSize);
|
987 |
}
|
988 |
$this->outputOpen = true;
|
990 |
|
991 |
public function closeOutput() {
|
992 |
if (!$this->outputOpen) {
|
993 |
+
if (false === fclose($this->outputFile)) {
|
994 |
throw new Exception("CsvWriter: Failed to close destination file'$this->finalDestinationPath'.");
|
995 |
}
|
996 |
$this->outputOpen = false;
|
app/code/community/Hawksearch/Datafeed/controllers/SearchController.php
CHANGED
@@ -117,9 +117,6 @@ class Hawksearch_Datafeed_SearchController extends Mage_Core_Controller_Front_Ac
|
|
117 |
try {
|
118 |
Mage::helper('hawksearch_datafeed/feed')->generateFeedsForAllStores();
|
119 |
}
|
120 |
-
catch (Exception $e) {
|
121 |
-
$response['error'] = $e->getMessage();
|
122 |
-
}
|
123 |
catch (Exception $e) {
|
124 |
Mage::logException($e);
|
125 |
$response['error'] = "An unknown error occurred.";
|
@@ -133,7 +130,7 @@ class Hawksearch_Datafeed_SearchController extends Mage_Core_Controller_Front_Ac
|
|
133 |
* Refreshes image cache based on passed in store id. Defaults store id to default store
|
134 |
*/
|
135 |
public function runImageCacheGenerationAction() {
|
136 |
-
$response = "";
|
137 |
try {
|
138 |
$storeId = $this->getRequest()->getParam("storeId");
|
139 |
|
@@ -143,14 +140,13 @@ class Hawksearch_Datafeed_SearchController extends Mage_Core_Controller_Front_Ac
|
|
143 |
|
144 |
Mage::getModel('hawksearch_datafeed/feed')->setData('store_id', $storeId)->refreshImageCache();
|
145 |
}
|
146 |
-
catch (Exception $e) {
|
147 |
-
$response = $e->getMessage();
|
148 |
-
}
|
149 |
catch (Exception $e) {
|
150 |
Mage::logException($e);
|
151 |
-
|
152 |
}
|
153 |
-
|
|
|
|
|
154 |
}
|
155 |
|
156 |
/**
|
@@ -166,9 +162,6 @@ class Hawksearch_Datafeed_SearchController extends Mage_Core_Controller_Front_Ac
|
|
166 |
}
|
167 |
Mage::getModel('hawksearch_datafeed/feed')->setData('store_id', $storeId)->generateFeed(true);
|
168 |
}
|
169 |
-
catch (Exception $e) {
|
170 |
-
$response = $e->getMessage();
|
171 |
-
}
|
172 |
catch (Exception $e) {
|
173 |
Mage::logException($e);
|
174 |
$response = "An unknown error occurred.";
|
117 |
try {
|
118 |
Mage::helper('hawksearch_datafeed/feed')->generateFeedsForAllStores();
|
119 |
}
|
|
|
|
|
|
|
120 |
catch (Exception $e) {
|
121 |
Mage::logException($e);
|
122 |
$response['error'] = "An unknown error occurred.";
|
130 |
* Refreshes image cache based on passed in store id. Defaults store id to default store
|
131 |
*/
|
132 |
public function runImageCacheGenerationAction() {
|
133 |
+
$response = array("error" => false);
|
134 |
try {
|
135 |
$storeId = $this->getRequest()->getParam("storeId");
|
136 |
|
140 |
|
141 |
Mage::getModel('hawksearch_datafeed/feed')->setData('store_id', $storeId)->refreshImageCache();
|
142 |
}
|
|
|
|
|
|
|
143 |
catch (Exception $e) {
|
144 |
Mage::logException($e);
|
145 |
+
$response['error'] = "An unknown error occurred.";
|
146 |
}
|
147 |
+
$this->getResponse()
|
148 |
+
->setHeader("Content-Type", "application/json")
|
149 |
+
->setBody(json_encode($response));
|
150 |
}
|
151 |
|
152 |
/**
|
162 |
}
|
163 |
Mage::getModel('hawksearch_datafeed/feed')->setData('store_id', $storeId)->generateFeed(true);
|
164 |
}
|
|
|
|
|
|
|
165 |
catch (Exception $e) {
|
166 |
Mage::logException($e);
|
167 |
$response = "An unknown error occurred.";
|
app/code/community/Hawksearch/Datafeed/etc/config.xml
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
<config>
|
13 |
<modules>
|
14 |
<Hawksearch_Datafeed>
|
15 |
-
<version>1.0.0.
|
16 |
</Hawksearch_Datafeed>
|
17 |
</modules>
|
18 |
<global>
|
12 |
<config>
|
13 |
<modules>
|
14 |
<Hawksearch_Datafeed>
|
15 |
+
<version>1.0.0.2</version>
|
16 |
</Hawksearch_Datafeed>
|
17 |
</modules>
|
18 |
<global>
|
app/code/community/Hawksearch/Datafeed/etc/system.xml
CHANGED
@@ -181,6 +181,15 @@
|
|
181 |
<show_in_website>0</show_in_website>
|
182 |
<show_in_store>0</show_in_store>
|
183 |
</optional_htaccess_password>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
</fields>
|
185 |
</feed>
|
186 |
<cron translate="label" module="hawksearch_datafeed">
|
181 |
<show_in_website>0</show_in_website>
|
182 |
<show_in_store>0</show_in_store>
|
183 |
</optional_htaccess_password>
|
184 |
+
<option_type translate="label">
|
185 |
+
<label>Attribute type</label>
|
186 |
+
<frontend_type>text</frontend_type>
|
187 |
+
<comment>Mode should generally be set to 'eav'</comment>
|
188 |
+
<sort_order>900</sort_order>
|
189 |
+
<show_in_default>1</show_in_default>
|
190 |
+
<show_in_website>0</show_in_website>
|
191 |
+
<show_in_store>0</show_in_store>
|
192 |
+
</option_type>
|
193 |
</fields>
|
194 |
</feed>
|
195 |
<cron translate="label" module="hawksearch_datafeed">
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>HawkSearch_Datafeed</name>
|
4 |
-
<version>1.0.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/OSL-3.0">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
@@ -9,11 +9,12 @@
|
|
9 |
<summary>This package generates data feeds in the required format and can be consumed by Hawk Search.</summary>
|
10 |
<description>This package generates data feeds in the required format and can be consumed by Hawk Search.</description>
|
11 |
<notes>Should have url generation for Magento 1.13
|
12 |
-
Should have category generation for attributes file
|
|
|
13 |
<authors><author><name>Hawksearch Inc.</name><user>hawksearch</user><email>mmunoz@thanxmedia.com</email></author></authors>
|
14 |
-
<date>2014-
|
15 |
-
<time>
|
16 |
-
<contents><target name="magecommunity"><dir name="Hawksearch"><dir name="Datafeed"><dir name="Block"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Version.php" hash="7f72ce91b67d40e68424454a449f1841"/></dir></dir><file name="Form.php" hash="1f6eaf265d3b8c78d3efd93cf93c7f2d"/><dir name="Frontend"><dir name="Feed"><dir name="Generate"><file name="Js.php" hash="b54e5207b5579648d7dfeb9515b3dfb2"/></dir><file name="Generate.php" hash="c73b0b2bd965b5c4e4cded455f23baa1"/><dir name="Generateimagecache"><file name="Js.php" hash="a8e2a4c5a6827eec8d9eebc88db9bbb9"/></dir><file name="Generateimagecache.php" hash="05a3585804163326b33d3a46ab7717b5"/><file name="Next.php" hash="92a25b140bc4d0f3b0c7b497fdf0ca6d"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="569bc6b857b652c80b933a6da02e4e19"/><file name="Feed.php" hash="8cf12219fcb541c409d1cde16b366de1"/></dir><dir name="Model"><file name="Cron.php" hash="2d5421315908619a744b96aa9d4d77cb"/><file name="Email.php" hash="f671df12afac28ae10713cd1972bef2c"/><file name="Feed.php" hash="
|
17 |
<compatible/>
|
18 |
<dependencies><required><php><min>5.1.0</min><max>8.1.0</max></php></required></dependencies>
|
19 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>HawkSearch_Datafeed</name>
|
4 |
+
<version>1.0.0.2</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/OSL-3.0">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
9 |
<summary>This package generates data feeds in the required format and can be consumed by Hawk Search.</summary>
|
10 |
<description>This package generates data feeds in the required format and can be consumed by Hawk Search.</description>
|
11 |
<notes>Should have url generation for Magento 1.13
|
12 |
+
Should have category generation for attributes file
|
13 |
+
Minor fix for attributes returning int values.</notes>
|
14 |
<authors><author><name>Hawksearch Inc.</name><user>hawksearch</user><email>mmunoz@thanxmedia.com</email></author></authors>
|
15 |
+
<date>2014-08-07</date>
|
16 |
+
<time>14:09:08</time>
|
17 |
+
<contents><target name="magecommunity"><dir name="Hawksearch"><dir name="Datafeed"><dir name="Block"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Version.php" hash="7f72ce91b67d40e68424454a449f1841"/></dir></dir><file name="Form.php" hash="1f6eaf265d3b8c78d3efd93cf93c7f2d"/><dir name="Frontend"><dir name="Feed"><dir name="Generate"><file name="Js.php" hash="b54e5207b5579648d7dfeb9515b3dfb2"/></dir><file name="Generate.php" hash="c73b0b2bd965b5c4e4cded455f23baa1"/><dir name="Generateimagecache"><file name="Js.php" hash="a8e2a4c5a6827eec8d9eebc88db9bbb9"/></dir><file name="Generateimagecache.php" hash="05a3585804163326b33d3a46ab7717b5"/><file name="Next.php" hash="92a25b140bc4d0f3b0c7b497fdf0ca6d"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="569bc6b857b652c80b933a6da02e4e19"/><file name="Feed.php" hash="8cf12219fcb541c409d1cde16b366de1"/></dir><dir name="Model"><file name="Cron.php" hash="2d5421315908619a744b96aa9d4d77cb"/><file name="Email.php" hash="f671df12afac28ae10713cd1972bef2c"/><file name="Feed.php" hash="a4973f0ebc2dca577d0bc29e2cca2da7"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Cron.php" hash="2919385264c00276cbf09c105418d5ed"/></dir></dir></dir></dir><dir name="controllers"><file name="SearchController.php" hash="1455f555aab7bd397993f4153309a248"/></dir><dir name="etc"><file name="adminhtml.xml" hash="96daebeddbd749dfe0341818fe2eeabb"/><file name="config.xml" hash="af82af1e1b99f072bb69b6ce560ff27f"/><file name="system.xml" hash="eeeeee9921ae160ab321b8c3192fa2b8"/></dir><dir name="sql"><dir name="hawksearch_datafeed_setup"><file name="install-1.0.0.0.php" hash="768e75fd75bbd9532c92859346d78ef2"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="hawksearch"><dir name="search"><dir name="sysconfig"><dir name="generate"><file name="js.phtml" hash="aa7a51511eaf9c2c1319df358181ae70"/></dir><dir name="generateimagecache"><file name="js.phtml" hash="aba0594893460ae5763ae243866e7e65"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Hawksearch_Datafeed.xml" hash="06b94625c6b60d1269fe61c4127d2146"/></dir></target></contents>
|
18 |
<compatible/>
|
19 |
<dependencies><required><php><min>5.1.0</min><max>8.1.0</max></php></required></dependencies>
|
20 |
</package>
|