- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想从 Magento 导出自定义 XML feed,这是我使用的以下代码:
<?php
header('Content-Type: text/xml'); // XML's a handy dandy format
include '../app/Mage.php'; // Include the magento core
include 'ArrayXml.php';
Mage::app(); //And start up the Magento app
$_result = array(); // Make sure we have a result array to store our products
$_products = Mage::getModel('catalog/product')->getCollection();
foreach($_products as $_product) {
$_result['produs'][] = array(
'denumire' => $_product->getName(),
'descriere_scurta' => $_product->getShortDescription(), //product's short description
'descriere_lunga' => $_product->getDescription(), // product's long description
'pret_intreg' => $_product->getPrice(), //product's regular Price
'pret_redus' => $_product->getSpecialPrice(), //product's special Price
'url_produs' => $_product->getProductUrl(), //product url
'fotografie_produs' => $_product->getImageUrl() //product's image url
);
}
$_converter = new ArrayXML();
echo $_converter->toXML($_result);
但是,只有产品 URL 和图像 URL 给了我正确的值。其余的都是空的。
什么给出了?
最佳答案
'name' 和其他都是属性,因此您应该调用 addAttributeToSelect
:
$_products = Mage::getModel('catalog/product')->getCollection()
->addAttributeToSelect(array(
'name',
'short_description',
'description'
))
->addPriceData();
关于Magento $_product->getName 为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10588616/
我认为Thread对象就像是带有名称和静态Thread.CurrentThread()的抽象对象,就像访问Thread对象的方式一样。显然,这是错误的假设。。是这样的吗?
我认为Thread对象就像是带有名称和静态Thread.CurrentThread()的抽象对象,就像访问Thread对象的方式一样。显然,这是错误的假设。。是这样的吗?
public class SynchThread1 extends Thread { SynchThread1 st; SynchThread1() {} SynchThrea
这是代码: import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import jav
特定 Thread 实例的静态 Thread.currentThread().getName() 和 getName() 之间有什么区别? 最佳答案 不同之处在于 getName() 是一个实例方法,
我有类人: class Person{ private String name; public Person(String name) { this.name = na
我想到了一个Thread对象,就像一些带有名称的抽象和静态Thread.currentThread(),就像访问该Thread对象的方式一样。显然,这是错误的假设。。是这样的吗?
我认为Thread对象就像是带有名称和静态Thread.CurrentThread()的抽象对象,就像访问Thread对象的方式一样。显然,这是错误的假设。。是这样的吗?
如标题所示,这两者如何区分?我们可以肯定地说它们是一样的吗?我们什么时候选择一个而不是另一个是最好的情况?我只是碰巧遇到它,我不太确定。我希望有人能消除我的疑虑。提前致谢。 最佳答案 this.Get
如果我要创建所有类型的类型,而不是使用字符串和原始类型,那么最大的缺点是什么? 通常它看起来像: String name = person.getName(); int age = person.ge
这个问题在这里已经有了答案: Returning a const reference to an object instead of a copy (12 个答案) 关闭 8 年前。 现在,这是高度
假设我有一个名为 Foo 的类的实例 abc。当我调用 abc.getClass().getName() 时,我相信我实际上是在调用 Class"".getName()。所以,我的问题是这与 Foo.
以下代码在一个简单的演示中运行,但在我的实际项目中无法编译。 namespace ConsoleApplication1 { class Program { stati
如果我在 C# 枚举中有重复值,说 enum MyE { value1 = 1, value2 = 2, valued = 1 } 以下字符串的值应该是什么? MyE N = (MyE)1
CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界. 这篇CFSDN的博客文章PHP getName()函数讲解由作者收集整理,如果你对这篇文章有兴趣
我想从 Magento 导出自定义 XML feed,这是我使用的以下代码: getCollection(); foreach($_products as $_product) { $_result[
只是因为我懒才这么做。我刚刚编写了一个程序,将我所有的音乐列出到一个 Excel 文件中。 import java.io.*; import org.apache.commons.io.F
我的目标是能够覆盖我从 CustomClass.class.getName() 和 CustomClass.getClass().getName() 返回的内容 它应该返回一个自定义值,我认为最好在像
所以我只是不确定如何使用这个方法。我有一个程序可以打印单词、字符和行的计数,但我还希望它在输出此信息之前说出文件名。我已经查看了这方面的信息,但我不确定如何用我的程序来实现这一点。 package p
这个问题已经有答案了: How do I compare strings in Java? (23 个回答) 已关闭 9 年前。 我已经用几种不同的方法对此进行了测试。我比较的字符串s to 与日志文
我是一名优秀的程序员,十分优秀!