Beispiel #1
0
 /**
  * Redirect to clean URL
  *
  * @return void
  */
 protected function performRedirectToCleanURL()
 {
     $data = \XLite\Core\Request::getInstance()->getGetData();
     if (\XLite::TARGET_DEFAULT === ($target = $this->getTarget())) {
         $target = '';
     } else {
         unset($data['target']);
     }
     $this->setReturnURL(\XLite\Core\Converter::buildFullURL($target, '', $data));
 }
Beispiel #2
0
 /**
  * Prepare data for 'low limit warning' email notifications
  *
  * @return array
  */
 protected function prepareDataForNotification()
 {
     $data = array();
     $product = $this->getProduct();
     $data['product'] = $product;
     $data['name'] = $product->getName();
     $data['sku'] = $this->getDisplaySku();
     $data['amount'] = $this->getAmount();
     $params = array('product_id' => $product->getProductId(), 'page' => 'inventory');
     $data['adminURL'] = \XLite\Core\Converter::buildFullURL('product', '', $params, \XLite::getAdminScript());
     return $data;
 }
Beispiel #3
0
 /**
  * Set LC breadcrumbs
  *
  * @return void
  */
 protected function setBreadcrumbs()
 {
     $widget = $this->getHandler()->getWidget('\\XLite\\View\\Location');
     $lcNodes = array_map(function (\XLite\View\Location\Node $node) {
         return $node->getContent();
     }, $widget->getNodes());
     array_shift($lcNodes);
     // Add store root node
     $trails = menu_get_active_trail();
     array_splice($trails, 1, 0, array(array('title' => t('Store'), 'href' => \XLite\Core\Converter::buildFullURL(), 'link_path' => '', 'localized_options' => array(), 'type' => MENU_VISIBLE_IN_BREADCRUMB)));
     menu_set_active_trail($trails);
     $drupalNodes = array_slice(drupal_get_breadcrumb(), 0, 2);
     drupal_set_breadcrumb(array_merge($drupalNodes, $lcNodes));
 }
Beispiel #4
0
 /**
  * Get column value for 'enabled' column
  *
  * @param array   $dataset Dataset
  * @param string  $name    Column name
  * @param integer $i       Subcolumn index
  *
  * @return string
  */
 protected function getCOMMODITY_URLColumnValue(array $dataset, $name, $i)
 {
     return \XLite\Core\Converter::buildFullURL('product', '', array('product_id' => $dataset['model']->getId()));
 }
Beispiel #5
0
 /**
  * Compose complete URL from target, action and additional params
  *
  * @param string $target Page identifier OPTIONAL
  * @param string $action Action to perform OPTIONAL
  * @param array  $params Additional params OPTIONAL
  *
  * @return string
  */
 public function buildFullURL($target = '', $action = '', array $params = array())
 {
     return \XLite\Core\Converter::buildFullURL($target, $action, $params);
 }
Beispiel #6
0
 /**
  * Get column value for 'enabled' column
  *
  * @param array   $dataset Dataset
  * @param string  $name    Column name
  * @param integer $i       Subcolumn index
  *
  * @return string
  */
 protected function getURLColumnValue(array $dataset, $name, $i)
 {
     return \XLite\Core\Converter::buildFullURL('category', '', array('category_id' => $dataset['model']->getId()));
 }
Beispiel #7
0
 /**
  * Get categories data
  *
  * @param $start
  * @param $limit
  *
  * @return array
  */
 public function getCategories($start, $limit)
 {
     $repo = Database::getRepo('XLite\\Model\\Category');
     $cnd = new CommonCell();
     $cnd->{\XLite\Model\Repo\Category::SEARCH_LIMIT} = array($start, $limit);
     $categories = $repo->search($cnd, false);
     $categoriesArray = array();
     $rootCatId = Database::getRepo('XLite\\Model\\Category')->getRootCategoryId();
     foreach ($categories as $category) {
         $parentId = $category->getParentId() == $rootCatId ? 0 : $category->getParentId();
         $categoryHash = array('id' => $category->getCategoryId(), 'name' => $category->getName(), 'description' => $category->getViewDescription(), 'parent' => $parentId);
         if ($category->getImage()) {
             list($categoryHash['image_width'], $categoryHash['image_height'], $categoryHash['image_src']) = $category->getImage()->getResizedURL(static::MAX_THUMBNAIL_WIDTH, static::MAX_THUMBNAIL_HEIGHT);
         }
         $categoryHash['url'] = Converter::buildFullURL('category', '', array('category_id' => $category->getCategoryId()));
         $categoriesArray[] = $categoryHash;
     }
     return $categoriesArray;
 }
Beispiel #8
0
 /**
  * Returns orders full url in admin area
  *
  * @return string
  */
 protected function getOrderAdminUrl()
 {
     return \XLite\Core\Converter::buildFullURL('order', '', array('order_number' => $this->getOrder()->getOrderNumber()), \XLite::ADMIN_SELF);
 }
Beispiel #9
0
 /**
  * Get download URL for customer front-end by key
  *
  * @return string
  */
 public function getDownloadURL(\XLite\Module\CDev\Egoods\Model\OrderItem\PrivateAttachment $attachment)
 {
     $params = $this->getGetterParams();
     $params['key'] = $attachment->getDownloadKey();
     return \XLite\Core\Converter::buildFullURL('storage', 'download', $params, \XLite::getCustomerScript());
 }
Beispiel #10
0
 /**
  * Analyze current target and request params and get a canonical redirect URL or null if redirect is not needed
  *
  * @param string $target
  *
  * @return string
  */
 public function getRedirectCanonicalURL($target)
 {
     $result = null;
     if ($this->isUseCanonicalURL()) {
         // Option use_canonical_urls_only is enabled: try to get canonical URL to redirect...
         $tmp = \XLite\Core\Request::getInstance();
         if ('product' === $target) {
             if (!empty($tmp->last)) {
                 list($target, $params) = $this->parseURL($tmp->url, $tmp->last, $tmp->rest, $tmp->ext);
                 $result = \XLite\Core\Converter::buildFullURL($target, '', $params);
             }
         }
     }
     return $result;
 }
Beispiel #11
0
 /**
  * Get merchant registration wizard return URL
  *
  * @return string
  */
 public function getWizardReturnUrl()
 {
     return \XLite\Core\Converter::buildFullURL();
 }