Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save isyan/be832aae22f0c11aaa1e to your computer and use it in GitHub Desktop.
Save isyan/be832aae22f0c11aaa1e to your computer and use it in GitHub Desktop.
<?php
if(!isset($_GET['auth']) || $_GET['auth'] !== '3ebb68a6f75c4c32bd04fe8ed5d76f18') {
header("HTTP/1.1 301 Moved Permanently");
header("Location: /");
header("X-Custom-Message: Please Authenticate");
die();
}
require_once "app/Mage.php";
header("X-Robots-Tag: noindex,nofollow");
header("Content-Type: application/json");
echo "title|description|condition|price|availability|link|image_link|gtin|mpn\n";
Mage::app($_SERVER['MAGE_RUN_CODE']);
$mediaUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
foreach( Mage::getModel('catalog/product')
->getCollection()
->addAttributeToSelect('*')
->addAttributeToFilter('visibility',4)
->load()
as
$p):
if(count($p->getCategoryIds()) > 1) {
echo implode("|",
array(
$p->getName(),
$p->getDescription(),
"new",
$p->getPrice(),
"in stock",
$p->getProductUrl(false),
"{$mediaUrl}catalog/product{$p->getImage()}",
$p->getSku(),
$p->getSku()
)
);
echo "\n";
}
endforeach;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment