-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Syam Mohan
committed
Oct 7, 2014
1 parent
58ae380
commit 18abcb0
Showing
16 changed files
with
589 additions
and
15 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
app/code/community/Medma/MarketPlace/Block/Vendor/.goutputstream-DDSMMX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
/** | ||
* Medma Marketplace | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Magento Team | ||
* that is bundled with this package of Medma Infomatix Pvt. Ltd. | ||
* ================================================================= | ||
* MAGENTO EDITION USAGE NOTICE | ||
* ================================================================= | ||
* This package designed for Magento COMMUNITY edition | ||
* Contact us Support does not guarantee correct work of this package | ||
* on any other Magento edition except Magento COMMUNITY edition. | ||
* ================================================================= | ||
* | ||
* @category Medma | ||
* @package Medma_MarketPlace | ||
**/ | ||
|
||
class Medma_MarketPlace_Block_Vendor_List extends Mage_Core_Block_Template | ||
{ | ||
public function __construct() | ||
{ | ||
$this->setTemplate('marketplace/vendor/list.phtml'); | ||
parent::__construct(); | ||
} | ||
|
||
public function getVendorListCollection() | ||
{ | ||
//~ $vendorCollection = Mage::getModel('marketplace/profile')->getCollection(); | ||
//~ $vendorCollection->addFieldToSelect('entity_id'); | ||
//~ $vendorCollection->addFieldToSelect('user_id'); | ||
//~ $vendorCollection->addFieldToSelect('image'); | ||
|
||
|
||
//$userTable = Mage::getSingleton('core/resource')->getTableName('admin/user'); | ||
//$collection = Mage :: getModel('marketplace/profile')->getCollection(); | ||
|
||
// Cannot append getSelect right here because $collection will not be a collection | ||
//return $collection->getSelect()->join(array('user' => $userTable),'main_table.user_id = user.user_id','main_table.*'); | ||
|
||
|
||
$collection = Mage::getModel('marketplace/profile')->getCollection(); | ||
$collection->getSelect()->joinInner( array('cat'=> Mage::getSingleton('core/resource')->getTableName('admin/user')), 'main_table.cat_id = cat.user_id', array('user_id')); | ||
//echo $collection->getSelect(); die; | ||
return $collection; | ||
|
||
} | ||
} | ||
|
||
?> |
71 changes: 71 additions & 0 deletions
71
app/code/community/Medma/MarketPlace/Block/Vendor/List.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
|
||
/** | ||
* Medma Marketplace | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Magento Team | ||
* that is bundled with this package of Medma Infomatix Pvt. Ltd. | ||
* ================================================================= | ||
* MAGENTO EDITION USAGE NOTICE | ||
* ================================================================= | ||
* This package designed for Magento COMMUNITY edition | ||
* Contact us Support does not guarantee correct work of this package | ||
* on any other Magento edition except Magento COMMUNITY edition. | ||
* ================================================================= | ||
* | ||
* @category Medma | ||
* @package Medma_MarketPlace | ||
**/ | ||
|
||
class Medma_MarketPlace_Block_Vendor_List extends Mage_Core_Block_Template | ||
{ | ||
public function __construct() | ||
{ | ||
$this->setTemplate('marketplace/vendor/list.phtml'); | ||
parent::__construct(); | ||
} | ||
|
||
public function getVendorListCollection() | ||
{ | ||
$userCollection = Mage::getModel('admin/user')->getCollection() | ||
->addFieldToFilter('is_active', 1); | ||
|
||
$userCollection->getSelect()->join( | ||
array('user_profile' => Mage::getSingleton('core/resource')->getTableName('marketplace/profile')), | ||
'user_profile.user_id = main_table.user_id', array('user_profile.*') | ||
); | ||
|
||
return $userCollection; | ||
} | ||
|
||
public function getProductList($vendor_id) | ||
{ | ||
return Mage::getModel('catalog/product')->getCollection()->addFieldToFilter('vendor', $vendor_id)->setPageSize(4); | ||
} | ||
|
||
public function getProductImage($product_id) | ||
{ | ||
$productModel = Mage::getModel('catalog/product')->load($product_id); | ||
return Mage::helper('catalog/image')->init($productModel, 'small_image')->resize(91, 91); | ||
} | ||
|
||
public function getVendorProfileUrl($vendorId) | ||
{ | ||
return $this->getUrl('marketplace/vendor/profile', array('id' => $vendorId)); | ||
} | ||
|
||
public function getViewAllProduct($vendorId) | ||
{ | ||
return $this->getUrl('marketplace/vendor/items', array('id' => $vendorId)); | ||
} | ||
|
||
public function getVendorImageUrl($vendorImageName) | ||
{ | ||
$dirPath = 'vendor' . DS . 'images'; | ||
return Mage::helper('marketplace')->getImagesUrl($dirPath) . $vendorImageName; | ||
} | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.