Loads a product class field from the database
@param integer $product_class_field_id
@return array
763842
public function get($product_class_field_id)
    {
        $result = null;
        $this->hook->attach('product.class.field.get.before', $product_class_field_id, $result, $this);

        if (isset($result)) {
            return $result;
        }

        $sql = 'SELECT * FROM product_class_field WHERE product_class_field_id=?';
        $result = $this->db->fetch($sql, array($product_class_field_id));

        $this->hook->attach('product.class.field.get.after', $result, $this);
        return $result;
    }
957905
public function loadObjectList($class_name = "stdClass")
    {
        if ($this->stmt === null) {
            return null;
        }

        $objectList = array();
        while ($object = $this->stmt->fetchObject($class_name)) {
            $objectList[] = $object;
        }
        return $objectList;
    }
1348233
protected function getUniqueListProductClassField()
    {
        $types = $this->field->getTypes();
        $fields = $this->getListProductClassField(array('index' => 'field_id'));

        $unique = array();

        foreach ((array) $this->field->getList() as $field) {
            if (empty($fields[$field['field_id']])) {
                $type = empty($types[$field['type']]) ? $this->text('Unknown') : $types[$field['type']];
                $unique[$field['field_id']] = "{$field['title']} ($type)";
            }
        }

        return $unique;
    }
925070
public function listProductClassField($product_class_id)
    {
        $this->setProductClassProductClassField($product_class_id);
        $this->setTitleListProductClassField();
        $this->setBreadcrumbListProductClassField();
        $this->setFilterListProductClassField();

        $this->setData('field_types', $this->field->getTypes());
        $this->setData('fields', $this->getListProductClassField());
        $this->setData('product_class', $this->data_product_class);

        $this->submitListProductClassField();
        $this->outputListProductClassField();
    }
998373
protected function getListProductClass()
    {
        $id = $this->getParam(0);

        if (!isset($id)) {
            return $this->product_class->getList(array('limit' => $this->getLimit()));
        }

        if (!is_numeric($id)) {
            $this->errorAndExit($this->text('Invalid argument'));
        }

        $result = $this->product_class->get($id);

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        return array($result);
    }
566482
public function update($product_class_id, array $data)
    {
        $result = null;
        $this->hook->attach('product.class.update.before', $product_class_id, $data, $result, $this);

        if (isset($result)) {
            return (bool) $result;
        }

        $conditions = array('product_class_id' => $product_class_id);
        $result = (bool) $this->db->update('product_class', $data, $conditions);
        $this->hook->attach('product.class.update.after', $product_class_id, $data, $result, $this);
        return (bool) $result;
    }
748679
public function cmdUpdateProductClassField()
    {
        $params = $this->getParam();

        if (empty($params[0]) || count($params) < 2) {
            $this->errorAndExit($this->text('Invalid command'));
        }

        if (!is_numeric($params[0])) {
            $this->errorAndExit($this->text('Invalid argument'));
        }

        $this->setSubmitted(null, $params);
        $this->setSubmitted('update', $params[0]);

        $this->validateComponent('product_class_field');
        $this->updateProductClassField($params[0]);
        $this->output();
    }
282237
protected function load_fields() {
        global $DB;

        $sql = "SELECT r.id AS rid, r.sort, r.description, r.descriptionformat,
                       l.id AS lid, l.grade, l.definition, l.definitionformat
                  FROM {workshopform_rubric} r
             LEFT JOIN {workshopform_rubric_levels} l ON (l.dimensionid = r.id)
                 WHERE r.workshopid = :workshopid
                 ORDER BY r.sort, l.grade";
        $params = array('workshopid' => $this->workshop->id);

        $rs = $DB->get_recordset_sql($sql, $params);
        $fields = array();
        foreach ($rs as $record) {
            if (!isset($fields[$record->rid])) {
                $fields[$record->rid] = new stdclass();
                $fields[$record->rid]->id = $record->rid;
                $fields[$record->rid]->sort = $record->sort;
                $fields[$record->rid]->description = $record->description;
                $fields[$record->rid]->descriptionformat = $record->descriptionformat;
                $fields[$record->rid]->levels = array();
            }
            if (!empty($record->lid)) {
                $fields[$record->rid]->levels[$record->lid] = new stdclass();
                $fields[$record->rid]->levels[$record->lid]->id = $record->lid;
                $fields[$record->rid]->levels[$record->lid]->grade = $record->grade;
                $fields[$record->rid]->levels[$record->lid]->definition = $record->definition;
                $fields[$record->rid]->levels[$record->lid]->definitionformat = $record->definitionformat;
            }
        }
        $rs->close();

        return $fields;
    }
258928
protected function updateProductClassField($product_class_field_id)
    {
        if (!$this->isError() && !$this->product_class_field->update($product_class_field_id, $this->getSubmitted())) {
            $this->errorAndExit($this->text('Unexpected result'));
        }
    }
1234425
def load_product_class(self, mode):
        """"""

        product_entry = self.products[mode]

        return self._get_base_class(product_entry)
143754
public function getLoadedProductCollection()
    {
        $params = $this->getRequest()->getParams();
        //check for param code and id
        if (! isset($params['customer_id']) ||
            ! isset($params['code']) ||
            ! $this->helper->isCodeValid($params['code'])
        ) {
            $this->helper->log('Wishlist no id or valid code is set');
            return [];
        }

        //products to be display for recommended pages
        //display mode based on the action name
        $mode = $this->getRequest()->getActionName();
        //number of product items to be displayed
        $limit = (int) $this->recommnededHelper->getDisplayLimitByMode($mode);
        $items = $this->_getWishlistItems();
        $numItems = count($items);

        //no product found to display
        if ($numItems == 0 || !$limit) {
            return [];
        } elseif ($numItems > $limit) {
            $maxPerChild = 1;
        } else {
            $maxPerChild = number_format($limit / $numItems);
        }

        $this->helper->log(
            'DYNAMIC WISHLIST PRODUCTS : limit ' . $limit . ' products : '
            . $numItems . ', max per child : ' . $maxPerChild
        );

        $productsToDisplayCounter = 0;
        $productsToDisplay = $this->getProductsToDisplay(
            $items,
            $mode,
            $productsToDisplayCounter,
            $limit,
            $maxPerChild
        );

        //check for more space to fill up the table with fallback products
        if ($productsToDisplayCounter < $limit) {
            $productsToDisplay = $this->fillProductsToDisplay($productsToDisplay, $productsToDisplayCounter, $limit);
        }

        $this->helper->log(
            'wishlist - loaded product to display ' . count($productsToDisplay)
        );

        return $productsToDisplay;
    }
793079
function load_field( $field, $field_key, $post_id = false )
	{
		// load cache
		if( !$field )
		{
			$field = wp_cache_get( 'load_field/key=' . $field_key, 'acf' );
		}
		
		
		// load from DB
		if( !$field )
		{
			// vars
			global $wpdb;
			
			
			// get field from postmeta
			$sql = $wpdb->prepare("SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = %s", $field_key);
			
			if( $post_id )
			{
				$sql .= $wpdb->prepare("AND post_id = %d", $post_id);
			}
	
			$rows = $wpdb->get_results( $sql, ARRAY_A );
			
			
			
			// nothing found?
			if( !empty($rows) )
			{
				$row = $rows[0];
				
				
				/*
				*  WPML compatibility
				*
				*  If WPML is active, and the $post_id (Field group ID) was not defined,
				*  it is assumed that the load_field functio has been called from the API (front end).
				*  In this case, the field group ID is never known and we can check for the correct translated field group
				*/
				
				if( defined('ICL_LANGUAGE_CODE') && !$post_id )
				{
					$wpml_post_id = icl_object_id($row['post_id'], 'acf', true, ICL_LANGUAGE_CODE);
					
					foreach( $rows as $r )
					{
						if( $r['post_id'] == $wpml_post_id )
						{
							// this row is a field from the translated field group
							$row = $r;
						}
					}
				}
				
				
				// return field if it is not in a trashed field group
				if( get_post_status( $row['post_id'] ) != "trash" )
				{
					$field = $row['meta_value'];
					$field = maybe_unserialize( $field );
					$field = maybe_unserialize( $field ); // run again for WPML
					
					
					// add field_group ID
					$field['field_group'] = $row['post_id'];
				}
				
			}
		}
		
		
		// apply filters
		$field = apply_filters('acf/load_field_defaults', $field);
		
		
		// apply filters
		foreach( array('type', 'name', 'key') as $key )
		{
			// run filters
			$field = apply_filters('acf/load_field/' . $key . '=' . $field[ $key ], $field); // new filter
		}
		
	
		// set cache
		wp_cache_set( 'load_field/key=' . $field_key, $field, 'acf' );
		
		return $field;
	}
333695
public function load( $product ) {
		$this->product = $product;

		$this->product_key = $this->product->get_key() . '-update-response';

		$this->license_key = $this->product->get_license();
		if ( $this->product->requires_license() ) {
			$this->failed_checks = intval( get_option( $this->product->get_key() . '_failed_checks', 0 ) );
			$this->register_license_hooks();
		}

		if ( $this->product->is_plugin() ) {
			add_filter(
				'pre_set_site_transient_update_plugins',
				[
					$this,
					'pre_set_site_transient_update_plugins_filter',
				]
			);
			add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
			add_filter( 'http_request_args', array( $this, 'http_request_args' ), 10, 2 );

			return $this;
		}
		if ( $this->product->is_theme() ) {
			add_filter( 'site_transient_update_themes', array( &$this, 'theme_update_transient' ) );
			add_filter( 'delete_site_transient_update_themes', array( &$this, 'delete_theme_update_transient' ) );
			add_action( 'load-update-core.php', array( &$this, 'delete_theme_update_transient' ) );
			add_action( 'load-themes.php', array( &$this, 'delete_theme_update_transient' ) );
			add_action( 'load-themes.php', array( &$this, 'load_themes_screen' ) );
			add_filter( 'http_request_args', array( $this, 'disable_wporg_update' ), 5, 2 );

			return $this;

		}

		return $this;
	}
168209
public function indexProduct($product_id)
    {
        $this->setProduct($product_id);
        $this->setMetaIndexProduct();
        $this->setTitleIndexProduct();
        $this->setBreadcrumbIndexProduct();
        $this->setHtmlFilterIndexProduct();

        $this->setData('product', $this->data_product);

        $this->setDataSummaryIndexProduct();
        $this->setDataImagesIndexProduct();
        $this->setDataCartFormIndexProduct();
        $this->setDataRatingWidgetIndexProduct();

        $this->setDataDescriptionIndexProduct();
        $this->setDataAttributesIndexProduct();
        $this->setDataReviewsIndexProduct();
        $this->setDataRecentIndexProduct();
        $this->setDataRelatedIndexProduct();
        $this->setDataBundledIndexProduct();

        $this->setJsIndexProduct();
        $this->outputIndexProduct();
    }
302845
protected function getIDListFromDB() : array
    {
        $arElementIDList = (array) Product::getByCategory($this->sValue)
            ->where('brand_id', '>', 0)
            ->lists('brand_id', 'id');

        $obCategory = Category::find($this->sValue);
        if (!empty($obCategory)) {
            $arAdditionalElementIDList = (array) $obCategory->product_link()
                ->where('brand_id', '>', 0)
                ->lists('brand_id', 'id');

            $arElementIDList = $arElementIDList + $arAdditionalElementIDList;
        }

        return $arElementIDList;
    }
66198
private function getSortedProducts()
    {
        $products   = [];
        $productIds = $this->getSortedProductIds();

        if ($productIds && count($productIds)) {
            $productCollection = $this->getProductCollection()->setPageSize(count($productIds));

            $idFilterParams = ['values' => $productIds, 'field' => 'entity_id'];
            $idFilter       = $this->queryFactory->create(QueryInterface::TYPE_TERMS, $idFilterParams);
            $productCollection->addQueryFilter($idFilter);

            $products = $productCollection->getItems();
        }

        $sortedProducts = [];

        foreach ($this->getSortedProductIds() as $productId) {
            if (isset($products[$productId])) {
                $sortedProducts[$productId] = $products[$productId];
            }
        }

        return $sortedProducts;
    }
1227239
public function getLoadedProductCollection()
    {
        $params = $this->getRequest()->getParams();
        //check for param code and id
        if (! isset($params['customer_id']) ||
            ! isset($params['code']) ||
            ! $this->helper->isCodeValid($params['code'])
        ) {
            $this->helper->log('Recently viewed no id or valid code is set');
            return [];
        }

        $productsToDisplay = [];
        $mode = $this->getRequest()->getActionName();
        $customerId = (int) $this->getRequest()->getParam('customer_id');
        $limit = (int) $this->recommnededHelper->getDisplayLimitByMode($mode);

        //login customer to receive the recent products
        $session = $this->sessionFactory->create();
        $isLoggedIn = $session->loginById($customerId);
        $productIds = $this->catalog->getRecentlyViewed($customerId, $limit);

        //get product collection to check for salable
        $productCollection = $this->catalog->getProductCollectionFromIds($productIds);

        //show products only if is salable
        foreach ($productCollection as $product) {
            if ($product->isSalable()) {
                $productsToDisplay[$product->getId()] = $product;
            }
        }
        $this->helper->log(
            'Recentlyviewed customer  : ' . $customerId . ', mode ' . $mode
            . ', limit : ' . $limit .
            ', items found : ' . count($productIds) . ', is customer logged in : '
            . $isLoggedIn . ', products :' . count($productsToDisplay)
        );

        $session->logout();

        return $productsToDisplay;
    }