Ejemplo n.º 1
0
 /**
  * @return Entity\AddResult|Entity\UpdateResult|Result
  */
 public function save()
 {
     $id = $this->getId();
     $fields = $this->fields->getValues();
     if ($id > 0) {
         $fields = $this->fields->getChangedValues();
         if (!empty($fields) && is_array($fields)) {
             $r = Internals\BasketPropertyTable::update($id, $fields);
             if (!$r->isSuccess()) {
                 return $r;
             }
         }
         $result = new Entity\UpdateResult();
     } else {
         $fields['BASKET_ID'] = $this->getCollection()->getBasketId();
         $r = Internals\BasketPropertyTable::add($fields);
         if (!$r->isSuccess()) {
             return $r;
         }
         $id = $r->getId();
         $this->setFieldNoDemand('ID', $id);
         $result = new Entity\AddResult();
     }
     return $result;
 }
Ejemplo n.º 2
0
 /**
  * @param $id
  * @return Main\Entity\DeleteResult
  * @throws Main\ArgumentException
  * @throws Main\ArgumentNullException
  */
 public static function deleteWithItems($id)
 {
     $id = intval($id);
     if ($id <= 0) {
         throw new Main\ArgumentNullException("id");
     }
     $itemsList = BasketPropertyTable::getList(array("filter" => array("BASKET_ID" => $id), "select" => array("ID")));
     while ($item = $itemsList->fetch()) {
         BasketPropertyTable::delete($item["ID"]);
     }
     return BasketTable::delete($id);
 }
Ejemplo n.º 3
0
 /**
  *
  */
 public function save()
 {
     $result = new Sale\Result();
     $itemsFromDb = array();
     $itemsFromDbList = Internals\BasketPropertyTable::getList(array("filter" => array("BASKET_ID" => $this->getBasketItem()->getId()), "select" => array("ID")));
     while ($itemsFromDbItem = $itemsFromDbList->fetch()) {
         $itemsFromDb[$itemsFromDbItem["ID"]] = true;
     }
     /** @var BasketPropertyItem $basketProperty */
     foreach ($this->collection as $basketProperty) {
         $r = $basketProperty->save();
         if (!$r->isSuccess()) {
             $result->addErrors($r->getErrors());
         }
         if (isset($itemsFromDb[$basketProperty->getId()])) {
             unset($itemsFromDb[$basketProperty->getId()]);
         }
     }
     foreach ($itemsFromDb as $k => $v) {
         Internals\BasketPropertyTable::delete($k);
     }
     return $result;
 }
Ejemplo n.º 4
0
 $fieldValue .= "[" . $arItem["PRODUCT_ID"] . "] ";
 if (strpos($arItem["DETAIL_PAGE_URL"], "http") === false) {
     $url = "http://" . $serverName[$arOrder["LID"]] . htmlspecialcharsBack($arItem["DETAIL_PAGE_URL"]);
 } else {
     $url = htmlspecialcharsBack($arItem["DETAIL_PAGE_URL"]);
 }
 if (strlen($arItem["DETAIL_PAGE_URL"]) > 0) {
     $fieldValue .= '<a href="' . htmlspecialcharsbx($url) . '" class="' . $linkClass . '">';
 }
 $fieldValue .= htmlspecialcharsbx($arItem["NAME"]);
 if (strlen($arItem["DETAIL_PAGE_URL"]) > 0) {
     $fieldValue .= "</a>";
 }
 $fieldValue .= " <nobr>(" . $arItem["QUANTITY"] . " " . $measure . ")</nobr>";
 if ($bShowBasketProps) {
     $dbProp = \Bitrix\Sale\Internals\BasketPropertyTable::getList(array('order' => array("SORT" => "ASC", "ID" => "ASC"), 'filter' => array("BASKET_ID" => $arItem["ID"], "!CODE" => array("CATALOG.XML_ID", "PRODUCT.XML_ID"))));
     while ($arProp = $dbProp->fetch()) {
         if (strlen($arProp["VALUE"]) > 0) {
             $fieldValue .= "<div><small>" . htmlspecialcharsbx($arProp["NAME"]) . ": " . htmlspecialcharsbx($arProp["VALUE"]) . "</small></div>";
         }
     }
 }
 if (CSaleBasketHelper::isSetParent($arItem)) {
     $fieldValue .= '<div class="set-link-block">';
     $fieldValue .= '<a class="dashed-link show-set-link" href="javascript:void(0);" id="set_toggle_link_' . $arItem["ID"] . '" onclick="fToggleSetItems(' . $arItem["ID"] . ')">' . Loc::getMessage("SOA_SHOW_SET") . "</a>";
     $fieldValue .= "</div>";
 }
 if ($bNeedLine) {
     $fieldValue .= $basketSeparator;
 }
 $fieldValue .= "</div>";
Ejemplo n.º 5
0
 					while($arProp = $dbProp -> fetch())
 						if(strlen($arProp["VALUE"]) > 0)
 							$fieldValue .= "<div><small>".htmlspecialcharsbx($arProp["NAME"]).": ".htmlspecialcharsbx($arProp["VALUE"])."</small></div>";
 */
 if (\Bitrix\Main\Analytics\Catalog::isOn() || $bNeedBasket) {
     $dbItemsList = \Bitrix\Sale\Internals\BasketTable::getList(array('order' => array('ID' => 'ASC'), 'filter' => array('=ORDER_ID' => array_keys($orderList))));
     while ($item = $dbItemsList->fetch()) {
         $basketList[$item['ORDER_ID']][$item['ID']] = $item;
         if (array_key_exists($item['ORDER_ID'], $recommendedList)) {
             if ($item['RECOMMENDATION']) {
                 $recommendedList[$item['ORDER_ID']] = true;
             }
         }
         if ($bShowBasketProps) {
             if (!empty($basketList[$item['ORDER_ID']]) && is_array($basketList[$item['ORDER_ID']])) {
                 $resProp = \Bitrix\Sale\Internals\BasketPropertyTable::getList(array('order' => array("SORT" => "ASC", "ID" => "ASC"), 'filter' => array("BASKET_ID" => array_keys($basketList[$item['ORDER_ID']]), "!CODE" => array("CATALOG.XML_ID", "PRODUCT.XML_ID"))));
                 while ($prop = $resProp->fetch()) {
                     if (strval($prop["VALUE"]) != "") {
                         $basketPropertyList[$prop['BASKET_ID']][$prop['ID']] = $prop;
                     }
                 }
             }
         }
     }
 }
 foreach ($orderList as $orderId => $arOrder) {
     foreach ($userIdFields as $userIdField) {
         $uId = intval($arOrder[$userIdField]);
         if ($uId > 0 && !in_array($uId, $users)) {
             $users[] = $uId;
         }