Skip to content

Instantly share code, notes, and snippets.

View eapdob's full-sized avatar

Evgenii Poperezhai eapdob

  • Kharkiv, Ukraine
View GitHub Profile
@eapdob
eapdob / unzip-archive.php
Created June 2, 2019 14:41
unzip archive in same catalog
<?php
// assuming file.zip is in the same directory as the executing script.
$file = 'schautz_01062019_after_remove_demo.zip';
// get the absolute path to $file
$path = pathinfo(realpath($file), PATHINFO_DIRNAME);
$zip = new ZipArchive;
$res = $zip->open($file);
@eapdob
eapdob / package.json
Created May 29, 2019 08:09
package json for opencart
{
"name": "opencart-gulp",
"version": "1.0.0",
"description": "",
"main": "gulpfile.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "eapdob",
"license": "ISC",
@eapdob
eapdob / gulpfile.js
Created May 29, 2019 08:08
gulp 4 for opencart
var gulp = require('gulp'),
sass = require('gulp-sass'),
browserSync = require('browser-sync'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify-es').default,
cleancss = require('gulp-clean-css'),
rename = require('gulp-rename'),
autoprefixer = require('gulp-autoprefixer'),
notify = require('gulp-notify'),
rsync = require('gulp-rsync'),
@eapdob
eapdob / header.php
Created May 5, 2019 13:56
some optimization for loading categories
/* header optimization */
$data['categories'] = array();
$result_all_categories = $this->cache->get('octemplates.module_all_category.' . (int)$this->config->get('config_language_id') . '.' . (int)$this->config->get('config_store_id') . '.' . $this->config->get('config_customer_group_id'));
if (!$result_all_categories) {
$categories = $this->model_catalog_category->getCategories(0);
foreach ($categories as $category) {
@eapdob
eapdob / jquery.leanModal.min
Created April 29, 2019 10:49
leanModal custom animation
// leanModal v1.1 by Ray Stone - http://finelysliced.com.au
// Dual licensed under the MIT and GPL
(function ($) {
$.fn.extend({
leanModal: function (options) {
var defaults = {top: 100, overlay: 0.5, closeButton: null};
var overlay = $("<div id='lean_overlay'></div>");
$("body").append(overlay);
options = $.extend(defaults, options);
@eapdob
eapdob / Delete all products
Created April 14, 2019 13:18
Delete all products from opencart
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)
LEFT JOIN oc_product_image t5 ON(t1.product_id=t5.product_id)
LEFT JOIN oc_product_option t6 ON(t1.product_id=t6.product_id)
LEFT JOIN oc_product_option_value t7 ON(t1.product_id=t7.product_id)
LEFT JOIN oc_product_related t8 ON(t1.product_id=t8.product_id)
LEFT JOIN oc_product_reward t9 ON(t1.product_id=t9.product_id)
@eapdob
eapdob / header.tpl
Created April 9, 2019 23:36
remove lost photos - 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 / yml_ocext_dmpro
Last active June 6, 2019 18:36
all yml data pro - import by offer id -> options & seo (Techstore)
<?php
class ModelToolYMLOcextDMPRO extends Model {
protected $registry;
private $categories = array();
public function __construct($registry) {
$this->registry = $registry;
}
@eapdob
eapdob / discount-options.js
Created January 13, 2019 03:09
discount options for opencart
$(function() {
// get first value
let firstDiscountRadio = $(".product-discount-radio").first();
let firstDiscountValue = Number(firstDiscountRadio.val());
// init counting variables
let standartValue = firstDiscountValue;
let stage = false;
// condition for standart value
@eapdob
eapdob / category.php
Last active December 12, 2018 16:05
4 Level category opencart
$categories = $this->model_catalog_category->getCategories(0);
// Level 1
foreach ($categories as $category) {
if ($category['top']) {
// Level 2
$children_data = array();
$children = $this->model_catalog_category->getCategories($category['category_id']);