Skip to content

Instantly share code, notes, and snippets.

View PechenkiUA's full-sized avatar
💭
On vacation

Pechenki PechenkiUA

💭
On vacation
View GitHub Profile
@PechenkiUA
PechenkiUA / functions.php
Created October 24, 2023 19:14
decode images file wc
<?php
add_filter('tscf_filter_codetemplate', function ($list, $order_id) {
$order = wc_get_order($order_id);
$file = get_post_meta($order->get_id(), '_billing_upload_main', true);
$file_path = '';
if ($file) {
$file_arr = json_decode($file,true);
@PechenkiUA
PechenkiUA / mc.ps1
Last active October 17, 2023 06:34
Builder Opencart module Power shell
function run {
param (
[string] $startFolder = $PWD.Path,
[string] $archiveName = "archive.zip",
[string] $targetFileName = "*.php"
)
# Path to the log file
$logFilePath = "log.txt"
@PechenkiUA
PechenkiUA / coder_simpla_addres_fix.ocmod.xml
Last active October 11, 2023 13:20
address filter relative to the delivery method
<modification>
<code>coder_simpla_addres_fix</code>
<name>coder_simpla_addres_fix</name>
<version>1.0</version>
<author>coder</author>
<file path="catalog/controller/account/address.php">
<operation>
<search><![CDATA[
private $error = array();
@PechenkiUA
PechenkiUA / deleteEmptyLine.php
Created October 7, 2023 10:27
Видаляємо не заповнені стрічки Simpla opencart в адресі
<?php
$text = <<<HTML
Населений пункт: Львов
Відділення "Нова Пошта": Отделение №1: ул. Городоцкая, 359
Вулиця: ulica1
Номер будинку: dom2
Номер квартири: okal3
HTML;
@PechenkiUA
PechenkiUA / coder_mf_price_fix.ocmod.xml
Created October 4, 2023 10:58
Мегафільтр разні ціни у фільтрації
<?xml version="1.0" encoding="utf-8"?>
<modification>
<name>coder_mf_price_fix</name>
<code>coder_mf_price_fix</code>
<version>0.1</version>
<date>4.10.2022</date>
<author>Autor</author>
<link>https://google.com</link>
<file path="system/library/mfilter_core.php">
@PechenkiUA
PechenkiUA / Opencart
Created September 28, 2023 13:34
megafilter.sql
SELECT
MIN(`price_tmp`) AS `p_min`,
MAX(`price_tmp`) AS `p_max`
FROM
(
SELECT
CASE WHEN cena1 IS NOT NULL THEN cena1 WHEN opt IS NOT NULL THEN opt ELSE price_tmp END AS price_tmp
FROM
(
SELECT
<?php
/*
* тестова функція WC для відображення адреси замовлення
*
*/
function tscf_wc_shipping_address_function($list, $order_id){
$order = wc_get_order( $order_id);
@PechenkiUA
PechenkiUA / merchants_google.xml
Created April 27, 2023 11:44
merchants_google modx minishop 2
<?xml version="1.0"?>
<feed xmlns:g="http://base.google.com/ns/1.0" xmlns="http://www.w3.org/2005/Atom">
<title>Оздоровча cкандінавская ходьба</title>
<link href="[[~1?scheme=`full`]]uk" rel="alternate" type="text/html"/>
<description>[[*description:cdata]]</description>
[[!msProducts?
&includeContent=`1`
&parents=`89`
&limit=`999`
&includeTVs=`img`
@PechenkiUA
PechenkiUA / article
Created April 7, 2023 09:38
getJSONLD article
<?php
// если на этой странице контент не является объектом "Article", то завершаем работу (на сайте статьи имеют шаблон с id = 2)
if ($modx->resource->get('template') !== 7) {
return;
}
// URL сайта
$siteUrl = $modx->getOption('site_url'); //$modx->getOption('http_host'); //$modx->getOption('site_url');
// id страницы
$id = $modx->resource->get('id');
@PechenkiUA
PechenkiUA / Productld
Created April 7, 2023 09:36
minishop2 modx schema.org Product
<script type="application/ld+json">
{
"@context": "https://schema.org/",
"@type": "Product",
"name": "[[*pagetitle]]",
"image": "[[*image]]",
"description": "[[*introtext:strip_tags:escape:notags]]",
"sku": "[[+id]]",
"brand": {
"@type": "Brand",