コード例 #1
0
ファイル: Base.php プロジェクト: aimeos/ai-admin-jsonadm
 /**
  * Returns the list of domains that are available as resources
  *
  * @param \Aimeos\MW\View\Iface $view View object with "resource" parameter
  * @return array List of domain names
  */
 protected function getDomains(\Aimeos\MW\View\Iface $view)
 {
     if (($domains = $view->param('resource')) == '') {
         /** admin/jsonadm/domains
          * A list of domain names whose clients are available for the JSON API
          *
          * The HTTP OPTIONS method returns a list of resources known by the
          * JSON API including their URLs. The list of available resources
          * can be exteded dynamically be implementing a new Jsonadm client
          * class handling request for this new domain.
          *
          * To add the new domain client to the list of resources returned
          * by the HTTP OPTIONS method, you have to add its name in lower case
          * to the existing configuration.
          *
          * @param array List of domain names
          * @since 2016.01
          * @category Developer
          */
         $default = array('attribute', 'catalog', 'coupon', 'customer', 'locale', 'media', 'order', 'plugin', 'price', 'product', 'service', 'supplier', 'tag', 'text');
         $domains = $this->getContext()->getConfig()->get('admin/jsonadm/domains', $default);
     }
     return (array) $domains;
 }
コード例 #2
0
ファイル: Standard.php プロジェクト: skyheights/aimeos-core
 /**
  * Updates existing product image references or creates new ones
  *
  * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters
  */
 protected function updateItems(\Aimeos\MW\View\Iface $view)
 {
     $id = $view->item->getId();
     $context = $this->getContext();
     $manager = \Aimeos\MShop\Factory::createManager($context, 'product');
     $mediaManager = \Aimeos\MShop\Factory::createManager($context, 'media');
     $listManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists');
     $cntl = \Aimeos\Controller\Common\Media\Factory::createController($context);
     $listIds = (array) $view->param('image/product.lists.id', array());
     $listItems = $manager->getItem($id, array('media'))->getListItems('media', 'default');
     $mediaItem = $this->createItem();
     $listItem = $this->createListItem($id);
     $files = $view->value($view->request()->getUploadedFiles(), 'image/files', array());
     $num = 0;
     foreach ($listIds as $idx => $listid) {
         if (!isset($listItems[$listid])) {
             $litem = $listItem;
             $litem->setId(null);
             if (($file = $view->value($files, $num)) !== null) {
                 $item = $mediaItem;
                 $item->setId(null);
                 $cntl->add($item, $file);
                 $num++;
             } else {
                 throw new \Aimeos\Admin\JQAdm\Exception(sprintf('No file uploaded for %1$d. new image', $num + 1));
             }
         } else {
             $litem = $listItems[$listid];
             $item = $litem->getRefItem();
         }
         $item->setLabel($view->param('image/media.label/' . $idx));
         $item->setLanguageId($view->param('image/media.languageid/' . $idx));
         $mediaManager->saveItem($item);
         $litem->setPosition($idx);
         $litem->setRefId($item->getId());
         $listManager->saveItem($litem, false);
     }
     $this->cleanupItems($listItems, $listIds);
 }
コード例 #3
0
ファイル: Standard.php プロジェクト: aimeos/ai-client-html
 /**
  * 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();
         $prodid = $view->param('d_prodid');
         $domains = array('media', 'price', 'text', 'attribute', 'product');
         $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
         $productItem = $this->getProductItem($prodid, $domains);
         $this->addMetaItems($productItem, $this->expire, $this->tags);
         $productManager = $controller->createManager('product');
         $productIds = array_keys($productItem->getRefItems('product'));
         $products = $this->getDomainItems($productManager, 'product.id', $productIds, $domains);
         $attrIds = array_keys($productItem->getRefItems('attribute'));
         $mediaIds = array_keys($productItem->getRefItems('media'));
         foreach ($products as $product) {
             $attrIds = array_merge($attrIds, array_keys($product->getRefItems('attribute')));
             $mediaIds = array_merge($mediaIds, array_keys($product->getRefItems('media')));
         }
         $attributeManager = $controller->createManager('attribute');
         $attributeItems = $this->getDomainItems($attributeManager, 'attribute.id', $attrIds, $domains);
         $this->addMetaItems($attributeItems, $this->expire, $this->tags);
         $mediaManager = $controller->createManager('media');
         $mediaItems = $this->getDomainItems($mediaManager, 'media.id', $mediaIds, $domains);
         $this->addMetaItems($mediaItems, $this->expire, $this->tags);
         $propertyManager = $controller->createManager('product/property');
         $propertyItems = $this->getDomainItems($propertyManager, 'product.property.parentid', $productIds, $domains);
         $view->detailProductItem = $productItem;
         $view->detailProductItems = $products;
         $view->detailPropertyItems = $propertyItems;
         $view->detailAttributeItems = $attributeItems;
         $view->detailMediaItems = $mediaItems;
         $view->detailUserId = $context->getUserId();
         $view->detailParams = $this->getClientParams($view->param());
         $this->cache = $view;
     }
     $expire = $this->expires($this->expire, $expire);
     $tags = array_merge($tags, $this->tags);
     return $this->cache;
 }
コード例 #4
0
ファイル: Standard.php プロジェクト: boettner-it/aimeos-core
 /**
  * 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)) {
         $expire = null;
         $tags = $items = array();
         $context = $this->getContext();
         $config = $context->getConfig();
         $session = $context->getSession();
         $default = array('media', 'price', 'text');
         $domains = $config->get('client/html/catalog/domains', $default);
         /** client/html/catalog/session/pinned/domains
          * A list of domain names whose items should be available in the pinned view template for the product
          *
          * The templates rendering product details usually add the images,
          * prices and texts, etc. associated to the product
          * item. If you want to display additional or less content, 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!
          *
          * From 2014.09 to 2015.03, this setting was available as
          * client/html/catalog/detail/pinned/domains
          *
          * @param array List of domain names
          * @since 2015.04
          * @category Developer
          * @see client/html/catalog/domains
          * @see client/html/catalog/lists/domains
          * @see client/html/catalog/detail/domains
          */
         $domains = $config->get('client/html/catalog/session/pinned/domains', $domains);
         $pinned = $session->get('aimeos/catalog/session/pinned/list', array());
         $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
         $result = $controller->getProductItems($pinned, $domains);
         foreach (array_reverse($pinned) as $id) {
             if (isset($result[$id])) {
                 $items[$id] = $result[$id];
             }
         }
         $view->pinnedProductItems = $items;
         $view->pinnedParams = $this->getClientParams($view->param());
         $this->cache = $view;
     }
     return $this->cache;
 }
コード例 #5
0
ファイル: Standard.php プロジェクト: skyheights/aimeos-core
 /**
  * Updates existing product category references or creates new ones
  *
  * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters
  */
 protected function updateItems(\Aimeos\MW\View\Iface $view)
 {
     $context = $this->getContext();
     $manager = \Aimeos\MShop\Factory::createManager($context, 'catalog/lists');
     $typeManager = \Aimeos\MShop\Factory::createManager($context, 'catalog/lists/type');
     $id = $view->item->getId();
     $map = $this->getListItems($id);
     $listIds = (array) $view->param('category/catalog.lists.id', array());
     foreach ($listIds as $pos => $listid) {
         if (isset($map[$listid])) {
             unset($map[$listid], $listIds[$pos]);
         }
     }
     $manager->deleteItems(array_keys($map));
     $item = $manager->createItem();
     $item->setTypeId($typeManager->findItem('default', array(), 'product')->getId());
     $item->setDomain('product');
     $item->setRefId($id);
     foreach ($listIds as $pos => $listid) {
         $item->setId(null);
         $item->setParentId($view->param('category/catalog.id/' . $pos));
         $manager->saveItem($item, false);
     }
 }
コード例 #6
0
ファイル: Standard.php プロジェクト: skyheights/aimeos-core
 /**
  * Updates existing product price references or creates new ones
  *
  * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters
  */
 protected function updateItems(\Aimeos\MW\View\Iface $view)
 {
     $id = $view->item->getId();
     $context = $this->getContext();
     $manager = \Aimeos\MShop\Factory::createManager($context, 'product');
     $priceManager = \Aimeos\MShop\Factory::createManager($context, 'price');
     $listManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists');
     $listTypeManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists/type');
     $listIds = (array) $view->param('price/product.lists.id', array());
     $listItems = $manager->getItem($id, array('price'))->getListItems('price');
     $listItem = $listManager->createItem();
     $listItem->setTypeId($listTypeManager->findItem('default', array(), 'price')->getId());
     $listItem->setDomain('price');
     $listItem->setParentId($id);
     $listItem->setStatus(1);
     $priceItem = $priceManager->createItem();
     $priceItem->setDomain('product');
     $priceItem->setStatus(1);
     foreach ($listIds as $idx => $listid) {
         if (!isset($listItems[$listid])) {
             $litem = $listItem;
             $litem->setId(null);
             $item = $priceItem;
             $item->setId(null);
         } else {
             $litem = $listItems[$listid];
             $item = $litem->getRefItem();
         }
         $item->setLabel($view->param('price/price.label/' . $idx));
         $item->setTypeId($view->param('price/price.typeid/' . $idx));
         $item->setCurrencyId($view->param('price/price.currencyid/' . $idx));
         $item->setQuantity($view->param('price/price.quantity/' . $idx));
         $item->setValue($view->param('price/price.value/' . $idx));
         $item->setCosts($view->param('price/price.costs/' . $idx));
         $item->setRebate($view->param('price/price.rebate/' . $idx));
         $item->setTaxRate($view->param('price/price.taxrate/' . $idx));
         $priceManager->saveItem($item);
         $litem->setPosition($idx);
         $litem->setRefId($item->getId());
         $listManager->saveItem($litem, false);
     }
     $rmIds = array();
     $rmListIds = array_diff(array_keys($listItems), $listIds);
     foreach ($rmListIds as $id) {
         $rmIds[] = $listItems[$id]->getRefId();
     }
     $listManager->deleteItems($rmListIds);
     $priceManager->deleteItems($rmIds);
 }
コード例 #7
0
ファイル: Standard.php プロジェクト: ajbm6/aimeos-core
 /**
  * Updates existing property items or creates new ones
  *
  * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters
  */
 protected function updateItems(\Aimeos\MW\View\Iface $view)
 {
     $context = $this->getContext();
     $manager = \Aimeos\MShop\Factory::createManager($context, 'product/property');
     $typeManager = \Aimeos\MShop\Factory::createManager($context, 'product/property/type');
     $ids = array();
     $items = $this->getItems($view->item->getId());
     foreach ((array) $view->param('physical', array()) as $type => $value) {
         $value = trim($value);
         if ($value == '') {
             if (isset($items[$type])) {
                 $ids[] = $items[$type]->getId();
             }
             continue;
         }
         if (!isset($items[$type])) {
             $items[$type] = $manager->createItem();
             $items[$type]->setParentId($view->item->getId());
             $items[$type]->setTypeId($typeManager->findItem($type, array(), 'product/property')->getId());
         }
         $items[$type]->setValue($value);
         $manager->saveItem($items[$type]);
     }
     $manager->deleteItems($ids);
 }
コード例 #8
0
ファイル: Standard.php プロジェクト: mvnp/aimeos-core
 /**
  * Maps the item configuration from parameters to a list of key/value pairs
  *
  * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters
  * @return array Associative list of key/value pairs
  */
 protected function getItemConfig(\Aimeos\MW\View\Iface $view)
 {
     $config = array();
     foreach ($view->param('item/config/key') as $idx => $key) {
         if (trim($key) !== '') {
             $config[$key] = $view->param('item/config/val/' . $idx);
         }
     }
     return $config;
 }
コード例 #9
0
ファイル: Standard.php プロジェクト: ajbm6/aimeos-core
 /**
  * Updates existing product text items or creates new ones
  *
  * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters
  */
 protected function updateItems(\Aimeos\MW\View\Iface $view)
 {
     $id = $view->item->getId();
     $context = $this->getContext();
     $types = array('name', 'short', 'long', 'url', 'meta-keyword', 'meta-description');
     $manager = \Aimeos\MShop\Factory::createManager($context, 'product');
     $textManager = \Aimeos\MShop\Factory::createManager($context, 'text');
     $listManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists');
     $listTypeManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists/type');
     $listIds = array();
     $langIds = (array) $view->param('text/langid', array());
     $listItems = $manager->getItem($id, array('text'))->getListItems('text');
     $listItem = $listManager->createItem();
     $listItem->setTypeId($listTypeManager->findItem('default', array(), 'text')->getId());
     $listItem->setDomain('text');
     $listItem->setParentId($id);
     $listItem->setStatus(1);
     $textItem = $textManager->createItem();
     $textItem->setDomain('product');
     $textItem->setStatus(1);
     foreach ($langIds as $idx => $langid) {
         foreach ($types as $type) {
             $content = trim($view->param('text/' . $type . '/content/' . $idx));
             $listid = $view->param('text/' . $type . '/listid' . $idx);
             $listIds[] = $listid;
             if (!isset($listItems[$listid])) {
                 $litem = $listItem;
                 $litem->setId(null);
                 $item = $textItem;
                 $item->setId(null);
             } else {
                 $litem = $listItems[$listid];
                 $item = $litem->getRefItem();
             }
             $item->setContent($content);
             $item->setLabel(mb_strcut($item->getContent(), 0, 255));
             $item->setTypeId($this->getTypeId($type));
             $item->setLanguageId($langid);
             $textManager->saveItem($item);
             $litem->setPosition($idx);
             $litem->setRefId($item->getId());
             $listManager->saveItem($litem, false);
         }
     }
     $rmIds = array();
     $rmListIds = array_diff(array_keys($listItems), $listIds);
     foreach ($rmListIds as $id) {
         $rmIds[] = $listItems[$id]->getRefId();
     }
     $listManager->deleteItems($rmListIds);
     $textManager->deleteItems($rmIds);
 }
コード例 #10
0
ファイル: Standard.php プロジェクト: aimeos/ai-client-html
 /**
  * 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)) {
         $codes = array();
         $context = $this->getContext();
         $input = $view->param('f_search');
         $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
         $filter = $controller->createTextFilter($input, null, '+', 0, 25, 'default', 'name');
         $texts = $controller->getTextList($filter);
         /** client/html/catalog/suggest/usecode
          * Enables product suggestions based on using the product code
          *
          * The suggested entries for the full text search in the catalog filter component
          * are based on the product names by default. By setting this option to true or 1,
          * you can add suggestions based on the product codes as well.
          *
          * @param boolean True to search for product codes too, false for product names only
          * @since 2016.09
          * @category Developer
          */
         if ($context->getConfig()->get('client/html/catalog/suggest/usecode', false)) {
             $filter = $controller->createTextFilter($input, null, '+', 0, 25, 'default', 'code');
             $codes = $controller->getTextList($filter);
         }
         /** client/html/catalog/suggest/domains
          * List of domain items that should be fetched along with the products
          *
          * The suggsted entries for the full text search in the catalog filter component
          * usually consist of the names of the matched products. By default, only the
          * product item including the localized name is available. You can add more domains
          * like e.g. "media" to get the images of the product as well.
          *
          * '''Note:''' The more domains you will add, the slower the autocomplete requests
          * will be! Keep it to an absolute minium for user friendly response times.
          *
          * @param array List of domain names
          * @since 2016.08
          * @category Developer
          * @see client/html/catalog/suggest/standard/template-body
          */
         $domains = $context->getConfig()->get('client/html/catalog/suggest/domains', array());
         $manager = $controller->createManager('product');
         $search = $manager->createSearch(true);
         $expr = array($search->compare('==', 'product.id', array_merge(array_keys($texts), array_keys($codes))), $search->getConditions());
         $search->setConditions($search->combine('&&', $expr));
         $result = $manager->searchItems($search, $domains);
         // shortcut to avoid having to fetch the text items to get the the localized name
         foreach ($result as $id => $item) {
             if (isset($texts[$id])) {
                 $item->setLabel($texts[$id]);
             }
         }
         $view->suggestItems = $result;
         $this->cache = $view;
     }
     return $this->cache;
 }
コード例 #11
0
ファイル: Standard.php プロジェクト: aimeos/ai-client-html
 /**
  * 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)) {
         if (($orderId = $view->param('his_id', null)) !== null) {
             $context = $this->getContext();
             $manager = \Aimeos\MShop\Factory::createManager($context, 'order');
             $baseManager = \Aimeos\MShop\Factory::createManager($context, 'order/base');
             $search = $manager->createSearch(true);
             $expr = array($search->getConditions(), $search->compare('==', 'order.id', $orderId), $search->compare('==', 'order.base.customerid', $context->getUserId()));
             $search->setConditions($search->combine('&&', $expr));
             $orderItems = $manager->searchItems($search);
             if (($orderItem = reset($orderItems)) === false) {
                 $msg = $view->translate('client', 'Order with ID "%1$s" not found');
                 throw new \Aimeos\Client\Html\Exception(sprintf($msg, $orderId));
             }
             if ($orderItem->getPaymentStatus() >= $this->getDownloadPaymentStatus()) {
                 $view->summaryShowDownloadAttributes = true;
             }
             $view->summaryBasket = $baseManager->load($orderItem->getBaseId());
             $view->summaryTaxRates = $this->getTaxRates($view->summaryBasket);
             $view->orderItem = $orderItem;
         }
         $this->cache = $view;
     }
     return $this->cache;
 }
コード例 #12
0
ファイル: Standard.php プロジェクト: mvnp/aimeos-core
 /**
  * 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();
         $siteConfig = $context->getLocale()->getSite()->getConfig();
         /** client/html/catalog/stock/sort
          * Sortation key if stock levels for different warehouses exist
          *
          * Products can be shipped from several warehouses with a different
          * stock level for each one. The stock levels for each warehouse will
          * be shown in the product detail page. To get a consistent sortation
          * of this list, the configured key of the product warehouse manager
          * will be used.
          *
          * @param string Key for sorting
          * @since 2014.03
          * @category Developer
          * @see client/html/catalog/stock/level/low
          */
         $sortkey = $context->getConfig()->get('client/html/catalog/stock/sort', 'product.stock.warehouseid');
         $productIds = $view->param('s_prodid');
         if (!is_array($productIds)) {
             $productIds = explode(' ', $productIds);
         }
         $stockManager = \Aimeos\MShop\Factory::createManager($context, 'product/stock');
         $search = $stockManager->createSearch(true);
         $expr = array($search->compare('==', 'product.stock.parentid', $productIds));
         if (isset($siteConfig['warehouse'])) {
             $expr[] = $search->compare('==', 'product.stock.warehouse.code', $siteConfig['warehouse']);
         }
         $expr[] = $search->getConditions();
         $sortations = array($search->sort('+', 'product.stock.parentid'), $search->sort('+', $sortkey));
         $search->setConditions($search->combine('&&', $expr));
         $search->setSortations($sortations);
         $search->setSlice(0, 0x7fffffff);
         $stockItems = $stockManager->searchItems($search);
         if (!empty($stockItems)) {
             $warehouseIds = $stockItemsByProducts = array();
             foreach ($stockItems as $item) {
                 $warehouseIds[$item->getWarehouseId()] = null;
                 $stockItemsByProducts[$item->getParentId()][] = $item;
             }
             $warehouseIds = array_keys($warehouseIds);
             $warehouseManager = \Aimeos\MShop\Factory::createManager($context, 'product/stock/warehouse');
             $search = $warehouseManager->createSearch();
             $search->setConditions($search->compare('==', 'product.stock.warehouse.id', $warehouseIds));
             $search->setSlice(0, count($warehouseIds));
             $view->stockWarehouseItems = $warehouseManager->searchItems($search);
             $view->stockItemsByProducts = $stockItemsByProducts;
         }
         $view->stockProductIds = $productIds;
         $this->cache = $view;
     }
     return $this->cache;
 }
コード例 #13
0
ファイル: Standard.php プロジェクト: aimeos/ai-client-html
 /**
  * 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');
         $view->standardBasket = $basketCntl->get();
         /** client/html/checkout/standard/url/step-active
          * Name of the checkout process step to jump to if no previous step requires attention
          *
          * The checkout process consists of several steps which are usually
          * displayed one by another to the customer. If the data of a step
          * is already available, then that step is skipped. The active step
          * is the one that is displayed if all other steps are skipped.
          *
          * If one of the previous steps misses some data the customer has
          * to enter, then this step is displayed first. After providing
          * the missing data, the whole series of steps are tested again
          * and if no other step requests attention, the configured active
          * step will be displayed.
          *
          * The order of the steps is determined by the order of sub-parts
          * that are configured for the checkout client.
          *
          * @param string Name of the confirm standard HTML client
          * @since 2014.07
          * @category Developer
          * @category User
          * @see client/html/checkout/standard/standard/subparts
          */
         $default = $view->config('client/html/checkout/standard/url/step-active', 'summary');
         /** client/html/checkout/standard/onepage
          * Shows all named checkout subparts at once for a one page checkout
          *
          * Normally, the checkout process is divided into several steps for entering
          * addresses, select delivery and payment options as well as showing the
          * summary page. This enables dependencies between two steps like showing
          * delivery options based on the address entered by the customer. Furthermore,
          * this is good way to limit the amount of information displayed which is
          * preferred by mobile users.
          *
          * Contrary to that, a one page checkout displays all information on only
          * one page and customers get an immediate overview of which information
          * they have to enter and what options they can select from. This is an
          * advantage if only a very limited amount of information must be entered
          * or if there are almost no options to choose from and no dependencies
          * between exist.
          *
          * Using this config options, shop developers are able to define which
          * checkout subparts are combined to a one page view. Simply add the names
          * of all checkout subparts to the list. Available checkout subparts for
          * a one page checkout are:
          * * address
          * * delivery
          * * payment
          * * summary
          *
          * @param array List of checkout subparts name
          * @since 2015.05
          * @category Developer
          */
         $onepage = $view->config('client/html/checkout/standard/onepage', array());
         $onestep = !empty($onepage) ? array_shift($onepage) : $default;
         // keep the first one page step
         $steps = (array) $context->getConfig()->get($this->subPartPath, $this->subPartNames);
         $steps = array_diff($steps, $onepage);
         // remove all remaining steps in $onepage
         // use first step if default step isn't available
         $default = !in_array($default, $steps) ? reset($steps) : $default;
         $current = $view->param('c_step', $default);
         // use $onestep if the current step isn't available due to one page layout
         if (!in_array($current, $steps)) {
             $current = $onestep;
         }
         // use $onestep if the active step isn't available due to one page layout
         if (isset($view->standardStepActive) && in_array($view->standardStepActive, $onepage)) {
             $view->standardStepActive = $onestep;
         }
         $cpos = array_search($current, $steps);
         if (!isset($view->standardStepActive) || ($apos = array_search($view->standardStepActive, $steps)) !== false && $cpos !== false && $cpos < $apos) {
             $view->standardStepActive = $current;
         }
         $view->standardSteps = $steps;
         $this->cache = $this->addNavigationUrls($view, $steps, $view->standardStepActive);
     }
     return $this->cache;
 }
コード例 #14
0
 /**
  * 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;
             }
             $context = $this->getContext();
             $site = $context->getLocale()->getSite()->getCode();
             $params = $context->getSession()->get('aimeos/catalog/lists/params/last/' . $site, array());
             $filter = $this->getProductListFilterByParam($params);
             $filter->setSlice($start, $size);
             $total = null;
             $controller = \Aimeos\Controller\Frontend\Factory::createController($context, '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;
 }
コード例 #15
0
ファイル: Standard.php プロジェクト: aimeos/ai-admin-jqadm
 /**
  * Updates existing product stock items or creates new ones
  *
  * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters
  */
 protected function updateItems(\Aimeos\MW\View\Iface $view)
 {
     $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/stock');
     $search = $manager->createSearch();
     $search->setConditions($search->compare('==', 'product.stock.parentid', $view->item->getId()));
     $items = $manager->searchitems($search);
     $list = (array) $view->param('stock/product.stock.id', array());
     foreach ($list as $idx => $id) {
         if (!isset($items[$id])) {
             $item = $manager->createItem();
         } else {
             $item = $items[$id];
         }
         $item->setParentId($view->item->getId());
         $item->setWarehouseId($view->param('stock/product.stock.warehouseid/' . $idx));
         $item->setStocklevel($view->param('stock/product.stock.stocklevel/' . $idx));
         $item->setDateBack($view->param('stock/product.stock.dateback/' . $idx));
         $manager->saveItem($item, false);
     }
     $manager->deleteItems(array_diff(array_keys($items), $list));
 }
コード例 #16
0
ファイル: Standard.php プロジェクト: aimeos/ai-admin-jqadm
 /**
  * Returns the mapped input parameter or the existing items as expected by the template
  *
  * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters
  */
 protected function setData(\Aimeos\MW\View\Iface $view)
 {
     $view->characteristicData = (array) $view->param('characteristic', array());
 }
コード例 #17
0
ファイル: Standard.php プロジェクト: aimeos/ai-admin-jqadm
 /**
  * Maps the input parameter to an associative array as expected by the template
  *
  * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters
  * @return array Multi-dimensional associative array
  */
 protected function getDataParams(\Aimeos\MW\View\Iface $view)
 {
     $data = array();
     foreach ((array) $view->param('selection/product.code', array()) as $pos => $code) {
         if (!empty($code)) {
             $data[$code]['product.lists.id'] = $view->param('selection/product.lists.id/' . $pos);
             $data[$code]['product.id'] = $view->param('selection/product.id/' . $pos);
             $data[$code]['product.label'] = $view->param('selection/product.label/' . $pos);
         }
     }
     foreach ((array) $view->param('selection/attr/ref', array()) as $pos => $code) {
         if (!empty($code)) {
             $id = $view->param('selection/attr/id/' . $pos);
             $data[$code]['attr'][$id]['ref'] = $code;
             $data[$code]['attr'][$id]['label'] = $view->param('selection/attr/label/' . $pos);
         }
     }
     return $data;
 }
コード例 #18
0
ファイル: Standard.php プロジェクト: skyheights/aimeos-core
 /**
  * Updates existing product download references or creates new ones
  *
  * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters
  */
 protected function updateItems(\Aimeos\MW\View\Iface $view)
 {
     $id = $view->item->getId();
     $context = $this->getContext();
     $manager = \Aimeos\MShop\Factory::createManager($context, 'product');
     $attrManager = \Aimeos\MShop\Factory::createManager($context, 'attribute');
     $listManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists');
     $listItems = $manager->getItem($id, array('attribute'))->getListItems('attribute', 'hidden');
     if (($listId = $view->param('download/product.lists.id')) !== null) {
         if (!isset($listItems[$listId])) {
             $litem = $this->createListItem($id);
             $item = $this->createItem();
         } else {
             $litem = $listItems[$listId];
             $item = $litem->getRefItem();
         }
         $item->setLabel($view->param('download/attribute.label'));
         if (($file = $view->value($view->request()->getUploadedFiles(), 'download/file')) !== null) {
             $item->setCode($this->storeFile($file));
         }
         $attrManager->saveItem($item);
         $litem->setPosition(0);
         $litem->setRefId($item->getId());
         $listManager->saveItem($litem, false);
     }
     $this->cleanupItems($listItems, array($listId));
 }
コード例 #19
0
ファイル: Standard.php プロジェクト: aimeos/ai-client-html
 /**
  * Returns the sanitized page size from the parameters for the product list.
  *
  * @param \Aimeos\MW\View\Iface $view View instance with helper for retrieving the required parameters
  * @return integer Page size
  */
 protected function getProductListSize(\Aimeos\MW\View\Iface $view)
 {
     /** client/html/account/favorite/size
      * The number of products shown in a list page for favorite products
      *
      * Limits the number of products that is shown in the list pages to the
      * given value. If more products are available, the products are split
      * into bunches which will be shown on their own list page. The user is
      * able to move to the next page (or previous one if it's not the first)
      * to display the next (or previous) products.
      *
      * The value must be an integer number from 1 to 100. Negative values as
      * well as values above 100 are not allowed. The value can be overwritten
      * per request if the "l_size" parameter is part of the URL.
      *
      * @param integer Number of products
      * @since 2014.09
      * @category User
      * @category Developer
      * @see client/html/catalog/lists/size
      */
     $defaultSize = $this->getContext()->getConfig()->get('client/html/account/favorite/size', 48);
     $size = (int) $view->param('fav-size', $defaultSize);
     return $size < 1 || $size > 100 ? $defaultSize : $size;
 }
コード例 #20
0
ファイル: Standard.php プロジェクト: aimeos/ai-admin-jsonadm
 /**
  * Retrieves the item or items and adds the data to the view
  *
  * @param \Aimeos\MW\View\Iface $view View instance
  * @return \Aimeos\MW\View\Iface View instance with additional data assigned
  */
 protected function getItems(\Aimeos\MW\View\Iface $view)
 {
     $include = ($include = $view->param('include')) !== null ? explode(',', $include) : array();
     $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog');
     $search = $this->initCriteria($manager->createSearch(), $view->param());
     $total = 1;
     if (($id = $view->param('id')) == null) {
         $view->data = $manager->searchItems($search, array(), $total);
         $view->listItems = $this->getListItems($view->data, $include);
         $view->childItems = $this->getChildItems($view->data, $include);
     } else {
         $view->data = $manager->getTree($id, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST, $search);
         $view->listItems = $this->getListItems(array($id => $view->data), $include);
         $view->childItems = $this->getChildItems(array($view->data), $include);
     }
     $view->refItems = $this->getRefItems($view->listItems);
     $view->total = $total;
     return $view;
 }
コード例 #21
0
ファイル: Standard.php プロジェクト: mvnp/aimeos-core
 /**
  * Updates existing product bundle references or creates new ones
  *
  * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters
  */
 protected function updateItems(\Aimeos\MW\View\Iface $view)
 {
     $context = $this->getContext();
     $manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists');
     $typeManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists/type');
     $item = $manager->createItem();
     $item->setParentId($view->item->getId());
     $item->setTypeId($typeManager->findItem('default', array(), 'product')->getId());
     $item->setDomain('product');
     $map = $this->getListItems($view->item->getId());
     foreach ((array) $view->param('bundle/product.lists.id', array()) as $pos => $prodid) {
         if (!isset($map[$prodid])) {
             $item->setId(null);
             $item->setRefId($prodid);
             $item->setPosition($pos);
             $manager->saveItem($item, false);
         } else {
             unset($map[$prodid]);
         }
     }
     $manager->deleteItems($map);
 }
コード例 #22
0
ファイル: Standard.php プロジェクト: aimeos/ai-client-html
 /**
  * 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)) {
         $view->actionsParams = $this->getClientParams($view->param());
         $view->actionsUserId = $this->getContext()->getUserId();
         $this->cache = $view;
     }
     return $this->cache;
 }
コード例 #23
0
ファイル: Standard.php プロジェクト: boettner-it/aimeos-core
 /**
  * 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)) {
         $config = $this->getContext()->getConfig();
         /** client/html/catalog/count/enable
          * Enables or disables displaying product counts in the catalog filter
          *
          * This configuration option allows shop owners to display product
          * counts in the catalog filter or to disable fetching product count
          * information.
          *
          * The product count information is fetched via AJAX and inserted via
          * Javascript. This allows to cache parts of the catalog filter by
          * leaving out such highly dynamic content like product count which
          * changes with used filter parameter.
          *
          * @param boolean Value of "1" to display product counts, "0" to disable them
          * @since 2014.03
          * @category User
          * @category Developer
          * @see client/html/catalog/count/url/target
          * @see client/html/catalog/count/url/controller
          * @see client/html/catalog/count/url/action
          * @see client/html/catalog/count/url/config
          */
         if ($config->get('client/html/catalog/count/enable', true) == true) {
             /** client/html/catalog/count/url/target
              * Destination of the URL where the controller specified in the URL is known
              *
              * The destination can be a page ID like in a content management system or the
              * module of a software development framework. This "target" must contain or know
              * the controller that should be called by the generated URL.
              *
              * @param string Destination of the URL
              * @since 2014.03
              * @category Developer
              * @see client/html/catalog/count/url/controller
              * @see client/html/catalog/count/url/action
              * @see client/html/catalog/count/url/config
              */
             $target = $config->get('client/html/catalog/count/url/target');
             /** client/html/catalog/count/url/controller
              * Name of the controller whose action should be called
              *
              * In Model-View-Controller (MVC) applications, the controller contains the methods
              * that create parts of the output displayed in the generated HTML page. Controller
              * names are usually alpha-numeric.
              *
              * @param string Name of the controller
              * @since 2014.03
              * @category Developer
              * @see client/html/catalog/count/url/target
              * @see client/html/catalog/count/url/action
              * @see client/html/catalog/count/url/config
              */
             $controller = $config->get('client/html/catalog/count/url/controller', 'catalog');
             /** client/html/catalog/count/url/action
              * Name of the action that should create the output
              *
              * In Model-View-Controller (MVC) applications, actions are the methods of a
              * controller that create parts of the output displayed in the generated HTML page.
              * Action names are usually alpha-numeric.
              *
              * @param string Name of the action
              * @since 2014.03
              * @category Developer
              * @see client/html/catalog/count/url/target
              * @see client/html/catalog/count/url/controller
              * @see client/html/catalog/count/url/config
              */
             $action = $config->get('client/html/catalog/count/url/action', 'count');
             /** client/html/catalog/count/url/config
              * Associative list of configuration options used for generating the URL
              *
              * You can specify additional options as key/value pairs used when generating
              * the URLs, like
              *
              *  client/html/<clientname>/url/config = array( 'absoluteUri' => true )
              *
              * The available key/value pairs depend on the application that embeds the e-commerce
              * framework. This is because the infrastructure of the application is used for
              * generating the URLs. The full list of available config options is referenced
              * in the "see also" section of this page.
              *
              * @param string Associative list of configuration options
              * @since 2014.03
              * @category Developer
              * @see client/html/catalog/count/url/target
              * @see client/html/catalog/count/url/controller
              * @see client/html/catalog/count/url/action
              * @see client/html/url/config
              */
             $config = $config->get('client/html/catalog/count/url/config', array());
             $params = $this->getClientParams($view->param(), array('f'));
             $view->filterCountUrl = $view->url($target, $controller, $action, $params, array(), $config);
         }
         $this->cache = $view;
     }
     return $this->cache;
 }
コード例 #24
0
ファイル: Base.php プロジェクト: aimeos/ai-client-html
 /**
  * Returns the sanitized sortation from the parameters for the product list.
  *
  * @param \Aimeos\MW\View\Iface $view View instance with helper for retrieving the required parameters
  * @param string &$sortdir Value-result parameter where the sort direction will be stored
  * @return string Sortation string (relevance, name, price)
  */
 protected function getProductListSort(\Aimeos\MW\View\Iface $view, &$sortdir)
 {
     return $this->getProductListSortByParam($view->param(), $sortdir);
 }
コード例 #25
0
ファイル: Standard.php プロジェクト: mvnp/aimeos-core
 /**
  * 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;
 }
コード例 #26
0
ファイル: Standard.php プロジェクト: mvnp/aimeos-core
 /**
  * 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)) {
         $input = $view->param('f_search');
         $controller = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'catalog');
         $filter = $controller->createTextFilter($input);
         $items = $controller->getTextList($filter);
         $suggestTextItems = array();
         foreach ($items as $id => $name) {
             $suggestTextItems[] = array("id" => $id, "name" => $name);
         }
         $view->suggestTextItems = $suggestTextItems;
         $this->cache = $view;
     }
     return $this->cache;
 }
コード例 #27
0
ファイル: Standard.php プロジェクト: boettner-it/aimeos-core
 /**
  * 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');
         $view->standardBasket = $basketCntl->get();
         $bTarget = $view->config('client/html/basket/standard/url/target');
         $bCntl = $view->config('client/html/basket/standard/url/controller', 'basket');
         $bAction = $view->config('client/html/basket/standard/url/action', 'index');
         $bConfig = $view->config('client/html/basket/standard/url/config', array());
         /** client/html/checkout/standard/url/target
          * Destination of the URL where the controller specified in the URL is known
          *
          * The destination can be a page ID like in a content management system or the
          * module of a software development framework. This "target" must contain or know
          * the controller that should be called by the generated URL.
          *
          * @param string Destination of the URL
          * @since 2014.03
          * @category Developer
          * @see client/html/checkout/standard/url/controller
          * @see client/html/checkout/standard/url/action
          * @see client/html/checkout/standard/url/config
          */
         $cTarget = $view->config('client/html/checkout/standard/url/target');
         /** client/html/checkout/standard/url/controller
          * Name of the controller whose action should be called
          *
          * In Model-View-Controller (MVC) applications, the controller contains the methods
          * that create parts of the output displayed in the generated HTML page. Controller
          * names are usually alpha-numeric.
          *
          * @param string Name of the controller
          * @since 2014.03
          * @category Developer
          * @see client/html/checkout/standard/url/target
          * @see client/html/checkout/standard/url/action
          * @see client/html/checkout/standard/url/config
          */
         $cCntl = $view->config('client/html/checkout/standard/url/controller', 'checkout');
         /** client/html/checkout/standard/url/action
          * Name of the action that should create the output
          *
          * In Model-View-Controller (MVC) applications, actions are the methods of a
          * controller that create parts of the output displayed in the generated HTML page.
          * Action names are usually alpha-numeric.
          *
          * @param string Name of the action
          * @since 2014.03
          * @category Developer
          * @see client/html/checkout/standard/url/target
          * @see client/html/checkout/standard/url/controller
          * @see client/html/checkout/standard/url/config
          */
         $cAction = $view->config('client/html/checkout/standard/url/action', 'index');
         /** client/html/checkout/standard/url/config
          * Associative list of configuration options used for generating the URL
          *
          * You can specify additional options as key/value pairs used when generating
          * the URLs, like
          *
          *  client/html/<clientname>/url/config = array( 'absoluteUri' => true )
          *
          * The available key/value pairs depend on the application that embeds the e-commerce
          * framework. This is because the infrastructure of the application is used for
          * generating the URLs. The full list of available config options is referenced
          * in the "see also" section of this page.
          *
          * @param string Associative list of configuration options
          * @since 2014.03
          * @category Developer
          * @see client/html/checkout/standard/url/target
          * @see client/html/checkout/standard/url/controller
          * @see client/html/checkout/standard/url/action
          * @see client/html/url/config
          */
         $cConfig = $view->config('client/html/checkout/standard/url/config', array());
         /** client/html/checkout/standard/url/step-active
          * Name of the checkout process step to jump to if no previous step requires attention
          *
          * The checkout process consists of several steps which are usually
          * displayed one by another to the customer. If the data of a step
          * is already available, then that step is skipped. The active step
          * is the one that is displayed if all other steps are skipped.
          *
          * If one of the previous steps misses some data the customer has
          * to enter, then this step is displayed first. After providing
          * the missing data, the whole series of steps are tested again
          * and if no other step requests attention, the configured active
          * step will be displayed.
          *
          * The order of the steps is determined by the order of sub-parts
          * that are configured for the checkout client.
          *
          * @param string Name of the confirm standard HTML client
          * @since 2014.07
          * @category Developer
          * @category User
          * @see client/html/checkout/standard/standard/subparts
          */
         $default = $view->config('client/html/checkout/standard/url/step-active', 'summary');
         /** client/html/checkout/standard/onepage
          * Shows all named checkout subparts at once for a one page checkout
          *
          * Normally, the checkout process is divided into several steps for entering
          * addresses, select delivery and payment options as well as showing the
          * summary page. This enables dependencies between two steps like showing
          * delivery options based on the address entered by the customer. Furthermore,
          * this is good way to limit the amount of information displayed which is
          * preferred by mobile users.
          *
          * Contrary to that, a one page checkout displays all information on only
          * one page and customers get an immediate overview of which information
          * they have to enter and what options they can select from. This is an
          * advantage if only a very limited amount of information must be entered
          * or if there are almost no options to choose from and no dependencies
          * between exist.
          *
          * Using this config options, shop developers are able to define which
          * checkout subparts are combined to a one page view. Simply add the names
          * of all checkout subparts to the list. Available checkout subparts for
          * a one page checkout are:
          * * address
          * * delivery
          * * payment
          * * summary
          *
          * @param array List of checkout subparts name
          * @since 2015.05
          * @category Developer
          */
         $onepage = $view->config('client/html/checkout/standard/onepage', array());
         $onestep = array_shift($onepage);
         // keep the first one page step
         $steps = (array) $context->getConfig()->get($this->subPartPath, $this->subPartNames);
         $steps = array_diff($steps, $onepage);
         // remove all remaining steps in $onepage
         // use first step if default step isn't available
         $default = !in_array($default, $steps) ? reset($steps) : $default;
         $current = $view->param('c_step', $default);
         // use $onestep if current step isn't available due to one page layout
         $current = !in_array($current, $steps) ? $onestep : $current;
         $cpos = $cpos = array_search($current, $steps);
         if (!isset($view->standardStepActive) || ($apos = array_search($view->standardStepActive, $steps)) !== false && $cpos !== false && $cpos < $apos) {
             $view->standardStepActive = $current;
         }
         $activeStep = $view->standardStepActive;
         $view->standardSteps = $steps;
         $step = null;
         do {
             $lastStep = $step;
         } while (($step = array_shift($steps)) !== null && $step !== $activeStep);
         if ($lastStep !== null) {
             $param = array('c_step' => $lastStep);
             $view->standardUrlBack = $view->url($cTarget, $cCntl, $cAction, $param, array(), $cConfig);
         } else {
             $view->standardUrlBack = $view->url($bTarget, $bCntl, $bAction, array(), array(), $bConfig);
         }
         if (!isset($view->standardUrlNext) && ($nextStep = array_shift($steps)) !== null) {
             $param = array('c_step' => $nextStep);
             $view->standardUrlNext = $view->url($cTarget, $cCntl, $cAction, $param, array(), $cConfig);
         }
         // don't overwrite $view->standardUrlNext so order step URL is used
         $this->cache = $view;
     }
     return $this->cache;
 }
コード例 #28
0
ファイル: Standard.php プロジェクト: mvnp/aimeos-core
 /**
  * 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)) {
         $map = array();
         $context = $this->getContext();
         $config = $context->getConfig();
         $locale = $context->getLocale();
         /** client/html/locale/select/language/param-name
          * Name of the parameter that contains the language ID value
          *
          * Frameworks and applications normally use its own predefined parameter
          * that contains the current language ID if they are multi-language
          * capable. To adapt the Aimeos parameter name to the already used name,
          * you are able to configure it by using this setting.
          *
          * @param string Parameter name for language ID
          * @since 2015.06
          * @see client/html/locale/select/currency/param-name
          */
         $langname = $config->get('client/html/locale/select/language/param-name', 'loc_languageid');
         /** client/html/locale/select/currency/param-name
          * Name of the parameter that contains the currency ID value
          *
          * Frameworks and applications normally use its own predefined parameter
          * that contains the current currency ID if they already support multiple
          * currencies. To adapt the Aimeos parameter name to the already used name,
          * you are able to configure it by using this setting.
          *
          * @param string Parameter name for currency ID
          * @since 2015.06
          * @see client/html/locale/select/language/param-name
          */
         $curname = $config->get('client/html/locale/select/currency/param-name', 'loc_currencyid');
         $manager = \Aimeos\MShop\Factory::createManager($context, 'locale');
         $search = $manager->createSearch(true);
         $search->setSortations(array($search->sort('+', 'locale.position')));
         foreach ($manager->searchItems($search) as $item) {
             $curId = $item->getCurrencyId();
             $langId = $item->getLanguageId();
             $map[$langId][$curId] = array($langname => $langId, $curname => $curId);
         }
         $params = $view->param();
         $view->selectMap = $map;
         $view->selectParams = $params;
         $view->selectLanguageId = $locale->getLanguageId();
         $view->selectCurrencyId = $locale->getCurrencyId();
         $this->cache = $view;
     }
     return $this->cache;
 }
コード例 #29
0
ファイル: Standard.php プロジェクト: aimeos/ai-client-html
 /**
  * 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)) {
         $params = $this->getClientParams($view->param(), array('f', 'l'));
         if (isset($params['f_catid']) && $params['f_catid'] != '') {
             $context = $this->getContext();
             $config = $context->getConfig();
             $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
             $default = array('attribute', 'media', 'text');
             /** client/html/catalog/domains
              * A list of domain names whose items should be available in the catalog view templates
              *
              * @see client/html/catalog/stage/domains
              */
             $domains = $config->get('client/html/catalog/domains', $default);
             /** client/html/catalog/stage/standard/domains
              * A list of domain names whose items should be available in the catalog stage view template
              *
              * The templates rendering the catalog stage section use the texts and
              * maybe images and attributes associated to the categories. 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!
              *
              * This configuration option overwrites the "client/html/catalog/domains"
              * option that allows to configure the domain names of the items fetched
              * for all catalog related data.
              *
              * @param array List of domain names
              * @since 2014.03
              * @category Developer
              * @see client/html/catalog/domains
              * @see client/html/catalog/detail/domains
              * @see client/html/catalog/lists/domains
              */
             $domains = $config->get('client/html/catalog/stage/standard/domains', $domains);
             $stageCatPath = $controller->getCatalogPath($params['f_catid'], $domains);
             if (($categoryItem = end($stageCatPath)) !== false) {
                 $view->stageCurrentCatItem = $categoryItem;
             }
             $this->addMetaItems($stageCatPath, $this->expire, $this->tags);
             $view->stageCatPath = $stageCatPath;
         }
         $view->stageParams = $params;
         $this->cache = $view;
     }
     $expire = $this->expires($this->expire, $expire);
     $tags = array_merge($tags, $this->tags);
     return $this->cache;
 }
コード例 #30
0
ファイル: Standard.php プロジェクト: mvnp/aimeos-core
 /**
  * Edits the products specified by the view parameters to the basket.
  *
  * @param \Aimeos\MW\View\Iface $view View object
  * @param array $options List of options for editProducts() in basket controller
  */
 protected function editProducts(\Aimeos\MW\View\Iface $view, array $options)
 {
     $this->clearCached();
     $products = (array) $view->param('b_prod', array());
     $controller = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'basket');
     if (($position = $view->param('b_position', '')) !== '') {
         $products[] = array('position' => $position, 'quantity' => $view->param('b_quantity', 1), 'attrconf-code' => array_filter((array) $view->param('b_attrconfcode', array())));
     }
     foreach ($products as $values) {
         $controller->editProduct(isset($values['position']) ? (int) $values['position'] : 0, isset($values['quantity']) ? (int) $values['quantity'] : 1, $options, isset($values['attrconf-code']) ? array_filter((array) $values['attrconf-code']) : array());
     }
 }