Created
February 26, 2019 14:30
-
-
Save vishy93/443fd7eab1786ff6c9b01885a96044c3 to your computer and use it in GitHub Desktop.
See by product id if product in category, if so which ones. Else not in any.
This file contains hidden or 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 | |
require '../app/Mage.php'; | |
umask(0); | |
Mage::app('admin'); | |
error_reporting(1); | |
set_time_limit(0); | |
ini_set('memory_limit', '2048M'); | |
$productId = 11569; | |
$product = Mage::getModel('catalog/product')->load($productId); | |
$cats = $product->getCategoryIds(); | |
foreach ($cats as $category_id) { | |
$_cat = Mage::getModel('catalog/category')->load($category_id) ; | |
if($_cat->getName()){ | |
echo $category_id." => ".$_cat->getName()."</br>"; | |
} else{ | |
echo "not in"; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment