@@ -125,27 +125,39 @@ static function editorSave($id, $fields, $type = 'product') {
125
125
$ product_content = [];
126
126
$ publicPath = \Vvveb \publicUrlPath () . 'media/ ' ;
127
127
128
+ $ product = [];
129
+ $ product_content = [];
130
+
128
131
foreach ($ fields as $ field ) {
129
132
$ name = $ field ['name ' ];
130
133
$ value = $ field ['value ' ];
131
134
132
135
if ($ name == 'name ' ) {
133
136
$ product_content [$ name ] = strip_tags ($ value );
134
137
} else {
135
- if ($ name == 'content ' || $ name == 'excerpt ' ) {
136
- $ product_content [$ name ] = sanitizeHTML ($ value );
138
+ if ($ name == 'images ' ) {
137
139
} else {
138
- if ($ name == 'image ' ) {
139
- $ value = str_replace ($ publicPath ,'' , $ value );
140
+ if ($ name == 'content ' || $ name == 'excerpt ' ) {
141
+ $ product_content [$ name ] = sanitizeHTML ($ value );
142
+ } else {
143
+ if ($ name == 'image ' ) {
144
+ $ value = str_replace ($ publicPath ,'' , $ value );
145
+ }
146
+ $ product [$ name ] = $ value ;
140
147
}
141
- $ product [$ name ] = $ value ;
142
148
}
143
149
}
144
150
}
145
151
146
- $ product_content ['language_id ' ] = 1 ;
147
- $ product ['product_content ' ][] = $ product_content ;
148
- $ product ['product_id ' ] = $ id ;
149
- $ result = $ products ->edit (['product ' => $ product , 'product_id ' => $ id ]);
152
+ if ($ product ) {
153
+ //$product['product_id'] = $id;
154
+ $ result = $ products ->edit (['product ' => $ product , 'product_id ' => $ id ]);
155
+ }
156
+
157
+ if ($ product_content ) {
158
+ $ product_content ['language_id ' ] = self :: $ global ['language_id ' ];
159
+ //$product['product_content']['post_id'] = $id;
160
+ $ result = $ products ->editContent (['product_content ' => $ product_content , 'product_id ' => $ id , 'language_id ' => self :: $ global ['language_id ' ]]);
161
+ }
150
162
}
151
163
}
0 commit comments