コード例 #1
0
ファイル: class.php プロジェクト: mrdeadmouse/u136006
 public function executeComponent()
 {
     if (!\Bitrix\Main\Loader::includeModule('sale')) {
         ShowError(GetMessage('SALE_MODULE_NOT_INSTALL'));
         return;
     }
     if (isset($_POST['sbblRemoveItemFromCart'])) {
         $this->removeItemFromCart();
     }
     // prepare result
     if (!\Bitrix\Main\Loader::includeModule("currency")) {
         ShowError(GetMessage("CURRENCY_MODULE_NOT_INSTALLED"));
         return;
     }
     $this->bUseCatalog = \Bitrix\Main\Loader::includeModule('catalog');
     $this->arResult = array("TOTAL_PRICE" => 0, "NUM_PRODUCTS" => 0, "CATEGORIES" => array(), "ERROR_MESSAGE" => GetMessage("TSB1_EMPTY"));
     if ($this->arParams["SHOW_PRODUCTS"] == "Y") {
         $this->arResult = $this->getProducts() + $this->arResult;
     } else {
         if ($this->arParams["SHOW_TOTAL_PRICE"] == "Y") {
             $this->arResult = $this->getTotalPrice() + $this->arResult;
         } else {
             $this->arResult["NUM_PRODUCTS"] = isset($_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID]) ? $_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID] : $this->getNumProducts();
         }
     }
     if ($this->arParams["SHOW_TOTAL_PRICE"] == "Y") {
         $this->arResult["TOTAL_PRICE"] = CCurrencyLang::CurrencyFormat($this->arResult["TOTAL_PRICE"], CSaleLang::GetLangCurrency(SITE_ID), true);
     }
     $productS = BasketNumberWordEndings($this->arResult["NUM_PRODUCTS"]);
     $this->arResult["PRODUCT(S)"] = GetMessage("TSB1_PRODUCT") . $productS;
     // compatibility!
     $this->arResult["PRODUCTS"] = str_replace("#END#", $productS, str_replace("#NUM#", $this->arResult["NUM_PRODUCTS"], GetMessage("TSB1_BASKET_TEXT")));
     // output
     if ($this->arParams['AJAX'] == 'Y') {
         $this->includeComponentTemplate('ajax_template');
     } else {
         $this->includeComponentTemplate();
     }
 }
コード例 #2
0
            if (IntVal($num) > 1) {
                return "s";
            }
            return "";
        } else {
            return "";
        }
    }
}
if (isset($_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID])) {
    $num_products = $_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID];
} else {
    if (!CModule::IncludeModule("sale")) {
        ShowError(GetMessage("SALE_MODULE_NOT_INSTALL"));
        return;
    }
    $fUserID = CSaleBasket::GetBasketUserID(True);
    $fUserID = IntVal($fUserID);
    $num_products = 0;
    if ($fUserID > 0) {
        $num_products = CSaleBasket::GetList(array(), array("FUSER_ID" => $fUserID, "LID" => SITE_ID, "ORDER_ID" => "NULL", "CAN_BUY" => "Y", "DELAY" => "N", "SUBSCRIBE" => "N"), array());
    }
    $_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID] = intval($num_products);
}
$arResult["NUM_PRODUCTS"] = $num_products;
if ($num_products > 0) {
    $arResult["PRODUCTS"] = str_replace("#END#", BasketNumberWordEndings($num_products), str_replace("#NUM#", $num_products, GetMessage("TSB1_BASKET_TEXT")));
} else {
    $arResult["ERROR_MESSAGE"] = GetMessage("TSB1_EMPTY");
}
$this->IncludeComponentTemplate();
コード例 #3
0
ファイル: class.php プロジェクト: akniyev/itprom_dobrohost
 public function executeComponent()
 {
     if ($this->arParams['HIDE_ON_BASKET_PAGES'] == 'Y') {
         $currentPage = strtolower(\Bitrix\Main\Context::getCurrent()->getRequest()->getRequestedPage());
         $basketPage = strtolower($this->arParams['PATH_TO_BASKET']);
         $orderPage = strtolower($this->arParams['PATH_TO_ORDER']);
         if (strncmp($currentPage, $basketPage, strlen($basketPage)) == 0 || strncmp($currentPage, $orderPage, strlen($orderPage)) == 0) {
             $this->disableUseBasket = true;
         }
     }
     if ($this->disableUseBasket && $this->arParams['SHOW_AUTHOR'] == 'N' && $this->arParams['SHOW_PERSONAL_LINK'] == 'N') {
         return;
     }
     if (!\Bitrix\Main\Loader::includeModule('sale')) {
         ShowError(GetMessage('SALE_MODULE_NOT_INSTALL'));
         return;
     }
     if (isset($_POST['sbblRemoveItemFromCart'])) {
         $this->removeItemFromCart();
     }
     // prepare result
     if (!\Bitrix\Main\Loader::includeModule("currency")) {
         ShowError(GetMessage("CURRENCY_MODULE_NOT_INSTALLED"));
         return;
     }
     $this->bUseCatalog = \Bitrix\Main\Loader::includeModule('catalog');
     $this->arResult = array("TOTAL_PRICE" => 0, "NUM_PRODUCTS" => 0, "CATEGORIES" => array(), "ERROR_MESSAGE" => '', "DISABLE_USE_BASKET" => $this->disableUseBasket);
     if (!$this->disableUseBasket) {
         $this->arResult['ERROR_MESSAGE'] = GetMessage("TSB1_EMPTY");
     }
     // deprecated
     if ($this->disableUseBasket) {
         $this->arParams['SHOW_PRODUCTS'] = 'N';
         $this->arParams['SHOW_TOTAL_PRICE'] = 'N';
         $this->arParams['SHOW_NUM_PRODUCTS'] = 'N';
         if ($this->arParams['SHOW_AUTHOR'] == 'Y') {
             $this->arParams['SHOW_PERSONAL_LINK'] = 'N';
         }
     }
     if ($this->arParams["SHOW_PRODUCTS"] == "Y") {
         $this->arResult = $this->getProducts() + $this->arResult;
     } else {
         if ($this->arParams["SHOW_TOTAL_PRICE"] == "Y") {
             if (isset($_SESSION["SALE_BASKET_PRICE"]) && array_key_exists(SITE_ID, $_SESSION["SALE_BASKET_PRICE"])) {
                 $totalPrice = floatval($_SESSION["SALE_BASKET_PRICE"][SITE_ID]);
             } else {
                 $totalPrice = $this->getTotalPrice();
             }
             $this->arResult["TOTAL_PRICE"] = $totalPrice;
         }
         if (isset($_SESSION["SALE_BASKET_NUM_PRODUCTS"]) && array_key_exists(SITE_ID, $_SESSION["SALE_BASKET_NUM_PRODUCTS"])) {
             $numProducts = intval($_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID]);
         } else {
             $numProducts = $this->getNumProducts();
         }
         $this->arResult["NUM_PRODUCTS"] = $numProducts;
     }
     if ($this->arParams["SHOW_TOTAL_PRICE"] == "Y") {
         $this->arResult["TOTAL_PRICE"] = CCurrencyLang::CurrencyFormat($this->arResult["TOTAL_PRICE"], CSaleLang::GetLangCurrency(SITE_ID), true);
     }
     $productS = BasketNumberWordEndings($this->arResult["NUM_PRODUCTS"]);
     $this->arResult["PRODUCT(S)"] = GetMessage("TSB1_PRODUCT") . $productS;
     // compatibility!
     $this->arResult["PRODUCTS"] = str_replace("#END#", $productS, str_replace("#NUM#", $this->arResult["NUM_PRODUCTS"], GetMessage("TSB1_BASKET_TEXT")));
     // output
     if ($this->arParams['AJAX'] == 'Y') {
         $this->includeComponentTemplate('ajax_template');
     } else {
         $this->includeComponentTemplate();
     }
 }
コード例 #4
0
		elseif ($lang=="en")
		{
			if (IntVal($num)>1)
			{
				return "s";
			}
			return "";
		}
		else
		{
			return "";
		}
	}
}
if(!empty($arResult["ITEMS"])){
    $arResult['END'] = BasketNumberWordEndings(count($arResult["ITEMS"]));
}
?>

    <div class="cart-info">
        <p class="cart"><?php 
echo GetMessage("DVS_INCART");
?>
</p>
<?
$sum = 0;
$num = 0;
foreach ($arResult["ITEMS"] as $v)
{
        if ($v["DELAY"]=="N" && $v["CAN_BUY"]=="Y")
        {