Export.php
1 week ago
ExportHPOS.php
1 week ago
ExportLegacy.php
1 week ago
Factory.php
1 week ago
Hooks.php
1 week ago
ExportLegacy.php
29 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WCML\Multicurrency\Analytics; |
| 4 | |
| 5 | use WCML\Orders\Helper as OrdersHelper; |
| 6 | |
| 7 | class ExportLegacy extends Export { |
| 8 | |
| 9 | public function addJoinClauses( $clauses ) { |
| 10 | $clauses[] = PHP_EOL . "LEFT JOIN {$this->wpdb->postmeta} AS wcmllang ON wcmllang.post_id = {$this->wpdb->prefix}wc_order_stats.order_id AND wcmllang.meta_key = '" . \WCML_Orders::KEY_LANGUAGE . "'"; |
| 11 | |
| 12 | if ( wcml_is_multi_currency_on() ) { |
| 13 | $clauses[] = PHP_EOL . "LEFT JOIN {$this->wpdb->postmeta} AS wcmlcurr ON wcmlcurr.post_id = {$this->wpdb->prefix}wc_order_stats.order_id AND wcmlcurr.meta_key = '" . OrdersHelper::KEY_LEGACY_CURRENCY . "'"; |
| 14 | } |
| 15 | |
| 16 | return $clauses; |
| 17 | } |
| 18 | |
| 19 | public function addSelectClauses( $clauses ) { |
| 20 | $clauses[] = sprintf( ', wcmllang.meta_value AS %s', self::COL_LANGUAGE ); |
| 21 | |
| 22 | if ( wcml_is_multi_currency_on() ) { |
| 23 | $clauses[] = sprintf( ', wcmlcurr.meta_value AS %s', self::COL_CURRENCY ); |
| 24 | } |
| 25 | |
| 26 | return $clauses; |
| 27 | } |
| 28 | } |
| 29 |