Forum Replies Created

Viewing 15 replies - 1 through 15 (of 35 total)
  • Thread Starter chadrex

    (@chadrex)

    Continuing to research the question. There is a good example here, but there is a question of compatibility with live search

    add_filter( 'posts_search', 'product_search_by_id', 9999, 2 );
      
    function product_search_by_id( $search, $wp_query ) {
       global $wpdb;
       if ( is_admin() || ! is_search() || ! isset( $wp_query->query_vars['s'] ) || ( ! is_array( $wp_query->query_vars['post_type'] ) && $wp_query->query_vars['post_type'] !== "product" ) || ( is_array( $wp_query->query_vars['post_type'] ) && ! in_array( "product", $wp_query->query_vars['post_type'] ) ) ) return $search;   
       $product_id = $wp_query->query_vars['s'];
       if ( ! get_post( $product_id ) ) return $search;
       $search = str_replace( 'AND (((', "AND (({$wpdb->posts}.ID IN (" . $product_id . ")) OR ((", $search );   
       return $search;   
    }
    • This reply was modified 1 year, 2 months ago by chadrex.
    Thread Starter chadrex

    (@chadrex)

    add_action( 'woocommerce_after_shop_loop_item', 'display_sku' );
    function display_sku() {
        global $product;
        if ( $product->get_id() ) {
            echo '<span class="sku"><bdi>ID: ' . $product->get_id() . '</bdi></span></div>';
        }
        }

    In short – I decided to use id to identify the product.

    Thread Starter chadrex

    (@chadrex)

    <font _mstmutation=”1″></font>Alas, I need not only the sku but also the product id which is set to the post after its creation.

    Thread Starter chadrex

    (@chadrex)

    Closed. The few solutions was presented on github:

    https://github.com/spider-themes/eazydocs/issues/1

    Thread Starter chadrex

    (@chadrex)

    not sure, but here is the solution to my problem (I guess)

            if( !$data['_wcmmq_s_min_quantity'] || $data['_wcmmq_s_min_quantity'] == '0' || $data['_wcmmq_s_min_quantity'] == 0 ){
               $data['_wcmmq_s_min_quantity'] = 1; 
            }

    in the file
    \wp-content\plugins\woo-min-max-quantity-step-control-single\admin\set_menu_and_fac.php (72-74)

    Thread Starter chadrex

    (@chadrex)

    For example, let’s compare two bases, before lick submit and after click submit.

    (1314, 'wcmmq_s_universal_minmaxstep', 'a:7:{s:21:\"_wcmmq_s_min_quantity\";i:1;s:21:\"_wcmmq_s_max_quantity\";b:0;s:21:\"_wcmmq_s_product_step\";i:1;s:22:\"_wcmmq_s_msg_min_limit\";s:34:\"Minimum quantity should %s of \"%s\"\";s:22:\"_wcmmq_s_msg_max_limit\";s:34:\"Maximum quantity should %s of \"%s\"\";s:35:\"_wcmmq_s_msg_max_limit_with_already\";s:32:\"You have already %s item of \"%s\"\";s:28:\"_wcmmq_s_min_qty_msg_in_loop\";s:14:\"Minimum qty is\";}', 'yes'),

    (1314, 'wcmmq_s_universal_minmaxstep', 'a:5:{s:22:\"_wcmmq_s_msg_min_limit\";s:34:\"Minimum quantity should %s of \"%s\"\";s:22:\"_wcmmq_s_msg_max_limit\";s:34:\"Maximum quantity should %s of \"%s\"\";s:35:\"_wcmmq_s_msg_max_limit_with_already\";s:32:\"You have already %s item of \"%s\"\";s:28:\"_wcmmq_s_min_qty_msg_in_loop\";s:14:\"Minimum qty is\";s:21:\"_wcmmq_s_min_quantity\";s:1:\"0\";}', 'yes'),

    The problem is that there is a global parameter change _wcmmq_s_min_quantity (zero at the end of the second example)

    Thread Starter chadrex

    (@chadrex)

    Thank you very much, now everything works. I would like to see this solution in the documentation

    Thread Starter chadrex

    (@chadrex)

    Yes of course, here is the complete code

    	add_filter( 'rwmb_meta_boxes', 'rsm_product_cfields_register_meta_boxes' );
    	
    	function rsm_product_cfields_register_meta_boxes( $meta_boxes ) {
    		$prefix = 'atr_';
    		
    		$meta_boxes[] = [
            'title'      => esc_html__( 'Складские данные', 'cartzilla' ),
            'id'         => 'rsm_product_cfields',
            'post_types' => ['product'],
            'context'    => 'side',
            'autosave'   => true,
            'fields'     => [
    		[
    		'type'        => 'text',
    		'name'        => esc_html__( 'Уникод', 'cartzilla' ),
    		'id'          => $prefix . 'unicode',
    		'desc'        => esc_html__( 'Уникальный код товара из 1C', 'cartzilla' ),
    		'placeholder' => esc_html__( 'Пример: LC000123456789', 'cartzilla' ),
    		],
    		[
    		'type'        => 'text',
    		'name'        => esc_html__( 'Штрихкод', 'cartzilla' ),
    		'id'          => $prefix . 'barcode',
    		'desc'        => esc_html__( 'Номерной штрихкод для считывания', 'cartzilla' ),
    		'placeholder' => esc_html__( 'Пример: 4820010161609', 'cartzilla' ),
    		],
    		[
    		'type'        => 'textarea',
    		'name'        => esc_html__( 'Украинское название товара', 'cartzilla' ),
    		'id'          => $prefix . 'name_ukr',
    		'desc'        => esc_html__( 'Полное название товара на украинском языке', 'cartzilla' ),
    		'placeholder' => esc_html__( 'Пример: Нап?й безалкогольний сильногазований 1л', 'cartzilla' ),
    		'rows'        => 1,
    		],
    		[
    		'type'        => 'textarea',
    		'name'        => esc_html__( 'Название товара по накладной', 'cartzilla' ),
    		'id'          => $prefix . 'name_waybill',
    		'desc'        => esc_html__( 'Наименование согласно приходу', 'cartzilla' ),
    		'placeholder' => esc_html__( 'Пример: Минвода Завод 1,5 л.', 'cartzilla' ),
    		'rows'        => 1,
    		],
    		[
    		'type'        => 'textarea',
    		'name'        => esc_html__( 'Примечание', 'cartzilla' ),
    		'id'          => $prefix . 'notice',
    		'desc'        => esc_html__( 'Примечание на счет этого товара', 'cartzilla' ),
    		'placeholder' => esc_html__( 'Пример: Например этот товар является хрупким', 'cartzilla' ),
    		'rows'        => 2,
    		],
    		[
    		'type'  => 'file_advanced',
    		'name'  => esc_html__( 'Документы', 'cartzilla' ),
    		'id'    => $prefix . 'documents',
    		'desc'  => esc_html__( 'Просто документы', 'cartzilla' ),
    		'clone' => true,
    		],
            ],
    		];
    		
    		return $meta_boxes;
    	}
    	
    Thread Starter chadrex

    (@chadrex)

    wrong code, this is what i’m actually using

    add_action( 'woocommerce_single_product_summary', 'rsm_product_tab_docs_content', 12 );
    function rsm_product_tab_docs_content() {
    $files = rwmb_meta( 'atr_documents' );
    foreach ( $files as $file ) {
        ?>
        <a href="<?php echo $file['url']; ?>"><?php echo $file['title']; ?></a>
        <?php
    }
    }
    • This reply was modified 3 years, 7 months ago by chadrex.
    Thread Starter chadrex

    (@chadrex)

    Alas, it did not help, the result is the same. I repeated the options you suggested, most likely the problem is with the server, and specifically with php module imagick, I will look into it, thanks for the answer

    Thread Starter chadrex

    (@chadrex)

    It’s strange, I sort of wrote the answer, but he left … In any case, the last option is definitely working. I will also add that this bug did not always appear, as I understood the pattern was that 3 or more filters were activated …

    That is, at some moments it was displayed normally. In any of your options helped, the issue is resolved. Thank you

    Thread Starter chadrex

    (@chadrex)

    Alas, I could not find a link to buy the premium version. Buying through a local site is not the best choice i think

    I tested these two plugins at the same time, everything works fine. Does ajax search itself work for you, separately without Relevanssi?

    Open \wp-content\plugins\msrp-for-woocommerce\includes\class-alg-wc-msrp-core.php(126)

    $template = '<div class="price"><label for="alg_wc_msrp">MSRP</label>: <span id="alg_wc_msrp"><' . $textFormat . '>%msrp%</' . $textFormat . '>%you_save%</span></div>';

    change to

    $template = '<div class="price"><label for="alg_wc_msrp">RRP</label>: <span id="alg_wc_msrp"><' . $textFormat . '>%msrp%</' . $textFormat . '>%you_save%</span></div>';

    A little crutch, but it works anyway

    • This reply was modified 3 years, 7 months ago by chadrex.
    Thread Starter chadrex

    (@chadrex)

    Yes, there is another thing, for example, if the attribute (attribute_name) contains Russian letters, then you can not then select the item in the frontend, they are just not clickable. I always use Latin for such parameters, in the original wc widgets the call is most likely by id, not by key. I don’t know how to make it better, it’s just that there is such a thing as extended Latin (e.g. Azeri), which may not work either.

    ——————–

    On the second point, thanks for the answer, should have been a little different (get a full link and disable one of the parameters), did so:
    remove_query_arg( 'orderby', $_SERVER['REQUEST_URI'] )

Viewing 15 replies - 1 through 15 (of 35 total)