如何在Magento中获取完整的产品图片网址 [英] How to get full product image url in Magento
本文介绍了如何在Magento中获取完整的产品图片网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在 magento 中获取完整的产品图片网址,我需要将数据从magento迁移到 django ,因此我需要获取产品完整的图片网址迁移网站
How to get full product image url in magento ,i need to migrate the data from magento to django so i need to get the product full image url to migrate the site
这是我的代码
<?php
@ob_start();
@session_start();
ini_set('display_errors', 1);
//for order update
include '../../../../app/Mage.php';
Mage::app('default');
echo '<pre>';
if(isset($_REQUEST['productid'])){
$productId = $_REQUEST['productid'];
}else{
echo 'Default Product => ';
$productId = '12402'; // product ID 10 is an actual product, and used here for a test
}
$product = Mage::getModel('catalog/product')->load($productId); //load the product
print_r($product->getthumbnail());<br/>
print_r($product->getcreated_at());
?>
推荐答案
您可以尝试以下代码 首先是目录的呼叫帮助器
You can try below code first of all call helper of catalog
echo Mage::helper('catalog/image')->init($product, 'thumbnail');
从此代码中,您还可以获取缓存路径.
From this code you can get cache path also.
这篇关于如何在Magento中获取完整的产品图片网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文