This file contains hidden or 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
var indexOf = function (arr, id) { | |
for(var idx = 0, l = arr.length;arr[idx] && arr[idx].title !== id;idx++); | |
return idx === l ? -1 : idx; | |
}; |
This file contains hidden or 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
убрать кэш |
This file contains hidden or 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
<?php | |
function proccess_add_attribute($attribute) | |
{ | |
global $wpdb; | |
// check_admin_referer( 'woocommerce-add-new_attribute' ); | |
if (empty($attribute['attribute_type'])) { $attribute['attribute_type'] = 'text';} | |
if (empty($attribute['attribute_orderby'])) { $attribute['attribute_orderby'] = 'menu_order';} |
This file contains hidden or 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
<?php | |
add_action('init', 'generate_taxonomy_product'); | |
function generate_taxonomy_product($value=''){ | |
$my_product_attributes = array('hdd1' => 'qqqqqq', 'ram2' => 'wwwwwww'); | |
wcproduct_set_attributes(10807, $my_product_attributes); | |
} | |
This file contains hidden or 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
<?php | |
$args = array( | |
'post_type' => array( 'product_variation',), | |
// 'post_status' => array( //(string / array) - use post status. Retrieves posts by Post Status, default value i'publish'. | |
// // 'publish', // - a published post or page. | |
// // 'pending', // - post is pending review. |
This file contains hidden or 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
<?php | |
add_action('init', 'update_attributes_variation_product'); | |
function add_variation_product($post_id){ | |
$cars = array('c1', 'c2', 'c3' ); | |
$info = array('ww' ); | |
$att_all = []; | |
$att_all['car'] = $cars; | |
$att_all['info'] = $info; |
This file contains hidden or 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
<?php | |
// add_action('woocommerce_before_add_to_cart_button','wdm_add_custom_fields'); | |
add_filter('woocommerce_add_cart_item_data','wdm_add_item_data',10,3); | |
add_filter('woocommerce_get_item_data','wdm_add_item_meta',10,2); | |
add_action( 'woocommerce_checkout_create_order_line_item', 'wdm_add_custom_order_line_item_meta',10,4 ); | |
function wdm_add_custom_fields() | |
{ |
This file contains hidden or 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
<?php | |
// /включать wp-load.php | |
if(!defined(ABSPATH)){ | |
$pagePath = explode('/wp-content/', dirname(__FILE__)); | |
include_once(str_replace('wp-content/' , '', $pagePath[0] . '/wp-load.php')); | |
} |
This file contains hidden or 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
<?php | |
/** | |
* Delete old LOG files | |
*/ | |
$path = $this_dir . '/logs/'; | |
$days = 90; | |
// Open the directory | |
if ($handle = opendir($path)) { | |
// Loop through the directory |
This file contains hidden or 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
<?php | |
foreach ($product_list as $data) { | |
// код 1С; артикул (ориентироватья ненадо); 0 нет в наличии > 0 в наличии; цена | |
$sku = trim($data[0]); // код 1С | |
$sku = $data[1]; // артикул (ориентироватья ненадо) | |
$quantity = $data[2]; // нет в наличии > 0 в наличии | |
$price = $data[3]; // цена | |
$found = false; |