Last active
January 25, 2020 00:59
-
-
Save deivisonarthur/5660902 to your computer and use it in GitHub Desktop.
Dica Pica das Galaxias heim rs http://www.manadev.com/blog/layered-navigation-on-home-or-any-other-cms-page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
error_reporting(E_ALL); | |
ini_set('display_errors', '1'); | |
// Load Up Magento Core | |
define('MAGENTO', realpath('')); | |
require_once(MAGENTO . '/app/Mage.php'); | |
$app = Mage::app()->getStore()->load(0); | |
$categories = Mage::getModel('catalog/category') | |
->getCollection() | |
->addAttributeToSelect('*') | |
// ->addAttributeToFilter('is_anchor', 0) | |
->addAttributeToFilter('custom_use_parent_settings', array("gt" => 0)) | |
->addAttributeToFilter('entity_id', array("gt" => 1)) | |
->setOrder('entity_id') | |
; | |
foreach($categories as $category) { | |
echo $category->getId() . "\t" . $category->getName() . "\n"; | |
$category->setIsAnchor(1); | |
$category->setCustomUseParentSettings(1); | |
$category->save(); | |
} | |
?> | |
########## | |
<?php | |
error_reporting(E_ALL); | |
ini_set('display_errors', '1'); | |
// Load Up Magento Core | |
define('MAGENTO', realpath('')); | |
require_once(MAGENTO . '/app/Mage.php'); | |
$app = Mage::app()->getStore()->load(0); | |
$categories = Mage::getModel('catalog/category') | |
->getCollection() | |
->addAttributeToSelect('*') | |
->addAttributeToFilter('is_anchor', 0) | |
->addAttributeToFilter('entity_id', array("gt" => 1)) | |
->setOrder('entity_id') | |
; | |
foreach($categories as $category) { | |
echo $category->getId() . "\t" . $category->getName() . "\n"; | |
$category->setIsAnchor(1); | |
$category->save(); | |
} | |
?> | |
######## | |
<?php | |
error_reporting(E_ALL); | |
ini_set('display_errors', '1'); | |
// Load Up Magento Core | |
define('MAGENTO', realpath('')); | |
require_once(MAGENTO . '/app/Mage.php'); | |
$app = Mage::app()->getStore()->load(0); | |
$categories = Mage::getModel('catalog/category') | |
->getCollection() | |
->addAttributeToSelect('*') | |
->addAttributeToFilter('include_in_menu', 1) | |
->addAttributeToFilter('entity_id', array("gt" => 1)) | |
->setOrder('entity_id') | |
; | |
foreach($categories as $category) { | |
echo $category->getId() . "\t" . $category->getName() . "\n"; | |
$category->setIncludeInMenu(0); | |
$category->save(); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment