How to get latest 5 Seller id's. Let us assume i am A Seller in backend i have option other seller block show my profile. In above mention image i update seller id it will display but now i want to automatically get latest 5 seller id Check this url This is my seller method
public function updateOtherSellersAction() {
$fieldId = (int) $this->getRequest()->getParam('id');
$otherSellerIds = $this->getRequest()->getParam('include_in_othersellers');
try {
if ($fieldId) {
$model = Mage::getModel('marketplace/sellerprofile')->load($fieldId, 'seller_id');
$model->setData ( 'include_in_othersellers', $otherSellerIds)->save ();
}
}
catch ( Exception $e ) {
Mage::getSingleton ( 'adminhtml/session' )->addError ( $e->getMessage () );
}
}
Here i want to show my other seller id
.phtml
<script type="text/javascript">
function updateOtherSellersField(button, fieldId)
{
new Ajax.Request('<?php echo Mage::helper('adminhtml')->getUrl('*/*/updateOtherSellers') ?>', {
method: 'post',
parameters: { id: fieldId, include_in_othersellers: $(button).previous('input').getValue() },
complete : alert("Other Sellers Block list has been updated successfully.")
});
}
</script>
Admin grid
$this->addColumn('include_in_othersellers', array(
'header' => Mage::helper('marketplace')->__('Include in Other Sellers Block'),
'align' => 'center',
'renderer' => 'marketplace/adminhtml_widget_grid_column_renderer_inline',
'index' => 'include_in_othersellers',
));
<?php
class Apptha_Marketplace_Block_Adminhtml_Widget_Grid_Column_Renderer_Inline
extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Input
{
public function render(Varien_Object $row)
{
$list = $this->OtherSellerList($row);
$html .= '<input type="text" name="'.$row->getId().'" value = "'.$list.'"/>';
$html .= '<button onclick="updateOtherSellersField(this, '. $row->getId() .'); return false">' . Mage::helper('marketplace')->__('Update') . '</button>';
return $html;
}
public function OtherSellerList(Varien_Object $row)
{
$id = $row->getData();
foreach ($id as $_id) {
$sellerProduct = Mage::helper('marketplace/marketplace')->getSellerCollection($_id);
return $sellerProduct['include_in_othersellers'];
}
}
}
include_in_othersellers