Skip to content

Instantly share code, notes, and snippets.

Avatar
😎
On vacation

Pechenki AlexandrKrot

😎
On vacation
View GitHub Profile
@AlexandrKrot
AlexandrKrot / fix.html
Last active Dec 21, 2020
Position Fixed header to scroll
View fix.html
<script>
fixedHeader = () => {
this.fix = () => {
if (window.innerWidth < 768) {
window.onscroll = function () {
myFunction()
};
var header = document.querySelector(".header");
View List api and description .js
listMethod = document.querySelector('.help-page-table');
var str = [];
listMethod.querySelectorAll(' tr').forEach((index) => {
let row = [];
let td = index.querySelectorAll('td').forEach((index)=>{
var str = index.textContent.replace(/[\n\t' ']/g,'')
row.push({str})
});
str.push(row)
View Read_local_fle.js
document.getElementById('read').addEventListener('click',file=>{
readFile(document.getElementById('file'))
})
function readFile(input) {
console.log(input)
let file = input.files[0];
let reader = new FileReader();
let readerText = new FileReader();
@AlexandrKrot
AlexandrKrot / test.php
Created Dec 28, 2020
Parse string new line to Array
View test.php
<?php
$str = '/ru/rensoria62
/ru/rubi102
/ru/milton86
/ru/sorrento96
/ru/samanta164
/ru/citywood97
/ru/casablanca249
/ru/finwood236
/ru/moris163
@AlexandrKrot
AlexandrKrot / item.php
Last active Dec 29, 2020
Json Utf-8 php
View item.php
<?php
json_encode($array, JSON_UNESCAPED_UNICODE)
@AlexandrKrot
AlexandrKrot / .htaccess
Created Jan 6, 2021
Редирект с нескольких сдешей в конце
View .htaccess
RewriteCond %{THE_REQUEST} \s/+(.*?)/{2,}([^\s]*)
RewriteRule ^ %1/%2 [R=301,L,NE]
View Breadcrumb_last_remove_link.ocmod.xml
View seo_default.sql
INSERT INTO `oc_seo_url` (`store_id`, `language_id`, `query`, `keyword`) VALUES ('0', '1', 'common/home', '');
INSERT INTO `oc_seo_url` (`store_id`, `language_id`, `query`, `keyword`) VALUES ('0', '1', 'account/wishlist', 'wishlist');
INSERT INTO `oc_seo_url` (`store_id`, `language_id`, `query`, `keyword`) VALUES ('0', '1', 'account/account', 'my-account');
INSERT INTO `oc_seo_url` (`store_id`, `language_id`, `query`, `keyword`) VALUES ('0', '1', 'checkout/cart', 'shopping-cart');
INSERT INTO `oc_seo_url` (`store_id`, `language_id`, `query`, `keyword`) VALUES ('0', '1', 'checkout/checkout', 'checkout');
INSERT INTO `oc_seo_url` (`store_id`, `language_id`, `query`, `keyword`) VALUES ('0', '1', 'account/login', 'login');
INSERT INTO `oc_seo_url` (`store_id`, `language_id`, `query`, `keyword`) VALUES ('0', '1', 'account/logout', 'logout');
INSERT INTO `oc_seo_url` (`store_id`, `language_id`, `query`, `keyword`) VALUES ('0', '1', 'account/order', 'order-history');
INSERT INTO `oc_seo_url` (`store_id`, `language_i
View fix seo url служебных страниц opencart 3
elseif ($key == 'route') {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE `query` = '" . $this->db->escape($value) . "' AND store_id = '" . (int)$this->config->get('config_store_id') . "' AND language_id = '" . (int)$this->config->get('config_language_id') . "'");
if ($query->num_rows && $query->row['keyword']) {
$url .= '/' . $query->row['keyword'];
unset($data[$key]);
} else if ($data['route'] == "common/home") {
$url .= '/';
}
@AlexandrKrot
AlexandrKrot / functions.php
Last active Feb 25, 2021
add fiter shortcode telsender wc
View functions.php
<?php
/* Telsender add action*/
function meta_wc_function ($list, $order_id){
$order = wc_get_order( $order_id);
$items = $order->get_items();
$product_f = '';
foreach ( $items as $item) {