Last active
June 10, 2016 17:43
-
-
Save felipecruz/1dfe11a21273a96192d8b43c6bb26414 to your computer and use it in GitHub Desktop.
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 | |
$attributes_str = "small_image"; | |
function IsNullOrEmptyString($value){ | |
return (!isset($value) || trim($value)===''); | |
} | |
foreach (explode(",", $attributes_str) as $attr) { | |
$meta_tag = '<meta name="product:%s" content="%s" />'; | |
$value = $product->getData(); | |
if (!IsNullOrEmptyString($value)) { | |
echo sprintf($meta_tag, $attr, $product->getAttributeText($attr)); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment