Andrei | фикс каталога (поместил файлы single страницы в правильные директории удалил лишние файлы которые не использовались)
parent
39ef43e7fd
commit
c74600377a
@ -1 +0,0 @@ |
|||||||
123 |
|
@ -1,63 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) { |
|
||||||
exit; |
|
||||||
} |
|
||||||
|
|
||||||
if (is_product()) { |
|
||||||
|
|
||||||
include_module('shop'); |
|
||||||
include_component('shop', 'single-product'); |
|
||||||
|
|
||||||
$context = Timber::get_context(); |
|
||||||
$post = Timber::get_post(); |
|
||||||
$context['post'] = $post; |
|
||||||
|
|
||||||
|
|
||||||
$context['wc_breadcrumbs'] = array(); |
|
||||||
|
|
||||||
if (function_exists('woocommerce_breadcrumb')) { |
|
||||||
$args = array( |
|
||||||
'delimiter' => '', |
|
||||||
'wrap_before' => '', |
|
||||||
'wrap_after' => '', |
|
||||||
'before' => '', |
|
||||||
'after' => '', |
|
||||||
'home' => _x('Home', 'breadcrumb', 'woocommerce'), |
|
||||||
); |
|
||||||
|
|
||||||
$breadcrumbs = new WC_Breadcrumb(); |
|
||||||
$breadcrumbs->generate(); |
|
||||||
|
|
||||||
$formatted_breadcrumbs = array(); |
|
||||||
foreach ($breadcrumbs->get_breadcrumb() as $crumb) { |
|
||||||
$formatted_breadcrumbs[] = array( |
|
||||||
'text' => $crumb[0], |
|
||||||
'url' => $crumb[1] |
|
||||||
); |
|
||||||
} |
|
||||||
|
|
||||||
$context['wc_breadcrumbs'] = $formatted_breadcrumbs; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
$product_id = get_the_ID(); |
|
||||||
$product = wc_get_product($product_id); |
|
||||||
|
|
||||||
$context['product'] = $product; |
|
||||||
|
|
||||||
$context['related_products'] = array(); |
|
||||||
$related_products_ids = wc_get_related_products($product_id, 5); |
|
||||||
|
|
||||||
if ($related_products_ids) { |
|
||||||
foreach ($related_products_ids as $related_id) { |
|
||||||
$related_product = wc_get_product($related_id); |
|
||||||
if ($related_product) { |
|
||||||
$context['related_products'][] = $related_product; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
Timber::render('modules/shop/components/single-product/component-template.twig', $context); |
|
||||||
} |
|
@ -1,19 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) { |
|
||||||
exit; |
|
||||||
} |
|
||||||
|
|
||||||
get_header(); |
|
||||||
|
|
||||||
$template_path = 'templates/shop/single-product.php'; |
|
||||||
if (file_exists(get_template_directory() . '/' . $template_path)) { |
|
||||||
include_once get_template_directory() . '/' . $template_path; |
|
||||||
} else { |
|
||||||
|
|
||||||
while (have_posts()) : the_post(); |
|
||||||
wc_get_template_part('content', 'single-product'); |
|
||||||
endwhile; |
|
||||||
} |
|
||||||
|
|
||||||
get_footer(); |
|
Loading…
Reference in new issue