博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
产品分类页面得到当前分类ID,产品详细信息页面得到当前产品默认商店的的商品名称 ---NAME
阅读量:4200 次
发布时间:2019-05-26

本文共 552 字,大约阅读时间需要 1 分钟。

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();

 

转载地址:http://zccli.baihongyu.com/

你可能感兴趣的文章
linux -8 Linux磁盘与文件系统的管理
查看>>
linux 9 -文件系统的压缩与打包 -dump
查看>>
PHP在变量前面加&是什么意思?
查看>>
ebay api - GetUserDisputes 函数
查看>>
ebay api GetMyMessages 函数
查看>>
wdlinux
查看>>
关于mysql升级到5.5报错问题
查看>>
magento - 通过storeid,分类id,天数(几天内)得到产品
查看>>
一个很不错的bash脚本编写教程,至少没接触过BASH的也能看懂!
查看>>
Redis和Memcache对比及选择
查看>>
用谷歌账号登陆magento、
查看>>
php oauth 模块在linux下安装
查看>>
代替nginx的服务器 - The Tengine Web Server
查看>>
nginx 升级成 tengine 的代码
查看>>
magento rest api 调用
查看>>
magento rest api 调用!
查看>>
magento rest api get Token key and secret
查看>>
谷歌获取货币汇率代码
查看>>
安装nginx
查看>>
手动6 - 隐藏Nginx版本号
查看>>