B
B
barder2020-10-09 10:18:28
1C-Bitrix
barder, 2020-10-09 10:18:28

Why is the price affixed but not shown on the site?

Hi all.
I have a shopping catalog, I'm trying to load a product from a CSV code:

$cat[] = ('724');
            $PROP = array();
            $detail_desc = $data[3] . "<BR>" . $data[10];
            $previev_desc = $data[3];
            $PROP['SSYLKA'] = $data[16];
            $PROP['CML2_ARTICLE'] = $data[4];
              $arLoadProductArray = Array(
              "MODIFIED_BY"    => $USER->GetID(), // элемент изменен текущим пользователем
              "ACTIVE_FROM" => date('d.m.Y H:i:s'),
            	  "IBLOCK_SECTION" => $cat,     
              "IBLOCK_ID"      => 5,
              "PROPERTY_VALUES"=> $PROP,
              "NAME"           => $data[8],
              "CATALOG_QUANTITY" => 100,
              "ACTIVE"         	=> "Y",            // активен
              "PREVIEW_TEXT"   	=> $previev_desc,
              "DETAIL_TEXT"    	=> $detail_desc,
                                                  "DETAIL_TEXT_TYPE" => 'html',
              "PREVIEW_PICTURE" => CFile::MakeFileArray($data[11]),
              "DETAIL_PICTURE" 	=> CFile::MakeFileArray($data[11]),
              "QUANTITY" 		=> 100
            );
            if($PRODUCT_ID = $el->Add($arLoadProductArray)) {
              	echo "Создан : ".$PRODUCT_ID . "ID магазина: " . $data[4];
              	
              	CPrice::SetBasePrice($PRODUCT_ID, $data[12], "RUB", 0);
              
              }


But here's the problem:
  • The price is not immediately entered into the base price, if you click "Use advanced price management mode", then the price will be in the base prices, and you have to go into the card and click save, then the price will appear.
  • The available quantity is not set, although the QUANTITY property is specified

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Ainur Valiev, 2020-10-09
@vaajnur

https://blog.d-it.ru/dev/add-the-product-in-bitrix...
How to update the balance?
We can't do this:
CCatalogProduct::update($row['ID'], array('QUANTITY' => $fields['QUANTITY']));
Because the product may not yet be in the database (despite the fact that the element is already there).
We can do like this:

CCatalogProduct::add(array('ID' => $row['ID'], 'QUANTITY' => $fields['QUANTITY']));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question