本文整理匯總了PHP中Magento\Framework\App\Action\Action::setRedirect方法的典型用法代碼示例。如果您正苦於以下問題:PHP Action::setRedirect方法的具體用法?PHP Action::setRedirect怎麽用?PHP Action::setRedirect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Framework\App\Action\Action
的用法示例。
在下文中一共展示了Action::setRedirect方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _setupCollection
/**
* @param $entity_ids
*/
protected function _setupCollection($entity_ids)
{
$list = $this->_objectManager->create('\\Boxalino\\Intelligence\\Model\\Collection');
$list->setStoreId($this->_storeManager->getStore()->getId())->addFieldToFilter('entity_id', $entity_ids)->addAttributeToSelect('*');
$list->getSelect()->order(new \Zend_Db_Expr('FIELD(e.entity_id,' . implode(',', $entity_ids) . ')'));
$list->load();
$list->setCurBxPage($this->getToolbarBlock()->getCurrentPage());
$limit = $this->getRequest()->getParam('product_list_limit') ? $this->getRequest()->getParam('product_list_limit') : $this->getToolbarBlock()->getDefaultPerPageValue();
$totalHitCount = $this->p13nHelper->getTotalHitCount();
if (ceil($totalHitCount / $limit) < $list->getCurPage() && $this->getRequest()->getParam('p')) {
$url = $this->_url->getCurrentUrl();
$url = preg_replace('/(\\&|\\?)p=+(\\d|\\z)/', '$1p=1', $url);
$this->_response->setRedirect($url);
}
$lastPage = ceil($totalHitCount / $limit);
$list->setLastBxPage($lastPage);
$list->setBxTotal($totalHitCount);
$this->_productCollection = $list;
}