| 1 |
<?php |
| 2 |
/** |
| 3 |
* Template: List 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 RadiusTheme\SB\Helpers\Fns; |
| 35 |
|
| 36 |
// Do not allow directly accessing this file. |
| 37 |
if ( ! defined( 'ABSPATH' ) ) { |
| 38 |
exit( 'This script cannot be accessed directly.' ); |
| 39 |
} |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
global $product; |
| 44 |
|
| 45 |
$classes = esc_attr( $grid ) . ' ' . esc_attr( $class ); |
| 46 |
$swatch_title_class = $has_attributes && in_array( 'swatches', $items, true ) && 'title' === $swatch_position ? 'title-with-swatch' : 'title-with-no-swatch'; |
| 47 |
$swatch_price_class = $has_attributes && in_array( 'swatches', $items, true ) && 'price' === $swatch_position ? ' price-with-swatch' : ''; |
| 48 |
$has_featured_img = $raw_settings['show_featured_image'] ? 'show-feature-img' : 'hide-feature-img'; |
| 49 |
?> |
| 50 |
|
| 51 |
<div <?php wc_product_class( $classes, $product ); ?> data-id="<?php echo absint( $p_id ); ?>"> |
| 52 |
<?php |
| 53 |
/** |
| 54 |
* Before product items hook. |
| 55 |
*/ |
| 56 |
do_action( 'rtsb/before/shop/product/item' ); |
| 57 |
?> |
| 58 |
|
| 59 |
<div class="rtsb-list-item <?php echo esc_attr( $has_featured_img ); ?>"> |
| 60 |
<div class="rtsb-product-img"> |
| 61 |
<?php |
| 62 |
/** |
| 63 |
* Before product image hook. |
| 64 |
*/ |
| 65 |
do_action( 'rtsb/before/shop/product/image' ); |
| 66 |
|
| 67 |
/** |
| 68 |
* Product image hook. |
| 69 |
* |
| 70 |
* @hooked RadiusTheme\SB\Controllers\Hooks\ActionHooks::render_image 10 |
| 71 |
*/ |
| 72 |
do_action( 'rtsb/shop/product/image', $img_args, $raw_settings ); |
| 73 |
|
| 74 |
/** |
| 75 |
* Sale Badge. |
| 76 |
*/ |
| 77 |
if ( ! empty( $p_sale ) ) { |
| 78 |
?> |
| 79 |
<div class="rtsb-promotion"> |
| 80 |
<?php |
| 81 |
Fns::get_badge_html( $p_sale, $badge_class ); |
| 82 |
?> |
| 83 |
</div> |
| 84 |
<?php |
| 85 |
} |
| 86 |
|
| 87 |
/** |
| 88 |
* After product image hook. |
| 89 |
*/ |
| 90 |
do_action( 'rtsb/after/shop/product/image', $raw_settings ); |
| 91 |
?> |
| 92 |
</div><!-- .rtsb-product-img --> |
| 93 |
|
| 94 |
<div class="rtsb-product-content"> |
| 95 |
<?php |
| 96 |
/** |
| 97 |
* Before product content hook. |
| 98 |
*/ |
| 99 |
do_action( 'rtsb/before/shop/product/content' ); |
| 100 |
|
| 101 |
/** |
| 102 |
* Product Categories. |
| 103 |
*/ |
| 104 |
if ( in_array( 'categories', $items, true ) ) { |
| 105 |
?> |
| 106 |
<div class="rtsb-product-category"> |
| 107 |
<?php |
| 108 |
Fns::get_categories_list( $p_id ); |
| 109 |
?> |
| 110 |
</div> |
| 111 |
<?php |
| 112 |
} |
| 113 |
|
| 114 |
/** |
| 115 |
* Product Swatches. |
| 116 |
*/ |
| 117 |
if ( in_array( 'swatches', $items, true ) ) { |
| 118 |
Fns::get_product_swatches( $swatch_type ); |
| 119 |
} |
| 120 |
|
| 121 |
/** |
| 122 |
* Product Rating. |
| 123 |
*/ |
| 124 |
if ( in_array( 'rating', $items, true ) ) { |
| 125 |
Fns::get_product_rating_html( $rating_args ); |
| 126 |
} |
| 127 |
|
| 128 |
/** |
| 129 |
* Before product title hook. |
| 130 |
*/ |
| 131 |
do_action( 'rtsb/before/shop/product/title' ); |
| 132 |
|
| 133 |
/** |
| 134 |
* Product Title. |
| 135 |
*/ |
| 136 |
if ( in_array( 'title', $items, true ) ) { |
| 137 |
?> |
| 138 |
<div class="rtsb-product-title-wrapper"> |
| 139 |
<<?php Fns::print_validated_html_tag( $title_tag ); ?> class="<?php echo esc_attr( $title_class ); ?>"> |
| 140 |
<?php if ( $title_link ) { ?> |
| 141 |
<a class="woocommerce-LoopProduct-link" href="<?php echo esc_url( $p_link ); ?>"><?php Fns::print_html( $title ); ?></a> |
| 142 |
<?php |
| 143 |
} else { |
| 144 |
Fns::print_html( $title ); |
| 145 |
} |
| 146 |
?> |
| 147 |
</<?php Fns::print_validated_html_tag( $title_tag ); ?>> |
| 148 |
</div> |
| 149 |
<?php |
| 150 |
} |
| 151 |
|
| 152 |
/** |
| 153 |
* After product title hook. |
| 154 |
*/ |
| 155 |
do_action( 'rtsb/after/shop/product/title' ); |
| 156 |
|
| 157 |
/** |
| 158 |
* Product Price. |
| 159 |
*/ |
| 160 |
if ( in_array( 'price', $items, true ) ) { |
| 161 |
?> |
| 162 |
<div class="product-price<?php echo esc_attr( $swatch_price_class ); ?>"> |
| 163 |
<div class="price-wrapper"> |
| 164 |
<?php |
| 165 |
woocommerce_template_single_price(); |
| 166 |
?> |
| 167 |
</div> |
| 168 |
</div> |
| 169 |
<?php |
| 170 |
} |
| 171 |
|
| 172 |
/** |
| 173 |
* Product Short Description. |
| 174 |
*/ |
| 175 |
if ( in_array( 'excerpt', $items, true ) ) { |
| 176 |
?> |
| 177 |
<div class="product-short-description rtsb-text-limit limit-<?php echo esc_attr( $excerpt_limit ); ?>"> |
| 178 |
<?php |
| 179 |
Fns::print_html( $excerpt ); |
| 180 |
?> |
| 181 |
</div> |
| 182 |
<?php |
| 183 |
} |
| 184 |
|
| 185 |
/** |
| 186 |
* Action buttons after content. |
| 187 |
*/ |
| 188 |
Fns::print_html( Fns::get_formatted_action_buttons( $items, $add_to_cart, 'preset1', 'after', 'bottom' ) ); |
| 189 |
|
| 190 |
/** |
| 191 |
* After product content hook. |
| 192 |
*/ |
| 193 |
do_action( 'rtsb/after/shop/product/content', $raw_settings ); |
| 194 |
?> |
| 195 |
</div> |
| 196 |
</div><!-- .rtsb-list-item --> |
| 197 |
|
| 198 |
<?php |
| 199 |
/** |
| 200 |
* After product item hook. |
| 201 |
*/ |
| 202 |
do_action( 'rtsb/after/shop/product/item' ); |
| 203 |
?> |
| 204 |
</div><!-- .rtsb-product --> |
| 205 |
|