/** * Get set collection of products * */ public function __construct() { parent::__construct(); $vendorId = $this->getVendorId(); $id = $this->getRequest()->getParam('id'); $status = 0; if ($id) { $vproductsCollection = Mage::getModel('csmarketplace/vproducts')->getVendorProducts('', $vendorId, $id); $status = $vproductsCollection->getFirstItem()->getCheckStatus(); } $storeId = 0; if ($this->getRequest()->getParam('store')) { $websiteId = Mage::getModel('core/store')->load($this->getRequest()->getParam('store'))->getWebsiteId(); if ($websiteId) { if (in_array($websiteId, Mage::getModel('csmarketplace/vproducts')->getAllowedWebsiteIds())) { $storeId = $this->getRequest()->getParam('store'); } } } $product = Mage::getModel('catalog/product')->setStoreId($storeId); if ($id) { $product = $product->load($id); } $this->setVproduct($product); Mage::register('current_product', $product); $this->setCheckStatus($status); }
public function __construct() { if ($this->getVendorId()) { $this->_associatedOrders = $this->getVendor()->getAssociatedOrders(); $this->_associatedPayments = $this->getVendor()->getAssociatedPayments(); } return parent::__construct(); }
/** * prepare list layout * */ protected function _prepareLayout() { parent::_prepareLayout(); $pager = $this->getLayout()->createBlock('csmarketplace/html_pager', 'custom.pager'); $pager->setAvailableLimit(array(5 => 5, 10 => 10, 20 => 20, 'all' => 'all')); $pager->setCollection($this->getVpayments()); $this->setChild('pager', $pager); $this->getVpayments()->load(); return $this; }
/** * Set the Vendor object and Vendor Id in customer session */ public function __construct() { parent::__construct(); if ($this->_getSession()->isLoggedIn()) { $vendor = Mage::getModel('csmarketplace/vendor')->loadByCustomerId($this->getCustomerId()); if ($vendor && $vendor->getId()) { $this->_getSession()->setData('vendor_id', $vendor->getId()); $this->_getSession()->setData('vendor', $vendor); } } }
public function __construct() { parent::__construct(); if ($this->getVendorId()) { $ordersCollection = $this->getVendor()->getAssociatedOrders()->setOrder('created_at', 'DESC')->setPageSize(5); $main_table = Mage::helper('csmarketplace')->getTableKey('main_table'); $order_total = Mage::helper('csmarketplace')->getTableKey('order_total'); $shop_commission_fee = Mage::helper('csmarketplace')->getTableKey('shop_commission_fee'); $ordersCollection->getSelect()->columns(array('net_vendor_earn' => new Zend_Db_Expr("({$main_table}.{$order_total} - {$main_table}.{$shop_commission_fee})"))); $this->setVorders($ordersCollection); } }
/** * Get set collection of Products report * */ public function __construct() { parent::__construct(); $productsCollection = array(); $reportHelper = Mage::helper('csmarketplace/report'); $params = Mage::getSingleton('core/session')->getData('vproducts_reports_filter'); if (isset($params) && $params != null) { $productsCollection = $reportHelper->getVproductsReportModel($this->getVendor()->getId(), $params['from'], $params['to']); if (count($productsCollection) > 0) { $this->_filtercollection = $productsCollection; $this->setVproductsReports($this->_filtercollection); } } }
/** * Get set collection of Products report * */ public function __construct() { parent::__construct(); $this->setPendingAmount(0.0); $this->setPendingTransfers(0); $this->setPaidAmount(0.0); $this->setCanceledAmount(0.0); $this->setRefundableAmount(0.0); $this->setRefundedAmount(0.0); $this->setEarningAmount(0.0); if ($this->getVendor() && $this->getVendor()->getId()) { $productsCollection = array(); $paymentHelper = Mage::helper('csmarketplace/payment'); $collection = $paymentHelper->_getTransactionsStats($this->getVendor()); if (count($collection) > 0) { foreach ($collection as $stats) { switch ($stats->getPaymentState()) { case Ced_CsMarketplace_Model_Vorders::STATE_OPEN: $this->setPendingAmount($stats->getNetAmount()); $this->setPendingTransfers($stats->getCount() ? $stats->getCount() : 0); break; case Ced_CsMarketplace_Model_Vorders::STATE_PAID: $this->setPaidAmount($stats->getNetAmount()); break; case Ced_CsMarketplace_Model_Vorders::STATE_CANCELED: $this->setCanceledAmount($stats->getNetAmount()); break; case Ced_CsMarketplace_Model_Vorders::STATE_REFUND: $this->setRefundableAmount($stats->getNetAmount()); break; case Ced_CsMarketplace_Model_Vorders::STATE_REFUNDED: $this->setRefundedAmount($stats->getNetAmount()); break; } } } $this->setEarningAmount($this->getVendor()->getAssociatedPayments()->getFirstItem()->getBalance()); } }
/** * prepare product list layout *@return Ced_CsMarketplace_Block_Vproducts */ protected function _prepareLayout() { parent::_prepareLayout(); if ($this->_filtercollection) { if ($this->_filtercollection->getSize() > 0) { $pager = $this->getLayout()->createBlock('csmarketplace/html_pager', 'custom.pager'); $pager->setAvailableLimit(array(5 => 5, 10 => 10, 20 => 20, 'all' => 'all')); $pager->setCollection($this->_filtercollection); $this->setChild('pager', $pager); } } return $this; }
/** * This method is called before rendering HTML * * @return Mage_Adminhtml_Block_Widget_Form */ protected function _beforeToHtml() { $this->_prepareForm(); $this->_initFormValues(); return parent::_beforeToHtml(); }
protected function _prepareLayout() { parent::_prepareLayout(); $this->setChild('csmarketplace_vendor_navigation_statatics', $this->getLayout()->createBlock('csmarketplace/vendor_navigation_statatics', 'csmarketplace_vendor_navigation_statatics')->setTemplate('csmarketplace/vendor/navigation/statatics.phtml')); return $this; }