sunnysash
Forum Replies Created
-
Forum: Plugins
In reply to: [Fixed Widget and Sticky Elements for WordPress] Sidebar is still jumpingHey,
I added the code directly to http://schwabenfotografie.de/?sccss=1&ver=4.7.3 but it looks like it doesn’t overwrite existing code.
If I modify the code directly in http://schwabenfotografie.de/wp-content/themes/Avada/assets/css/style.min.css?ver=5.0.6 the jumping ends.Do I really have to edit the style within style.min.css?
Forum: Plugins
In reply to: [Fixed Widget and Sticky Elements for WordPress] Sidebar is still jumpingThe code was disabled for a second. I actived those rows again. But I think there is no improvment on the site..
Forum: Plugins
In reply to: [Fixed Widget and Sticky Elements for WordPress] Sidebar is still jumpingThank you for your reply. Of course I applied both changes simultaneously.
@lorro: I think I found a solution. Maybe not the best and smartest, but it is working. At the moment…
In functions.php I created a new shortcode (with your help):
add_shortcode('product_stock', 'product_stock'); function product_stock( $atts ) { if ( ! $atts['id'] ) { return ''; } $product = get_product($atts['id']); $numleft = $product->get_stock_quantity(); $link = 'http://mywebsite.de/?add-to-cart='.$atts['id']; /*Original: return (int) $product->stock;*/ if ($numleft == 0) { return '<a><span>' . "Sold out" . '</span></a>'; } /*return ("<font color=\"blue\">Buchen!</font>");*/ return '<a href="'.$link.'"><span>' . "BUY ME" . '</span></a>'; }Also edit custom buttons for mybutton/mybutton2 in css.
What do you think? Is that a good way?
@lorro: I know that is not the best way to edit core files. I will do all my changes to a child theme, when i solved the problem.
I added your shortcode to functions.php
If I use [product_stock id=”xyz”] the result will be a 0 if the product is out of stock.Is there a way to write a small function or text (within fusion builder) to do the following:
If {
[product_stock id=”xyz”] > 0 Then SHOW_CUSTOM_BUTTON1 ELSE SHOW_CUSTOM_BUTTON2
}@lorro: Thank you again. Sorry, that my developer skills are at a beginner level. I try to study fast.
I checked out the plugin. But I think this is not what I am looking for.
Your indication with class-wp-shortcodes.php was good!In the meantime I worked out something else. In class-wc-product-simple.php you can find the following:
public function add_to_cart_text() {
$text = $this->is_purchasable() && $this->is_in_stock() ? __( ‘Add to cart’, ‘woocommerce’ ) : __( ‘Read more’, ‘woocommerce’ );return apply_filters( ‘woocommerce_product_add_to_cart_text’, $text, $this );
}Replacing ‘Read more’ in ‘Sold out!’ was what I am looking for.
Two more things and I am happy! Maybe you can help me again?
1. I like to remove the link/href from that button to the product page, if the product is sold out.
2. I like to change the color of the button, if the product is ‘sold out’.@lorro: thank you for your quick response. I tried to follow your description, but I wasn’t able to follow all the steps.
I found the “function product_add_to_cart” in class-wp-shortcodes.php
Within this code I found: ‘quantity’ => ‘1’
What happens, if quantity is less 1? This is what I am interested in, isn’t it?Can you please give me a more detailed instructions, where to put the different code lines?
Thank you so much! 🙂