| 1 |
<?php |
| 2 |
/** |
| 3 |
* Template: Grid Layout 1. |
| 4 |
* |
| 5 |
* @package RadiusTheme\SB |
| 6 |
*/ |
| 7 |
|
| 8 |
/** |
| 9 |
* Template variables: |
| 10 |
* |
| 11 |
* @var $grid string |
| 12 |
* @var $class string |
| 13 |
* @var $p_id int |
| 14 |
* @var $img_args array |
| 15 |
* @var $p_link string |
| 16 |
* @var $items array |
| 17 |
* @var $rating_args array |
| 18 |
* @var $add_to_cart string |
| 19 |
* @var $title_tag string |
| 20 |
* @var $excerpt_limit string |
| 21 |
* @var $excerpt string |
| 22 |
* @var $title_class string |
| 23 |
* @var $title_link bool |
| 24 |
* @var $title string |
| 25 |
* @var $badge_class string |
| 26 |
* @var $action_btn_preset string |
| 27 |
* @var $action_btn_position string |
| 28 |
* @var $swatch_position string |
| 29 |
* @var $swatch_type string |
| 30 |
* @var $has_attributes bool |
| 31 |
* @var $raw_settings array |
| 32 |
*/ |
| 33 |
|
| 34 |
use Elementor\Utils; |
| 35 |
use RadiusTheme\SB\Helpers\Fns; |
| 36 |
|
| 37 |
// Do not allow directly accessing this file. |
| 38 |
if ( ! defined( 'ABSPATH' ) ) { |
| 39 |
exit( 'This script cannot be accessed directly.' ); |
| 40 |
} |
| 41 |
|
| 42 |
global $product; |
| 43 |
|
| 44 |
$classes = esc_attr( $grid ) . ' ' . esc_attr( $class ); |
| 45 |
$swatch_title_class = $has_attributes && in_array( 'swatches', $items, true ) && 'title' === $swatch_position ? 'title-with-swatch' : 'title-with-no-swatch'; |
| 46 |
$swatch_price_class = $has_attributes && in_array( 'swatches', $items, true ) && 'price' === $swatch_position ? ' price-with-swatch' : ''; |
| 47 |
?> |
| 48 |
|
| 49 |
<div <?php wc_product_class( $classes, $product ); ?> data-id="<?php echo absint( $p_id ); ?>"> |
| 50 |
<?php |
| 51 |
/** |
| 52 |
* Before product items hook. |
| 53 |
*/ |
| 54 |
do_action( 'rtsb/before/shop/product/item' ); |
| 55 |
?> |
| 56 |
|
| 57 |
<div class="rtsb-grid-item"> |
| 58 |
<div class="rtsb-product-img"> |
| 59 |
<?php |
| 60 |
/** |
| 61 |
* Before product image hook. |
| 62 |
*/ |
| 63 |
do_action( 'rtsb/before/shop/product/image' ); |
| 64 |
|
| 65 |
/** |
| 66 |
* Product image hook. |
| 67 |
* |
| 68 |
* @hooked RadiusTheme\SB\Controllers\Hooks\ActionHooks::render_image 10 |
| 69 |
*/ |
| 70 |
do_action( 'rtsb/shop/product/image', $img_args, $raw_settings ); |
| 71 |
|
| 72 |
/** |
| 73 |
* Sale Badge. |
| 74 |
*/ |
| 75 |
if ( ! empty( $p_sale ) ) { |
| 76 |
?> |
| 77 |
<div class="rtsb-promotion"> |
| 78 |
<?php |
| 79 |
Fns::get_badge_html( $p_sale, $badge_class ); |
| 80 |
?> |
| 81 |
</div> |
| 82 |
<?php |
| 83 |
} |
| 84 |
|
| 85 |
/** |
| 86 |
* Action buttons above image. |
| 87 |
*/ |
| 88 |
Fns::print_html( Fns::get_formatted_action_buttons( $items, $add_to_cart, $action_btn_preset, $action_btn_position, 'top' ) ); |
| 89 |
|
| 90 |
/** |
| 91 |
* After product image hook. |
| 92 |
*/ |
| 93 |
do_action( 'rtsb/after/shop/product/image', $raw_settings ); |
| 94 |
?> |
| 95 |
</div><!-- .rtsb-product-img --> |
| 96 |
|
| 97 |
<div class="rtsb-product-content"> |
| 98 |
<?php |
| 99 |
/** |
| 100 |
* Before product content hook. |
| 101 |
*/ |
| 102 |
do_action( 'rtsb/before/shop/product/content' ); |
| 103 |
|
| 104 |
/** |
| 105 |
* Product Swatches. |
| 106 |
*/ |
| 107 |
if ( in_array( 'swatches', $items, true ) && 'top' === $swatch_position ) { |
| 108 |
Fns::get_product_swatches( $swatch_type ); |
| 109 |
} |
| 110 |
|
| 111 |
/** |
| 112 |
* Product Categories. |
| 113 |
*/ |
| 114 |
if ( in_array( 'categories', $items, true ) ) { |
| 115 |
?> |
| 116 |
<div class="rtsb-product-category"> |
| 117 |
<?php |
| 118 |
Fns::get_categories_list( $p_id ); |
| 119 |
?> |
| 120 |
</div> |
| 121 |
<?php |
| 122 |
} |
| 123 |
/** |
| 124 |
* Product Brands. |
| 125 |
*/ |
| 126 |
if ( in_array( 'brands', $items, true ) ) { |
| 127 |
?> |
| 128 |
<div class="rtsb-brand-category"> |
| 129 |
<?php |
| 130 |
Fns::get_brands_list( $p_id ); |
| 131 |
?> |
| 132 |
</div> |
| 133 |
<?php |
| 134 |
} |
| 135 |
|
| 136 |
/** |
| 137 |
* Before product title hook. |
| 138 |
*/ |
| 139 |
do_action( 'rtsb/before/shop/product/title' ); |
| 140 |
|
| 141 |
/** |
| 142 |
* Product Title. |
| 143 |
*/ |
| 144 |
if ( in_array( 'title', $items, true ) ) { |
| 145 |
?> |
| 146 |
<div class="rtsb-product-title-wrapper <?php echo esc_attr( $swatch_title_class ); ?>"> |
| 147 |
<<?php Fns::print_validated_html_tag( $title_tag ); ?> class="<?php echo esc_attr( $title_class ); ?>"> |
| 148 |
<?php |
| 149 |
if ( $title_link ) { |
| 150 |
?> |
| 151 |
<a class="woocommerce-LoopProduct-link" href="<?php echo esc_url( $p_link ); ?>"><?php Fns::print_html( $title ); ?></a> |
| 152 |
<?php |
| 153 |
} else { |
| 154 |
Fns::print_html( $title ); |
| 155 |
} |
| 156 |
?> |
| 157 |
</<?php Fns::print_validated_html_tag( $title_tag ); ?>> |
| 158 |
<?php |
| 159 |
if ( in_array( 'swatches', $items, true ) && 'title' === $swatch_position ) { |
| 160 |
Fns::get_product_swatches( $swatch_type ); |
| 161 |
} |
| 162 |
?> |
| 163 |
</div> |
| 164 |
<?php |
| 165 |
} |
| 166 |
|
| 167 |
/** |
| 168 |
* After product title hook. |
| 169 |
*/ |
| 170 |
do_action( 'rtsb/after/shop/product/title' ); |
| 171 |
|
| 172 |
/** |
| 173 |
* Product Rating. |
| 174 |
*/ |
| 175 |
if ( in_array( 'rating', $items, true ) ) { |
| 176 |
Fns::get_product_rating_html( $rating_args ); |
| 177 |
} |
| 178 |
|
| 179 |
/** |
| 180 |
* Product Short Description. |
| 181 |
*/ |
| 182 |
if ( in_array( 'excerpt', $items, true ) ) { |
| 183 |
?> |
| 184 |
<div class="product-short-description rtsb-text-limit limit-<?php echo esc_attr( $excerpt_limit ); ?>"> |
| 185 |
<?php |
| 186 |
Fns::print_html( $excerpt ); |
| 187 |
?> |
| 188 |
</div> |
| 189 |
<?php |
| 190 |
} |
| 191 |
|
| 192 |
/** |
| 193 |
* Product Price. |
| 194 |
*/ |
| 195 |
if ( in_array( 'price', $items, true ) ) { |
| 196 |
?> |
| 197 |
<div class="product-price<?php echo esc_attr( $swatch_price_class ); ?>"> |
| 198 |
<div class="price-wrapper"> |
| 199 |
<?php woocommerce_template_single_price(); ?> |
| 200 |
</div> |
| 201 |
<?php |
| 202 |
if ( in_array( 'swatches', $items, true ) && 'price' === $swatch_position ) { |
| 203 |
Fns::get_product_swatches( $swatch_type ); |
| 204 |
} |
| 205 |
?> |
| 206 |
</div> |
| 207 |
<?php |
| 208 |
} |
| 209 |
|
| 210 |
/** |
| 211 |
* Action buttons after content. |
| 212 |
*/ |
| 213 |
Fns::print_html( Fns::get_formatted_action_buttons( $items, $add_to_cart, $action_btn_preset, $action_btn_position, 'bottom' ) ); |
| 214 |
|
| 215 |
/** |
| 216 |
* After product content hook. |
| 217 |
*/ |
| 218 |
do_action( 'rtsb/after/shop/product/content', $raw_settings ); |
| 219 |
?> |
| 220 |
</div><!-- .rtsb-product-content --> |
| 221 |
</div><!-- .rtsb-grid-item --> |
| 222 |
|
| 223 |
<?php |
| 224 |
/** |
| 225 |
* After product item hook. |
| 226 |
*/ |
| 227 |
do_action( 'rtsb/after/shop/product/item' ); |
| 228 |
?> |
| 229 |
</div><!-- .rtsb-product --> |
| 230 |
|