コード例 #1
0
ファイル: form.php プロジェクト: ASDAFF/rees46_bitrix
					<label for="REES46_recommend_nonavailable"><?= GetMessage('REES_OPTIONS_RECOMMEND_NONAVAILABLE') ?></label>
				</td>
				<td style="padding-left: 10px">
					<input type="checkbox" id="REES46_recommend_nonavailable" value="1" <?php if (\Rees46\Options::getRecommendNonAvailable()): ?>checked="checked"<? endif ?> name="recommend_nonavailable" style="margin: 0"/>
				</td>
			</tr>
	</div>

	<?php $tabControl->BeginNextTab(); ?>

	<div>
		<label for="REES46_img_width"><?= GetMessage('REES_OPTIONS_IMAGE_SIZE') ?></label>
		<br/>
		<input type="text" id="REES46_img_width"  value="<?= \Rees46\Options::getImageWidth() ?>" name="image_width" style="width: 50px"/>
		<label for="REES46_img_height">x</label>
		<input type="text" id="REES46_img_height" value="<?= \Rees46\Options::getImageHeight() ?>" name="image_height" style="width: 50px"/>
	</div>

	<div style="margin-top: 40px; display: none;">
		<label for="REES46_css"><?= GetMessage('REES_OPTIONS_CSS_FIELD') ?></label>
		<br/>
		<textarea id="REES46_css" style="width: 500px; height: 250px;" name="css"><?= strip_tags(\Rees46\Options::getRecommenderCSS()) ?></textarea>
	</div>

	<?php $tabControl->BeginNextTab(); ?>

	<?php if ($export_state === \Rees46\Service\Export::STATUS_NOT_PERFORMED): ?>
		<p>
			<?= GetMessage('REES_QUICK_EXPORT_DESC') ?>
		</p>
コード例 #2
0
    /**
     * handler for include/rees46-recommender.php, render recommenders
     */
    public static function run()
    {
        CModule::IncludeModule('catalog');
        CModule::IncludeModule('sale');
        CModule::IncludeModule("iblock");
        global $USER;
        $recommended_by = '';
        // get recommender name
        if (isset($_REQUEST['recommended_by'])) {
            $recommender = strval($_REQUEST['recommended_by']);
            $recommended_by = '?recommended_by=' . urlencode($recommender);
            switch ($recommender) {
                case 'buying_now':
                    $recommender_title = GetMessage('REES_INCLUDE_BUYING_NOW');
                    break;
                case 'see_also':
                    $recommender_title = GetMessage('REES_INCLUDE_SEE_ALSO');
                    break;
                case 'recently_viewed':
                    $recommender_title = GetMessage('REES_INCLUDE_RECENTLY_VIEWED');
                    break;
                case 'also_bought':
                    $recommender_title = GetMessage('REES_INCLUDE_ALSO_BOUGHT');
                    break;
                case 'similar':
                    $recommender_title = GetMessage('REES_INCLUDE_SIMILAR');
                    break;
                case 'interesting':
                    $recommender_title = GetMessage('REES_INCLUDE_INTERESTING');
                    break;
                case 'popular':
                    $recommender_title = GetMessage('REES_INCLUDE_POPULAR');
                    break;
                default:
                    $recommender_title = '';
            }
        }
        $libCatalogProduct = new CCatalogProduct();
        $libFile = new CFile();
        // render items
        if (isset($_REQUEST['recommended_items']) && is_array($_REQUEST['recommended_items']) && count($_REQUEST['recommended_items']) > 0) {
            $found_items = 0;
            // Currency to display
            $sale_currency = Data::getSaleCurrency();
            $html = '';
            $html .= '<div class="recommender-block-title">' . $recommender_title . '</div>';
            $html .= '<div class="recommended-items">';
            foreach ($_REQUEST['recommended_items'] as $item_id) {
                $item_id = intval($item_id);
                $item = $libCatalogProduct->GetByIDEx($item_id);
                // Get price
                $final_price = Data::getFinalPriceInCurrency($item_id, $sale_currency);
                // Check price
                if ($final_price == false) {
                    continue;
                }
                // Url to product with recommended_by attribute
                $link = $item['DETAIL_PAGE_URL'] . $recommended_by;
                // Get photo
                $picture_id = Data::getProductPhotoId($item_id);
                if ($picture_id === null) {
                    continue;
                }
                $file = $libFile->ResizeImageGet($picture_id, array('width' => Options::getImageWidth(), 'height' => Options::getImageHeight()), BX_RESIZE_IMAGE_PROPORTIONAL, true);
                $html .= '<div class="recommended-item">
					<div class="recommended-item-photo"><a href="' . $link . '"><img src="' . $file['src'] . '" class="item_img"/></a></div>
					<div class="recommended-item-title"><a href="' . $link . '">' . $item['NAME'] . '</a></div>
					' . ($final_price ? '<div class="recommended-item-price">' . CCurrencyLang::CurrencyFormat($final_price, $sale_currency, true) . '</div>' : '') . '
					<div class="recommended-item-action"><a href="' . $link . '">' . GetMessage('REES_INCLUDE_MORE') . '</a></div>
				</div>';
                $found_items++;
            }
            $html .= '</div>';
            if ($found_items > 0) {
                echo $html;
            }
        }
    }