【发布时间】:2014-05-21 07:06:11
【问题描述】:
以下是控制器中返回产品值的函数
public function productsAction()
{
$sku=$this->getRequest()->getparam('subvalue');
$_product = Mage::getModel('catalog/product')->loadByAttribute('sku', $sku);
$upsell_product_collection = $_product->getUpSellProductCollection();
$upsel=$upsell_product_collection->addAttributeToSelect('product_type')
->addAttributeToFilter('product_type', 133);
$products1 = $_product->getData();
return $products1;
}
下面是前端取值的ajax请求
$.ajax
({
type: "POST",
url: "<?php echo $this->getUrl('finder/index/products');?>",
data:"subvalue="+subval,
success: function(response)
{
alert(response);
$("#responseproducts").html(response);
};
});
我无法在前端获取值..请告诉我在前端获取值的方法
【问题讨论】:
-
你遇到任何 js 错误吗?
-
尝试以 json 格式返回值。关注这个magento.stackexchange.com/questions/16216/…
-
没有收到任何 js 错误
标签: magento magento-1.8