本文整理汇总了PHP中Magento\Framework\App\Request\Http::getParams方法的典型用法代码示例。如果您正苦于以下问题:PHP Http::getParams方法的具体用法?PHP Http::getParams怎么用?PHP Http::getParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\App\Request\Http
的用法示例。
在下文中一共展示了Http::getParams方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeGetImage
/**
* Replace original configurable product with first child
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @param \Magento\Catalog\Block\Product\AbstractProduct $subject
* @param \Magento\Catalog\Model\Product $product
* @param string $location
* @param array $attributes
* @return array
*/
public function beforeGetImage(\Magento\Catalog\Block\Product\AbstractProduct $subject, \Magento\Catalog\Model\Product $product, $location, array $attributes = [])
{
if ($product->getTypeId() == \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE && ($location == self::CATEGORY_PAGE_GRID_LOCATION || $location == self::CATEGORY_PAGE_LIST_LOCATION)) {
$request = $this->request->getParams();
if (is_array($request)) {
$filterArray = $this->getFilterArray($request);
if (!empty($filterArray)) {
$product = $this->loadSimpleVariation($product, $filterArray);
}
}
}
return [$product, $location, $attributes];
}
示例2: prepareFacets
/**
* @return \com\boxalino\bxclient\v1\BxFacets
*/
private function prepareFacets()
{
$bxFacets = new \com\boxalino\bxclient\v1\BxFacets();
$selectedValues = array();
$requestParams = $this->request->getParams();
$attributeCollection = $this->bxHelperData->getFilterProductAttributes();
foreach ($requestParams as $key => $values) {
if (strpos($key, $this->getUrlParameterPrefix()) === 0) {
$fieldName = substr($key, 3);
$selectedValues[$fieldName] = !is_array($values) ? array($values) : $values;
}
if (isset($attributeCollection['products_' . $key])) {
$paramValues = !is_array($values) ? array($values) : $values;
$attributeModel = $this->_modelConfig->getAttribute('catalog_product', $key)->getSource();
foreach ($paramValues as $paramValue) {
$selectedValues['products_' . $key][] = $attributeModel->getOptionText($paramValue);
}
}
}
if (!$this->navigation) {
$catId = isset($selectedValues['category_id']) && sizeof($selectedValues['category_id']) > 0 ? $selectedValues['category_id'][0] : null;
$bxFacets->addCategoryFacet($catId);
}
foreach ($attributeCollection as $code => $attribute) {
if ($this->navigation && $code == 'categories') {
$this->bxHelperData->setRemovedAttributes($code);
continue;
}
$bound = $code == 'discountedPrice' ? true : false;
list($label, $type, $order, $position) = array_values($attribute);
$selectedValue = isset($selectedValues[$code]) ? $selectedValues[$code][0] : null;
$bxFacets->addFacet($code, $selectedValue, $type, $label, $order, $bound);
}
list($topField, $topOrder) = $this->bxHelperData->getTopFacetValues();
if ($topField) {
$selectedValue = isset($selectedValues[$topField][0]) ? $selectedValues[$topField][0] : null;
$bxFacets->addFacet($topField, $selectedValue, "string", $topField, $topOrder);
}
return $bxFacets;
}