当前位置: 首页>>代码示例>>PHP>>正文


PHP CCatalogSKU::getProductInfo方法代码示例

本文整理汇总了PHP中CCatalogSKU::getProductInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogSKU::getProductInfo方法的具体用法?PHP CCatalogSKU::getProductInfo怎么用?PHP CCatalogSKU::getProductInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCatalogSKU的用法示例。


在下文中一共展示了CCatalogSKU::getProductInfo方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: checkByShipment

 public function checkByShipment(\Bitrix\Sale\Shipment $shipment, array $restrictionParams, $deliveryId = 0)
 {
     if (!\Bitrix\Main\Loader::includeModule('iblock')) {
         return array();
     }
     if (!\Bitrix\Main\Loader::includeModule('catalog')) {
         return array();
     }
     $productIds = array();
     /** @var \Bitrix\Sale\ShipmentItem $shipmentItem */
     foreach ($shipment->getShipmentItemCollection() as $shipmentItem) {
         /** @var \Bitrix\Sale\BasketItem $basketItem */
         $basketItem = $shipmentItem->getBasketItem();
         if ($basketItem->getField('MODULE') != 'catalog') {
             continue;
         }
         $productId = intval($basketItem->getField('PRODUCT_ID'));
         $iblockId = (int) \CIBlockElement::getIBlockByID($productId);
         $info = \CCatalogSKU::getProductInfo($productId, $iblockId);
         if (!empty($info['ID'])) {
             $candidate = $info['ID'];
         } else {
             $candidate = $productId;
         }
         if (!in_array($candidate, $productIds)) {
             $productIds[] = $candidate;
         }
     }
     $categoriesIds = self::getGroupsIds($productIds);
     return $this->check($categoriesIds, $restrictionParams, $deliveryId);
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:byproductcategory.php

示例2: refresh

 /**
  * Common function, used to update/insert any product.
  *
  * @param int $productId			Id of product.
  * @param int $fuserId				User basket id.
  * @param string $siteId			Site id.
  * @param int $elementId			Parent id.
  * @param string $recommendationId	Bigdata recommendation id.
  *
  * @return int
  */
 public static function refresh($productId, $fuserId, $siteId = SITE_ID, $elementId = 0, $recommendationId = '')
 {
     $productId = (int) $productId;
     if ($productId <= 0) {
         return -1;
     }
     $fuserId = (int) $fuserId;
     if ($fuserId <= 0) {
         return -1;
     }
     $siteId = (string) $siteId;
     if ($siteId == '') {
         return -1;
     }
     $elementId = (int) $elementId;
     $filter = array('FUSER_ID' => $fuserId, '=SITE_ID' => $siteId);
     $connection = Application::getConnection();
     $helper = $connection->getSqlHelper();
     $sqlSiteId = $helper->forSql($siteId);
     if ($elementId > 0) {
         $filter["ELEMENT_ID"] = $elementId;
         // Delete parent product id (for capability)
         if ($elementId != $productId) {
             $connection->query("delete from b_catalog_viewed_product\n\t\t\t\t\t\t\t\t\twhere PRODUCT_ID = " . $elementId . " and FUSER_ID = " . $fuserId . " and SITE_ID = '" . $sqlSiteId . "'");
         }
     } else {
         $productInfo = \CCatalogSKU::getProductInfo($productId);
         // Real SKU ID
         if (!empty($productInfo)) {
             $elementId = $productInfo['ID'];
             $siblings = array();
             // Delete parent product id (for capability)
             $connection->query("delete from b_catalog_viewed_product\n\t\t\t\t\t\t\t\t\twhere PRODUCT_ID = " . $productInfo['ID'] . " and FUSER_ID = " . $fuserId . " and SITE_ID = '" . $sqlSiteId . "'");
             $skus = \CIBlockElement::getList(array(), array('IBLOCK_ID' => $productInfo['OFFER_IBLOCK_ID'], 'PROPERTY_' . $productInfo['SKU_PROPERTY_ID'] => $productInfo['ID']), false, false, array('ID', 'IBLOCK_ID'));
             while ($oneSku = $skus->fetch()) {
                 $siblings[] = $oneSku['ID'];
             }
             $filter['PRODUCT_ID'] = $siblings;
         } else {
             $elementId = $productId;
             $filter['PRODUCT_ID'] = $productId;
         }
     }
     $iterator = static::getList(array('select' => array('ID', 'FUSER_ID', 'DATE_VISIT', 'PRODUCT_ID', 'SITE_ID', 'VIEW_COUNT'), 'filter' => $filter));
     if ($row = $iterator->fetch()) {
         static::update($row['ID'], array("PRODUCT_ID" => $productId, "DATE_VISIT" => new Main\Type\DateTime(), 'VIEW_COUNT' => $row['VIEW_COUNT'] + 1, "ELEMENT_ID" => $elementId, "RECOMMENDATION" => $recommendationId));
         return $row['ID'];
     } else {
         $result = static::add(array("FUSER_ID" => $fuserId, "DATE_VISIT" => new Main\Type\DateTime(), "PRODUCT_ID" => $productId, "ELEMENT_ID" => $elementId, "SITE_ID" => $siteId, "VIEW_COUNT" => 1, "RECOMMENDATION" => $recommendationId));
         return $result->getId();
     }
 }
开发者ID:akniyev,项目名称:arteva.ru,代码行数:63,代码来源:catalogviewedproduct.php

示例3: refresh

 /**
  * Common function, used to update/insert any product.
  *
  * @param int $productId			Id of product.
  * @param int $fuserId				User basket id.
  * @param string $siteId			Site id.
  * @param int $elementId			Parent id.
  * @param string $recommendationId	Bigdata recommendation id.
  *
  * @return int Id of row.
  */
 public static function refresh($productId, $fuserId, $siteId = SITE_ID, $elementId = 0, $recommendationId = '')
 {
     $connection = Application::getConnection();
     $productId = (int) $productId;
     if ($productId <= 0) {
         return -1;
     }
     $fuserId = (int) $fuserId;
     if ($fuserId <= 0) {
         return -1;
     }
     if (!is_string($siteId) || strlen($siteId) <= 0) {
         return -1;
     }
     $filter = array("FUSER_ID" => $fuserId, "SITE_ID" => $siteId);
     if ($elementId > 0) {
         $filter["ELEMENT_ID"] = $elementId;
         // Delete parent product id (for capability)
         if ($elementId != $productId) {
             $connection->query("DELETE FROM\n\t\t\t\t\t\t\t\t\t\tb_catalog_viewed_product\n\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\tPRODUCT_ID = " . intval($elementId) . "\n\t\t\t\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\t\t\tFUSER_ID = " . intval($fuserId) . "\n\t\t\t\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\t\t\tSITE_ID = '" . $connection->getSqlHelper()->forSql($siteId) . "'");
         }
     } else {
         $iblockId = (int) \CIBlockElement::getIBlockByID($productId);
         if ($iblockId <= 0) {
             return -1;
         }
         $productInfo = \CCatalogSKU::getProductInfo($productId, $iblockId);
         // Concrete SKU ID
         if (!empty($productInfo)) {
             $filter['PRODUCT_ID'] = array();
             $siblings = array();
             // Delete parent product id (for capability)
             $connection->query("DELETE FROM\n\t\t\t\t\t\t\t\t\t\tb_catalog_viewed_product\n\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\tPRODUCT_ID = " . intval($productInfo['ID']) . "\n\t\t\t\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\t\t\tFUSER_ID = " . intval($fuserId) . "\n\t\t\t\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\t\t\tSITE_ID = '" . $connection->getSqlHelper()->forSql($siteId) . "'");
             $skuInfo = \CCatalogSKU::getInfoByOfferIBlock($iblockId);
             $skus = \CIBlockElement::getList(array(), array('IBLOCK_ID' => $iblockId, 'PROPERTY_' . $skuInfo['SKU_PROPERTY_ID'] => $productInfo['ID']), false, false, array('ID', 'IBLOCK_ID'));
             while ($oneSku = $skus->fetch()) {
                 $siblings[] = $oneSku['ID'];
             }
             $filter["PRODUCT_ID"] = $siblings;
         } else {
             $filter["PRODUCT_ID"] = $productId;
         }
     }
     $iterator = static::getList(array("filter" => $filter, "select" => array("ID", "FUSER_ID", "DATE_VISIT", "PRODUCT_ID", "SITE_ID", "VIEW_COUNT")));
     if ($row = $iterator->fetch()) {
         static::update($row["ID"], array("PRODUCT_ID" => $productId, "DATE_VISIT" => new \Bitrix\Main\Type\DateTime(), 'VIEW_COUNT' => $row['VIEW_COUNT'] + 1, "ELEMENT_ID" => $elementId, "RECOMMENDATION" => $recommendationId));
         return $row['ID'];
     } else {
         $result = static::add(array("FUSER_ID" => $fuserId, "DATE_VISIT" => new \Bitrix\Main\Type\DateTime(), "PRODUCT_ID" => $productId, "ELEMENT_ID" => $elementId, "SITE_ID" => $siteId, "VIEW_COUNT" => 1, "RECOMMENDATION" => $recommendationId));
         return $result->getId();
     }
 }
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:63,代码来源:catalogviewedproduct.php

示例4: resolveElement

 /**
  * If elementId is an offer, then it's product identifier returned
  * Otherwise $elementId returned.
  *
  * @param integer $iblockId Information block identifier.
  * @param integer $elementId Element identifier.
  *
  * @return integer
  */
 public static function resolveElement($iblockId, $elementId)
 {
     if (self::$catalog === null) {
         self::$catalog = \Bitrix\Main\Loader::includeModule("catalog");
     }
     if (self::$catalog) {
         $catalog = \CCatalogSKU::getProductInfo($elementId, $iblockId);
         if (!empty($catalog) && is_array($catalog)) {
             return $catalog["ID"];
         }
     }
     return $elementId;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:22,代码来源:manager.php

示例5: refresh

 /**
  * Common function, used to update/insert any product.
  *
  * @param int $productId   Id of product.
  * @param int $fuserId   User basket id.
  * @param string $siteId      Site id.
  *
  * @return int Id of row.
  */
 public static function refresh($productId, $fuserId, $siteId = SITE_ID)
 {
     $connection = Application::getConnection();
     $productId = (int) $productId;
     if ($productId <= 0) {
         return -1;
     }
     $iblockID = (int) \CIBlockElement::getIBlockByID($productId);
     if ($iblockID <= 0) {
         return -1;
     }
     $productInfo = \CCatalogSKU::getProductInfo($productId, $iblockID);
     $fuserId = (int) $fuserId;
     if ($fuserId <= 0) {
         return -1;
     }
     if (!is_string($siteId) || strlen($siteId) <= 0) {
         return -1;
     }
     $filter = array("FUSER_ID" => $fuserId, "SITE_ID" => $siteId);
     // Concrete SKU ID
     if (!empty($productInfo)) {
         $filter['PRODUCT_ID'] = array();
         $siblings = array();
         // Delete parent product id (for capability)
         $connection->query("DELETE FROM b_catalog_viewed_product WHERE PRODUCT_ID = {$productInfo['ID']} AND FUSER_ID = {$fuserId} AND SITE_ID = '{$siteId}'");
         $skuInfo = \CCatalogSKU::getInfoByOfferIBlock($iblockID);
         $skus = \CIBlockElement::getList(array(), array('IBLOCK_ID' => $iblockID, 'PROPERTY_' . $skuInfo['SKU_PROPERTY_ID'] => $productInfo['ID']), false, false, array('ID', 'IBLOCK_ID'));
         while ($oneSku = $skus->fetch()) {
             $siblings[] = $oneSku['ID'];
         }
         $filter["PRODUCT_ID"] = $siblings;
     } else {
         $filter["PRODUCT_ID"] = $productId;
     }
     $iterator = static::getList(array("filter" => $filter, "select" => array("ID", "FUSER_ID", "DATE_VISIT", "PRODUCT_ID", "SITE_ID", "VIEW_COUNT")));
     if ($row = $iterator->fetch()) {
         static::update($row["ID"], array("PRODUCT_ID" => $productId, "DATE_VISIT" => new \Bitrix\Main\Type\DateTime(), 'VIEW_COUNT' => $row['VIEW_COUNT'] + 1));
         return $row['ID'];
     } else {
         $result = static::add(array("FUSER_ID" => $fuserId, "DATE_VISIT" => new \Bitrix\Main\Type\DateTime(), "PRODUCT_ID" => $productId, "SITE_ID" => $siteId, "VIEW_COUNT" => 1));
         return $result->getId();
     }
 }
开发者ID:rasuldev,项目名称:torino,代码行数:53,代码来源:catalogviewedproduct.php

示例6: refresh

 /**
  * Common function, used to update/insert any product.
  *
  * @param int $productId			Id of product.
  * @param int $fuserId				User basket id.
  * @param string $siteId			Site id.
  * @param int $elementId			Parent id.
  * @param string $recommendationId	Bigdata recommendation id.
  *
  * @return int
  */
 public static function refresh($productId, $fuserId, $siteId = SITE_ID, $elementId = 0, $recommendationId = '')
 {
     $productId = (int) $productId;
     $fuserId = (int) $fuserId;
     $siteId = (string) $siteId;
     $elementId = (int) $elementId;
     $recommendationId = (string) $recommendationId;
     if ($productId <= 0 || $fuserId <= 0 || $siteId == '') {
         return -1;
     }
     if (Main\Loader::includeModule('statictic') && isset($_SESSION['SESS_SEARCHER_ID']) && (int) $_SESSION['SESS_SEARCHER_ID'] > 0) {
         return -1;
     }
     $filter = array('=FUSER_ID' => $fuserId, '=SITE_ID' => $siteId);
     $connection = Application::getConnection();
     $helper = $connection->getSqlHelper();
     $sqlSiteId = $helper->forSql($siteId);
     if ($elementId > 0) {
         $filter["=ELEMENT_ID"] = $elementId;
         // Delete parent product id (for capability)
         if ($elementId != $productId) {
             $connection->query("delete from b_catalog_viewed_product where PRODUCT_ID = " . $elementId . " and FUSER_ID = " . $fuserId . " and SITE_ID = '" . $sqlSiteId . "'");
         }
     } else {
         $productInfo = \CCatalogSKU::getProductInfo($productId);
         // Real SKU ID
         if (!empty($productInfo)) {
             $elementId = $productInfo['ID'];
             $siblings = array();
             // Delete parent product id (for capability)
             $connection->query("delete from b_catalog_viewed_product\n\t\t\t\t\t\t\t\t\twhere PRODUCT_ID = " . $productInfo['ID'] . " and FUSER_ID = " . $fuserId . " and SITE_ID = '" . $sqlSiteId . "'");
             $skus = \CIBlockElement::getList(array(), array('IBLOCK_ID' => $productInfo['OFFER_IBLOCK_ID'], '=PROPERTY_' . $productInfo['SKU_PROPERTY_ID'] => $productInfo['ID']), false, false, array('ID', 'IBLOCK_ID'));
             while ($oneSku = $skus->fetch()) {
                 $siblings[] = $oneSku['ID'];
             }
             unset($oneSku, $skus);
             $filter['@PRODUCT_ID'] = $siblings;
         } else {
             $elementId = $productId;
             $filter['=PRODUCT_ID'] = $productId;
         }
     }
     // recommendation
     if (!empty($elementId)) {
         global $APPLICATION;
         $recommendationCookie = $APPLICATION->get_cookie(Main\Analytics\Catalog::getCookieLogName());
         if (!empty($recommendationCookie)) {
             $recommendations = Main\Analytics\Catalog::decodeProductLog($recommendationCookie);
             if (is_array($recommendations) && isset($recommendations[$elementId])) {
                 $recommendationId = $recommendations[$elementId][0];
             }
         }
     }
     $iterator = static::getList(array('select' => array('ID', 'FUSER_ID', 'DATE_VISIT', 'PRODUCT_ID', 'SITE_ID', 'VIEW_COUNT'), 'filter' => $filter));
     if ($row = $iterator->fetch()) {
         $update = array("PRODUCT_ID" => $productId, "DATE_VISIT" => new Main\Type\DateTime(), 'VIEW_COUNT' => $row['VIEW_COUNT'] + 1, "ELEMENT_ID" => $elementId);
         if (!empty($recommendationId)) {
             $update["RECOMMENDATION"] = $recommendationId;
         }
         $result = static::update($row['ID'], $update);
         return $result->isSuccess(true) ? $row['ID'] : -1;
     } else {
         $result = static::add(array("FUSER_ID" => $fuserId, "DATE_VISIT" => new Main\Type\DateTime(), "PRODUCT_ID" => $productId, "ELEMENT_ID" => $elementId, "SITE_ID" => $siteId, "VIEW_COUNT" => 1, "RECOMMENDATION" => $recommendationId));
         return $result->isSuccess(true) ? $result->getId() : -1;
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:77,代码来源:catalogviewedproduct.php


注:本文中的CCatalogSKU::getProductInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。