Answer the question
In order to leave comments, you need to log in
How to display goods and trade offers in 1C-Bitrix?
Good afternoon!
Please help, I started working with 1C-Bitrix not long ago and I can’t figure out how to display the product and trade offers for the product, if any.
There is a product in the infoblock and not all products have trade offers.
I was able to understand how to withdraw only the goods but not the trade ones from them, you need to withdraw both options.
CModule::IncludeModule("catalog");
$my_slider = CIBlockElement::GetList (
Array("NAME" => "ASC"),
Array("IBLOCK_ID" => 1),
false,
false,
Array(
'ID',
'NAME',
'PROPERTY_G_ART', //Артикул
'PROPERTY_G_FULL', //Полное название товара
'PROPERTY_UKLON', //Уклон типа
'PROPERTY_G_SHORT', //Краткое наименование товара
)
);
while($ar_fields = $my_slider->GetNext())
{
echo"<pre><b>";
print_r($ar_fields);
echo"<b/></pre>";
}
Answer the question
In order to leave comments, you need to log in
0. For starters, you should not use the direct non-cached methods of the deprecated api. To start, the standard components of Bitrix are enough for you. When you study caching, database structure and D7 - then you can play around with direct queries.
Abusing these CIBlockElement::GetList will put you on the site. These methods from 2010 and in modern development are not used by anyone (in their right mind).
1. Try to understand everything that you write, and not stupidly copy-paste code from examples from somewhere.
What is this line doing here? What is she responsible for? Answer these questions for yourself.
2. Name variables with meaningful names, not like in the examples
CModule::IncludeModule("catalog");
$my_slider = CIBlockElement::GetList
And here is the slider, when do you have goods? You will have the whole site in one sliders. After half a year, you won’t figure out where you have what. Don't shoot yourself in the foot.
3.
Array("NAME" => "ASC"),
Array("IBLOCK_ID" => 1),
false,
false,
I was able to understand how to withdraw only goods but not trade ones from them,
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question