过滤器会导致Woocommerce 3.4.2中的产品属性出现问题

时间:2018-06-13 14:30:14

标签: php woocommerce attributes

我需要小组帮助解决我们的Woocommerce问题...但首先,我要感谢您参与我们的小组讨论。我正在开发一个WordPress项目(版本4.9.6),我在其中导入具有公共属性的产品(所有导入),并且相同的属性出现在不同产品的前端,但在某些产品中,它们在属性分类中存在缺陷(空格%20和重音%F5),而其他产品在同一属性中保持正确。我检查过有一个过滤器进行更改,过滤器的位置在不同的位置导致错误。不幸的是我无法解决它。请问,你们有没有解决方案?我相信匹配问题的文件是:product-attributes.php。我现在使用最新版本来满足您的所有要求。 PHP 7.2.5并且我用尽所有尝试来解决.CSV文件的导入问题..我来自巴西!很难!!!!

<?php
/**
 * Product attributes
 *
 * @version     3.1.0
 */

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}
?>
<table class="table table-striped shop_attributes">
    <?php if ( $display_dimensions && $product->has_weight() ) : ?>
        <tr>
            <th><?php _e( 'Weight', 'porto' ) ?></th>
            <td class="product_weight"><?php echo esc_html( wc_format_weight( $product->get_weight() ) ); ?></td>
        </tr>
    <?php endif; ?>

    <?php if ( $display_dimensions && $product->has_dimensions() ) : ?>
        <tr>
            <th><?php _e( 'Dimensions', 'porto' ) ?></th>
            <td class="product_dimensions"><?php echo esc_html( wc_format_dimensions( $product->get_dimensions( false ) ) ); ?></td>
        </tr>
    <?php endif; ?>

    <?php foreach ( $attributes as $attribute ) : ?>
        <tr>
            <th><?php echo wc_attribute_label( $attribute->get_name() ); ?></th>
            <td><?php
                $values = array();

                if ( $attribute->is_taxonomy() ) {
                    $attribute_taxonomy = $attribute->get_taxonomy_object();
                    $attribute_values = wc_get_product_terms( $product->get_id(), $attribute->get_name(), array( 'fields' => 'all' ) );

                    foreach ( $attribute_values as $attribute_value ) {
                        $value_name = esc_html( $attribute_value->name );

                        if ( $attribute_taxonomy->attribute_public ) {
                            $values[] = '<a href="' . esc_url( get_term_link( $attribute_value->term_id, $attribute->get_name() ) ) . '" rel="tag">' . $value_name . '</a>';
                        } else {
                            $values[] = $value_name;
                        }
                    }
                } else {
                    $values = $attribute->get_options();

                    foreach ( $values as &$value ) {
                        $value = make_clickable( esc_html( $value ) );
                    }
                }

                echo apply_filters( 'woocommerce_attribute', wpautop( wptexturize( implode( ', ', $values ) ) ), $attribute, $values );
            ?></td>
        </tr>
    <?php endforeach; ?>
</table>


我已经进行了测试,我相信你已经用尽了这些尝试,通过一个.CSV工作表导入数据,大约150个项目,9个产品系列,其他行是由属性生成的变体

我已经将整个数据库从我认为与所有产品数据相关的点清零,总是用于新测试。在WP&gt;中,导入时数据库中的taxinomies是正确的。产品面板&gt;属性是完美的。在加载某些产品的页面时,过滤器的替换发生,导致错误。

产品集中始终是产生错误的相同产品,甚至在数据库重置时隔离导入新文件。我已经隔离了每个产品都有很高的变化,但小于要求,每个产品注册50个变种。

这是产品页面HTML中的正确结果:class =“filter-item”是缺陷的位置。

<ul class="filter-item-list" name="attribute_pa_impressao"><li><a href="#">Frente e Verso</a></li></ul>
//***after href = “#” is correct.


<ul class="filter-item-list" name="attribute_pa_impressao"><li><a href="#">Frente%20e%20Verso</a></li></ul>
///***after data-value is wrong.

为什么过滤器对同一项目的处理方式不同? 我有一个线索,问题解决的是thema的functions.php

我会继续努力。

0 个答案:

没有答案