| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentCart\App\Modules\Templating\BlockTemplates; |
| 4 |
|
| 5 |
/** |
| 6 |
* ProductCategoryTemplate class. |
| 7 |
* |
| 8 |
*/ |
| 9 |
class ProductCategoryTemplate |
| 10 |
{ |
| 11 |
|
| 12 |
/** |
| 13 |
* The slug of the template. |
| 14 |
* |
| 15 |
* @var string |
| 16 |
*/ |
| 17 |
const SLUG = 'taxonomy-product-categories'; |
| 18 |
|
| 19 |
/** |
| 20 |
* Initialization method. |
| 21 |
*/ |
| 22 |
public function init() |
| 23 |
{ |
| 24 |
register_block_template('fluent-cart//taxonomy-product-categories', [ |
| 25 |
'title' => $this->getTitle(), |
| 26 |
'description' => $this->getDescription(), |
| 27 |
'content' => $this->getDefaultTemplate(), |
| 28 |
]); |
| 29 |
} |
| 30 |
|
| 31 |
/** |
| 32 |
* Returns the title of the template. |
| 33 |
* |
| 34 |
* @return string |
| 35 |
*/ |
| 36 |
public function getTitle() |
| 37 |
{ |
| 38 |
return _x('Products by Category', 'Template name', 'fluent-cart'); |
| 39 |
} |
| 40 |
|
| 41 |
/** |
| 42 |
* Returns the description of the template. |
| 43 |
* |
| 44 |
* @return string |
| 45 |
*/ |
| 46 |
public function getDescription() |
| 47 |
{ |
| 48 |
return __('Displays products filtered by a category.', 'fluent-cart'); |
| 49 |
} |
| 50 |
|
| 51 |
public function getDefaultTemplate() |
| 52 |
{ |
| 53 |
ob_start(); |
| 54 |
?> |
| 55 |
<!-- wp:template-part {"slug":"header","tagName":"header","area":"header"} /--> |
| 56 |
|
| 57 |
<!-- wp:group {"tagName":"main","align":"full","layout":{"type":"constrained"}} --> |
| 58 |
<main class="wp-block-group alignfull"><!-- wp:query-title {"type":"archive","showPrefix":false,"align":"wide","style":{"typography":{"lineHeight":"1"},"spacing":{"padding":{"top":"var:preset|spacing|20"}}}} /--> |
| 59 |
|
| 60 |
<!-- wp:term-description {"align":"wide"} /--> |
| 61 |
|
| 62 |
<!-- wp:group {"className":"alignwide","layout":{"type":"flex","flexWrap":"nowrap","justifyContent":"space-between"}} --> |
| 63 |
<div class="wp-block-group alignwide"><!-- wp:fluent-cart/products {"colors":{}} --> |
| 64 |
<div class="wp-block-fluent-cart-products"><div class="fct-products-wrapper" data-fluent-cart-shop-app="true" data-fluent-cart-product-wrapper=""><!-- wp:fluent-cart/shopapp-product-view-switcher {"className":"fluent-product-view-switcher","metadata":{"name":"View Switcher"}} /--> |
| 65 |
|
| 66 |
<!-- wp:fluent-cart/shopapp-product-container {"className":"fluent-product-container"} --> |
| 67 |
<div class="wp-block-fluent-cart-shopapp-product-container fluent-product-container" data-fluent-cart-shop-app-product-list=""><!-- wp:fluent-cart/shopapp-product-filter --> |
| 68 |
<div class="fluent-cart-product-filter-wrapper"><!-- wp:fluent-cart/shopapp-product-filter-search-box /--> |
| 69 |
|
| 70 |
<!-- wp:fluent-cart/shopapp-product-filter-filters /--> |
| 71 |
|
| 72 |
<!-- wp:fluent-cart/shopapp-product-filter-button --> |
| 73 |
<div class="fct-product-block-filter-item"><!-- wp:fluent-cart/shopapp-product-filter-apply-button /--> |
| 74 |
|
| 75 |
<!-- wp:fluent-cart/shopapp-product-filter-reset-button /--></div> |
| 76 |
<!-- /wp:fluent-cart/shopapp-product-filter-button --></div> |
| 77 |
<!-- /wp:fluent-cart/shopapp-product-filter --> |
| 78 |
|
| 79 |
<!-- wp:fluent-cart/shopapp-product-loop {"wp_client_id":"694667c7-282b-4595-9acd-98b8c2e13c6e","last_changed":"2025-09-28T09:02:35.262Z","className":"fluent-product-loop","metadata":{"name":"Product Loop"}} --> |
| 80 |
<div class="fluent-cart-product-loop fct-product-block-editor-product-card"><!-- wp:fluent-cart/shopapp-product-image --> |
| 81 |
<div class="fluent-cart-product-image"></div> |
| 82 |
<!-- /wp:fluent-cart/shopapp-product-image --> |
| 83 |
|
| 84 |
<!-- wp:fluent-cart/shopapp-product-title /--> |
| 85 |
|
| 86 |
<!-- wp:fluent-cart/shopapp-product-price /--> |
| 87 |
|
| 88 |
<!-- wp:fluent-cart/shopapp-product-buttons /--></div> |
| 89 |
<!-- /wp:fluent-cart/shopapp-product-loop --></div> |
| 90 |
<!-- /wp:fluent-cart/shopapp-product-container --> |
| 91 |
|
| 92 |
<!-- wp:fluent-cart/product-paginator {"className":"fluent-product-paginator","metadata":{"name":"Paginator"}} --> |
| 93 |
<div class="fluent-cart-product-paginator"><!-- wp:fluent-cart/product-paginator-info /--> |
| 94 |
|
| 95 |
<!-- wp:fluent-cart/product-paginator-number /--></div> |
| 96 |
<!-- /wp:fluent-cart/product-paginator --> |
| 97 |
|
| 98 |
<!-- wp:fluent-cart/shopapp-product-no-result {"className":"fluent-product-no-result","metadata":{"name":"No Result"}} --> |
| 99 |
<div class="fct-product-block-filter-item"><!-- wp:paragraph {"align":"center","fontSize":"large"} --> |
| 100 |
<p class="has-text-align-center has-large-font-size">No results found</p> |
| 101 |
<!-- /wp:paragraph --> |
| 102 |
|
| 103 |
<!-- wp:paragraph {"align":"center"} --> |
| 104 |
<p class="has-text-align-center">You can try <a href="#">clearing any filters</a> or head to our <a href="#">store's home</a></p> |
| 105 |
<!-- /wp:paragraph --></div> |
| 106 |
<!-- /wp:fluent-cart/shopapp-product-no-result --></div></div> |
| 107 |
<!-- /wp:fluent-cart/products --></div> |
| 108 |
<!-- /wp:group --></main> |
| 109 |
<!-- /wp:group --> |
| 110 |
|
| 111 |
<!-- wp:template-part {"slug":"footer","tagName":"footer","area":"footer"} /--> |
| 112 |
<?php |
| 113 |
return ob_get_clean(); |
| 114 |
} |
| 115 |
} |
| 116 |
|