diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/System/Convert/Gui/Grid.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/System/Convert/Gui/Grid.php new file mode 100644 index 0000000..7a60a1a --- /dev/null +++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/System/Convert/Gui/Grid.php @@ -0,0 +1,48 @@ +addFieldToFilter('entity_type', array('notnull'=>'')); + + + $isVendor = Mage::helper('marketplace')->isVendor();//current user is vendor or not + + if($isVendor) + { + $collection->addFieldToFilter('name',array('in'=>array('Vendor Import Products','Vendor Export Products'))); + //$collection->addFieldToFilter('entity_type','product'); + $this->setCollection($collection); + return $this; + } + else + { + $this->setCollection($collection); + return parent::_prepareCollection(); + } + + + } + +} + diff --git a/app/code/community/Medma/MarketPlace/Block/Adminhtml/System/Convert/Profile/Edit/Tab/Run.php b/app/code/community/Medma/MarketPlace/Block/Adminhtml/System/Convert/Profile/Edit/Tab/Run.php new file mode 100644 index 0000000..2deebfd --- /dev/null +++ b/app/code/community/Medma/MarketPlace/Block/Adminhtml/System/Convert/Profile/Edit/Tab/Run.php @@ -0,0 +1,21 @@ +isVendor();//current user is vendor or not + + $model = Mage::registry('current_convert_profile'); + + if($isVendor && $model->getDirection()=='export') + { + $this->setTemplate('marketplace/system/convert/profile/run.phtml'); + } + } + + +} +?> diff --git a/app/code/community/Medma/MarketPlace/Helper/Data.php b/app/code/community/Medma/MarketPlace/Helper/Data.php index 61f3ae1..7c7fe2f 100644 --- a/app/code/community/Medma/MarketPlace/Helper/Data.php +++ b/app/code/community/Medma/MarketPlace/Helper/Data.php @@ -54,5 +54,45 @@ public function getVarificationProofTypeList() return $proofType; } + + + /**Check current user is a vendor**/ + public function isVendor() + { + $result = ''; + + /**Fetch Current User Id**/ + $user = Mage::getSingleton('admin/session'); + $userId = $user->getUser()->getUserId(); + + /**Fetch Parent Id For Current Role**/ + $role = Mage::getModel('admin/role') + ->getCollection() + ->addFieldToFilter('user_id',$userId) + ->getFirstItem(); + + $parentId = $role->getParentId(); + + + /**Fetch Role Name of current parent id**/ + + $parentRole = Mage::getModel('admin/role') + ->getCollection() + ->addFieldToFilter('role_id',$parentId) + ->getFirstItem(); + + $roleName = $parentRole->getRoleName(); + + if($roleName == 'VENDORS') + { + $result = true; + } + else + { + $result = false; + } + + return $result; + } } ?> diff --git a/app/code/community/Medma/MarketPlace/Model/Convert/Adapter/Product.php b/app/code/community/Medma/MarketPlace/Model/Convert/Adapter/Product.php new file mode 100644 index 0000000..07c7f71 --- /dev/null +++ b/app/code/community/Medma/MarketPlace/Model/Convert/Adapter/Product.php @@ -0,0 +1,383 @@ + 'type_id', + 'attribute_set' => 'attribute_set_id' + ); + + $filters = $this->_parseVars(); + + if ($qty = $this->getFieldValue($filters, 'qty')) { + $qtyFrom = isset($qty['from']) ? (float) $qty['from'] : 0; + $qtyTo = isset($qty['to']) ? (float) $qty['to'] : 0; + + $qtyAttr = array(); + $qtyAttr['alias'] = 'qty'; + $qtyAttr['attribute'] = 'cataloginventory/stock_item'; + $qtyAttr['field'] = 'qty'; + $qtyAttr['bind'] = 'product_id=entity_id'; + $qtyAttr['cond'] = "{{table}}.qty between '{$qtyFrom}' AND '{$qtyTo}'"; + $qtyAttr['joinType'] = 'inner'; + + $this->setJoinField($qtyAttr); + } + + parent::setFilter($attrFilterArray, $attrToDb); + + if ($price = $this->getFieldValue($filters, 'price')) { + $this->_filter[] = array( + 'attribute' => 'price', + 'from' => $price['from'], + 'to' => $price['to'] + ); + $this->setJoinAttr(array( + 'alias' => 'price', + 'attribute' => 'catalog_product/price', + 'bind' => 'entity_id', + 'joinType' => 'LEFT' + )); + } + + + /**Start Code For Vendor**/ + $isVendor = Mage::helper('marketplace')->isVendor();//current user is vendor or not + + if($isVendor) + { + /**Fetch Current User Id**/ + $user = Mage::getSingleton('admin/session'); + $userId = $user->getUser()->getUserId(); + + $this->_filter[] = array( + 'attribute' => 'vendor', + 'eq' => $userId + ); + } + /**End Code For Vendor**/ + + return parent::load(); + } + + + + /** + * Save product (import) + * + * @param array $importData + * @throws Mage_Core_Exception + * @return bool + */ + public function saveRow(array $importData) + { + $product = $this->getProductModel() + ->reset(); + + if (empty($importData['store'])) { + if (!is_null($this->getBatchParams('store'))) { + $store = $this->getStoreById($this->getBatchParams('store')); + } else { + $message = Mage::helper('catalog')->__('Skipping import row, required field "%s" is not defined.', 'store'); + Mage::throwException($message); + } + } else { + $store = $this->getStoreByCode($importData['store']); + } + + if ($store === false) { + $message = Mage::helper('catalog')->__('Skipping import row, store "%s" field does not exist.', $importData['store']); + Mage::throwException($message); + } + + if (empty($importData['sku'])) { + $message = Mage::helper('catalog')->__('Skipping import row, required field "%s" is not defined.', 'sku'); + Mage::throwException($message); + } + $product->setStoreId($store->getId()); + $productId = $product->getIdBySku($importData['sku']); + + $isVendor = false; + + if ($productId) { + $product->load($productId); + + /**Start Code For Vendor**/ + $isVendor = Mage::helper('marketplace')->isVendor();//current user is vendor or not + + if($isVendor) + { + /**Fetch Current User Id**/ + $user = Mage::getSingleton('admin/session'); + $userId = $user->getUser()->getUserId(); + + if($userId != $product->getVendor()) + { + $message = Mage::helper('catalog')->__("You are not allowed to update product with sku '".$product->getSku()."' because it's not created by you"); + Mage::throwException($message); + } + else if(($importData['status']=='Enabled' || $importData['status']==1)&&$product->getStatus()==2) + { + //Mage::throwException($product->getStatus()); + $importData['status'] = 'Disabled'; + } + + } + /**End Code For Vendor**/ + + } else { + $productTypes = $this->getProductTypes(); + $productAttributeSets = $this->getProductAttributeSets(); + + /**Start Code For Vendor**/ + $isVendor = Mage::helper('marketplace')->isVendor();//current user is vendor or not + + if($isVendor) + { + $importData['status'] = 'Disabled'; + } + /**End Code For Vendor**/ + + + /** + * Check product define type + */ + if (empty($importData['type']) || !isset($productTypes[strtolower($importData['type'])])) { + $value = isset($importData['type']) ? $importData['type'] : ''; + $message = Mage::helper('catalog')->__('Skip import row, is not valid value "%s" for field "%s"', $value, 'type'); + Mage::throwException($message); + } + $product->setTypeId($productTypes[strtolower($importData['type'])]); + /** + * Check product define attribute set + */ + if (empty($importData['attribute_set']) || !isset($productAttributeSets[$importData['attribute_set']])) { + $value = isset($importData['attribute_set']) ? $importData['attribute_set'] : ''; + $message = Mage::helper('catalog')->__('Skip import row, the value "%s" is invalid for field "%s"', $value, 'attribute_set'); + Mage::throwException($message); + } + $product->setAttributeSetId($productAttributeSets[$importData['attribute_set']]); + + foreach ($this->_requiredFields as $field) { + $attribute = $this->getAttribute($field); + if (!isset($importData[$field]) && $attribute && $attribute->getIsRequired()) { + $message = Mage::helper('catalog')->__('Skipping import row, required field "%s" for new products is not defined.', $field); + Mage::throwException($message); + } + } + } + + $this->setProductTypeInstance($product); + + if (isset($importData['category_ids'])) { + $product->setCategoryIds($importData['category_ids']); + } + + foreach ($this->_ignoreFields as $field) { + if (isset($importData[$field])) { + unset($importData[$field]); + } + } + + if ($store->getId() != 0) { + $websiteIds = $product->getWebsiteIds(); + if (!is_array($websiteIds)) { + $websiteIds = array(); + } + if (!in_array($store->getWebsiteId(), $websiteIds)) { + $websiteIds[] = $store->getWebsiteId(); + } + $product->setWebsiteIds($websiteIds); + } + + if (isset($importData['websites'])) { + $websiteIds = $product->getWebsiteIds(); + if (!is_array($websiteIds) || !$store->getId()) { + $websiteIds = array(); + } + $websiteCodes = explode(',', $importData['websites']); + foreach ($websiteCodes as $websiteCode) { + try { + $website = Mage::app()->getWebsite(trim($websiteCode)); + if (!in_array($website->getId(), $websiteIds)) { + $websiteIds[] = $website->getId(); + } + } catch (Exception $e) {} + } + $product->setWebsiteIds($websiteIds); + unset($websiteIds); + } + + foreach ($importData as $field => $value) { + if (in_array($field, $this->_inventoryFields)) { + continue; + } + if (is_null($value)) { + continue; + } + + $attribute = $this->getAttribute($field); + if (!$attribute) { + continue; + } + + $isArray = false; + $setValue = $value; + + if ($attribute->getFrontendInput() == 'multiselect') { + $value = explode(self::MULTI_DELIMITER, $value); + $isArray = true; + $setValue = array(); + } + + if ($value && $attribute->getBackendType() == 'decimal') { + $setValue = $this->getNumber($value); + } + + if ($attribute->usesSource()) { + $options = $attribute->getSource()->getAllOptions(false); + + if ($isArray) { + foreach ($options as $item) { + if (in_array($item['label'], $value)) { + $setValue[] = $item['value']; + } + } + } else { + $setValue = false; + foreach ($options as $item) { + if (is_array($item['value'])) { + foreach ($item['value'] as $subValue) { + if (isset($subValue['value']) && $subValue['value'] == $value) { + $setValue = $value; + } + } + } else if ($item['label'] == $value) { + $setValue = $item['value']; + } + } + } + } + + $product->setData($field, $setValue); + } + + + + if (!$product->getVisibility()) { + $product->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE); + } + + $stockData = array(); + $inventoryFields = isset($this->_inventoryFieldsProductTypes[$product->getTypeId()]) + ? $this->_inventoryFieldsProductTypes[$product->getTypeId()] + : array(); + foreach ($inventoryFields as $field) { + if (isset($importData[$field])) { + if (in_array($field, $this->_toNumber)) { + $stockData[$field] = $this->getNumber($importData[$field]); + } else { + $stockData[$field] = $importData[$field]; + } + } + } + $product->setStockData($stockData); + + $mediaGalleryBackendModel = $this->getAttribute('media_gallery')->getBackend(); + + $arrayToMassAdd = array(); + + foreach ($product->getMediaAttributes() as $mediaAttributeCode => $mediaAttribute) { + if (isset($importData[$mediaAttributeCode])) { + $file = trim($importData[$mediaAttributeCode]); + if (!empty($file) && !$mediaGalleryBackendModel->getImage($product, $file)) { + $arrayToMassAdd[] = array('file' => trim($file), 'mediaAttribute' => $mediaAttributeCode); + } + } + } + + $addedFilesCorrespondence = $mediaGalleryBackendModel->addImagesWithDifferentMediaAttributes( + $product, + $arrayToMassAdd, Mage::getBaseDir('media') . DS . 'import', + false, + false + ); + + foreach ($product->getMediaAttributes() as $mediaAttributeCode => $mediaAttribute) { + $addedFile = ''; + if (isset($importData[$mediaAttributeCode . '_label'])) { + $fileLabel = trim($importData[$mediaAttributeCode . '_label']); + if (isset($importData[$mediaAttributeCode])) { + $keyInAddedFile = array_search($importData[$mediaAttributeCode], + $addedFilesCorrespondence['alreadyAddedFiles']); + if ($keyInAddedFile !== false) { + $addedFile = $addedFilesCorrespondence['alreadyAddedFilesNames'][$keyInAddedFile]; + } + } + + if (!$addedFile) { + $addedFile = $product->getData($mediaAttributeCode); + } + if ($fileLabel && $addedFile) { + $mediaGalleryBackendModel->updateImage($product, $addedFile, array('label' => $fileLabel)); + } + } + } + + $product->setIsMassupdate(true); + $product->setExcludeUrlRewrite(true); + + + /**Code For Vendor**/ + if($isVendor) + { + /**Fetch Current User Id**/ + $user = Mage::getSingleton('admin/session'); + $userId = $user->getUser()->getUserId(); + + $product->setVendor($userId); + } + + $product->save(); + + // Store affected products ids + $this->_addAffectedEntityIds($product->getId()); + + return true; + } + +} diff --git a/app/code/community/Medma/MarketPlace/Model/Dataflow/Convert/Adapter/Io.php b/app/code/community/Medma/MarketPlace/Model/Dataflow/Convert/Adapter/Io.php new file mode 100644 index 0000000..55a2f81 --- /dev/null +++ b/app/code/community/Medma/MarketPlace/Model/Dataflow/Convert/Adapter/Io.php @@ -0,0 +1,68 @@ +getResource(true)) { + return $this; + } + + $batchModel = Mage::getSingleton('dataflow/batch'); + + $dataFile = $batchModel->getIoAdapter()->getFile(true); + + $filename = $this->getVar('filename'); + + /**Start Code For Vendor**/ + $isVendor = Mage::helper('marketplace')->isVendor();//current user is vendor or not + + if($isVendor) + { + /**Fetch Current User Name**/ + $user = Mage::getSingleton('admin/session'); + $userName = $user->getUser()->getUsername(); + + $filename = 'export_product_'.$userName.'.csv'; + } + /**End Code For Vendor**/ + + $result = $this->getResource()->write($filename, $dataFile, 0777); + + if (false === $result) { + $message = Mage::helper('dataflow')->__('Could not save file: %s.', $filename); + Mage::throwException($message); + } else { + + /**Start Code For Vendor**/ + if($isVendor) + { + $localpath = 'vendor/'; + //create path if not exist + if (!file_exists($localpath)) { + mkdir($localpath, 0777, true); + } + $fileWithPath = $localpath.'/'.$filename; + + $localResource = new Varien_Io_File(); + + $localResource->write($fileWithPath, $dataFile, 0777); + + } + /**End Code For Vendor**/ + + + $message = Mage::helper('dataflow')->__('Saved successfully: "%s" [%d byte(s)].', $filename, $batchModel->getIoAdapter()->getFileSize()); + if ($this->getVar('link')) { + $message .= Mage::helper('dataflow')->__('Link', $this->getVar('link')); + } + $this->addException($message); + } + return $this; + } +} + diff --git a/app/code/community/Medma/MarketPlace/Model/Dataflow/Profile.php b/app/code/community/Medma/MarketPlace/Model/Dataflow/Profile.php new file mode 100644 index 0000000..124c7e2 --- /dev/null +++ b/app/code/community/Medma/MarketPlace/Model/Dataflow/Profile.php @@ -0,0 +1,295 @@ +setGuiData($p); + + $xml = ' + + + true + + 1 + + marketplace/convert_adapter_product + parse + '; + + $this->setActionsXml($xml); + + return $this; + } + else + { + $this->setGuiData($p); + + $xml = ' + + + + + + + + + + + + + + + true + + + + file + var/export + + '; + + $this->setActionsXml($xml); + + return $this; + } + } + + public function _parseGuiData() + { + $nl = "\r\n"; + $import = $this->getDirection()==='import'; + $p = $this->getGuiData(); + + + /**If profile is vendor profile**/ + if($this->getName()=='Vendor Import Products' || $this->getName()=='Vendor Export Products') + { + $p['parse']['type'] = 'csv'; + $p['parse']['fieldnames'] = true; + $this->vendorProfileData($import,$p); + + return $this; + } + + + if ($this->getDataTransfer()==='interactive') { +// $p['file']['type'] = 'file'; +// $p['file']['filename'] = $p['interactive']['filename']; +// $p['file']['path'] = 'var/export'; + + $interactiveXml = '' . $nl; + #$interactiveXml .= ' '.$nl; + $interactiveXml .= ''; + + $fileXml = ''; + } else { + $interactiveXml = ''; + + $fileXml = '' . $nl; + $fileXml .= ' ' . $p['file']['type'] . '' . $nl; + $fileXml .= ' ' . $p['file']['path'] . '' . $nl; + $fileXml .= ' ' . $nl; + if ($p['file']['type']==='ftp') { + $hostArr = explode(':', $p['file']['host']); + $fileXml .= ' ' . $nl; + if (isset($hostArr[1])) { + $fileXml .= ' ' . $nl; + } + if (!empty($p['file']['passive'])) { + $fileXml .= ' true' . $nl; + } + if ((!empty($p['file']['file_mode'])) + && ($p['file']['file_mode'] == FTP_ASCII || $p['file']['file_mode'] == FTP_BINARY) + ) { + $fileXml .= ' ' . $p['file']['file_mode'] . '' . $nl; + } + if (!empty($p['file']['user'])) { + $fileXml .= ' ' . $nl; + } + if (!empty($p['file']['password'])) { + $fileXml .= ' ' . $nl; + } + } + if ($import) { + $fileXml .= ' ' . $nl; + } + $fileXml .= '' . $nl . $nl; + } + + switch ($p['parse']['type']) { + case 'excel_xml': + $parseFileXml = '' . $nl; + $parseFileXml .= ' ' . $nl; + break; + + case 'csv': + $parseFileXml = '' . $nl; + $parseFileXml .= ' ' . $nl; + $parseFileXml .= ' ' . $nl; + break; + } + $parseFileXml .= ' ' . $p['parse']['fieldnames'] . '' . $nl; + $parseFileXmlInter = $parseFileXml; + $parseFileXml .= '' . $nl . $nl; + + $mapXml = ''; + + if (isset($p['map']) && is_array($p['map'])) { + foreach ($p['map'] as $side=>$fields) { + if (!is_array($fields)) { + continue; + } + foreach ($fields['db'] as $i=>$k) { + if ($k=='' || $k=='0') { + unset($p['map'][$side]['db'][$i]); + unset($p['map'][$side]['file'][$i]); + } + } + } + } + $mapXml .= '' . $nl; + $map = $p['map'][$this->getEntityType()]; + if (sizeof($map['db']) > 0) { + $from = $map[$import?'file':'db']; + $to = $map[$import?'db':'file']; + $mapXml .= ' ' . $nl; + $parseFileXmlInter .= ' ' . $nl; + foreach ($from as $i=>$f) { + $mapXml .= ' ' . $nl; + $parseFileXmlInter .= ' ' . $nl; + } + $mapXml .= ' ' . $nl; + $parseFileXmlInter .= ' ' . $nl; + } + if ($p['map']['only_specified']) { + $mapXml .= ' ' . $p['map']['only_specified'] . '' . $nl; + //$mapXml .= ' ' . $nl; + $parseFileXmlInter .= ' ' . $p['map']['only_specified'] . '' . $nl; + } + $mapXml .= '' . $nl . $nl; + + $parsers = array( + 'product'=>'catalog/convert_parser_product', + 'customer'=>'customer/convert_parser_customer', + ); + + if ($import) { +// if ($this->getDataTransfer()==='interactive') { + $parseFileXmlInter .= ' getStoreId() . ']]>' . $nl; +// } else { +// $parseDataXml = '' . $nl; +// $parseDataXml = ' getStoreId() . ']]>' . $nl; +// $parseDataXml .= ''.$nl.$nl; +// } +// $parseDataXml = ''.$nl; +// $parseDataXml .= ' getStoreId().']]>'.$nl; +// $parseDataXml .= ''.$nl.$nl; + } else { + $parseDataXml = '' . $nl; + $parseDataXml .= ' getStoreId() . ']]>' . $nl; + if (isset($p['export']['add_url_field'])) { + $parseDataXml .= ' ' . $nl; + } + $parseDataXml .= '' . $nl . $nl; + } + + $adapters = array( + 'product'=>'catalog/convert_adapter_product', + 'customer'=>'customer/convert_adapter_customer', + ); + + if ($import) { + $entityXml = '' . $nl; + $entityXml .= ' getStoreId() . ']]>' . $nl; + $entityXml .= '' . $nl . $nl; + } else { + $entityXml = '' . $nl; + $entityXml .= ' getStoreId() . ']]>' . $nl; + foreach ($p[$this->getEntityType()]['filter'] as $f=>$v) { + + if (empty($v)) { + continue; + } + if (is_scalar($v)) { + $entityXml .= ' ' . $nl; + $parseFileXmlInter .= ' ' . $nl; + } elseif (is_array($v)) { + foreach ($v as $a=>$b) { + + if (strlen($b) == 0) { + continue; + } + $entityXml .= ' ' . $nl; + $parseFileXmlInter .= ' ' . $nl; + } + } + } + $entityXml .= '' . $nl . $nl; + } + + // Need to rewrite the whole xml action format + if ($import) { + $numberOfRecords = isset($p['import']['number_of_records']) ? $p['import']['number_of_records'] : 1; + $decimalSeparator = isset($p['import']['decimal_separator']) ? $p['import']['decimal_separator'] : ' . '; + $parseFileXmlInter .= ' ' + . $numberOfRecords . '' . $nl; + $parseFileXmlInter .= ' ' . $nl; + if ($this->getDataTransfer()==='interactive') { + $xml = $parseFileXmlInter; + $xml .= ' ' . $adapters[$this->getEntityType()] . '' . $nl; + $xml .= ' parse' . $nl; + $xml .= ''; + } else { + $xml = $fileXml; + $xml .= $parseFileXmlInter; + $xml .= ' ' . $adapters[$this->getEntityType()] . '' . $nl; + $xml .= ' parse' . $nl; + $xml .= ''; + } + //$xml = $interactiveXml.$fileXml.$parseFileXml.$mapXml.$parseDataXml.$entityXml; + + } else { + $xml = $entityXml . $parseDataXml . $mapXml . $parseFileXml . $fileXml . $interactiveXml; + } + + $this->setGuiData($p); + $this->setActionsXml($xml); +/*echo "
" . print_r($p,1) . "
"; +echo "" . $xml . ""; +die;*/ + return $this; + } +} diff --git a/app/code/community/Medma/MarketPlace/controllers/Adminhtml/System/Convert/ProfileController.php b/app/code/community/Medma/MarketPlace/controllers/Adminhtml/System/Convert/ProfileController.php new file mode 100644 index 0000000..34b5232 --- /dev/null +++ b/app/code/community/Medma/MarketPlace/controllers/Adminhtml/System/Convert/ProfileController.php @@ -0,0 +1,29 @@ +_initProfile(); + $this->loadLayout(); + $this->renderLayout(); + + /**Fetch Current User Id**/ + $user = Mage::getSingleton('admin/session'); + $userName = $user->getUser()->getUsername(); + $filename = 'vendor/export_product_'.$userName.'.csv'; + if(file_exists($filename)) + { + $baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); + $content = file_get_contents($baseUrl.$filename); + $this->_prepareDownloadResponse('export_product.csv', $content); + } + } + + protected function _isAllowed() + { + return true; + } +} diff --git a/app/code/community/Medma/MarketPlace/etc/config.xml b/app/code/community/Medma/MarketPlace/etc/config.xml index fe0cc4d..f5ba152 100644 --- a/app/code/community/Medma/MarketPlace/etc/config.xml +++ b/app/code/community/Medma/MarketPlace/etc/config.xml @@ -2,11 +2,16 @@ - 2.0.3 + 2.0.5 + + + Medma_MarketPlace_Model_Dataflow_Profile + + Medma_MarketPlace_Model marketplace_mysql4 @@ -73,6 +78,8 @@ Medma_MarketPlace_Block_Adminhtml_System_Account_Edit_Form Medma_MarketPlace_Block_Adminhtml_Catalog_Product_Grid + Medma_MarketPlace_Block_Adminhtml_System_Convert_Gui_Grid + Medma_MarketPlace_Block_Adminhtml_System_Convert_Profile_Edit_Tab_Run @@ -148,13 +155,13 @@ - + admin Medma_MarketPlace admin_marketplace - + diff --git a/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-2.0.2-2.0.3.php b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-2.0.2-2.0.3.php new file mode 100644 index 0000000..89ddf73 --- /dev/null +++ b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-2.0.2-2.0.3.php @@ -0,0 +1,29 @@ + diff --git a/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-2.0.3-2.0.4.php b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-2.0.3-2.0.4.php new file mode 100644 index 0000000..ba38706 --- /dev/null +++ b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-2.0.3-2.0.4.php @@ -0,0 +1,34 @@ +getCollection() + ->addFieldToFilter('role_name', Medma_MarketPlace_Model_Vendor::ROLE) + ->getFirstItem() + ->getId(); + +Mage::getModel('admin/rules') + ->setRoleId($vendorRoleId) + ->setResources(array('admin/catalog', 'admin/catalog/products', 'admin/system', 'admin/system/myaccount', 'admin/vendor', 'admin/vendor/orders', 'admin/vendor/transaction', 'admin/vendor/review','admin/system/convert','admin/system/convert/gui')) + ->saveRel(); + + +?> diff --git a/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-2.0.4-2.0.5.php b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-2.0.4-2.0.5.php new file mode 100644 index 0000000..efb46fe --- /dev/null +++ b/app/code/community/Medma/MarketPlace/sql/marketplace_setup/mysql4-upgrade-2.0.4-2.0.5.php @@ -0,0 +1,93 @@ +getTable('dataflow/profile'); + +$data[0] = array( + 'name' => 'Vendor Export Products', + 'actions_xml' => " + + + + + + + + + + + + + + + true + + + + file + var/export + + ", + + 'gui_data' => "a:5:{s:6:\"export\";a:1:{s:13:\"add_url_field\";s:1:\"0\";}s:4:\"file\";a:5:{s:4:\"host\";s:0:\"\";s:4:\"user\";s:0:\"\";s:8:\"password\";s:9:\"medma1234\";s:9:\"file_mode\";s:1:\"2\";s:7:\"passive\";s:0:\"\";}s:5:\"parse\";a:3:{s:12:\"single_sheet\";s:0:\"\";s:4:\"type\";s:3:\"csv\";s:10:\"fieldnames\";b:1;}s:3:\"map\";a:2:{s:7:\"product\";a:2:{s:2:\"db\";a:1:{i:0;s:1:\"0\";}s:4:\"file\";a:1:{i:0;s:0:\"\";}}s:8:\"customer\";a:2:{s:2:\"db\";a:2:{i:0;s:1:\"0\";i:1;s:1:\"0\";}s:4:\"file\";a:2:{i:0;s:0:\"\";i:1;s:0:\"\";}}}s:8:\"customer\";a:1:{s:6:\"filter\";a:10:{s:9:\"firstname\";s:0:\"\";s:8:\"lastname\";s:0:\"\";s:5:\"email\";s:0:\"\";s:5:\"group\";s:1:\"0\";s:10:\"adressType\";s:15:\"default_billing\";s:9:\"telephone\";s:0:\"\";s:8:\"postcode\";s:0:\"\";s:7:\"country\";s:0:\"\";s:6:\"region\";s:0:\"\";s:10:\"created_at\";a:2:{s:4:\"from\";s:0:\"\";s:2:\"to\";s:0:\"\";}}}}", + + 'direction' => 'export', + + 'entity_type' => 'product', + + 'store_id' => 0, + + 'data_transfer' => 'file' + ); + + +$data[1] = array( + 'name' => 'Vendor Import Products', + 'actions_xml' => " + + + true + + 1 + + marketplace/convert_adapter_product + parse +", + + 'gui_data' => "a:7:{s:6:\"export\";a:1:{s:13:\"add_url_field\";s:1:\"0\";}s:6:\"import\";a:2:{s:17:\"number_of_records\";s:1:\"1\";s:17:\"decimal_separator\";s:1:\".\";}s:4:\"file\";a:8:{s:4:\"type\";s:4:\"file\";s:8:\"filename\";s:18:\"export_product.csv\";s:4:\"path\";s:10:\"var/export\";s:4:\"host\";s:0:\"\";s:4:\"user\";s:0:\"\";s:8:\"password\";s:9:\"medma1234\";s:9:\"file_mode\";s:1:\"2\";s:7:\"passive\";s:0:\"\";}s:5:\"parse\";a:5:{s:4:\"type\";s:3:\"csv\";s:12:\"single_sheet\";s:0:\"\";s:9:\"delimiter\";s:1:\",\";s:7:\"enclose\";s:1:\"\"\";s:10:\"fieldnames\";s:4:\"true\";}s:3:\"map\";a:3:{s:14:\"only_specified\";s:0:\"\";s:7:\"product\";a:2:{s:2:\"db\";a:0:{}s:4:\"file\";a:0:{}}s:8:\"customer\";a:2:{s:2:\"db\";a:0:{}s:4:\"file\";a:0:{}}}s:7:\"product\";a:1:{s:6:\"filter\";a:8:{s:4:\"name\";s:0:\"\";s:3:\"sku\";s:0:\"\";s:4:\"type\";s:1:\"0\";s:13:\"attribute_set\";s:0:\"\";s:5:\"price\";a:2:{s:4:\"from\";s:0:\"\";s:2:\"to\";s:0:\"\";}s:3:\"qty\";a:2:{s:4:\"from\";s:0:\"\";s:2:\"to\";s:0:\"\";}s:10:\"visibility\";s:1:\"0\";s:6:\"status\";s:1:\"0\";}}s:8:\"customer\";a:1:{s:6:\"filter\";a:10:{s:9:\"firstname\";s:0:\"\";s:8:\"lastname\";s:0:\"\";s:5:\"email\";s:0:\"\";s:5:\"group\";s:1:\"0\";s:10:\"adressType\";s:15:\"default_billing\";s:9:\"telephone\";s:0:\"\";s:8:\"postcode\";s:0:\"\";s:7:\"country\";s:0:\"\";s:6:\"region\";s:0:\"\";s:10:\"created_at\";a:2:{s:4:\"from\";s:0:\"\";s:2:\"to\";s:0:\"\";}}}}", + + 'direction' => 'import', + + 'entity_type' => 'product', + + 'store_id' => 0, + + 'data_transfer' => 'interactive' + ); + +$connection = $installer->getConnection(); +$connection->insertMultiple($table, $data); + + +$installer->endSetup(); +?> diff --git a/app/design/adminhtml/default/default/layout/marketplace.xml b/app/design/adminhtml/default/default/layout/marketplace.xml index 4795fc7..424f3c1 100644 --- a/app/design/adminhtml/default/default/layout/marketplace.xml +++ b/app/design/adminhtml/default/default/layout/marketplace.xml @@ -14,4 +14,22 @@ + + + + + + + + + + + + + + + + + + diff --git a/app/design/adminhtml/default/default/template/marketplace/system/convert/gui/js.phtml b/app/design/adminhtml/default/default/template/marketplace/system/convert/gui/js.phtml new file mode 100644 index 0000000..55058fe --- /dev/null +++ b/app/design/adminhtml/default/default/template/marketplace/system/convert/gui/js.phtml @@ -0,0 +1,41 @@ +isVendor();//current user is vendor or not +?> + + diff --git a/app/design/adminhtml/default/default/template/marketplace/system/convert/profile/run.phtml b/app/design/adminhtml/default/default/template/marketplace/system/convert/profile/run.phtml new file mode 100644 index 0000000..f823cb9 --- /dev/null +++ b/app/design/adminhtml/default/default/template/marketplace/system/convert/profile/run.phtml @@ -0,0 +1,60 @@ + +
    +
  • +
      +
    • __('Please make sure that your changes were saved before running the profile.') ?>
    • +
    +
  • +
+ + +getRunButtonHtml() ?>
+ diff --git a/app/design/frontend/base/default/template/marketplace/vendor/list.phtml b/app/design/frontend/base/default/template/marketplace/vendor/list.phtml index 8fe1a49..e31383a 100644 --- a/app/design/frontend/base/default/template/marketplace/vendor/list.phtml +++ b/app/design/frontend/base/default/template/marketplace/vendor/list.phtml @@ -21,9 +21,16 @@
-
- -
+ load('status');?> + getStatus()==2):?> +
+ +
+ +
+ +
+
diff --git a/app/locale/en_US/template/email/sales/new_vendor_order.html b/app/locale/en_US/template/email/sales/new_vendor_order.html index 838f5de..c4affea 100644 --- a/app/locale/en_US/template/email/sales/new_vendor_order.html +++ b/app/locale/en_US/template/email/sales/new_vendor_order.html @@ -4,7 +4,7 @@ "var logo_url":"Email Logo Image Url", "var logo_alt":"Email Logo Image Alt", "var vendor_name":"Vendor Name", -"var customer_name:"Customer Name", +"var customer_name":"Customer Name", "var order_no":"Order No.", "var store.getFrontendName()":"Store Name", "store url=\"customer/account/\"":"Customer Account Url", diff --git a/media/marketplace/vendor/vendor/images/bg1.png b/media/marketplace/vendor/vendor/images/bg1.png new file mode 100644 index 0000000..9556efd Binary files /dev/null and b/media/marketplace/vendor/vendor/images/bg1.png differ diff --git a/media/marketplace/vendor/vendor/images/bg_3.png b/media/marketplace/vendor/vendor/images/bg_3.png new file mode 100644 index 0000000..3c316ec Binary files /dev/null and b/media/marketplace/vendor/vendor/images/bg_3.png differ diff --git a/package.xml b/package.xml index 4c26872..3926f57 100644 --- a/package.xml +++ b/package.xml @@ -1,21 +1,21 @@ Medma_MarketPlace - 2.0.3 + 2.0.5 stable - OSL + Open Software License (OSL) community Manage Vendors and its profile, manage vendor transactions and provides platform for managing their accounts. Manage Vendors and its profile, manage vendor transactions and provides platform for managing their accounts. - 1. Bug Fix on Seller profile page. -2. Transactional Mails for sellers. -3. Seller list for home page. + 1. Bug Fix on Seller profile page. 
 +2. Transactional Mails for sellers. 
 +3. Seller list for home page.
 4. Localization - Medma InfomatixMedmagaurav@medma.in - 2014-10-01 - - + Medma_InfomatixMedma_Infomatixgaurav@medma.in + 2014-10-15 + + 5.2.06.0.0 diff --git a/skin/frontend/base/default/marketplace/css/styles.css b/skin/frontend/base/default/marketplace/css/styles.css index abdcf4f..4932e6a 100644 --- a/skin/frontend/base/default/marketplace/css/styles.css +++ b/skin/frontend/base/default/marketplace/css/styles.css @@ -1,6 +1,5 @@ .clear { clear: both; } .vendor-info .shop-info { padding: 8px 10px 10px; } -.vendor-info button.button span { border-color: #406a83; background: #618499; } #user_profile { padding: 10px; background: #FFFFFF; opacity: 0.9; filter: alpha(opacity=90); box-shadow: 0px 0px 5px 2px rgba(119, 119, 119, 0.5); -moz-box-shadow: 0px 0px 5px 2px rgba(119, 119, 119, 0.5); -webkit-box-shadow: 0px 0px 5px 2px rgba(119, 119, 119, 0.5); } #user_image { float: left; height: 160px; width: 160px; padding: 5px; margin-right: 10px; }