This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Forum Replies Created

Viewing 15 posts - 1,441 through 1,455 (of 18,418 total)
  • Author
    Posts
  • in reply to: Add to cart for a specific form #52628
    Ernest MarcinkoErnest Marcinko
    Keymaster

    I remembered someone asked about quantity before and found this topic.

    Apparently it’s possible and it was working for him with this:

    <div class="woocommerce">
    	<div class="quantity">
    		<input type="number" step="1" min="1" max="" name="quantity" value="1" title="Quantity" class="input-text qty text" size="4" pattern="[0-9]*" inputmode="numeric">
    	</div>
    	<a href="<?php echo $link; ?>"
    	   class="button product_type_simple add_to_cart_button<?php echo $ajax; ?>"
    	   data-product_id="<?php echo $r->id; ?>" data-product_sku=""
    	   rel="nofollow"><?php echo $text; ?></a>
    </div>

    The script does not have to be changed.

    in reply to: Reducing Duplicate Queries #52626
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

    in reply to: Reducing Duplicate Queries #52624
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

    in reply to: How to use color picker in theme & styling section #52623
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

    in reply to: What to show if multiple categories are selected #52619
    Ernest MarcinkoErnest Marcinko
    Keymaster

    I’m afraid I can’t do that. You can make a short video if you want to, I’m more than happy to help.

    in reply to: Result page incomplete #52618
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You are very welcome!

    Usually combining 2 or more filter/searches is problematic as they want to override each other, so either results from the one or the other apply. We are doing our best to make things work together, but in many cases it’s unfortunately not doable.

    I will try to contact them in the future to see if we can do anything about it, just to be sure 🙂

    in reply to: Add to cart for a specific form #52617
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi,

    Yes, of course!

    All you have to do is modify the fist hook and function like so:

    add_filter('asp_results', 'asp_add_to_cart_data', 10, 2);
    function asp_add_to_cart_data($results, $search_id) {
    	// Apply add to cart only to search ID = 1
    	if ( $search_id != 1 ) {
    		return $results;
    	}
    
    	$product_add_to_cart_text   = 'Add to cart';
    	$variation_add_to_cart_text = 'Choose variation';   // Leave it empty to not display at all
    
    	if (class_exists("WooCommerce")) {
    		$_pf = new WC_Product_Factory();
    		foreach ($results as &$r) {
    			if (
    				$r->content_type == "pagepost" &&
    				in_array($r->post_type, array("product", "product_variation"))
    			) {
    				$product = $_pf->get_product($r->id);
    				$is_variable = $product->is_type( 'variable' ) || $r->post_type == 'product_variation';
    				$link = !$is_variable ? get_permalink(wc_get_page_id('shop')) : $product->get_permalink();
    				$ajax = !$is_variable ? ' ajax_add_to_cart' : '';
    				$text = !$is_variable ? $product_add_to_cart_text : $variation_add_to_cart_text;
    				if ( empty($text) )
    					continue;
    				ob_start();
    				?>
    				<div class="woocommerce">
    					<a href="<?php echo $link; ?>"
    					   data-quantity="1"
    					   class="button product_type_simple add_to_cart_button<?php echo $ajax; ?>"
    					   data-product_id="<?php echo $r->id; ?>" data-product_sku=""
    					   rel="nofollow"><?php echo $text; ?></a>
    				</div>
    				<?php
    				$button = ob_get_clean();
    				$r->content .= $button;
    			}
    		}
    	}
    	return $results;
    }

    This will apply the add to cart to search form with ID=1 only. You can change that on line 5 🙂

    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi!

    For that make sure to change the ordering to “Publish date descending” here: https://i.imgur.com/3a6X2t9.png
    That should do the trick 🙂

    in reply to: WooCommerce Shop Search Tutorial #52609
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Sure!

    You can use the advanced title/content fields to display the price wherever you need it.
    Also, for out of stock check this, and for hidden check this.

    I hope this helps!

    in reply to: terms filter on custom page #52608
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

    in reply to: terms filter on custom page #52606
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Yes, this should work with any filter now.

    in reply to: Select Field Styling #52603
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Great 🙂

    If you don’t mind, I will close this topic soon and mark it as resolved, feel free to open another one if you have other questions or issues.

    If you like the plugin and have not rated already, feel free to leave a rating on the wordpress plugin repository, it’s greatly appreciated.

    in reply to: Select Field Styling #52600
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi,

    Well, the only I was able to find is from this stack overflow thread. Basically this custom CSS:

    .asp_ss select {
        background: url("data:image/svg+xml,<svg height='10px' width='10px' viewBox='0 0 16 16' fill='%23000000' xmlns='http://www.w3.org/2000/svg'><path d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/></svg>") no-repeat !important;
        background-position: calc(100% - 0.75rem) center !important;
        appearance: none !important;
    }

    It should yield a very similar output to what you are looking for.

    in reply to: horizontal filters #52598
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You are very welcome and thank you for your kind words!

    We are planning to rework the back-end slowly to add more options for customization, but it’s a painfully slow process unfortunately. It will get better for sure 🙂

    If you like the plugin and have not rated already, feel free to leave a rating on the wordpress plugin repository, it’s greatly appreciated.

    I will mark this as resolved now 🙂

    in reply to: WooCommerce Shop Search Tutorial #52597
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Sure!

    You can choose the “Post titles” as the main source, which in your case is going to be the Product titles: https://i.imgur.com/ojL6am7.png

Viewing 15 posts - 1,441 through 1,455 (of 18,418 total)