Magento-在外部PHP脚本中获取产品的自定义属性值



有人知道我如何在php脚本中获得产品的自定义属性值(我们在服务器的root ot ot the ot the of the of the of the the the the the the the the the the the the the the the the the the the the the the>

p>自定义属性是property_type。其他人工作,但不是那个。这是代码:

foreach ($arrayObj  as $row ) {
//get data
$pro_item = getPropertyItem($row['entity_id'],$pdo);
$images = getImages($row['entity_id'],$pdo);
$term = getTerm($row['entity_id'],$pdo);
$local=getLocation($row['entity_id'],$pdo);
// create tags and data
$item = $xml->createElement('item');
$i_status = $xml->createElement('status',getStatus($row['entity_id'],$pdo));
$i_propertyType = $xml->createElement('propertyType',$row['property_type']);
$i_title = $xml->createElement('title',htmlentities(removeAt($pro_item['title'])));
$i_projectName = $xml->createElement('projectName',getBuilding($local,$pro_item['title']));
$i_description = $xml->createElement('description',htmlentities(removeAt($pro_item['description'])));

我的下面代码将帮助您..!

$productId = 'YOUR PRODUCT ID';
$_product= Mage::getSingleton('catalog/product')->load($productId);
echo $_product->getResource()->getAttribute('attribute_code')->getFrontend()->getValue($_product);

请尝试此。

在集合请求中添加您的自定义属性property_type,其中类似的内容:

(结果循环之前(

Mage::getModel('catalog/product')->getCollection()
    ->addAttributeToSelect('property_type')

需要在脚本的标头部分中添加以下行。

mage :: app('admin'(;

产品清单中使用的设置选项为"是"中的"是"属性属性编辑部分。

最新更新