Commit 515794e8 by liumengfei

Merge branch 'developer' into production

parents 11fcf67d 4f3ff447
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace Joshine\GoogleFeed\Console\Command; namespace Joshine\GoogleFeed\Console\Command;
use Magento\Framework\App\State; use Magento\Framework\App\State;
use Magento\Setup\Exception;
use Magento\Store\Model\Store; use Magento\Store\Model\Store;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
...@@ -233,6 +234,11 @@ class GoogleFeed extends Command ...@@ -233,6 +234,11 @@ class GoogleFeed extends Command
$productRows['header'] = $this->generateRow($this->columns); $productRows['header'] = $this->generateRow($this->columns);
foreach ($products as $key => $product) { foreach ($products as $key => $product) {
//去除没有主产品的子产品
$configProductIds = $this->configurable->getParentIdsByChild($product->getId());
if (empty($configProductIds)){
continue;
}
$_product = $this->productRepository->getById($product->getId()); $_product = $this->productRepository->getById($product->getId());
$data = $this->generateProductData($_product,$categoryGoogleProductCategory); $data = $this->generateProductData($_product,$categoryGoogleProductCategory);
if (count($data) > 0) { if (count($data) > 0) {
...@@ -284,7 +290,14 @@ class GoogleFeed extends Command ...@@ -284,7 +290,14 @@ class GoogleFeed extends Command
$data['id'] = $product->getSku(); $data['id'] = $product->getSku();
$data['title'] = $this->getStoreName() .' '. str_replace('"', '\'', $product->getName()); $data['title'] = $this->getStoreName() .' '. str_replace('"', '\'', $product->getName());
$data['description'] = strip_tags(str_replace('"', '\'', $product->getDescription())); $data['description'] = strip_tags(str_replace('"', '\'', $product->getDescription()));
//获取主产品描述信息
if (empty($data['description'])){
var_dump($product->getSku());
$desc = $this->getConfigProductDescription($product);
if (!empty($desc)){
$data['description'] = strip_tags(str_replace('"', '\'', $desc));
}
}
foreach( $product->getCategoryIds() as $k=>$v){ foreach( $product->getCategoryIds() as $k=>$v){
if (isset($categoryGoogleProductCategory[$v])){ if (isset($categoryGoogleProductCategory[$v])){
...@@ -375,6 +388,29 @@ class GoogleFeed extends Command ...@@ -375,6 +388,29 @@ class GoogleFeed extends Command
return $name; return $name;
} }
public function getConfigProductDescription($product){
$configProductIds = $this->configurable->getParentIdsByChild($product->getId());
if (!$configProductIds){
return "";
}
if(is_array($configProductIds) && !empty($configProductIds)){
$configProductId = $configProductIds[0];
}
if(is_int($configProductIds)){
$configProductId = $configProductIds;
}
$configurablProduct =$this->productRepository->getById($configProductId, false, $product->getStoreId());
try {
$desc = $configurablProduct->getCustomAttribute("description");
}catch (Exception $e){
$desc = false;
}
if ($desc){
return $desc->getValue();
}
return "";
}
public function getConfigProductUrl($product){ public function getConfigProductUrl($product){
$configProductIds = $this->configurable->getParentIdsByChild($product->getId()); $configProductIds = $this->configurable->getParentIdsByChild($product->getId());
if (!$configProductIds){ if (!$configProductIds){
......
...@@ -299,11 +299,6 @@ fieldset[disabled] a.joshine-btn { ...@@ -299,11 +299,6 @@ fieldset[disabled] a.joshine-btn {
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
outline: 0; outline: 0;
} }
.j-modal .j-modal-dialog {
position: relative;
width: 530px;
margin: 7rem auto;
}
.j-modal .j-modal-content { .j-modal .j-modal-content {
position: relative; position: relative;
padding: 40px 50px 30px; padding: 40px 50px 30px;
...@@ -321,6 +316,8 @@ fieldset[disabled] a.joshine-btn { ...@@ -321,6 +316,8 @@ fieldset[disabled] a.joshine-btn {
} }
.joshine-model-warp .j-modal .j-modal-dialog { .joshine-model-warp .j-modal .j-modal-dialog {
width: 1050px; width: 1050px;
position: relative;
margin: 7rem auto;
} }
.joshine-close { .joshine-close {
position: absolute; position: absolute;
...@@ -336,7 +333,11 @@ fieldset[disabled] a.joshine-btn { ...@@ -336,7 +333,11 @@ fieldset[disabled] a.joshine-btn {
position: relative; position: relative;
line-height: 1.2; line-height: 1.2;
} }
.joshine-model-warp .j-modal.j-modal-vertical {
justify-content: center;
align-items: center;
display: flex;
}
.swiper-button-prev { .swiper-button-prev {
height: 100%; height: 100%;
...@@ -361,10 +362,3 @@ fieldset[disabled] a.joshine-btn { ...@@ -361,10 +362,3 @@ fieldset[disabled] a.joshine-btn {
z-index: 12; z-index: 12;
cursor: url('@{baseDir}images/favicon-next.ico'), auto; cursor: url('@{baseDir}images/favicon-next.ico'), auto;
} }
\ No newline at end of file
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