Created
August 4, 2014 19:59
-
-
Save bastianccm/f5505a767a9576129884 to your computer and use it in GitHub Desktop.
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 | |
$order = 13; | |
$attribute = 'url_key'; | |
require_once 'app/Mage.php'; | |
Mage::app(); | |
/** @var Mage_Sales_Model_Order $order */ | |
$order = Mage::getModel('sales/order')->load(1); | |
/** @var array $itemIds */ | |
$itemIds = Mage::getResourceModel('sales/order_item_collection')->setOrderFilter($order)->getAllIds(); | |
/** @var Mage_Catalog_Model_Resource_Product_Collection $productCollection */ | |
$productCollection = Mage::getResourceModel('catalog/product_collection'); | |
$productCollection->addFieldToFilter('entity_id', array('in' => $itemIds)); | |
$productCollection->addAttributeToSelect($attribute); | |
foreach ($productCollection as $product) { | |
/** @var Mage_Catalog_Model_Product $product */ | |
echo $product->getId() . ': ' . $product->getData($attribute) . PHP_EOL; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment