Skip to content

Instantly share code, notes, and snippets.

View eapdob's full-sized avatar

Evgenii Poperezhai eapdob

  • Kharkiv, Ukraine
View GitHub Profile
#!/bin/bash
# Adding php wrapper
user="$1"
domain="$2"
ip="$3"
home_dir="$4"
docroot="$5"
wrapper_script="#!/bin/sh
PHPRC=/usr/local/lib
@eapdob
eapdob / import.php
Created January 29, 2021 23:07
import tool example
<?php
class ModelToolYMLOcextDMPRO extends Model
{
protected $registry;
private $categories = array();
public function __construct($registry)
@eapdob
eapdob / relocateToCategoryId.js
Last active June 24, 2020 17:36
js relocate to category id
$(function() {
let _window = $(window);
_window.on("resize", function() {
if (window.innerWidth <= 992) {
if (window.location.pathname = '/') {
let categoryId = '123';
window.location.href = '/index.php?route=product/category&category_id=' + categoryId;
}
}
});
@eapdob
eapdob / sg-script.php
Last active June 7, 2020 20:22
opencart-translate-create-seo-urls
<?php
class ControllerToolTranslate extends Controller
{
private $yandexApi;
public function __construct($registry)
{
parent::__construct($registry);
@eapdob
eapdob / lemp-bash.sh
Last active May 9, 2021 11:01
nginx-bash
#!/bin/bash
# ssh
sudo apt-get update;
sudo apt-get install openssh-server;
sudo service ssh start;
sudo update-rc.d ssh defaults;
# nginx
sudo apt-get install nginx;
@eapdob
eapdob / header.php
Created June 10, 2019 20:55
script for removing lost photos in opencart
public function scan_Dir($dir) {
$dir = str_replace("//", "/", $dir);
$arrfiles = array();
if (is_dir($dir)) {
if ($handle = opendir($dir)) {
chdir($dir);
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (is_dir($file)) {
$arr = $this->scan_Dir($file);
@eapdob
eapdob / remove all opencart products
Created June 8, 2019 20:36
remove all opencart products - sql
DELETE t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15
FROM `oc_product` t1
LEFT JOIN `oc_product_attribute` t2 ON(t1.product_id=t2.product_id)
LEFT JOIN `oc_product_description` t3 ON(t1.product_id=t3.product_id)
LEFT JOIN `oc_product_discount` t4 ON(t1.product_id=t4.product_id)
@eapdob
eapdob / cron
Created June 8, 2019 20:31
cron task hostpro - wget
/usr/bin/wget -O - -q -t 1 'https://mixtools.com.ua/index.php?route=feed/ocext_feed_generator_yamarket&token=31082'
@eapdob
eapdob / zipping.php
Created June 8, 2019 20:19
zip catalog
<?php
ini_set('max_execution_time', 600);
ini_set('memory_limit','1024M');
// Start the backup!
zipData('public_html', 'backup.zip');
echo 'Finished.';
// Here the magic happens :)
function zipData($folder, $zipTo) {
if (extension_loaded('zip') === true) {
@eapdob
eapdob / discount_interactive.xml
Last active May 23, 2021 18:57
discount interactive
<?xml version="1.0" encoding="utf-8"?>
<modification>
<name>Product discount options</name>
<version>1.0.0</version>
<link>https://e-m.com.ua</link>
<author>em</author>
<code>product_discount_options</code>
<file path="catalog/model/catalog/product.php">
<operation error="skip">
<search><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_discount WHERE product_id = '" . (int)$product_id . "' AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND quantity > 1 AND ((date_start = '0000-00-00' OR date_start < NOW()) AND (date_end = '0000-00-00' OR date_end > NOW())) ORDER BY quantity ASC, priority ASC, price ASC");]]></search>