本文整理汇总了PHP中Aimeos\MW\View\Iface::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Iface::get方法的具体用法?PHP Iface::get怎么用?PHP Iface::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aimeos\MW\View\Iface
的用法示例。
在下文中一共展示了Iface::get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setViewParams
/**
* Sets the necessary parameter values in the view.
*
* @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
* @param array &$tags Result array for the list of tags that are associated to the output
* @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
* @return \Aimeos\MW\View\Iface Modified view object
*/
protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
{
if (!isset($this->cache)) {
$context = $this->getContext();
$basketCntl = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
try {
$langid = $basketCntl->get()->getAddress('payment')->getLanguageId();
} catch (\Exception $e) {
$langid = $view->param('ca_billing/order.base.address.languageid', $context->getLocale()->getLanguageId());
}
$view->billingLanguage = $langid;
/** client/html/checkout/standard/address/billing/hidden
* List of billing address input fields that are optional and should be hidden
*
* You can configure the list of billing address fields that
* are hidden when a customer enters his new billing address.
* Available field keys are:
* * order.base.address.company
* * order.base.address.vatid
* * order.base.address.salutation
* * order.base.address.firstname
* * order.base.address.lastname
* * order.base.address.address1
* * order.base.address.address2
* * order.base.address.address3
* * order.base.address.postal
* * order.base.address.city
* * order.base.address.state
* * order.base.address.languageid
* * order.base.address.countryid
* * order.base.address.telephone
* * order.base.address.telefax
* * order.base.address.email
* * order.base.address.website
*
* Caution: Only hide fields that don't require any input
*
* Until 2015-02, the configuration option was available as
* "client/html/common/address/billing/hidden" starting from 2014-03.
*
* @param array List of field keys
* @since 2015.02
* @category User
* @category Developer
* @see client/html/checkout/standard/address/billing/disable-new
* @see client/html/checkout/standard/address/billing/salutations
* @see client/html/checkout/standard/address/billing/mandatory
* @see client/html/checkout/standard/address/billing/optional
* @see client/html/checkout/standard/address/countries
*/
$hidden = $view->config('client/html/checkout/standard/address/billing/hidden', array());
if (count($view->get('addressLanguages', array())) === 1) {
$hidden[] = 'order.base.address.languageid';
}
$salutations = array('company', 'mr', 'mrs');
/** client/html/checkout/standard/address/billing/salutations
* List of salutions the customer can select from for the billing address
*
* The following salutations are available:
* * empty string for "unknown"
* * company
* * mr
* * mrs
* * miss
*
* You can modify the list of salutation codes and remove the ones
* which shouldn't be used. Adding new salutations is a little bit
* more difficult because you have to adapt a few areas in the source
* code.
*
* Until 2015-02, the configuration option was available as
* "client/html/common/address/billing/salutations" starting from 2014-03.
*
* @param array List of available salutation codes
* @since 2015.02
* @category User
* @category Developer
* @see client/html/checkout/standard/address/billing/disable-new
* @see client/html/checkout/standard/address/billing/mandatory
* @see client/html/checkout/standard/address/billing/optional
* @see client/html/checkout/standard/address/billing/hidden
* @see client/html/checkout/standard/address/countries
*/
$view->billingSalutations = $view->config('client/html/checkout/standard/address/billing/salutations', $salutations);
$view->billingMandatory = $view->config('client/html/checkout/standard/address/billing/mandatory', $this->mandatory);
$view->billingOptional = $view->config('client/html/checkout/standard/address/billing/optional', $this->optional);
$view->billingHidden = $hidden;
$this->cache = $view;
}
return $this->cache;
}
示例2: setViewParams
/**
* Sets the necessary parameter values in the view.
*
* @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
* @param array &$tags Result array for the list of tags that are associated to the output
* @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
* @return \Aimeos\MW\View\Iface Modified view object
*/
protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
{
if (!isset($this->cache)) {
$mediaItems = array();
$catPath = $view->get('stageCatPath', array());
foreach (array_reverse($catPath) as $catItem) {
$mediaItems = $catItem->getRefItems('media', 'default', 'stage');
if (!empty($mediaItems)) {
break;
}
}
$view->imageItems = $mediaItems;
$this->cache = $view;
}
return $this->cache;
}
示例3: setViewParams
/**
* Sets the necessary parameter values in the view.
*
* @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
* @param array &$tags Result array for the list of tags that are associated to the output
* @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
* @return \Aimeos\MW\View\Iface Modified view object
*/
protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
{
if (!isset($this->cache)) {
$attributeTypes = array();
$attrItems = $view->get('detailProductAttributeItems', array());
$configAttributes = $view->detailProductItem->getRefItems('attribute', null, 'config');
foreach ($configAttributes as $id => $attribute) {
if (isset($attrItems[$id])) {
$attributeTypes[$attrItems[$id]->getType()][$id] = $attrItems[$id];
}
}
$view->attributeConfigItems = $attributeTypes;
$view->attributeCustomItems = $view->detailProductItem->getRefItems('attribute', null, 'custom');
$view->attributeHiddenItems = $view->detailProductItem->getRefItems('attribute', null, 'hidden');
$this->cache = $view;
}
return $this->cache;
}
示例4: setViewParams
/**
* Sets the necessary parameter values in the view.
*
* @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
* @param array &$tags Result array for the list of tags that are associated to the output
* @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
* @return \Aimeos\MW\View\Iface Modified view object
*/
protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
{
if (!isset($this->cache)) {
$context = $this->getContext();
$config = $context->getConfig();
if ($config->get('client/html/catalog/lists/basket-add', false)) {
$products = $view->get('listProductItems', array());
$domains = array('media', 'price', 'text', 'attribute', 'product');
$controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
$productIds = $this->getProductIds($products);
$productManager = $controller->createManager('product');
$productItems = $this->getDomainItems($productManager, 'product.id', $productIds, $domains);
$this->addMetaItems($productItems, $this->expire, $this->tags);
$attrIds = $this->getAttributeIds($productItems);
$attributeManager = $controller->createManager('attribute');
$attributeItems = $this->getDomainItems($attributeManager, 'attribute.id', $attrIds, $domains);
$this->addMetaItems($attributeItems, $this->expire, $this->tags);
$mediaIds = $this->getMediaIds($productItems);
$mediaManager = $controller->createManager('media');
$mediaItems = $this->getDomainItems($mediaManager, 'media.id', $mediaIds, $domains);
$this->addMetaItems($mediaItems, $this->expire, $this->tags);
if (!empty($productIds) && $config->get('client/html/catalog/lists/stock/enable', true) === true) {
$view->itemsStockUrl = $this->getStockUrl($view, $productIds);
}
$view->itemsAttributeItems = $attributeItems;
$view->itemsProductItems = $productItems;
$view->itemsMediaItems = $mediaItems;
}
$view->itemPosition = ($this->getProductListPage($view) - 1) * $this->getProductListSize($view);
$this->cache = $view;
}
return $this->cache;
}
示例5: addConfigAttributes
/**
* Adds the necessary view parameters for adding config attributes to the basket
*
* @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
* @param array &$tags Result array for the list of tags that are associated to the output
* @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
* @return \Aimeos\MW\View\Iface Modified view object
*/
protected function addConfigAttributes(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
{
$context = $this->getContext();
$config = $context->getConfig();
$attrIds = $attributeTypes = array();
foreach ((array) $view->get('listProductItems', array()) as $product) {
foreach ($product->getListItems('attribute') as $listItem) {
$attrIds[$listItem->getRefId()] = null;
}
}
/** client/html/catalog/list/items/domains-attributes
* A list of domain names whose items should be available for the attributes
* in the "items" part of the catalog list view templates
*
* The templates rendering attributes usually add images, texts and
* maybe prices associated to each item. If you want to display
* additional content like the attributes, you can configure your own
* list of domains (attribute, media, price, product, text, etc. are
* domains) whose items are fetched from the storage.
*
* Please keep in mind that the more domains you add to the
* configuration, the more time is required for fetching the content!
*
* @param array List of domain names
* @since 2016.01
* @category Developer
*/
$domains = $config->get('client/html/catalog/list/items/domains-attributes', array('text', 'price', 'media'));
$controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
$attrManager = $controller->createManager('attribute');
$search = $attrManager->createSearch(true);
$expr = array($search->compare('==', 'attribute.id', array_keys($attrIds)), $search->getConditions());
$search->setConditions($search->combine('&&', $expr));
$attrItems = $attrManager->searchItems($search, $domains);
$this->addMetaItem($attrItems, 'attribute', $this->expire, $this->tags);
$this->addMetaList(array_keys($attrItems), 'attribute', $this->expire);
foreach ((array) $view->get('listProductItems', array()) as $prodId => $product) {
foreach ($product->getRefItems('attribute', null, 'config') as $id => $attribute) {
if (isset($attrItems[$id])) {
$attributeTypes[$prodId][$attrItems[$id]->getType()][$id] = $attrItems[$id];
}
}
}
$view->itemsAttributeConfigItems = $attributeTypes;
return $view;
}
示例6: setViewParams
/**
* Sets the necessary parameter values in the view.
*
* @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
* @param array &$tags Result array for the list of tags that are associated to the output
* @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
* @return \Aimeos\MW\View\Iface Modified view object
*/
protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
{
if (!isset($this->view)) {
if (($pos = $view->param('l_pos')) !== null && ($pid = $view->param('d_prodid')) !== null) {
if ($pos < 1) {
$start = 0;
$size = 2;
} else {
$start = $pos - 1;
$size = 3;
}
$filter = $this->getProductListFilterByParam($view->get('stageParams', array()));
$filter->setSlice($start, $size);
$total = null;
$controller = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'catalog');
$products = $controller->getIndexItems($filter, array('text'), $total);
if (($count = count($products)) > 1) {
$enc = $view->encoder();
$listPos = array_search($pid, array_keys($products));
$target = $view->config('client/html/catalog/detail/url/target');
$controller = $view->config('client/html/catalog/detail/url/controller', 'catalog');
$action = $view->config('client/html/catalog/detail/url/action', 'detail');
$config = $view->config('client/html/catalog/detail/url/config', array());
if ($listPos > 0 && ($product = reset($products)) !== false) {
$param = array('d_prodid' => $product->getId(), 'd_name' => $enc->url($product->getName('url ')), 'l_pos' => $pos - 1);
$view->navigationPrev = $view->url($target, $controller, $action, $param, array(), $config);
}
if ($listPos < $count - 1 && ($product = end($products)) !== false) {
$param = array('d_prodid' => $product->getId(), 'd_name' => $enc->url($product->getName('url')), 'l_pos' => $pos + 1);
$view->navigationNext = $view->url($target, $controller, $action, $param, array(), $config);
}
}
}
$this->view = $view;
}
return $this->view;
}