• Как рекурсивно скопировать директорию в папки?

    @anriko Автор вопроса
    hint000, взять папку /optimaservis.ru/public_html/yamochnyi-remont/
    и скопировать
    /ekb/public_html/yamochnyi-remont/, yamochnyi-remont этой папки пока нету ее надо добавить
    /spb/public_html/yamochnyi-remont/ yamochnyi-remont этой папки пока нету ее надо добавить
    /tver/public_html/yamochnyi-remont/ yamochnyi-remont этой папки пока нету ее надо добавить
    /ufa/public_html/yamochnyi-remont/ yamochnyi-remont этой папки пока нету ее надо добавить
  • Как скрыть онлайн оплату картой для весовых товаров?

    @anriko Автор вопроса
    Роман Грицук, а как это работает тогда в базовом кампоненте битрикс для доставки? или Shipment это объект доставки?
  • Как скрыть онлайн оплату картой для весовых товаров?

    @anriko Автор вопроса
    Роман Грицук, почему тогда мой не работал ? что то не подключил ?
    я проверял приходит ли он в check но первый параметр был пуст
    protected static function extractParams(Entity $entity)
      {
        if (!($entity instanceof Shipment))
          return false;
    
        return $entity->getWeight();
      }
    
    public static function check($weight, array $restrictionParams, $serviceId = 0)
        {
             file_put_contents('/var/www/www-root/data/www/shop.mercury-market.ru/bitrix/php_interface/classes/restrictions/log.php', print_r($weight, true));
  • Как скрыть онлайн оплату картой для весовых товаров?

    @anriko Автор вопроса
    anriko, да все заработало спасибо ,только не понимаю как работает это function check($measures, array $restrictionParams, $serviceId = 0) мы же ее негде не вызываем и не передаем параметры ?
  • Как скрыть онлайн оплату картой для весовых товаров?

    @anriko Автор вопроса
    Роман Грицук, а почему надо регистрировать единицы измерения ведь в товаре они и так есть?
    bitrix/admin/cat_measure_edit.php?lang=ru , тут они есть пересохранил их

    тут тоже есть bitrix/admin/perfmon_table.php?lang=ru&table_name=b_catalog_measure
    единицы измерения появились в ограничениях
  • Как скрыть онлайн оплату картой для весовых товаров?

    @anriko Автор вопроса
    Роман Грицук, а как сам код поправить чтобы небыло алерта, не дает сделать выбор
  • Как скрыть онлайн оплату картой для весовых товаров?

    @anriko Автор вопроса
    anriko,
    подключил его так
    $bxEventManager->addEventHandler(
        'sale',
        'onSalePaySystemRestrictionsClassNamesBuildList',
        'onCheckMeasure'
        
    );
      function onCheckMeasure()
        {
            $fPayments = '/bitrix/php_interface/classes/restrictions/measure.php';
    
            return new \Bitrix\Main\EventResult(
                \Bitrix\Main\EventResult::SUCCESS,
                array(
                    '\ByMeasure' => $fPayments,         
                )
            );
        }


    и в /bitrix/php_interface/classes/restrictions/measure.php' пришлось убрать нем спейс не работатало
  • Как скрыть онлайн оплату картой для весовых товаров?

    @anriko Автор вопроса
    Роман Грицук, поправил должна быть ,там алерт где написано единицы измерения Array после из выбора в окне ограничений ,в самих единицах измерения вместо кг ,1,2,3,4
  • Как скрыть онлайн оплату картой для весовых товаров?

    @anriko Автор вопроса
    Роман Грицук, ваш код ставил выглядит вот так 151z194,
    60c1c7a25855b281488072.png
    но сообщение вылетает поле единиц измерения Array, как доработать чтобы были кг ?
    выбрал все вот так получилось
    60c1c82c49016606822229.png
  • Как скрыть онлайн оплату картой для весовых товаров?

    @anriko Автор вопроса
    Роман Грицук, тогда поясни я не понимаю как сюда попадает $measures
    function check($measures, array $restrictionParams, $serviceId = 0)


    и //bitrix/php_interface/init.php я подключал так
    $eventManager2 = \Bitrix\Main\EventManager::getInstance();
    $eventManager2->addEventHandler(
        'sale',
        'onSalePaySystemRestrictionsClassNamesBuildList',
        'onCheckRulePayment'
    );
     function onCheckRulePayment()
        {
             
              $fPayments = '/bitrix/php_interface/classes/restrictions/payments.php';
    
            return new \Bitrix\Main\EventResult(
                \Bitrix\Main\EventResult::SUCCESS,
                array(
                 
                    '\checkvesovie' => $fPayments,         // по скидкам
                )
            );
    
          
            );
        }
  • Как скрыть онлайн оплату картой для весовых товаров?

    @anriko Автор вопроса
    Роман Грицук , оно у меня в админке появилось ,ограничения там проставил но в эту функцию не попадает вес товаров из оформления заказа function check($weight, array $restrictionParams, $deliveryId = 0),я ее скопировал с ограничения по весу доставки ,но там она работает тут нет
    /bitrix/modules/sale/lib/delivery/restrictions/byweight.php тут оригинал
  • Почему на внутренних разделах каталога 404?

    @anriko Автор вопроса
    <?php
    $arUrlRewrite=array (
      32 => 
      array (
        'CONDITION' => '#^/https://sirius-electro.ru/catalog/avtomatika_nva/filter/nomin_tok-is-10/apply/#',
        'RULE' => 'ls=107282',
        'ID' => '',
        'PATH' => '/catalog/index.php',
        'SORT' => 100,
      ),
      3 => 
      array (
        'CONDITION' => '#^/bitrix/services/ymarket/([\\w\\d\\-]+)?(/)?(([\\w\\d\\-]+)(/)?)?#',
        'RULE' => 'REQUEST_OBJECT=$1&METHOD=$4',
        'ID' => '',
        'PATH' => '/bitrix/services/ymarket/index.php',
        'SORT' => 100,
      ),
      43 => 
      array (
        'CONDITION' => '#^/https://sirius-electro.ru/catalog/schneider_electric/#',
        'RULE' => 'ls=107317',
        'ID' => '',
        'PATH' => '/catalog/index.php',
        'SORT' => 100,
      ),
      42 => 
      array (
        'CONDITION' => '#^/https://sirius-electro.ru/catalog/domovoy#',
        'RULE' => 'ls=254',
        'ID' => '',
        'PATH' => '/catalog/index.php',
        'SORT' => 100,
      ),
      41 => 
      array (
        'CONDITION' => '#^/https://sirius-electro.ru/catalog/tdm/#',
        'RULE' => 'ls=256',
        'ID' => '',
        'PATH' => '/catalog/index.php',
        'SORT' => 100,
      ),
      4 => 
      array (
        'CONDITION' => '#^/personal/history-of-orders/#',
        'RULE' => '',
        'ID' => 'bitrix:sale.personal.order',
        'PATH' => '/personal/history-of-orders/index.php',
        'SORT' => 100,
      ),
      0 => 
      array (
        'CONDITION' => '#^\\/?\\/mobileapp/jn\\/(.*)\\/.*#',
        'RULE' => 'componentName=$1',
        'ID' => NULL,
        'PATH' => '/bitrix/services/mobileapp/jn.php',
        'SORT' => 100,
      ),
      2 => 
      array (
        'CONDITION' => '#^/bitrix/services/ymarket/#',
        'RULE' => '',
        'ID' => '',
        'PATH' => '/bitrix/services/ymarket/index.php',
        'SORT' => 100,
      ),
      5 => 
      array (
        'CONDITION' => '#^/contacts/stores/#',
        'RULE' => '',
        'ID' => 'bitrix:catalog.store',
        'PATH' => '/contacts/stores/index.php',
        'SORT' => 100,
      ),
      6 => 
      array (
        'CONDITION' => '#^/personal/order/#',
        'RULE' => '',
        'ID' => 'bitrix:sale.personal.order',
        'PATH' => '/personal/order/index.php',
        'SORT' => 100,
      ),
      12 => 
      array (
        'CONDITION' => '#^/company/staff/#',
        'RULE' => '',
        'ID' => 'bitrix:news',
        'PATH' => '/company/staff/index.php',
        'SORT' => 100,
      ),
      28 => 
      array (
        'CONDITION' => '#^/company/news/#',
        'RULE' => '',
        'ID' => 'bitrix:news',
        'PATH' => '/company/news/index.php',
        'SORT' => 100,
      ),
      13 => 
      array (
        'CONDITION' => '#^/info/brands/#',
        'RULE' => '',
        'ID' => 'bitrix:news',
        'PATH' => '/info/brands/index.php',
        'SORT' => 100,
      ),
      16 => 
      array (
        'CONDITION' => '#^/landings/#',
        'RULE' => '',
        'ID' => 'bitrix:catalog',
        'PATH' => '/landings/index.php',
        'SORT' => 100,
      ),
      23 => 
      array (
        'CONDITION' => '#^/info/faq/#',
        'RULE' => '',
        'ID' => 'bitrix:news',
        'PATH' => '/info/faq/index.php',
        'SORT' => 100,
      ),
      10 => 
      array (
        'CONDITION' => '#^/projects/#',
        'RULE' => '',
        'ID' => 'bitrix:news',
        'PATH' => '/projects/index.php',
        'SORT' => 100,
      ),
      14 => 
      array (
        'CONDITION' => '#^/services/#',
        'RULE' => '',
        'ID' => 'bitrix:news',
        'PATH' => '/services/index.php',
        'SORT' => 100,
      ),
      27 => 
      array (
        'CONDITION' => '#^/personal/#',
        'RULE' => '',
        'ID' => 'bitrix:sale.personal.section',
        'PATH' => '/personal/index.php',
        'SORT' => 100,
      ),
      46 => 
      array (
        'CONDITION' => '#^/contacts/#',
        'RULE' => '',
        'ID' => 'bitrix:news',
        'PATH' => '/contacts/page_contacts_3.php',
        'SORT' => 100,
      ),
      47 => 
      array (
        'CONDITION' => '#^/catalog/#',
        'RULE' => '',
        'ID' => 'bitrix:catalog',
        'PATH' => '/catalog/index.php',
        'SORT' => 100,
      ),
      1 => 
      array (
        'CONDITION' => '#^/rest/#',
        'RULE' => '',
        'ID' => NULL,
        'PATH' => '/bitrix/services/rest/index.php',
        'SORT' => 100,
      ),
      22 => 
      array (
        'CONDITION' => '#^/sale/#',
        'RULE' => '',
        'ID' => 'bitrix:news',
        'PATH' => '/sale/index.php',
        'SORT' => 100,
      ),
      39 => 
      array (
        'CONDITION' => '#^/blog/#',
        'RULE' => '',
        'ID' => 'bitrix:news',
        'PATH' => '/blog/index.php',
        'SORT' => 100,
      ),
      45 => 
      array (
        'CONDITION' => '#^/auth/#',
        'RULE' => '',
        'ID' => 'aspro:auth.next',
        'PATH' => '/auth/index.php',
        'SORT' => 100,
      ),
    );
  • Почему на внутренних разделах каталога 404?

    @anriko Автор вопроса
    "TOP_PROPERTY_CODE_MOBILE" => "",
    		"TOP_VIEW_MODE" => "SECTION",
    		"TOP_PRODUCT_BLOCKS_ORDER" => "price,props,sku,quantityLimit,quantity,buttons,compare",
    		"TOP_PRODUCT_ROW_VARIANTS" => "[{'VARIANT':'3','BIG_DATA':false},{'VARIANT':'3','BIG_DATA':false}]",
    		"TOP_ENLARGE_PRODUCT" => "STRICT",
    		"TOP_SHOW_SLIDER" => "Y",
    		"TOP_SLIDER_INTERVAL" => "3000",
    		"TOP_SLIDER_PROGRESS" => "N",
    		"SECTIONS_VIEW_MODE" => "LIST",
    		"SECTIONS_SHOW_PARENT_NAME" => "Y",
    		"LIST_PROPERTY_CODE_MOBILE" => "",
    		"LIST_PRODUCT_BLOCKS_ORDER" => "price,props,sku,quantityLimit,quantity,buttons,compare",
    		"LIST_PRODUCT_ROW_VARIANTS" => "[{'VARIANT':'3','BIG_DATA':false},{'VARIANT':'3','BIG_DATA':false},{'VARIANT':'3','BIG_DATA':false},{'VARIANT':'3','BIG_DATA':false},{'VARIANT':'3','BIG_DATA':false}]",
    		"LIST_ENLARGE_PRODUCT" => "STRICT",
    		"LIST_SHOW_SLIDER" => "Y",
    		"LIST_SLIDER_INTERVAL" => "3000",
    		"LIST_SLIDER_PROGRESS" => "N",
    		"DETAIL_MAIN_BLOCK_PROPERTY_CODE" => "",
    		"DETAIL_MAIN_BLOCK_OFFERS_PROPERTY_CODE" => "",
    		"DETAIL_USE_VOTE_RATING" => "N",
    		"DETAIL_USE_COMMENTS" => "N",
    		"DETAIL_BRAND_USE" => "N",
    		"DETAIL_DISPLAY_NAME" => "Y",
    		"DETAIL_IMAGE_RESOLUTION" => "16by9",
    		"DETAIL_PRODUCT_INFO_BLOCK_ORDER" => "sku,props",
    		"DETAIL_PRODUCT_PAY_BLOCK_ORDER" => "rating,price,priceRanges,quantityLimit,quantity,buttons",
    		"DETAIL_SHOW_SLIDER" => "N",
    		"DETAIL_DETAIL_PICTURE_MODE" => array(
    			0 => "POPUP",
    			1 => "MAGNIFIER",
    		),
    		"DETAIL_DISPLAY_PREVIEW_TEXT_MODE" => "E",
    		"MESS_PRICE_RANGES_TITLE" => "Цены",
    		"MESS_DESCRIPTION_TAB" => "Описание",
    		"MESS_PROPERTIES_TAB" => "Характеристики",
    		"MESS_COMMENTS_TAB" => "Комментарии",
    		"LAZY_LOAD" => "N",
    		"LOAD_ON_SCROLL" => "N",
    		"USE_ENHANCED_ECOMMERCE" => "N",
    		"DETAIL_DOCS_PROP" => "-",
    		"STIKERS_PROP" => "HIT",
    		"USE_SHARE" => "Y",
    		"TAB_OFFERS_NAME" => "",
    		"TAB_DESCR_NAME" => "",
    		"TAB_CHAR_NAME" => "",
    		"TAB_VIDEO_NAME" => "",
    		"TAB_REVIEW_NAME" => "",
    		"TAB_FAQ_NAME" => "",
    		"TAB_STOCK_NAME" => "",
    		"TAB_DOPS_NAME" => "",
    		"BLOCK_SERVICES_NAME" => "",
    		"BLOCK_DOCS_NAME" => "",
    		"CHEAPER_FORM_NAME" => "",
    		"DIR_PARAMS" => CNext::GetDirMenuParametrs(__DIR__),
    		"SHOW_CHEAPER_FORM" => "Y",
    		"SHOW_LANDINGS" => "Y",
    		"LANDING_TITLE" => "Популярные категории",
    		"LANDING_SECTION_COUNT" => "7",
    		"SHOW_LANDINGS_SEARCH" => "Y",
    		"LANDING_SEARCH_TITLE" => "Похожие запросы",
    		"LANDING_SEARCH_COUNT" => "1",
    		"SECTIONS_TYPE_VIEW" => "sections_1",
    		"SECTION_ELEMENTS_TYPE_VIEW" => "list_elements_1",
    		"ELEMENT_TYPE_VIEW" => "FROM_MODULE",
    		"SHOW_ARTICLE_SKU" => "Y",
    		"SORT_REGION_PRICE" => "Розница Основной склад",
    		"LANDING_TYPE_VIEW" => "landing_1",
    		"BIGDATA_NORMAL" => "bigdata_1",
    		"BIGDATA_EXT" => "bigdata_2",
    		"SHOW_MEASURE_WITH_RATIO" => "N",
    		"SHOW_DISCOUNT_PERCENT_NUMBER" => "N",
    		"ALT_TITLE_GET" => "NORMAL",
    		"SHOW_COUNTER_LIST" => "Y",
    		"SHOW_DISCOUNT_TIME_EACH_SKU" => "N",
    		"USER_CONSENT" => "N",
    		"USER_CONSENT_ID" => "0",
    		"USER_CONSENT_IS_CHECKED" => "Y",
    		"USER_CONSENT_IS_LOADED" => "N",
    		"SHOW_HOW_BUY" => "Y",
    		"TITLE_HOW_BUY" => "Как купить",
    		"SHOW_DELIVERY" => "Y",
    		"TITLE_DELIVERY" => "Условия доставки",
    		"SHOW_PAYMENT" => "Y",
    		"TITLE_PAYMENT" => "Условия оплаты",
    		"SHOW_GARANTY" => "Y",
    		"TITLE_GARANTY" => "Условия гарантии",
    		"USE_FILTER_PRICE" => "N",
    		"DISPLAY_ELEMENT_COUNT" => "Y",
    		"RESTART" => "N",
    		"USE_LANGUAGE_GUESS" => "N",
    		"NO_WORD_LOGIC" => "Y",
    		"SHOW_SECTION_DESC" => "Y",
    		"LANDING_POSITION" => "AFTER_PRODUCTS",
    		"TITLE_SLIDER" => "Рекомендуем",
    		"VIEW_BLOCK_TYPE" => "Y",
    		"SHOW_SEND_GIFT" => "Y",
    		"SEND_GIFT_FORM_NAME" => "",
    		"USE_ADDITIONAL_GALLERY" => "N",
    		"BLOCK_LANDINGS_NAME" => "",
    		"BLOG_IBLOCK_ID" => "",
    		"BLOCK_BLOG_NAME" => "",
    		"RECOMEND_COUNT" => "5",
    		"VISIBLE_PROP_COUNT" => "4",
    		"BUNDLE_ITEMS_COUNT" => "3",
    		"STORES_FILTER" => "TITLE",
    		"STORES_FILTER_ORDER" => "SORT_ASC",
    		"OFFER_SHOW_PREVIEW_PICTURE_PROPS" => "",
    		"FILE_404" => "",
    		"SEF_URL_TEMPLATES" => array(
    			"sections" => "",
    			"section" => "#SECTION_CODE_PATH#/",
    			"element" => "#SECTION_CODE_PATH#/#ELEMENT_CODE#/",
    			"compare" => "compare.php?action=#ACTION_CODE#",
    			"smart_filter" => "#SECTION_CODE_PATH#/filter/#SMART_FILTER_PATH#/apply/",
    		),
    		"VARIABLE_ALIASES" => array(
    			"compare" => array(
    				"ACTION_CODE" => "action",
    			),
    		)
    	),
    	false
  • Почему на внутренних разделах каталога 404?

    @anriko Автор вопроса
    "COMPARE_PROPERTY_CODE" => array(
    			0 => "BRAND",
    			1 => "CML2_ARTICLE",
    			2 => "CML2_BASE_UNIT",
    			3 => "CML2_MANUFACTURER",
    			4 => "PROP_2033",
    			5 => "PROP_159",),
    		"COMPARE_OFFERS_FIELD_CODE" => array(
    			0 => "NAME",
    			1 => "PREVIEW_PICTURE",
    		),
    		"COMPARE_OFFERS_PROPERTY_CODE" => array(
    			0 => "ARTICLE",
    			1 => "VOLUME",
    			2 => "SIZES",
    			3 => "COLOR_REF",
    		),
    		"COMPARE_ELEMENT_SORT_FIELD" => "name",
    		"COMPARE_ELEMENT_SORT_ORDER" => "asc",
    		"DISPLAY_ELEMENT_SELECT_BOX" => "N",
    		"PRICE_CODE" => array(
    			0 => "Розница Основной склад",
    		),
    		"USE_PRICE_COUNT" => "N",
    		"SHOW_PRICE_COUNT" => "1",
    		"PRICE_VAT_INCLUDE" => "Y",
    		"PRICE_VAT_SHOW_VALUE" => "N",
    		"PRODUCT_PROPERTIES" => "",
    		"USE_PRODUCT_QUANTITY" => "Y",
    		"CONVERT_CURRENCY" => "Y",
    		"CURRENCY_ID" => "RUB",
    		"OFFERS_CART_PROPERTIES" => "",
    		"SHOW_TOP_ELEMENTS" => "N",
    		"SECTION_COUNT_ELEMENTS" => "Y",
    		"SECTION_TOP_DEPTH" => "2",
    		"SECTIONS_LIST_PREVIEW_PROPERTY" => "UF_SECTION_DESCR",
    		"SHOW_SECTION_LIST_PICTURES" => "Y",
    		"PAGE_ELEMENT_COUNT" => "40",
    		"LINE_ELEMENT_COUNT" => "4",
    		"ELEMENT_SORT_FIELD" => "name",
    		"ELEMENT_SORT_ORDER" => "asc",
    		"ELEMENT_SORT_FIELD2" => "name",
    		"ELEMENT_SORT_ORDER2" => "asc",
    		"LIST_PROPERTY_CODE" => array(
    			0 => "BRAND",
    			1 => "CML2_ARTICLE",
    			2 => "PROP_2033",
    			3 => "COLOR_REF2",
    			4 => "PROP_159",),
    		"INCLUDE_SUBSECTIONS" => "Y",
    		"LIST_META_KEYWORDS" => "-",
    		"LIST_META_DESCRIPTION" => "-",
    		"LIST_BROWSER_TITLE" => "-",
    		"LIST_OFFERS_FIELD_CODE" => array(
    			0 => "NAME",
    			1 => "CML2_LINK",
    			2 => "DETAIL_PAGE_URL",
    			3 => "",
    		),
    		"LIST_OFFERS_PROPERTY_CODE" => array(
    			0 => "ARTICLE",
    			1 => "VOLUME",
    			2 => "SIZES",
    			3 => "COLOR_REF",
    			),
    		"LIST_OFFERS_LIMIT" => "10",
    		"SORT_BUTTONS" => array(
    			0 => "POPULARITY",
    			1 => "NAME",
    			2 => "PRICE",
    		),
    		"SORT_PRICES" => "REGION_PRICE",
    		"DEFAULT_LIST_TEMPLATE" => "block",
    		"SECTION_DISPLAY_PROPERTY" => "UF_SECTION_TEMPLATE",
    		"LIST_DISPLAY_POPUP_IMAGE" => "Y",
    		"SECTION_PREVIEW_PROPERTY" => "DESCRIPTION",
    		"SHOW_SECTION_PICTURES" => "Y",
    		"SHOW_SECTION_SIBLINGS" => "Y",
    		"USE_DETAIL_PREDICTION" => "N",
    		"DETAIL_PROPERTY_CODE" => array(
    			0 => "BRAND",
    			1 => "CML2_ARTICLE",
    			2 => "VIDEO_YOUTUBE",
    			3 => "PROP_2033",
    			4 => "CML2_ATTRIBUTES",
    			5 => "COLOR_REF2",),
    		"DETAIL_META_KEYWORDS" => "ASSOCIATED_FILTER",
    		"DETAIL_META_DESCRIPTION" => "-",
    		"DETAIL_BROWSER_TITLE" => "-",
    		"DETAIL_OFFERS_FIELD_CODE" => array(
    			0 => "NAME",
    			1 => "PREVIEW_PICTURE",
    			2 => "DETAIL_PICTURE",
    			3 => "DETAIL_PAGE_URL",
    			),
    		"DETAIL_OFFERS_PROPERTY_CODE" => array(
    			0 => "FRAROMA",
    			1 => "ARTICLE",
    			2 => "SPORT",
    			3 => "VLAGOOTVOD",
    			4 => "AGE",),
    		"PROPERTIES_DISPLAY_LOCATION" => "DESCRIPTION",
    		"SHOW_BRAND_PICTURE" => "Y",
    		"SHOW_ASK_BLOCK" => "N",
    		"ASK_FORM_ID" => "2",
    		"SHOW_ADDITIONAL_TAB" => "N",
    		"PROPERTIES_DISPLAY_TYPE" => "TABLE",
    		"SHOW_KIT_PARTS" => "Y",
    		"SHOW_KIT_PARTS_PRICES" => "Y",
    		"LINK_IBLOCK_TYPE" => "aspro_next_content",
    		"LINK_IBLOCK_ID" => "",
    		"LINK_PROPERTY_SID" => "",
    		"LINK_ELEMENTS_URL" => "link.php?PARENT_ELEMENT_ID=#ELEMENT_ID#",
    		"USE_ALSO_BUY" => "Y",
    		"ALSO_BUY_ELEMENT_COUNT" => "5",
    		"ALSO_BUY_MIN_BUYES" => "2",
    		"USE_STORE" => "N",
    		"USE_STORE_PHONE" => "Y",
    		"USE_STORE_SCHEDULE" => "Y",
    		"USE_MIN_AMOUNT" => "N",
    		"MIN_AMOUNT" => "10",
    		"STORE_PATH" => "/contacts/stores/#store_id#/",
    		"MAIN_TITLE" => "Наличие на складах",
    		"MAX_AMOUNT" => "20",
    		"USE_ONLY_MAX_AMOUNT" => "Y",
    		"OFFERS_SORT_FIELD" => "shows",
    		"OFFERS_SORT_ORDER" => "asc",
    		"OFFERS_SORT_FIELD2" => "shows",
    		"OFFERS_SORT_ORDER2" => "asc",
    		"PAGER_TEMPLATE" => "main",
    		"DISPLAY_TOP_PAGER" => "N",
    		"DISPLAY_BOTTOM_PAGER" => "Y",
    		"PAGER_TITLE" => "Товары",
    		"PAGER_SHOW_ALWAYS" => "N",
    		"PAGER_DESC_NUMBERING" => "N",
    		"PAGER_DESC_NUMBERING_CACHE_TIME" => "36000",
    		"PAGER_SHOW_ALL" => "Y",
    		"IBLOCK_STOCK_ID" => "19",
    		"SHOW_QUANTITY" => "Y",
    		"SHOW_MEASURE" => "Y",
    		"SHOW_QUANTITY_COUNT" => "Y",
    		"USE_RATING" => "Y",
    		"DISPLAY_WISH_BUTTONS" => "Y",
    		"DEFAULT_COUNT" => "1",
    		"SHOW_HINTS" => "Y",
    		"AJAX_OPTION_ADDITIONAL" => "",
    		"ADD_SECTIONS_CHAIN" => "Y",
    		"ADD_ELEMENT_CHAIN" => "Y",
    		"ADD_PROPERTIES_TO_BASKET" => "Y",
    		"PARTIAL_PRODUCT_PROPERTIES" => "Y",
    		"DETAIL_CHECK_SECTION_ID_VARIABLE" => "N",
    		"STORES" => array(
    			0 => "",
    			1 => "",
    		),
    		"USER_FIELDS" => array(
    			0 => "",
    			1 => "",
    		),
    		"FIELDS" => array(
    			0 => "",
    			1 => "",
    		),
    		"SHOW_EMPTY_STORE" => "Y",
    		"SHOW_GENERAL_STORE_INFORMATION" => "N",
    		"TOP_ELEMENT_COUNT" => "8",
    		"TOP_LINE_ELEMENT_COUNT" => "4",
    		"TOP_ELEMENT_SORT_FIELD" => "shows",
    		"TOP_ELEMENT_SORT_ORDER" => "asc",
    		"TOP_ELEMENT_SORT_FIELD2" => "shows",
    		"TOP_ELEMENT_SORT_ORDER2" => "asc",
    		"TOP_PROPERTY_CODE" => array(
    			0 => "",
    			1 => "",
    		),
    		"COMPONENT_TEMPLATE" => "main",
    		"DETAIL_SET_CANONICAL_URL" => "N",
    		"SHOW_DEACTIVATED" => "N",
    		"TOP_OFFERS_FIELD_CODE" => array(
    			0 => "ID",
    			1 => "",
    		),
    		"TOP_OFFERS_PROPERTY_CODE" => array(
    			0 => "",
    			1 => "",
    		),
    		"TOP_OFFERS_LIMIT" => "10",
    		"SECTION_TOP_BLOCK_TITLE" => "Лучшие предложения",
    		"OFFER_TREE_PROPS" => array(
    			0 => "SIZES",
    			1 => "COLOR_REF",
    		),
    		"USE_BIG_DATA" => "N",
    		"BIG_DATA_RCM_TYPE" => "similar",
    		"SHOW_DISCOUNT_PERCENT" => "Y",
    		"SHOW_OLD_PRICE" => "Y",
    		"VIEWED_ELEMENT_COUNT" => "20",
    		"VIEWED_BLOCK_TITLE" => "Ранее вы смотрели",
    		"ELEMENT_SORT_FIELD_BOX" => "name",
    		"ELEMENT_SORT_ORDER_BOX" => "asc",
    		"ELEMENT_SORT_FIELD_BOX2" => "id",
    		"ELEMENT_SORT_ORDER_BOX2" => "desc",
    		"ADD_PICT_PROP" => "MORE_PHOTO",
    		"OFFER_ADD_PICT_PROP" => "MORE_PHOTO",
    		"DETAIL_ADD_DETAIL_TO_SLIDER" => "Y",
    		"SKU_DETAIL_ID" => "oid",
    		"USE_MAIN_ELEMENT_SECTION" => "Y",
    		"SET_LAST_MODIFIED" => "N",
    		"PAGER_BASE_LINK_ENABLE" => "N",
    		"SHOW_404" => "Y",
    		"MESSAGE_404" => "",
    		"AJAX_FILTER_CATALOG" => "N",
    		"SECTION_BACKGROUND_IMAGE" => "-",
    		"DETAIL_BACKGROUND_IMAGE" => "-",
    		"DISPLAY_ELEMENT_SLIDER" => "10",
    		"SHOW_ONE_CLICK_BUY" => "Y",
    		"USE_GIFTS_DETAIL" => "Y",
    		"USE_GIFTS_SECTION" => "Y",
    		"USE_GIFTS_MAIN_PR_SECTION_LIST" => "Y",
    		"GIFTS_DETAIL_PAGE_ELEMENT_COUNT" => "8",
    		"GIFTS_DETAIL_HIDE_BLOCK_TITLE" => "N",
    		"GIFTS_DETAIL_BLOCK_TITLE" => "Выберите один из подарков",
    		"GIFTS_DETAIL_TEXT_LABEL_GIFT" => "Подарок",
    		"GIFTS_SECTION_LIST_PAGE_ELEMENT_COUNT" => "8",
    		"GIFTS_SECTION_LIST_HIDE_BLOCK_TITLE" => "N",
    		"GIFTS_SECTION_LIST_BLOCK_TITLE" => "Подарки к товарам этого раздела",
    		"GIFTS_SECTION_LIST_TEXT_LABEL_GIFT" => "Подарок",
    		"GIFTS_SHOW_DISCOUNT_PERCENT" => "Y",
    		"GIFTS_SHOW_OLD_PRICE" => "Y",
    		"GIFTS_SHOW_NAME" => "Y",
    		"GIFTS_SHOW_IMAGE" => "Y",
    		"GIFTS_MESS_BTN_BUY" => "Выбрать",
    		"GIFTS_MAIN_PRODUCT_DETAIL_PAGE_ELEMENT_COUNT" => "8",
    		"GIFTS_MAIN_PRODUCT_DETAIL_HIDE_BLOCK_TITLE" => "N",
    		"GIFTS_MAIN_PRODUCT_DETAIL_BLOCK_TITLE" => "Выберите один из товаров, чтобы получить подарок",
    		"OFFER_HIDE_NAME_PROPS" => "N",
    		"DISABLE_INIT_JS_IN_COMPONENT" => "N",
    		"DETAIL_SET_VIEWED_IN_COMPONENT" => "N",
    		"SECTION_PREVIEW_DESCRIPTION" => "Y",
    		"SECTIONS_LIST_PREVIEW_DESCRIPTION" => "N",
    		"SALE_STIKER" => "SALE_TEXT",
    		"SHOW_DISCOUNT_TIME" => "Y",
    		"SHOW_RATING" => "Y",
    		"COMPOSITE_FRAME_MODE" => "A",
    		"COMPOSITE_FRAME_TYPE" => "AUTO",
    		"DETAIL_OFFERS_LIMIT" => "0",
    		"DETAIL_EXPANDABLES_TITLE" => "Аксессуары",
    		"DETAIL_ASSOCIATED_TITLE" => "Похожие товары",
    		"DETAIL_PICTURE_MODE" => "MAGNIFIER",
    		"SHOW_UNABLE_SKU_PROPS" => "Y",
    		"HIDE_NOT_AVAILABLE_OFFERS" => "Y",
    		"DETAIL_STRICT_SECTION_CHECK" => "Y",
    		"COMPATIBLE_MODE" => "Y",
    		"TEMPLATE_THEME" => "blue",
    		"LABEL_PROP" => "",
    		"PRODUCT_DISPLAY_MODE" => "Y",
    		"COMMON_SHOW_CLOSE_POPUP" => "N",
    		"PRODUCT_SUBSCRIPTION" => "Y",
    		"SHOW_MAX_QUANTITY" => "N",
    		"MESS_BTN_BUY" => "Купить",
    		"MESS_BTN_ADD_TO_BASKET" => "В корзину",
    		"MESS_BTN_COMPARE" => "Сравнение",
    		"MESS_BTN_DETAIL" => "Подробнее",
    		"MESS_NOT_AVAILABLE" => "Нет в наличии",
    		"MESS_BTN_SUBSCRIBE" => "Подписаться",
    		"SIDEBAR_SECTION_SHOW" => "Y",
    		"SIDEBAR_DETAIL_SHOW" => "N",
    		"SIDEBAR_PATH" => "",
    		"USE_SALE_BESTSELLERS" => "Y",
    		"FILTER_VIEW_MODE" => "VERTICAL",
    		"FILTER_HIDE_ON_MOBILE" => "N",
    		"INSTANT_RELOAD" => "N",
    		"COMPARE_POSITION_FIXED" => "Y",
    		"COMPARE_POSITION" => "top left",
    		"USE_RATIO_IN_RANGES" => "Y",
    		"USE_COMMON_SETTINGS_BASKET_POPUP" => "N",
    		"COMMON_ADD_TO_BASKET_ACTION" => "ADD",
    		"TOP_ADD_TO_BASKET_ACTION" => "ADD",
    		"SECTION_ADD_TO_BASKET_ACTION" => "ADD",
    		"DETAIL_ADD_TO_BASKET_ACTION" => array(
    			0 => "BUY",
    		),
    		"DETAIL_ADD_TO_BASKET_ACTION_PRIMARY" => array(
    			0 => "BUY",
    		),
  • Как не по делениям ,а по ориентировочным линиям сделать градиент в chartjs?

    @anriko Автор вопроса
    сделал так
    <canvas id="myChart2" width="502" height="262" style="display: block; box-sizing: border-box; height: 262px; width: 502.3px;"></canvas>
    <script>
                      function myChart(){
                    var ctx = document.getElementById('myChart2').getContext('2d');
              
                    var marketing = [20, 37];
                    var amount = [20, 37];
                    var marketing2 = [25, 30];
                    var amount2 = [25, 30];
                    // populate 'annotations' array dynamically based on 'marketing'
                    var annotations1 = marketing.map(function (date, index) {
                        return {
                            type: 'line',
                            id: 'vline' + index,
                            mode: 'horizontal',
                            scaleID: 'y-axis-0',
                            value: date,
                            borderColor: '#006F93',
                            borderWidth: 2,
                            yMin: date,
              				yMax: date,
                            label: {
                                enabled: true,
                                position: "center",
                                content: amount[index]
                            }
                          
                        }
                    });
                  var annotations2 = marketing2.map(function (date, index) {
                        return {
                            type: 'line',
                            id: 'vline' + index+1,
                            mode: 'horizontal',
                            scaleID: 'y-axis-0',
                            value: date,
                            borderColor: '#00CFD7',
                            borderWidth: 2,
                            yMin: date,
              				yMax: date,
                            label: {
                                enabled: true,
                                position: "center",
                                content: amount2[index]
                            }
                          
                        }
                    });
                      var annotations = annotations1.concat(annotations2); 
                          console.log(annotations); 
                      
                        
                        
                    var myChart = new Chart(ctx, {
                        type: 'line',
                        data: {
                            labels: ["29-04-21","29-04-20","29-04-17","29-04-16","29-04-15"],
                            datasets: [{
                                label: "мкмоль/л",
                                data: ["5","10 ","20","10","45"],
                                backgroundColor:  'rgb(54 162 235 /20% )' ,
                                borderColor: ['rgb(54 162 235 /100% )' ],
                                borderWidth: 2
                            },
                         {
                                 label: "ниже",
                                data: new Array(5).fill(20),
                                pointRadius: 0.1,
          						backgroundColor: '#f9fbbd',
          						fill: true,
                            },
                      		{
                                label: "норма",
                                data: new Array(5).fill(30),
                                pointRadius: 0.1,
          						backgroundColor: '#cff5bd',
          						fill: true,
                            },
                              {
                                 label: "выше",
                                data: new Array(5).fill(45),
                                pointRadius: 0.1,
          						backgroundColor: '#fad0c2',
          						fill: true,
                            },
                          
                      
                      ]
                        },
                        options: {
                         datasets:{
                            	line:{
                              /*	backgroundColor:function(context){
                      
                       console.log(context.chart.chartArea);
                     // console.log(context.chart.scales.y.ticks);
                      debugger;
                     
                           
                                	/*	let ctx = context.chart.ctx;
                             			let gradient = ctx.createLinearGradient(0, context.chart.scales.y.bottom || 0,0, -context.chart.scales.y.paddingTop || 0,0);
                                  gradient.addColorStop(0, 'green');   
                            gradient.addColorStop(0.44444444444444, 'green');
                            gradient.addColorStop(0.44444444444444, 'yellow'); 
                            gradient.addColorStop(0.66666666666667, 'yellow');
                            gradient.addColorStop(0.66666666666667, 'red');
                            gradient.addColorStop(1, 'red');
                                    return gradient;
                                },*/
                                fill:true
                              }
                            },
                            scales: {
                                x: {
                                   /* beginAtZero: true,*/
                                    ticks: {
                                        color: 'red',
                                    },
                                    grid: {
                                        borderColor: 'red'
                                    }
                                },
                                y: {
                                   // stacked: true,
                                    title: {
                                        display: true,
                                        text: "мкмоль/л",
                                        color: 'red',
                                        ticks: {
                                            color: 'red',
                                        }
                                    }
                                }
                            },
                               plugins: {
                            annotation: {
                                drawTime: 'afterDatasetsDraw',
                                annotations: annotations
                            }}
                        }
                    });
                        }
                      myChart();
               
                </script>
  • Как сделать градиент по дилениям в chartjs.org?

    @anriko Автор вопроса
    twobomb, по делениям графика получилось сделать градиент ,а вот по ориентировочным линиям нет линиям , по ним и нужно сделать
    проблема в том что графики циклом формируются и линии ориентира беруться из админки
    на значении линии ориентира допустим 35 делю на самую большое деление по шкале Y , но градиент не совпадает с линией ориентира
    <script>
                      function myChart(){
                    var ctx = document.getElementById('myChart2').getContext('2d');
               /*
                     var gradient = ctx.createLinearGradient(0, 260, 0, 0);
                            gradient.addColorStop(0, 'green');   
                            gradient.addColorStop(0.375, 'green');
                            gradient.addColorStop(0.375, 'yellow'); 
                            gradient.addColorStop(0.625, 'yellow');
                            gradient.addColorStop(0.625, 'red');
                            gradient.addColorStop(1, 'red');*/
                       
                    var marketing = [20, 37];
                    var amount = [20, 37];
                    var marketing2 = [25, 30];
                    var amount2 = [25, 30];
                    // populate 'annotations' array dynamically based on 'marketing'
                    var annotations1 = marketing.map(function (date, index) {
                        return {
                            type: 'line',
                            id: 'vline' + index,
                            mode: 'horizontal',
                            scaleID: 'y-axis-0',
                            value: date,
                            borderColor: '#006F93',
                            borderWidth: 2,
                            yMin: date,
              				yMax: date,
                            label: {
                                enabled: true,
                                position: "center",
                                content: amount[index]
                            }
                          
                        }
                    });
                  var annotations2 = marketing2.map(function (date, index) {
                        return {
                            type: 'line',
                            id: 'vline' + index+1,
                            mode: 'horizontal',
                            scaleID: 'y-axis-0',
                            value: date,
                            borderColor: '#00CFD7',
                            borderWidth: 2,
                            yMin: date,
              				yMax: date,
                            label: {
                                enabled: true,
                                position: "center",
                                content: amount2[index]
                            }
                          
                        }
                    });
                      var annotations = annotations1.concat(annotations2); 
                          console.log(annotations); 
                      
                        
                        
                    var myChart = new Chart(ctx, {
                        type: 'line',
                        data: {
                            labels: ["29-04-21","29-04-20","29-04-17","29-04-16","29-04-15"],
                            datasets: [{
                                label: "мкмоль/л",
                                data: ["5","10 ","20","10","45"],
                                /*backgroundColor: 'rgba(255, 99, 132, 0.2)',
                                borderColor: [
                                    'rgba(255, 99, 132, 1)',
                                    'rgba(54, 162, 235, 1)',
                                    'rgba(255, 206, 86, 1)',
                                    'rgba(75, 192, 192, 1)',
                                    'rgba(153, 102, 255, 1)',
                                    'rgba(255, 159, 64, 1)'
                                ],*/
                                borderWidth: 2
                            }]
                        },
                        options: {
                         datasets:{
                            	line:{
                              	backgroundColor:function(context){
                      debugger;
                     
                           /* gradient.addColorStop(0, 'green');   
                            gradient.addColorStop(0.375, 'green');
                            gradient.addColorStop(0.375, 'yellow'); 
                            gradient.addColorStop(0.625, 'yellow');
                            gradient.addColorStop(0.625, 'red');
                            gradient.addColorStop(1, 'red');*/
                                		let ctx = context.chart.ctx;
                             			let gradient = ctx.createLinearGradient(0, context.chart.scales.y.bottom || 0,0, -context.chart.scales.y.paddingTop || 0,0);
                                  gradient.addColorStop(0, 'green');   
                            gradient.addColorStop(0.44444444444444, 'green');
                            gradient.addColorStop(0.44444444444444, 'yellow'); 
                            gradient.addColorStop(0.66666666666667, 'yellow');
                            gradient.addColorStop(0.66666666666667, 'red');
                            gradient.addColorStop(1, 'red');
                                    return gradient;
                                },
                                fill:true
                              }
                            },
                            scales: {
                                x: {
                                    beginAtZero: true,
                                    ticks: {
                                        color: 'red',
                                    },
                                    grid: {
                                        borderColor: 'red'
                                    }
                                },
                                y: {
                                    stacked: true,
                                    title: {
                                        display: true,
                                        text: 'мкмоль/л',
                                        color: 'red',
                                        ticks: {
                                            color: 'red',
                                        }
                                    }
                                }
                            },
                               plugins: {
                            annotation: {
                                drawTime: 'afterDatasetsDraw',
                                annotations: annotations
                            }}
                        }
                    });
                        }
                      myChart();
               
                </script>
  • Как сделать график градиентом?

    @anriko Автор вопроса
    получилось, только по линиям не получается

    var gradient = ctx.createLinearGradient(0, 230, 0, 0);
    gradient.addColorStop(0, 'green');
    gradient.addColorStop(0.25, 'green');
    gradient.addColorStop(0.25, 'yellow');
    gradient.addColorStop(0.50, 'yellow');
    gradient.addColorStop(0.50, 'red');
    gradient.addColorStop(1, 'red');

    609d59504d5d5559178696.png
  • Как сделать график градиентом?

    @anriko Автор вопроса
    не получается

    <canvas id="myChart2" width="502" height="262" class="chartjs-render-monitor" style="display: block; width: 502px; height: 262px;"></canvas>
    
    <script>
                      function myChart(){
                    var ctx = document.getElementById('myChart2').getContext('2d');
                        var gradient = ctx.createLinearGradient(20,0, 220,0);
                    // Добавление трёх контрольных точек
                    gradient.addColorStop(0, 'green');
                    gradient.addColorStop(.5, 'cyan');
                    gradient.addColorStop(1, 'green');
                    // Установка стиля заливки и отрисовка прямоугольника градиента
                    ctx.fillStyle = gradient;
                        
                    var marketing = [20, 37];
                    var amount = [20, 37];
                    var marketing2 = [30, 25];
                    var amount2 = [30, 25];
                    // populate 'annotations' array dynamically based on 'marketing'
                    var annotations1 = marketing.map(function (date, index) {
                        return {
                            type: 'line',
                            id: 'vline' + index,
                            mode: 'horizontal',
                            scaleID: 'y-axis-0',
                            value: date,
                            borderColor: '#006F93',
                            borderWidth: 2,
                            label: {
                                enabled: true,
                                position: "center",
                                content: amount[index]
                            }
                          
                        }
                    });
                  var annotations2 = marketing2.map(function (date, index) {
                        return {
                            type: 'line',
                            id: 'vline' + index+1,
                            mode: 'horizontal',
                            scaleID: 'y-axis-0',
                            value: date,
                            borderColor: '#00CFD7',
                            borderWidth: 2,
                            label: {
                                enabled: true,
                                position: "center",
                                content: amount2[index]
                            }
                          
                        }
                    });
                      var annotations = annotations1.concat(annotations2); 
                          console.log(annotations); 
                      
                    var myChart = new Chart(ctx, {
                        type: 'line',
                        data: {
                            labels: ["29-04-21","29-04-20","29-04-17","29-04-16","29-04-15"],
                            datasets: [{
                                label: 'мкмоль/л',
                                data: ["5","10 ","20","10","45"],
                                backgroundColor: [
                                    'rgba(255, 99, 132, 0.2)',
                                    'rgba(54, 162, 235, 0.2)',
                                    'rgba(255, 206, 86, 0.2)',
                                    'rgba(75, 192, 192, 0.2)',
                                    'rgba(153, 102, 255, 0.2)',
                                    'rgba(255, 159, 64, 0.2)'
                                ],
                                borderColor: [
                                    'rgba(255, 99, 132, 1)',
                                    'rgba(54, 162, 235, 1)',
                                    'rgba(255, 206, 86, 1)',
                                    'rgba(75, 192, 192, 1)',
                                    'rgba(153, 102, 255, 1)',
                                    'rgba(255, 159, 64, 1)'
                                ],
                                borderWidth: 2
                            }]
                        },
                        options: {
                            scales: {
                                x: {
                                    beginAtZero: true,
                                    ticks: {
                                        color: 'red',
                                    },
                                    grid: {
                                        borderColor: 'red'
                                    }
                                },
                                y: {
                                    stacked: true,
                                    title: {
                                        display: true,
                                        text: 'мкмоль/л',
                                        color: 'red',
                                        ticks: {
                                            color: 'red',
                                        }
                                    }
                                }
                            },
                            annotation: {
                                drawTime: 'afterDatasetsDraw',
                                annotations: annotations
                            }
                        }
                    });
                        }
                      myChart();
                </script>
  • Как сделать график градиентом?

    @anriko Автор вопроса
    twobomb, на графике так не получается график выше с этим кодом и на нем нет градиента
  • Как сделать график градиентом?

    @anriko Автор вопроса
    twobomb,
    а что не так с моим кодом тогда?

    var gradient = ctx.createLinearGradient(20,0, 220,0);
    
                    // Добавление трёх контрольных точек
                    gradient.addColorStop(0, 'green');
                    gradient.addColorStop(.5, 'cyan');
                    gradient.addColorStop(1, 'green');
    
                    // Установка стиля заливки и отрисовка прямоугольника градиента
                    ctx.fillStyle = gradient;
                    ctx.fillRect(20, 20, 200, 100);