@ligisayan

С помощью каких событий можно подключиться и настраивать плагин yith-woocommerce-compare?

Приветствую. Вопрос по магазину на wordpress+woocommerce. С помощью каких событий можно подключиться и настраивать плагин yith-woocommerce-compare? к yith_woocompare_open_popup подключиться получается, пишет hello, а вот к элементу обратиться нет..
$('body').bind('yith_woocompare_open_popup', function() {
console.log("hello!");
var number = $('.compare-list .input-text.qty.text').val();
console.log(number);
});
});

<table class="compare-list">
  <thead>
    <tr>
      <td>
        <input type="number" step="1" min="1" max="27" id="num_count" name="quantity" value="1" title="Кол." class="input-text qty text" size="4">
      </td>
  </thead>
</table>
  • Вопрос задан
  • 212 просмотров
Решения вопроса 1
Код такой

public function list_products_html( $lang = false ) {
ob_start();

/**
* WPML Suppot: Localize Ajax Call
*/
global $sitepress;

if( defined( 'ICL_LANGUAGE_CODE' ) && $lang && isset( $sitepress )) {
$sitepress->switch_lang( $lang, true );
}

if ( empty( $this->products_list ) ) {
echo '' . __( 'No products to compare', 'yith-woocommerce-compare' ) . '';
return ob_get_clean();
}
$count = 0;
foreach ( $this->products_list as $product_id ) {
/**
* @type object $product /WC_Product
*/
$product = $this->wc_get_product( $product_id );
$count++;
?>

<?php
}
echo $count;
$return = ob_get_clean();

return apply_filters( 'yith_woocompare_widget_products_html', $return, $this->products_list, $this );
}

и в шаблоне
<?php global $yith_woocompare;
echo $yith_woocompare->obj->list_products_html();
?>
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы