1
产品详细信息页面得到当前产品默认商店的的商品名称 ---NAME,和链接
$storeId = Mage::app()->getStore()->getId();
if($storeId!=1){
$product = Mage::getModel('catalog/product')
->setStoreId(1)
->load($_product->getId());
$stringpos = $product->getProductUrl();
$pos = strrpos($stringpos,"?");
$stringpos =substr($stringpos,0,$pos);
$productname = $product->getName();
echo "<a href='".$stringpos.$productname."'>".$productname."</a>"
}
2
产品分类页面得到当前分类ID:
$layer = Mage::getSingleton(‘catalog/layer’);
$_category = $layer->getCurrentCategory();
$currentCategoryId= $_category->getId();
本文介绍了如何使用Magento平台的API及核心方法来获取指定商店的产品详细信息,包括产品名称及其URL,以及如何在产品分类页面中获取当前分类的ID。

被折叠的 条评论
为什么被折叠?



