通过magento API获取父产品网址
I'd like to get the parent URL for a simple product that is associated with a grouped product (the "parent") through the magento API.
This is how I do it inside the magento app:
<?php if($_product->getTypeId() == "simple"): ?>
<?php $parentIds = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($_product->getId()); ?>
Now I need a call like this for the API, so I can get the grouped product URL (that has the simple product associated) when I input the "sku" of the simple product.
我想获取与分组产品相关联的简单产品的父URL(“父” “)通过magento API。 p>
这是我在magento app中的方式: p>
&lt;?php if($ _product-&gt; getTypeId()==“simple”):?&gt;
&lt;?php $ parentIds = Mage :: getModel('catalog / product_type_grouped') - &gt; getParentIdsByChild($ _ product-&gt; getId()) ; ?&gt;
code> pre>
现在我需要为这样的API调用,所以当我输入时,我可以获得分组的产品URL(具有关联的简单产品) 简单产品的“sku”。 p>
div>
You should creating a Custom API for to do this. You can read how create custom API here: http://www.magentocommerce.com/api/soap/create_your_own_api.html In native API methods is only one method list http://www.magentocommerce.com/api/soap/catalog/catalogProductTypes/productTypes.html