if (!function_exists('site_proto')) {
function site_proto() {
...
}
}
По видимому, у вас ИБ 1.0. Перейдите в настройки инфоблока и посмотрите значение "Значения свойств хранятся". Скорее всего там "в общей таблице (по умолчанию)" и ниже есть ссылка "изменить место хранения свойств" - нажмите ее.
$resElement = \CIBlockElement::GetList(
[],
[
'IBLOCK_ID' => 5,
'ID' => 371,
],
false,
false,
[
'ID',
'IBLOCK_ID',
'PROPERTY_SLOGAN',
'PROPERTY_COPY'
]
);
if ( !($element = $resElement->getNext() ) )
{
echo "Элемент не найден";
return;
}
var_dump($element);
if(CModule::IncludeModule('iblock'))
{
$res = CIBlockElement::GetList(
array("SHOW_COUNTER"=>"DESC"), // сортировка по количеству просмотров;
array("IBLOCK_ID"=>1," ACTIVE"=>"Y"), //Получаем активные элементы , в данном случае из инфоблока с ID = 1;
false,
array("nTopCount"=>5), //ограничиваем количество элементов - только 5.
array("NAME","PREVIEW_PICTURE", "DETAIL_PAGE_URL")// Выбираем только указанные поля
);
while($ar = $res->GetNext())
{
$arTheBest[]=$ar; //массив с данными 5 самых просматриваемых элементов инфоблока
}
}
add_action('pre_get_posts', 'filter');
function filter($query)
{
if (!is_admin() && $query->is_main_query() && !is_single() &&
((isset($_GET['pa_class']) || isset($_GET['pa_size']) || isset($_GET['pa_material']))
)
) {
if (is_woocommerce()) {
if ((isset($_GET['pa_class']) && !empty($_GET['pa_class'])) ||
(isset($_GET['pa_size']) && !empty($_GET['pa_size'])) ||
(isset($_GET['pa_color']) && !empty($_GET['pa_color'])) ||
(isset($_GET['pa_material']) && !empty($_GET['pa_material']))
) {
if ((isset($_GET['pa_class']) && !empty($_GET['pa_class']))) {
$tax[] = array(
'taxonomy' => 'pa_class',
'field' => 'slug',
'terms' => $_GET['pa_class']
);
}
if ((isset($_GET['pa_color']) && !empty($_GET['pa_color']))) {
$tax[] = array(
'taxonomy' => 'pa_color',
'field' => 'slug',
'terms' => $_GET['pa_color']
);
}
if ((isset($_GET['pa_size']) && !empty($_GET['pa_size']))) {
$tax[] = array(
'taxonomy' => 'pa_size',
'field' => 'slug',
'terms' => $_GET['pa_size']
);
}
if ((isset($_GET['pa_material']) && !empty($_GET['pa_material']))) {
$tax[] = array(
'taxonomy' => 'pa_material',
'field' => 'slug',
'terms' => $_GET['pa_material']
);
}
$query->set('tax_query', $tax);
}
}
} elseif (is_search()) {
$query->set('post_type', 'product');
}
}
<?php $product->list_attributes(); ?>
используется метот list_attributes(); Можно на этом остановиться и в своем шаблоне написать global $product;
$product->list_attributes();
public function list_attributes() {
wc_get_template( 'single-product/product-attributes.php', array(
'product' => $this
) );
}
$attributes = $product->get_attributes();
.........
<?php foreach ( $attributes as $attribute ) :
if ( empty( $attribute['is_visible'] ) || ( $attribute['is_taxonomy'] && ! taxonomy_exists( $attribute['name'] ) ) ) {
continue;
} else {
$has_row = true;
}
?>
<tr class="<?php if ( ( $alt = $alt * -1 ) == 1 ) echo 'alt'; ?>">
<th><?php echo wc_attribute_label( $attribute['name'] ); ?></th>
<td><?php
if ( $attribute['is_taxonomy'] ) {
$values = wc_get_product_terms( $product->id, $attribute['name'], array( 'fields' => 'names' ) );
echo apply_filters( 'woocommerce_attribute', wpautop( wptexturize( implode( ', ', $values ) ) ), $attribute, $values );
} else {
// Convert pipes to commas and display values
$values = array_map( 'trim', explode( WC_DELIMITER, $attribute['value'] ) );
echo apply_filters( 'woocommerce_attribute', wpautop( wptexturize( implode( ', ', $values ) ) ), $attribute, $values );
}
?></td>
</tr>
<?php endforeach; ?>
$tax = 'pa_заданный_вами_слаг_атрибута'
$pa_args = get_terms( $tax, array(
'hide_empty' => false,
)
);
$pa_args = array();
$attribute_taxonomies = wc_get_attribute_taxonomies();
if ( 0 !== count( $attribute_taxonomies ) ) {
foreach ( $attribute_taxonomies as $one_tax ) {
$pa_args[] = get_terms( $one_tax, array(
'hide_empty' => false,
) );
}
}
#container {
box-sizing: border-box;
display: flex;
flex-wrap: nowrap;
width: 100%;
}
#container > div {
flex-basis: 100%;
}
#container > div:nth-child(1) {
flex-shrink: 4;
}
#container > div:nth-child(2) {
flex-shrink: 3;
}
#container > div:nth-child(3) {
flex-shrink: 2;
}
add_action('after_setup_theme', 'remove_zoom_theme_support', 100);
function remove_zoom_theme_support() {
remove_theme_support('wc-product-gallery-zoom');
}
<?php
namespace MySpace;
class DateTime {...}
<?php
...
...
require_once 'app/MySpace/DateTime.php';
// если мы хотим создать объект СВОЕГО КЛАССА:
$myDateTime = new \MySpace\DateTime();
//Или так:
use \MySpace\DateTime;
$myDateTime2 = new DateTime();
// а вот если хотим использовать встроенный класс DateTime в данной ситуации:
$intDateTime = new \DateTime();
$file = file_get_contents('../test.html');
libxml_use_internal_errors(TRUE);
$node = new DOMDocument();
$text = $node->loadHTML('<meta http-equiv="Content-Type" content="text/html; charset=utf-8">' . $file);
$id = $node->getElementById('firstElement');
$html = $node->saveHTML($id);
$file = file_get_contents('./какой-тоФайл.html');
preg_replace('/(\<[\s\S]*?myId[\s\S]*?\>)/', '\\1 $html', $file);
mask: radial-gradient(320px 320px at var(--x) var(--y), black 1%, transparent 40%);
select * from b_event order by id desc
############################################################################
#### Убираем слеши в конце URL для статических файлов (содержит точку) ####
############################################################################
RewriteCond %{REQUEST_URI} \..+$
# Если файл содержит точку.
RewriteCond %{REQUEST_FILENAME} !-d
# И это не директория.
RewriteCond %{REQUEST_FILENAME} -f
# Является файлом.
RewriteCond %{REQUEST_URI} ^(.+)/$
# И в конце URL есть слеш.
RewriteRule ^(.+)/$ /$1 [R=301,L]
# Исключить слеш.
############################################################################
#### Добавляем слеш(/), если его нет, и это не файл. ####
############################################################################
RewriteCond %{REQUEST_URI} !(.*)/$
# Если слеша в конце нет.
RewriteCond %{REQUEST_FILENAME} !-f
# Не является файлом.
RewriteCond %{REQUEST_URI} !\..+$
# В URL нет точки (файл).
RewriteRule ^(.*)$ $1/ [L,R=301]
# Добавляем слеш в конце.