1515use Thelia \Model \ConfigQuery ;
1616use Thelia \Model \Map \AttributeAvI18nTableMap ;
1717use Thelia \Model \Map \AttributeI18nTableMap ;
18+ use Thelia \Model \Map \FeatureAvI18nTableMap ;
19+ use Thelia \Model \Map \FeatureI18nTableMap ;
1820use Thelia \Model \TaxRuleQuery ;
1921use Thelia \TaxEngine \Calculator ;
2022use 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