Skip to content

Commit 7b8ba39

Browse files
committed
Add features on extends fields
1 parent aef7b68 commit 7b8ba39

File tree

2 files changed

+36
-9
lines changed

2 files changed

+36
-9
lines changed

Config/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<language>en_US</language>
1414
<language>fr_FR</language>
1515
</languages>
16-
<version>1.3.2</version>
16+
<version>1.3.3</version>
1717
<authors>
1818
<author>
1919
<name>Bertrand TOURLONIAS</name>

Service/Provider/ProductProvider.php

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
use Thelia\Model\ConfigQuery;
1616
use Thelia\Model\Map\AttributeAvI18nTableMap;
1717
use Thelia\Model\Map\AttributeI18nTableMap;
18+
use Thelia\Model\Map\FeatureAvI18nTableMap;
19+
use Thelia\Model\Map\FeatureI18nTableMap;
1820
use Thelia\Model\TaxRuleQuery;
1921
use Thelia\TaxEngine\Calculator;
2022
use Thelia\Tools\MoneyFormat;
@@ -78,13 +80,14 @@ public function getDataGenerator(GoogleshoppingxmlFeed $feed, MoneyFormat $money
7880
$extraStaticFields = $this->getExtraStaticFields();
7981

8082
$extraAttributeFields = $this->getExtraAttributeFields($row['id'], $locale);
83+
$extraFeatureFields = $this->getExtraFeatureFields($row['id'], $locale);
8184

8285
yield (new GoogleProductModel(
8386
$taxCalculator,
8487
$moneyFormat,
8588
$shipping,
8689
$feed->getCurrency(),
87-
array_merge($extraStaticFields, $extraAttributeFields),
90+
array_merge($extraStaticFields, $extraAttributeFields, $extraFeatureFields),
8891
'g:')
8992
)->build($row);
9093
}
@@ -101,26 +104,50 @@ private function getExtraStaticFields()
101104
->toArray();
102105
}
103106

104-
private function getExtraAttributeFields(int $pseId, string $locale ='en_US')
107+
private function getExtraAttributeFields(int $pseId, string $locale = 'en_US')
105108
{
106109
return GoogleshoppingxmlGoogleFieldAssociationQuery::create()
107110
->select(['value', 'google_field'])
108111
->addAsColumn('value', AttributeAvI18nTableMap::COL_TITLE)
109112
->addAsColumn('google_field', GoogleshoppingxmlGoogleFieldAssociationTableMap::COL_GOOGLE_FIELD)
110113
->useAttributeQuery()
111-
->useAttributeCombinationQuery()
112-
->useAttributeAvQuery()
113-
->useAttributeAvI18nQuery()
114+
->useAttributeCombinationQuery()
115+
->useAttributeAvQuery()
116+
->useAttributeAvI18nQuery()
117+
->filterByLocale($locale)
118+
->endUse()
119+
->endUse()
120+
->useProductSaleElementsQuery()
121+
->filterById($pseId)
122+
->endUse()
123+
->endUse()
124+
->endUse()
125+
->find()
126+
->toArray();
127+
}
128+
129+
private function getExtraFeatureFields(int $pseId, string $locale = 'en_US')
130+
{
131+
return GoogleshoppingxmlGoogleFieldAssociationQuery::create()
132+
->select(['value', 'google_field'])
133+
->addAsColumn('value', FeatureAvI18nTableMap::COL_TITLE)
134+
->addAsColumn('google_field', GoogleshoppingxmlGoogleFieldAssociationTableMap::COL_GOOGLE_FIELD)
135+
->useFeatureQuery()
136+
->useFeatureProductQuery()
137+
->useFeatureAvQuery()
138+
->useFeatureAvI18nQuery()
114139
->filterByLocale($locale)
115140
->endUse()
116141
->endUse()
117-
->useProductSaleElementsQuery()
118-
->filterById($pseId)
142+
->useProductQuery()
143+
->useProductSaleElementsQuery()
144+
->filterById($pseId)
145+
->endUse()
119146
->endUse()
120147
->endUse()
121148
->endUse()
122149
->find()
123-
->toArray();
150+
->toArray();
124151
}
125152

126153
/**

0 commit comments

Comments
 (0)