Skip to content

Instantly share code, notes, and snippets.

@natrod

natrod/sample Secret

Created October 6, 2017 10:22
Show Gist options
  • Save natrod/9c074cc70351c2cb4bcc8cb806faf0d8 to your computer and use it in GitHub Desktop.
Save natrod/9c074cc70351c2cb4bcc8cb806faf0d8 to your computer and use it in GitHub Desktop.
$_helper = Mage::helper('catalog/output');
$add = new Mage_Catalog_Block_Product_View_Attributes();
$add->setProduct($productId);
$_product = Mage::getModel('catalog/product');
$_product->setStoreId($storeId);
$_product->load($productId);
Mage::register('product', $_product);
$_additional = $add->getAdditionalData();
foreach ($_additional as $_data):
$_attribute = $_product->getResource()->getAttribute($_data['code']);
if (!is_null($_product->getData($_attribute->getAttributeCode())) && ((string)$_attribute->getFrontend()->getValue($_product) !='') && (!is_null($_data['label'])) && (!is_null($_data['value'])))
{
$produs->appendChild($xml->createElement(str_replace(" ","_", preg_replace("/[^A-Za-z0-9_ ]/", "",$_data['label'])), str_replace($replace_from, $replace_to, strip_tags($_helper->productAttribute($_product, $_data['value'], $_data['code'])))));
}
endforeach;
Mage::unregister('product');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment