Reduces a number of items to save
@param array $product_ids
542496
protected function controlLimit(array &$product_ids)
    {
        $limit = $this->getLimit();

        if (!empty($limit)) {
            $product_ids = array_slice($product_ids, 0, $limit);
        }
    }
486155
protected function setProductProductBundle($product_id)
    {
        $this->data_product = $this->product->get($product_id);

        if (empty($this->data_product)) {
            $this->outputHttpStatus(404);
        }

        $this->prepareProductBundle($this->data_product);
    }
1151552
final public function deleteByPks(array $ids)
    {
        foreach ($ids as $id) {
            if (!$this->deleteByPk($id)) {
                return false;
            }
        }

        return true;
    }
781337
protected function _removeProductSuggestions( $productId, $listTypeId,
		MShop_Common_Manager_Interface $productListManager )
	{
		$search = $productListManager->createSearch();
		$expr = array(
			$search->compare( '==', 'product.list.parentid', $productId ),
			$search->compare( '==', 'product.list.type.id', $listTypeId )
		);

		$search->setConditions( $search->combine( '&&', $expr ) );
		$listItems = $productListManager->searchItems( $search );

		$productListManager->deleteItems( array_keys( $listItems ) );
	}
849864
protected function prepareProductsCompare(array &$products)
    {
        foreach ($products as $product_id => &$product) {
            $product['field'] = $this->product_field->getList($product_id);
            $this->setItemProductFields($product, $this->image, $this->product_class);
        }
    }
159989
protected function deleteLinked($product_id)
    {
        $conditions = array('product_id' => $product_id);
        $conditions2 = array('entity' => 'product', 'entity_id' => $product_id);

        $this->db->delete('cart', $conditions);
        $this->db->delete('review', $conditions);
        $this->db->delete('rating', $conditions);
        $this->db->delete('wishlist', $conditions);
        $this->db->delete('rating_user', $conditions);

        $this->db->delete('product_sku', $conditions);
        $this->db->delete('product_field', $conditions);
        $this->db->delete('product_translation', $conditions);
        $this->db->delete('product_view', $conditions);

        $this->db->delete('product_related', $conditions);
        $this->db->delete('product_related', array('item_product_id' => $product_id));
        $this->db->delete('product_bundle', $conditions);

        $this->db->delete('file', $conditions2);
        $this->db->delete('alias', $conditions2);
        $this->db->delete('search_index', $conditions2);

        $sql = 'DELETE ci
                FROM collection_item ci
                INNER JOIN collection c ON(ci.collection_id = c.collection_id)
                WHERE c.type = ? AND ci.entity_id = ?';

        $this->db->run($sql, array('product', $product_id));
    }
748515
public function setProductId($product_id) {

        $this->checkInArray($product_id, GDAXConstants::$productIdValues);
        $this->product_id = $product_id;
        return $this;

    }
750624
public function cleanup( array $siteids )
	{
		foreach( $this->_getSubManagers() as $submanager ) {
			$submanager->cleanup( $siteids );
		}

		$this->_cleanup( $siteids, 'mshop/catalog/manager/index/catalog/default/item/delete' );
	}
954827
protected function setIds(array $product)
    {
        $this->setLastEntityId(isset($product[MemberNames::ENTITY_ID]) ? $product[MemberNames::ENTITY_ID] : null);
    }
1157832
public function cleanupNodesWithIds($ids)
    {
        $ids = array_merge($this->getRelatedNodeIds($ids), $ids);

        if (!empty($ids)) {
            $repositories = $this->getNodeRepositories($ids);

            //delete all the nodes
            $this->getService('repos:base.node')->destroy($ids);

            //set the creator,updator,authors to null
            $in = '('.implode(',', $ids).')';
            $query[] = "last_comment_id = IF(last_comment_id IN $in, NULL, last_comment_id)";
            $query[] = "created_by = IF(created_by IN $in, NULL, created_by)";
            $query[] = "modified_by = IF(modified_by IN $in, NULL, modified_by)";
            $query[] = "last_comment_by = IF(last_comment_by IN $in, NULL, last_comment_by)";
            $query = implode(', ', $query);
            $where = $this->getService('repos:base.node')
                        ->getQuery()
                        ->where("last_comment_by IN $in OR created_by IN $in OR modified_by IN $in OR last_comment_by IN $in");

            $this->getService('repos:base.node')->update($query, $where);

            //cleanup all the relationship of every deleted node
            $query = $this->getService('repos:base.edge')
                ->getQuery()
                ->where('nodeA.id', 'IN', $ids)
                ->where('nodeB.id', 'IN', $ids, 'OR');

            $this->getService('repos:base.edge')->destroy($query);

            //now lets the repositories know so they can
            //handle the cleanup
            foreach ($repositories as $repository) {
                $context = $repository->getCommandContext();
                $context->node_ids = $ids;
                $repository->getCommandChain()->run('after.deletenodes', $context);
            }
        }
    }
545402
public function setImportedByIds($ids)
    {
        try {
            $coreResource = $this->getConnection();
            $tableName = $this->getTable(Schema::EMAIL_CATALOG_TABLE);

            $coreResource->update(
                $tableName,
                [
                    'modified' => new \Zend_Db_Expr('null'),
                    'imported' => '1',
                    'updated_at' => gmdate('Y-m-d H:i:s'),
                ],
                ["product_id IN (?)" => $ids]
            );
        } catch (\Exception $e) {
            $this->helper->debug((string)$e, []);
        }
    }
1220743
public function deleteContent(array $ids): void
	{
		if ($this->isAjax() && $this->editConst) {
			$pages = $this->orm->content->findById($ids);
			foreach ($pages as $page) {
				$this->orm->content->remove($page);
			}
			$this->orm->flush();
			$this['list']->reload();
		} else {
			$this->terminate();
		}
	}
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();
    }
99466
protected function setProduct($product_id)
    {
        $this->data_product = $this->product->get($product_id);

        if (empty($this->data_product)) {
            $this->outputHttpStatus(404);
        }

        $this->controlAccessProduct();
        $this->prepareProduct($this->data_product);
    }
227275
public function editProductBundle($product_id)
    {
        $this->setProductProductBundle($product_id);
        $this->setTitleEditProductBundle();
        $this->setBreadcrumbEditProductBundle();

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

        $this->submitEditProductBundle();
        $this->setDataItemsProductBundle();
        $this->outputEditProductBundle();
    }
144314
protected function updateProductsFeatures(array $attributes, $products)
    {
        $products->each(function ($item, $key) use ($attributes, $products) {
            $item->update(['features' => json_encode($attributes[$item->id])]);
            $item->save();
        });
    }
315616
public function saveRecords(array $records, DataDimensions $dataDimensions = null)
    {

        if (!$dataDimensions) {
            $dataDimensions = $this->getCurrentDataDimensions();
        }

        $recordIds = [];
        foreach ($records as $record) {
            $recordIds[] = $this->saveRecord($record, $dataDimensions);
        }

        return $recordIds;

    }