| @@ -23,13 +23,8 @@ | ||
| 23 | 23 | * ProductsGrid class. |
| 24 | 24 | */ |
| 25 | 25 | abstract class AdditionalQueryCustomLayout extends ElementorWidgetBase { |
| 26 | 26 | /** |
| 27 | - * Control Fields | |
| 28 | - * | |
| 29 | - * @var array | |
| 30 | - */ | |
| 31 | - /** | |
| 32 | 27 | * Action Button Traits. |
| 33 | 28 | */ |
| 34 | 29 | use ActionBtnTraits; |
| 35 | 30 | |
| @@ -82,10 +77,8 @@ | ||
| 82 | 77 | $this->widget_query() |
| 83 | 78 | ) |
| 84 | 79 | ); |
| 85 | 80 | |
| 86 | - unset( $fields['grid_style'] ); | |
| 87 | - | |
| 88 | 81 | return $fields; |
| 89 | 82 | } |
| 90 | 83 | |
| 91 | 84 | /** |
| @@ -110,11 +103,12 @@ | ||
| 110 | 103 | unset( $content_visibility['show_title']['separator'] ); |
| 111 | 104 | |
| 112 | 105 | $sections = array_merge( |
| 113 | 106 | $content_visibility, |
| 107 | + Controls\SettingsFields::content_ordering( $this ), | |
| 108 | + Controls\SettingsFields::section_title( $this ), | |
| 114 | 109 | Controls\SettingsFields::image( $this ), |
| 115 | 110 | Controls\SettingsFields::action_buttons( $this ), |
| 116 | - Controls\SettingsFields::section_title( $this ), | |
| 117 | 111 | Controls\SettingsFields::product_title( $this ), |
| 118 | 112 | Controls\SettingsFields::product_excerpt( $this ), |
| 119 | 113 | Controls\SettingsFields::badges( $this ), |
| 120 | 114 | $this->variation_swatch_conditionaly(), |
| @@ -129,16 +123,24 @@ | ||
| 129 | 123 | */ |
| 130 | 124 | protected function widget_layout() { |
| 131 | 125 | return Controls\LayoutFields::grid_layout( $this ); |
| 132 | 126 | } |
| 127 | + | |
| 128 | + /** | |
| 129 | + * Controls for layout tab | |
| 130 | + * | |
| 131 | + * @return array | |
| 132 | + */ | |
| 133 | 133 | public function variation_swatch_conditionaly() { |
| 134 | - if ( ! function_exists( 'rtwpvsp' ) ) { | |
| 134 | + if ( ! function_exists( 'rtwpvsp' ) && ! rtsb()->has_pro() ) { | |
| 135 | 135 | return []; |
| 136 | 136 | } |
| 137 | - $swatches_controls = Controls\SettingsFields::variation_swatch( $this ); | |
| 138 | - $swatches_controls['swatch_position']['condition'] = [ | |
| 139 | - 'layout' => [ 'grid-layout1' ], | |
| 140 | - ]; | |
| 137 | + $swatches_controls = Controls\SettingsFields::variation_swatch( $this ); | |
| 138 | + if ( ! empty( $swatches_controls['swatch_position'] ) ) { | |
| 139 | + $swatches_controls['swatch_position']['condition'] = [ | |
| 140 | + 'layout' => [ 'grid-layout1' ], | |
| 141 | + ]; | |
| 142 | + } | |
| 141 | 143 | return $swatches_controls; |
| 142 | 144 | } |
| 143 | 145 | /** |
| 144 | 146 | * Controls for layout tab |
| @@ -150,8 +152,13 @@ | ||
| 150 | 152 | $additional_query['posts_limit']['separator'] = 'default'; |
| 151 | 153 | return $additional_query; |
| 152 | 154 | } |
| 153 | 155 | |
| 156 | + /** | |
| 157 | + * Controls for style tab | |
| 158 | + * | |
| 159 | + * @return array | |
| 160 | + */ | |
| 154 | 161 | protected function pagination_navigation() { |
| 155 | 162 | return Controls\StyleFields::pagination( $this ); |
| 156 | 163 | } |
| 157 | 164 | |
| @@ -187,9 +194,9 @@ | ||
| 187 | 194 | |
| 188 | 195 | /** |
| 189 | 196 | * Widget Field |
| 190 | 197 | * |
| 191 | - * @return void|array | |
| 198 | + * @return string | |
| 192 | 199 | */ |
| 193 | 200 | protected function render_template_file() { |
| 194 | 201 | return 'elementor/general/grid/'; |
| 195 | 202 | } |
| @@ -206,9 +213,9 @@ | ||
| 206 | 213 | $this->render_start(); |
| 207 | 214 | $args = [ |
| 208 | 215 | 'posts_per_page' => $settings['posts_limit'], |
| 209 | 216 | 'columns' => $settings['posts_limit'], |
| 210 | - 'orderby' => $settings['posts_order_by'], // @codingStandardsIgnoreLine. | |
| 217 | + 'orderby' => $settings['posts_order_by'], | |
| 211 | 218 | 'order' => $settings['posts_order'], |
| 212 | 219 | ]; |
| 213 | 220 | |
| 214 | 221 | $settings['query_products'] = $this->get_the_products( $args ); |
| @@ -220,11 +227,11 @@ | ||
| 220 | 227 | if ( $this->is_builder_mode() ) { |
| 221 | 228 | add_filter( 'wp_kses_allowed_html', [ FilterHooks::class, 'custom_wpkses_post_tags' ], 10, 2 ); |
| 222 | 229 | } |
| 223 | 230 | |
| 231 | + // Call the template rendering method. | |
| 224 | 232 | Fns::print_html( Render::instance()->setup_loop_for_product_view( $this->render_template_file(), $settings, $this ), true ); |
| 225 | 233 | |
| 226 | 234 | $this->action_button_icon_set_default(); |
| 227 | 235 | $this->render_end(); |
| 228 | 236 | } |
| 229 | - | |
| 230 | 237 | } |