0

i have a problem with this code. some one deleted/changed something here. i spent countless hours trying to figure out where my ; or } might be missing, but no luck. Could you please help me.

<?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");
$APPLICATION->SetTitle("Корзина");
?><?

if($_REQUEST['otkr'])
{
 Add2BasketByProductID(
  $_REQUEST['otkr'],
  1,
  array(),
  array(
    array("NAME" => "Текст открытки", "CODE" => "TEXT", "VALUE" => $_REQUEST['text_otkr'])
  )
 );
}

if($_REQUEST['pack'])
{
 Add2BasketByProductID(
  $_REQUEST['pack'],
  1,
  array(),
  array()
 );
}

?> <?$APPLICATION->IncludeComponent(
 "infoday:sale.basket.basket",
 "cart",
 Array(
  "COLUMNS_LIST" => array("NAME","PRICE","TYPE","QUANTITY","DELETE","DELAY","WEIGHT","DISCOUNT"),
  "COMPOSITE_FRAME_MODE" => "A",
  "COMPOSITE_FRAME_TYPE" => "AUTO",
  "COUNT_DISCOUNT_4_ALL_QUANTITY" => "Y",
  "GIFT_ID" => "",
  "HIDE_COUPON" => "Y",
  "PATH_TO_ORDER" => "/personal/order/make/",
  "PRICE_VAT_SHOW_VALUE" => "N",
  "QUANTITY_FLOAT" => "N",
  "SET_TITLE" => "Y"
 )
);?> <?if($USER->isAdmin()):?>&nbsp;&nbsp;<br>
 <br><?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");?>
E. Rak
  • 3
  • 2

2 Answers2

1

you are missing endif; at the end.

<?if($USER->isAdmin()):?>&nbsp;&nbsp;<br>
<br><?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");?>
<? endif; ?>

your code style is terrible... why are you mixing html with php and ending php section (?>) when at next line starting a new one (<?)

Eduard Void
  • 2,646
  • 1
  • 13
  • 13
  • this is a legacy code for the online store my sister manages. You are my hero. it is working now. this is the link to the store http://www.farfalladitoscana.ru/ – E. Rak Jan 26 '18 at 08:19
1

I reformatted your code and tested it without parse error on my localhost:

<?php 
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");
$APPLICATION->SetTitle("Корзина");
?>

<?

if($_REQUEST['otkr'])
{
    Add2BasketByProductID(
        $_REQUEST['otkr'],
        1,
        array(),
        array(
                array("NAME" => "Текст открытки", "CODE" => "TEXT", "VALUE" => $_REQUEST['text_otkr'])
        )
    );
}

if($_REQUEST['pack'])
{
    Add2BasketByProductID(
        $_REQUEST['pack'],
        1,
        array(),
        array()
    );
}

?> 

<?php

$APPLICATION->IncludeComponent(
    "infoday:sale.basket.basket",
    "cart",
    array(
        "COLUMNS_LIST" => array("NAME","PRICE","TYPE","QUANTITY","DELETE","DELAY","WEIGHT","DISCOUNT"),
        "COMPOSITE_FRAME_MODE" => "A",
        "COMPOSITE_FRAME_TYPE" => "AUTO",
        "COUNT_DISCOUNT_4_ALL_QUANTITY" => "Y",
        "GIFT_ID" => "",
        "HIDE_COUPON" => "Y",
        "PATH_TO_ORDER" => "/personal/order/make/",
        "PRICE_VAT_SHOW_VALUE" => "N",
        "QUANTITY_FLOAT" => "N",
        "SET_TITLE" => "Y"
    )
);

?> 

<? 

if($USER->isAdmin()) : 
/* doing nothing here ??? */
endif
?>

&nbsp;&nbsp;<br>

<br>
<? 
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");

?>
ild flue
  • 1,323
  • 8
  • 9
  • 1
    thank you for your work. as i mention earlier this is not i how coded that way- this web site was created from scratch about 4 years ago by a hired company ( cleary they managed to create it and make it work, however coding inself is indeed horrible). – E. Rak Jan 26 '18 at 08:45