Skip to content

Instantly share code, notes, and snippets.

View iledcom's full-sized avatar

Konstantyn iledcom

View GitHub Profile
@iledcom
iledcom / Drupal7 concluded the "add to cart"
Created September 7, 2015 11:05
Drupal7 concluded the "add to cart"
<?php
$form_id
= commerce_cart_add_to_cart_form_id(array($product->product_id));
$line_item = commerce_product_line_item_new($product);
$line_item->data['context']['product_ids'] = array($product->product_id);
$form = drupal_get_form($form_id, $line_item);
// render your $form somewhere
?>
@iledcom
iledcom / Drupal 7 foreach node one type of material
Created September 14, 2015 15:16
Drupal 7 foreach node one type of material
<?php
// for example node type = product_display
$type = 'product_display';
$nodes = node_load_multiple(array(), array('type' => $type));
foreach ($nodes as $node){
$title = $node->title;
print $title;
}
?>
@iledcom
iledcom / WordPress get_bloginfo('name')
Created September 16, 2015 09:22
WordPress get_bloginfo('name')
<?php echo get_bloginfo('name');?>
@iledcom
iledcom / WordPress get_bloginfo('description')
Created September 16, 2015 09:22
WordPress get_bloginfo('description')
<?php echo get_bloginfo('description');?>
@iledcom
iledcom / PHP message handler: sendmail.php
Created September 22, 2015 15:21
PHP message handler: sendmail.php
file: sendmail.php
<?php
session_start();
if (isset($_POST["send"])) {
$from = $_POST["from"];
$to = $_POST["to"];
$subject = $_POST["subject"];
$message = $_POST["message"];
$_SESSION["from"] = $from;
$_SESSION["to"] = $to;
@iledcom
iledcom / The third level of the categories in the main menu opencart 1.5
Last active August 26, 2016 07:41
OpenCart. The third level of the categories in the main menu
//3 level
//*** Получаем список подкгатегорий для каждой категории второго уровня
$subchildren = $this->model_catalog_category->getCategories($child['category_id']);
//*** Обнуляем массив для каждого набора подкатегорий вторго уровня
$subchildren_data = array();
//*** Получаем список подкгатегорий для каждой категории второго уровня
foreach ($subchildren as $subchild) {
@iledcom
iledcom / Drupal 7 URL taxonomy term
Created November 19, 2015 16:03
Drupal 7 URL taxonomy term
$url = drupal_lookup_path('alias', 'taxonomy/term/'.$known_tid, $lang_code);
@iledcom
iledcom / Категории третьего уровня в OpenCart2
Last active June 16, 2017 07:46
Категории третьего уровня в OpenCart2
Меняем в файле /home/ohranactr/public_html/catalog/controller/common/header.php
это:
foreach ($children as $child) {
$filter_data = array(
'filter_category_id' => $child['category_id'],
'filter_sub_category' => true
);
$children_data[] = array(
@iledcom
iledcom / expand abbreviation by tab
Created December 19, 2016 15:28
Emmet for sublimetext 3 ul>li
{ "keys": ["tab"], "command": "expand_abbreviation_by_tab", "context":
[
{
"operand": "source.css, source.sass, source.less, source.scss, source.stylus, source.postcss, source.jade, text.jade, text.slim, text.xml, text.html - source, text.haml, text.scala.html, source string",
"operator": "equal",
"match_all": true,
"key": "selector"
},
{
"operand": "storage.type.templatetag.django",
@iledcom
iledcom / Fixed menu jQuery
Last active February 15, 2017 10:17
Fixed menu (a selector) when the page scrolls
//common.js
$(function() {
$(window).scroll(function() {
var the_top = $(document).scrollTop();
if (the_top > 1) {
$('.site-navigation-wrap').addClass('fixed-menu');
}
else {
$('.site-navigation-wrap').removeClass('fixed-menu');
}