Forum Replies Created
-
AuthorPosts
-
Ernest Marcinko
KeymasterI 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.
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterI’m afraid I can’t do that. You can make a short video if you want to, I’m more than happy to help.
Ernest Marcinko
KeymasterYou 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 🙂
Ernest Marcinko
KeymasterHi,
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 🙂
January 23, 2025 at 2:18 pm in reply to: La página de resultados no ordena cronológicamente por fecha #52610Ernest Marcinko
KeymasterHi!
For that make sure to change the ordering to “Publish date descending” here: https://i.imgur.com/3a6X2t9.png
That should do the trick 🙂Ernest Marcinko
KeymasterSure!
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!
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterYes, this should work with any filter now.
Ernest Marcinko
KeymasterGreat 🙂
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.
Ernest Marcinko
KeymasterHi,
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.
Ernest Marcinko
KeymasterYou 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 🙂
Ernest Marcinko
KeymasterSure!
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
-
AuthorPosts