This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//событие подмены нужной цены для покупки услуг | |
AddEventHandler("catalog", "OnGetOptimalPrice", 'OnGetOptimalPriceHandler'); | |
function OnGetOptimalPriceHandler($productID) | |
{ | |
//получаем id инфоблока покупаемого товара. Если это услуга, то подменяем цену. | |
$db_iblock = CIBlockElement::GetList(array(), array("ID" => $productID), false, false, array("IBLOCK_ID")); | |
$iblock = $db_iblock->Fetch(); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# class Post < ActiveRecord::Base | |
# #code | |
# end | |
# | |
# class Backend::Post < Post # we don't want to define it in each model file. | |
# end | |
module Backend | |
def self.const_missing(klass) | |
klass = klass.to_s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TransportAdvertisment < ActiveRecord::Base | |
# fields, for sorting in view (name => order_by field) | |
SORTING_FIELDS = { | |
'Город' => 'cities.title', | |
'Пробег' => 'mileage', | |
'Объем' => 'capacity', | |
'Цена' => 'price' | |
} | |
PRICE = 100 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PartAdvertisment < ActiveRecord::Base | |
# fields, for sorting in view (name => order_by field) | |
SORTING_FIELDS = { | |
'Город' => 'cities.title', | |
'Модель' => 'transport_models.title', | |
' ' => ' ', # gap | |
'Цена' => 'price' | |
} | |
# Advertisment-related behaviour. see lib/behaviours/advertisable.rb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Frontend::CommonController < ApplicationController | |
before_action :set_ig_user, except: [:auth, :login, :logout] | |
before_action :create_cart | |
# Set custom layout | |
layout 'frontend' | |
def index | |
@catalog_items = CatalogueItem.published.to_a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.updateKitCount = (etalon_kit) -> | |
# update kit total_count, if number of chosen photos > than kit | |
current_count = parseInt($('#js-kit-counter .count').text()) | |
total_count = parseInt($('#js-kit-counter .all').text()) | |
if current_count > total_count | |
$('#js-kit-counter .all').text(total_count + etalon_kit) | |
window.initSortablePhotos = (el = '#sortable') -> | |
# sortable photos | |
$(el).sortable( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Это копия стандартного sails blueprint destroy action | |
// за исключением того, что по дефолту вызывается .meta(fetch: true) | |
// для того, чтобы вызывались afterDestroy колбеки моделей. | |
// переопределение возможно за счет пакета https://github.com/sgress454/sails-hook-custom-blueprints | |
// подробней в моем issue https://github.com/balderdashy/sails/issues/4476 | |
// Если issue пофиксят в мою пользу, то это переопределение можно будет убрать | |
var _ = require('@sailshq/lodash'); | |
module.exports = function destroyOneRecord (req, res) { | |
var parseBlueprintOptions = req.options.parseBlueprintOptions || req._sails.config.blueprints.parseBlueprintOptions; |