/** * 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(); }
/** * Get set collection of Orders * */ public function __construct() { parent::__construct(); $payments = array(); if ($vendorId = $this->getVendorId()) { $payments = $this->getVendor()->getVendorPayments()->setOrder('created_at', 'DESC'); $payments = $this->filterPayment($payments); } $this->setVpayments($payments); }
/** * 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()); } }
/** * Get set collection of products * */ public function __construct() { parent::__construct(); $vendorId = $this->getVendorId(); $collection = Mage::getModel('csmarketplace/vproducts')->getVendorProducts('', $vendorId, 0); if (count($collection) > 0) { $products = array(); $statusarray = array(); foreach ($collection as $data) { array_push($products, $data->getProductId()); $statusarray[$data->getProductId()] = $data->getCheckStatus(); } $currentStore = Mage::app()->getStore()->getId(); Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); $productcollection = Mage::getModel('catalog/product')->getCollection(); $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'); } } } $productcollection->addAttributeToSelect('*')->addAttributeToFilter('entity_id', array('in' => $products))->addAttributeToSort('entity_id', 'DESC'); if ($storeId) { $productcollection->addStoreFilter($storeId); $productcollection->joinAttribute('name', 'catalog_product/name', 'entity_id', null, 'inner', $storeId); $productcollection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner', $storeId); $productcollection->joinAttribute('price', 'catalog_product/price', 'entity_id', null, 'left', $storeId); $productcollection->joinAttribute('thumbnail', 'catalog_product/thumbnail', 'entity_id', null, 'left', $storeId); } if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) { $productcollection->joinField('qty', 'cataloginventory/stock_item', 'qty', 'product_id=entity_id', '{{table}}.stock_id=1', 'left'); } $productcollection->joinField('check_status', 'csmarketplace/vproducts', 'check_status', 'product_id=entity_id', null, 'left'); $params = Mage::getSingleton('core/session')->getData('product_filter'); if (isset($params) && is_array($params) && count($params) > 0) { foreach ($params as $field => $value) { if ($field == 'store' || $field == 'store_switcher' || $field == "__SID") { continue; } if (is_array($value)) { if (isset($value['from']) && urldecode($value['from']) != "") { $from = urldecode($value['from']); $productcollection->addAttributeToFilter($field, array('gteq' => $from)); } if (isset($value['to']) && urldecode($value['to']) != "") { $to = urldecode($value['to']); $productcollection->addAttributeToFilter($field, array('lteq' => $to)); } } else { if (urldecode($value) != "") { $productcollection->addAttributeToFilter($field, array("like" => '%' . urldecode($value) . '%')); } } } } Mage::app()->setCurrentStore($currentStore); $productcollection->setStoreId($storeId); if ($productcollection->getSize() > 0) { $this->_filtercollection = $productcollection; $this->setVproducts($this->_filtercollection); } } }