This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'woocommerce_display_product_attributes', 'woo_custom_variation_display', 12 ); | |
function woo_custom_variation_display( $product_attributes ) { | |
global $product; | |
// make sure this is a variable product. If not, return | |
if ( ! $product->is_type( 'variable' ) ) return; | |
if ( isset( $product_attributes[ 'attribute_pa_color' ] ) ) { | |
$variations = $product->get_available_variations( 'object' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'woocommerce_single_product_summary', 'woo_custom_editor_block_field_display', 12 ); | |
function woo_custom_editor_block_field_display() { | |
global $product; | |
$example_block_property = $product->get_meta( 'example_block_property' ); | |
if ( empty ( $example_block_property ) ) return; | |
echo sprintf( __( 'Example Block Property: %s', 'astra-child' ), $example_block_property ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Automattic\WooCommerce\Admin\BlockTemplates\BlockInterface; | |
if ( ! function_exists( 'woo_prod_editor_custom_add_block' ) ) { | |
/** | |
* Add a new block to the template after the product name field. | |
* | |
* @param BlockInterface $product_name_field The product name block. | |
*/ | |
function woo_prod_editor_custom_add_block( BlockInterface $product_name_field ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT t.id, t.start_segment, t.end_segment, | |
SUM(t.one_lag) OVER(ORDER BY t.id ASC) AS rolling_sum | |
FROM | |
(SELECT | |
id, start_segment, end_segment, | |
IFNULL(LAG(segment_length, 1) OVER(ORDER BY id ASC), 0) AS one_lag | |
FROM coords_measure) AS t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT t.id, t.start_segment, t.end_segment, | |
SUM(t.one_lag) OVER(ORDER BY t.id ASC) AS rolling_sum | |
FROM | |
(SELECT | |
id, start_segment, end_segment, | |
LAG(segment_length, 1) OVER(ORDER BY id ASC) AS one_lag | |
FROM coords_measure) AS t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
id, start_segment, end_segment, | |
SUM(LAG(segment_length, 1) OVER(ORDER BY id ASC)) OVER(ORDER BY id ASC) AS one_lag | |
FROM coords_measure; | |
Error Code: 3593. You cannot use the window function 'lag' in this context. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
id, start_segment, end_segment, | |
LAG(segment_length, 1) OVER(ORDER BY id ASC) AS one_lag | |
FROM coords_measure; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
id, start_segment, end_segment, | |
SUM(segment_length) OVER(ORDER BY id ASC) AS rolling_sum | |
FROM coords_measure; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql> SELECT last_update, DATE(last_update) | |
-> FROM category | |
-> LIMIT 5; | |
+---------------------+-------------------+ | |
| last_update | DATE(last_update) | | |
+---------------------+-------------------+ | |
| 2006-02-15 04:46:27 | 2006-02-15 | | |
| 2006-02-15 04:46:27 | 2006-02-15 | | |
| 2006-02-15 04:46:27 | 2006-02-15 | | |
| 2006-02-15 04:46:27 | 2006-02-15 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT category_id, name | |
FROM category | |
WHERE category_id NOT BETWEEN 1 AND 5; |
NewerOlder