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;
use Magento\Catalog\Model\CategoryList;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Eav\Api\AttributeRepositoryInterface;
use Magento\Store\Model\Website;
/**
* Class SomeCommand
*/
......@@ -46,7 +47,8 @@ class GoogleFeed extends Command
private $scopeConfigInterface;
/* @var AttributeRepositoryInterface */
private $attributeRepositoryInterface;
/* @var Website */
private $webSite;
/*table title*/
private $columns = array(
'id',
......@@ -143,7 +145,8 @@ class GoogleFeed extends Command
StoreManagerInterface $storeManager,
CategoryList $categoryList,
ScopeConfigInterface $scopeConfigInterface,
AttributeRepositoryInterface $attributeRepositoryInterface
AttributeRepositoryInterface $attributeRepositoryInterface,
Website $webSite
)
{
$this->state = $state;
......@@ -158,6 +161,7 @@ class GoogleFeed extends Command
$this->categoryList = $categoryList;
$this->scopeConfigInterface = $scopeConfigInterface;
$this->attributeRepositoryInterface = $attributeRepositoryInterface;
$this->webSite = $webSite;
parent::__construct();
}
......@@ -289,7 +293,7 @@ class GoogleFeed extends Command
$data['price'] = number_format($finalPriceAmt,2) . ' USD';
$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['gender'] = 'Female';
$data['age group'] = 'Adult';
......@@ -298,7 +302,7 @@ class GoogleFeed extends Command
$optionText = $attribute->getSource()->getOptionText($product->getColor());
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];
}else{
$data['color'] = $optionText;
......@@ -306,7 +310,11 @@ class GoogleFeed extends Command
$data['size system'] = '';
$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['item group id'] = $mpu;
$data['material'] = '';
......@@ -328,7 +336,9 @@ class GoogleFeed extends Command
*/
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){
......
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