getProductListJSON need more data
There is a part of the code that calls the getProductListJSON javascript
function that looks like this
$.getJSON(storeRootUrl + "jsoncatalog/product/list/id/"+id,
function(jsonObj) {
renderProductList(jsonObj,sid);
});
It returns the image, product name, description and id.
I would like it to return a bit more, like the type of product, as in
"simple, configurable, etc"
Based on the layout:
<jsoncatalog_product_list>
<reference name="content">
<block type="paypal_catalog/json_product_list" output="toHtml"
name="product_list"/>
</reference>
</jsoncatalog_product_list>
Looking at app\code\community\Paypal\Catalog\Block\Json\Product\List.php
(hopefully I am looking in the right place), I can see the following code,
wich I assume returns the data.
public function _toHtml()
{
try {
$array = array();
$category = Mage::registry('pp_current_category');
if (!is_null($category)) {
$array =
Mage::helper('paypal_catalog')->getProducts($category->getId());
$this->setCurrenCategoryKey($category->getId());
} else {
$array = array('category' => '', 'items' => array());
}
return Mage::helper('core')->jsonEncode($array);
} catch (Exception $e) {
Mage::logException($e);
return false;
}
}
Where can I add the extra fields in that I need?
Am I on the right track, or even looking at the right template / php code
that returns the data?
Please help me out here, I have not done Magento development for 2 years,
so I have to re-learn allot of this stuff again....
Thanks in advance.
No comments:
Post a Comment