我有我的自定义产品属性在magento.i想要设置产品描述的动态。他们任何方式在magento,以便我们可以找到属性是由我们自定义创建默认magento。区分magento产品属性和自定义创建的产品属性
我已经搜索过,但没有取得任何成功。
请帮忙。
在此先感谢。
我有我的自定义产品属性在magento.i想要设置产品描述的动态。他们任何方式在magento,以便我们可以找到属性是由我们自定义创建默认magento。区分magento产品属性和自定义创建的产品属性
我已经搜索过,但没有取得任何成功。
请帮忙。
在此先感谢。
假设您有一个代码为some_code
的属性。
以下是您可以检查它是系统属性还是自定义属性。
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'some_code');
if ($attribute->getIsUserDefined()) {
//then you created the attribute
}
else {
//then it's a system attribute
}
您可以使用Magento的默认API来获取默认的产品列表
欲了解更多详细信息,您可以参考以下网址:
使用将代码:
$proxy = new SoapClient('localhost/api/soap/?wsdl');
$sessionId = $proxy->login('apiUser', 'apiKey');
$listAttributes = $proxy->call($sessionId, 'product.listOfAdditionalAttributes', array('simple', 13));
请注明相关的答案,而不仅仅是一个链接。多年以后,链接可能会破裂。 – mhlester
使用Magento的SOAP/REST API用于创建产品,并与价值观的更新以及自定义属性,
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
$sessionId = $proxy->login('apiUser', 'apiKey');
echo "<pre>";
// Create new attribute
$attributeToCreate = array(
"attribute_code" => "new_attribute",
"scope" => "store",
"frontend_input" => "select",
"is_unique" => 0,
"is_required" => 0,
"is_configurable" => 0,
"is_searchable" => 0,
"is_visible_in_advanced_search" => 0,
"used_in_product_listing" => 0,
"additional_fields" => array(
"is_filterable" => 1,
"is_filterable_in_search" => 1,
"position" => 1,
"used_for_sort_by" => 1
),
"frontend_label" => array(
array("store_id" => 0,"label" => "A new attribute")
)
);
$attributeId = $proxy->call($sessionId,"product_attribute.create",
array(
$attributeToCreate
)
);
// Update attribute
$attributeToUpdate = array(
"scope" => "global",
"is_unique" => 1,
"is_required" => 1,
"is_configurable" => 1,
"is_searchable" => 1,
"is_visible_in_advanced_search" => 0,
"used_in_product_listing" => 0,
"additional_fields" => array(
"is_filterable" => 01,
"is_filterable_in_search" => 0,
"position" => 2,
"used_for_sort_by" => 0
),
"frontend_label" => array(
array(
"store_id" => 0,
"label" => "A Test Attribute"
)
)
);
$proxy->call(
$sessionId,
"product_attribute.update",
array(
"new_attribute",
$attributeToUpdate
)
);
我希望这将解决您的问题..
感谢您的解决方案为我工作。只需一个小修改 D应该是$ attribute-> getIsUserdefined() 的资本,它将是$ attribute-> getIsUserDefined() –
@waqarmirza。对。对不起。我修好了它。 – Marius
好的没问题。感谢解决方案 –