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
/* Меняем шрифт на Google Fonts */ | |
add_action( 'storefront_header', 'add_google_fonts_storefront_header', 40 ); | |
function add_google_fonts_storefront_header() { | |
?> | |
<link rel="preconnect" href="https://fonts.googleapis.com"> | |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | |
<link href="https://fonts.googleapis.com/css2?family=Roboto+Flex:opsz,wght@8..144,200;8..144,300;8..144,400;8..144,500;8..144,600&display=swap" rel="stylesheet"> | |
<?php | |
} |
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
import csv | |
import requests | |
import json | |
def get_json(): | |
url = "https://www.ozon.ru/api/composer-api.bx/page/json/v2" \ | |
"?url=/product/avtomaticheskaya-kofemashina-inhouse-rozhkovaya-coffee-arte-icm1507-seryy-397529235/" | |
response = requests.get(url=url) | |
with open('ozon_1.json', 'w', encoding='utf-8') as file: |
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( 'get_header', 'remove_storefront_sidebar' ); | |
function remove_storefront_sidebar() { | |
if (is_product_category() ) { | |
global $wp_query; | |
$cat_obj = $wp_query->get_queried_object(); | |
$category_parent = $cat_obj->parent; | |
if ( $category_parent == 0) { | |
remove_action( 'storefront_sidebar', 'storefront_get_sidebar', 10 ); | |
?> |
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
import urllib.parse | |
import requests | |
def get_phone(offer_id): | |
"""offer_id - ID объявления""" | |
params = ( | |
('key', 'af0deccbgcgidddjgnvljitntccdduijhdinfgjgfjir'), | |
) |
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_filter( 'woocommerce_subcategory_count_html', 'woo_remove_category_products_count' ); | |
function woo_remove_category_products_count() { | |
return; | |
} |
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
import csv | |
from pathlib import Path | |
import requests | |
from transliterate import slugify | |
def download_image(image_url, image_name): | |
# получаем расширение файла изображения из url | |
# и добавлем его к имени изображения | |
image_name += Path(image_url).suffix |
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
import requests | |
def send_telegram(text: str): | |
token = 'token' | |
url = "https://api.telegram.org/bot" | |
channel_id = 'channel_id' | |
url += token | |
method = url + "/sendMessage" |
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_filter( 'woocommerce_loop_add_to_cart_link', 'quantity_inputs_for_woocommerce_loop_add_to_cart_link', 10, 2 ); | |
function quantity_inputs_for_woocommerce_loop_add_to_cart_link( $html, $product ) { | |
if ( $product && $product->is_type( 'simple' ) && $product->is_purchasable() && $product->is_in_stock() && ! $product->is_sold_individually() ) { | |
$html = '<form action="' . esc_url( $product->add_to_cart_url() ) . '" class="cart" method="post" enctype="multipart/form-data">'; | |
$html .= woocommerce_quantity_input( array(), $product, false ); | |
$html .= '<button type="submit" class="button alt">' . esc_html( $product->add_to_cart_text() ) . '</button>'; | |
$html .= '</form>'; | |
} | |
return $html; |
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
{"_id":"avito","startUrl":["https://www.avito.ru/krasnodar/kvartiry/sdam/na_dlitelnyy_srok/2-komnatnye-ASgBAQICAkSSA8gQ8AeQUgFAzAgUkFk?cd=1&p=[1-6]"],"selectors":[{"delay":0,"id":"adv","multiple":true,"parentSelectors":["_root"],"selector":"div.iva-item-list-H_dpX","type":"SelectorElement"},{"delay":0,"id":"link","multiple":false,"parentSelectors":["adv"],"selector":"a.link-link-MbQDP[itemprop='url']","type":"SelectorLink"},{"delay":0,"id":"price","multiple":false,"parentSelectors":["adv"],"regex":"","selector":"span.price-text-E1Y7h","type":"SelectorText"}]} |
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', 'show_attr_singe_product', 21 ); | |
function show_attr_singe_product() { | |
global $product; | |
// Получаем элементы таксономии атрибута color | |
$attribute_names = get_the_terms($product->get_id(), 'pa_color'); | |
$attribute_name = "pa_color"; | |
if ($attribute_names) { |