Commit 74d41df3 by dhn

Merge branch 'developer' of http://47.99.244.21:9999/root/joshine into Branch_developer

parents 8096e805 fc452160
...@@ -19,6 +19,7 @@ use Magento\Store\Model\StoreManagerInterface; ...@@ -19,6 +19,7 @@ use Magento\Store\Model\StoreManagerInterface;
use Magento\Catalog\Model\CategoryList; use Magento\Catalog\Model\CategoryList;
use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Eav\Api\AttributeRepositoryInterface; use Magento\Eav\Api\AttributeRepositoryInterface;
use Magento\Store\Model\Website;
/** /**
* Class SomeCommand * Class SomeCommand
*/ */
...@@ -46,7 +47,8 @@ class GoogleFeed extends Command ...@@ -46,7 +47,8 @@ class GoogleFeed extends Command
private $scopeConfigInterface; private $scopeConfigInterface;
/* @var AttributeRepositoryInterface */ /* @var AttributeRepositoryInterface */
private $attributeRepositoryInterface; private $attributeRepositoryInterface;
/* @var Website */
private $webSite;
/*table title*/ /*table title*/
private $columns = array( private $columns = array(
'id', 'id',
...@@ -143,7 +145,8 @@ class GoogleFeed extends Command ...@@ -143,7 +145,8 @@ class GoogleFeed extends Command
StoreManagerInterface $storeManager, StoreManagerInterface $storeManager,
CategoryList $categoryList, CategoryList $categoryList,
ScopeConfigInterface $scopeConfigInterface, ScopeConfigInterface $scopeConfigInterface,
AttributeRepositoryInterface $attributeRepositoryInterface AttributeRepositoryInterface $attributeRepositoryInterface,
Website $webSite
) )
{ {
$this->state = $state; $this->state = $state;
...@@ -158,6 +161,7 @@ class GoogleFeed extends Command ...@@ -158,6 +161,7 @@ class GoogleFeed extends Command
$this->categoryList = $categoryList; $this->categoryList = $categoryList;
$this->scopeConfigInterface = $scopeConfigInterface; $this->scopeConfigInterface = $scopeConfigInterface;
$this->attributeRepositoryInterface = $attributeRepositoryInterface; $this->attributeRepositoryInterface = $attributeRepositoryInterface;
$this->webSite = $webSite;
parent::__construct(); parent::__construct();
} }
...@@ -289,7 +293,7 @@ class GoogleFeed extends Command ...@@ -289,7 +293,7 @@ class GoogleFeed extends Command
$data['price'] = number_format($finalPriceAmt,2) . ' USD'; $data['price'] = number_format($finalPriceAmt,2) . ' USD';
$data['brand'] = $this->getStoreName(); $data['brand'] = $this->getStoreName();
$mpu = explode('-',$product->getSku())[0]; $mpu = stripos($product->getSku(),'-') ? explode('-',$product->getSku())[0] : explode('_',$product->getSku())[0];
$data['mpn'] = $mpu; $data['mpn'] = $mpu;
$data['gender'] = 'Female'; $data['gender'] = 'Female';
$data['age group'] = 'Adult'; $data['age group'] = 'Adult';
...@@ -298,7 +302,7 @@ class GoogleFeed extends Command ...@@ -298,7 +302,7 @@ class GoogleFeed extends Command
$optionText = $attribute->getSource()->getOptionText($product->getColor()); $optionText = $attribute->getSource()->getOptionText($product->getColor());
if (in_array($optionText,$this->pattern)){ if (in_array($optionText,$this->pattern)){
$colorShort = $this->explode('-',$product->getSku())[1]; $colorShort = stripos($product->getSku(),'-') ? explode('-',$product->getSku())[1] : explode('_',$product->getSku())[1];
$data['color'] = $this->color[$colorShort]; $data['color'] = $this->color[$colorShort];
}else{ }else{
$data['color'] = $optionText; $data['color'] = $optionText;
...@@ -306,7 +310,11 @@ class GoogleFeed extends Command ...@@ -306,7 +310,11 @@ class GoogleFeed extends Command
$data['size system'] = ''; $data['size system'] = '';
$attribute = $this->attributeRepositoryInterface->get('4', 'size'); $attribute = $this->attributeRepositoryInterface->get('4', 'size');
$sizeText = $attribute->getSource()->getOptionText($product->getSize()); $sizeText = $attribute->getSource()->getOptionText($attribute->getSize());
$skuSize = stripos($product->getSku(),'-') ? explode('-',$product->getSku()) : explode('_',$product->getSku());
if (isset($skuSize[2])){
$sizeText = $skuSize[2];
}
$data['size'] = $sizeText; $data['size'] = $sizeText;
$data['item group id'] = $mpu; $data['item group id'] = $mpu;
$data['material'] = ''; $data['material'] = '';
...@@ -328,7 +336,9 @@ class GoogleFeed extends Command ...@@ -328,7 +336,9 @@ class GoogleFeed extends Command
*/ */
public function getStoreName() public function getStoreName()
{ {
return $this->storeManager->getStore()->getName(); $webSiteId = $this->storeManager->getStore()->getWebsiteId();
$collection = $this->webSite->load($webSiteId,'website_id');
return $collection->getName();
} }
public function getPrdouctType($category,&$name){ public function getPrdouctType($category,&$name){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment