当前位置: 首页>>代码示例>>PHP>>正文


PHP Catalog::GetProductAttributes方法代码示例

本文整理汇总了PHP中Catalog::GetProductAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP Catalog::GetProductAttributes方法的具体用法?PHP Catalog::GetProductAttributes怎么用?PHP Catalog::GetProductAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Catalog的用法示例。


在下文中一共展示了Catalog::GetProductAttributes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 public function init()
 {
     // Get product details from business tier
     $this->mProduct = Catalog::GetProductDetails($this->_mProductId);
     if (isset($_SESSION['link_to_continue_shopping'])) {
         $continue_shopping = Link::QueryStringToArray($_SESSION['link_to_continue_shopping']);
         $page = 1;
         if (isset($continue_shopping['Page'])) {
             $page = (int) $continue_shopping['Page'];
         }
         if (isset($continue_shopping['CategoryId'])) {
             $this->mLinkToContinueShopping = Link::ToCategory((int) $continue_shopping['DepartmentId'], (int) $continue_shopping['CategoryId'], $page);
         } elseif (isset($continue_shopping['DepartmentId'])) {
             $this->mLinkToContinueShopping = Link::ToDepartment((int) $continue_shopping['DepartmentId'], $page);
         } elseif (isset($continue_shopping['SearchResults'])) {
             $this->mLinkToContinueShopping = Link::ToSearchResults(trim(str_replace('-', ' ', $continue_shopping['SearchString'])), $continue_shopping['AllWords'], $page);
         } else {
             $this->mLinkToContinueShopping = Link::ToIndex($page);
         }
     }
     if ($this->mProduct['image']) {
         $this->mProduct['image'] = Link::Build('images/product_images/' . $this->mProduct['image']);
     }
     if ($this->mProduct['image_2']) {
         $this->mProduct['image_2'] = Link::Build('images/product_images/' . $this->mProduct['image_2']);
     }
     $this->mProduct['attributes'] = Catalog::GetProductAttributes($this->mProduct['product_id']);
     $this->mLocations = Catalog::GetProductLocations($this->_mProductId);
     // Create the Add to Cart link
     $this->mProduct['link_to_add_product'] = Link::ToCart(ADD_PRODUCT, $this->_mProductId);
     // Build links for product departments and categories pages
     for ($i = 0; $i < count($this->mLocations); $i++) {
         $this->mLocations[$i]['link_to_department'] = Link::ToDepartment($this->mLocations[$i]['department_id']);
         $this->mLocations[$i]['link_to_category'] = Link::ToCategory($this->mLocations[$i]['department_id'], $this->mLocations[$i]['category_id']);
     }
     // Подготавливаем кнопу редактирования
     $this->mEditActionTarget = Link::Build(str_replace(VIRTUAL_LOCATION, '', getenv('REQUEST_URI')));
     if (isset($_SESSION['admin_logged']) && $_SESSION['admin_logged'] == TRUE && isset($_POST['submit_edit'])) {
         $product_locations = $this->mLocations;
         if (count($product_locations) > 0) {
             $department_id = $product_locations[0]['department_id'];
             $category_id = $product_locations[0]['category_id'];
             header('Location: ' . htmlspecialchars_decode(Link::ToProductAdmin($department_id, $category_id, $this->_mProductId)));
         }
     }
 }
开发者ID:naOyD,项目名称:tshirtshop_g,代码行数:46,代码来源:product.php

示例2: init

 public function init()
 {
     // Get product details from business tier
     $this->mProduct = Catalog::GetProductDetails($this->_mProductId);
     // Session Handle
     if (isset($_SESSION['link_to_continue_shopping'])) {
         $continue_shopping = Link::QueryStringToArray($_SESSION['link_to_continue_shopping']);
         $page = 1;
         // Cache the current query string. Then after choose the product, we will get back this page.
         if (isset($continue_shopping['Page'])) {
             $page = (int) $continue_shopping['Page'];
         }
         if (isset($continue_shopping['CategoryId'])) {
             $this->mLinkToContinueShopping = Link::ToCategory((int) $continue_shopping['DepartmentId'], (int) $continue_shopping['CategoryId'], $page);
         } elseif (isset($continue_shopping['DepartmentId'])) {
             $this->mLinkToContinueShopping = Link::ToDepartment((int) $continue_shopping['DepartmentId'], $page);
         } else {
             $this->mLinkToContinueShopping = Link::ToIndex($page);
         }
     }
     // Product detail
     if ($this->mProduct['image']) {
         $this->mProduct['image'] = Link::Build('images/product_images/' . $this->mProduct['image']);
     }
     if ($this->mProduct['image_2']) {
         $this->mProduct['image_2'] = Link::Build('images/product_images/' . $this->mProduct['image_2']);
     }
     $this->mProduct['attributes'] = Catalog::GetProductAttributes($this->mProduct['product_id']);
     // Similar products in catalog
     $this->mLocations = Catalog::GetProductLocations($this->_mProductId);
     // Build links for product departments and categories pages
     for ($i = 0; $i < count($this->mLocations); $i++) {
         $this->mLocations[$i]['link_to_department'] = Link::ToDepartment($this->mLocations[$i]['department_id']);
         $this->mLocations[$i]['link_to_category'] = Link::ToCategory($this->mLocations[$i]['department_id'], $this->mLocations[$i]['category_id']);
     }
 }
开发者ID:huynhchanhuy,项目名称:tshirtshop,代码行数:36,代码来源:product.php

示例3: init

 public function init()
 {
     /* If browsing a category, get the list of products by calling the
      * GetProductsInCategory() business tier method */
     if (isset($this->_mCategoryId)) {
         $this->mProducts = Catalog::GetProductsInCategory($this->_mCategoryId, $this->mPage, $this->mrTotalPages);
     } elseif (isset($this->_mDepartmentId)) {
         $this->mProducts = Catalog::GetProductsOnDepartment($this->_mDepartmentId, $this->mPage, $this->mrTotalPages);
     } else {
         $this->mProducts = Catalog::GetProductsOnCatalog($this->mPage, $this->mrTotalPages);
     }
     /* If there are subpages of products, display navigation
        controls */
     if ($this->mrTotalPages > 1) {
         // Build the Next link
         if ($this->mPage < $this->mrTotalPages) {
             if (isset($this->_mCategoryId)) {
                 $this->mLinkToNextPage = Link::ToCategory($this->_mDepartmentId, $this->_mCategoryId, $this->mPage + 1);
             } elseif (isset($this->_mDepartmentId)) {
                 $this->mLinkToNextPage = Link::ToDepartment($this->_mDepartmentId, $this->mPage + 1);
             } else {
                 $this->mLinkToNextPage = Link::ToIndex($this->mPage + 1);
             }
         }
         // Build the Previous Link
         if ($this->mPage > 1) {
             if (isset($this->_mCategoryId)) {
                 $this->mLinkToPreviousPage = Link::ToCategory($this->_mDepartmentId, $this->_mCategoryId, $this->mPage - 1);
             } elseif (isset($this->_mDepartmentId)) {
                 $this->mLinkToPreviousPage = Link::ToDepartment($this->_mDepartmentId, $this->mPage - 1);
             } else {
                 $this->mLinkToPreviousPage = Link::ToIndex($this->mPage - 1);
             }
         }
     }
     // Build links for product details pages
     for ($i = 0; $i < count($this->mProducts); $i++) {
         $this->mProducts[$i]['link_to_product'] = Link::ToProduct($this->mProducts[$i]['product_id']);
         if ($this->mProducts[$i]['thumbnail']) {
             $this->mProducts[$i]['thumbnail'] = Link::Build('images/product_images/' . $this->mProducts[$i]['thumbnail']);
         }
         $this->mProducts[$i]['attributes'] = Catalog::GetProductAttributes($this->mProducts[$i]['product_id']);
     }
 }
开发者ID:huynhchanhuy,项目名称:tshirtshop,代码行数:44,代码来源:products_list.php

示例4: init


//.........这里部分代码省略.........
         }
         //загружаем миниатюру
         //Если код ошибки - 0, файл успешно загружен
         if ($_FILES['ThumbnailUpload']['error'] == 0) {
             move_uploaded_file($_FILES['ThumbnailUpload']['tmp_name'], SITE_ROOT . '/images/product_images/' . $_FILES['ThumbnailUpload']['name']);
             //обновляем информацию о товаре в базе данных
             Catalog::SetThumbnail($this->_mProductId, $_FILES['ThumbnailUpload']['name']);
         }
     }
     // При обновлении информации о товаре...
     if (isset($_POST['UpdateProductInfo'])) {
         $product_name = $_POST['name'];
         $product_description = $_POST['description'];
         $product_price = $_POST['price'];
         $product_discounted_price = $_POST['discounted_price'];
         if ($product_name == NULL) {
             $this->mErrorMessage = 'Имя товара не установлено!';
         }
         if ($product_description == NULL) {
             $this->mErrorMessage = 'Описание не заполнено!';
         }
         if ($product_price == NULL || !is_numeric($product_price)) {
             $this->mErrorMessage = 'Цена товара должна быть в виде числа!';
         }
         if ($product_discounted_price == NULL || !is_numeric($product_discounted_price)) {
             $this->mErrorMessage = 'Цена товара со скидкой 
               должна быть в виде числа!';
         }
         if ($this->mErrorMessage == NULL) {
             Catalog::UpdateProduct($this->_mProductId, $product_name, $product_description, $product_price, $product_discounted_price);
         }
     }
     //При удалении товара из категории...
     if (isset($_POST['RemoveFromCategory'])) {
         $target_category_id = $_POST['TargetCategoryIdRemove'];
         $still_exists = Catalog::RemoveProductFromCategory($this->_mProductId, $target_category_id);
         if ($still_exists == 0) {
             header('Location: ' . htmlspecialchars_decode($this->mLinkToCategoryProductsAdmin));
             exit;
         }
     }
     // При установке параметров отображения товара
     if (isset($_POST['SetProductDisplayOption'])) {
         $product_display = $_POST['ProductDisplay'];
         Catalog::SetProductDisplayOption($this->_mProductId, $product_display);
     }
     // При удалениии товара из каталога
     if (isset($_POST['RemoveFromCatalog'])) {
         Catalog::DeleteProduct($this->_mProductId);
         header('Location: ' . htmlspecialchars_decode($this->mLinkToCategoryProductsAdmin));
         exit;
     }
     //При зачислении товара в другую категори ...
     if (isset($_POST['Assign'])) {
         $target_category_id = $_POST['TargetCategoryIdAssign'];
         Catalog::AssignProductToCategory($this->_mProductId, $target_category_id);
     }
     //При переносе товара в другую категорию
     if (isset($_POST['Move'])) {
         $target_category_id = $_POST['TargetCategoryIdMove'];
         Catalog::MoveProductToCategory($this->_mProductId, $this->_mCategoryId, $target_category_id);
         header('Location: ' . htmlspecialchars_decode(Link::ToProductAdmin($this->_mDepartmentId, $target_category_id, $this->_mProductId)));
         exit;
     }
     // При присвоении товару значения атрибута...
     if (isset($_POST['AssignAttributeValue'])) {
         $targer_attribute_value_id = $_POST['TargetAttributeValueIdAssign'];
         Catalog::AssignAttributeValueToProduct($this->_mProductId, $targer_attribute_value_id);
     }
     // При удалении значения атрибута из товара
     if (isset($_POST['RemoveAttributeValue'])) {
         $targer_attribute_value_id = $_POST['TargetAttributeValueIdRemove'];
         Catalog::RemoveProductAttributeValue($this->_mProductId, $targer_attribute_value_id);
     }
     //Получаем информацию о товаре
     $this->mProduct = Catalog::GetProductInfo($this->_mProductId);
     $product_categories = Catalog::GetCategoriesForProduct($this->_mProductId);
     $product_attributes = Catalog::GetProductAttributes($this->_mProductId);
     for ($i = 0; $i < count($product_attributes); $i++) {
         $this->mProductAttributes[$product_attributes[$i]['attribute_value_id']] = $product_attributes[$i]['attribute_name'] . ': ' . $product_attributes[$i]['attribute_value'];
     }
     $catalog_attributes = Catalog::GetAttributesNotAssignedToProduct($this->_mProductId);
     for ($i = 0; $i < count($catalog_attributes); $i++) {
         $this->mProductAttributes[$catalog_attributes[$i]['attribute_value_id']] = $catalog_attributes[$i]['attribute_name'] . ': ' . $catalog_attributes[$i]['attribute_value'];
     }
     if (count($product_categories) == 1) {
         $this->mRemoveFromCategoryButtonDisabled = true;
     }
     //Отображаем категории к которым принадлежит товар
     for ($i = 0; $i < count($product_categories); $i++) {
         $temp1[$product_categories[$i]['category_id']] = $product_categories[$i]['name'];
     }
     $this->mRemoveFromCategories = $temp1;
     $this->mProductCategoriesString = implode(', ', $temp1);
     $all_categories = Catalog::GetCategories();
     for ($i = 0; $i < count($all_categories); $i++) {
         $temp2[$all_categories[$i]['category_id']] = $all_categories[$i]['name'];
     }
     $this->mAssignOrMoveTo = array_diff($temp2, $temp1);
 }
开发者ID:naOyD,项目名称:tshirtshop_g,代码行数:101,代码来源:admin_product_details.php

示例5: init


//.........这里部分代码省略.........
     if (isset($_SESSION['admin_logged']) && $_SESSION['admin_logged'] == TRUE && isset($_POST['product_id'])) {
         if (isset($this->_mDepartmentId) && isset($this->_mCategoryId)) {
             header('Location: ' . htmlspecialchars_decode(Link::ToProductAdmin($this->_mDepartmentId, $this->_mCategoryId, (int) $_POST['product_id'])));
         } else {
             $product_locations = Catalog::GetProductLocations((int) $_POST['product_id']);
             if (count($product_locations) > 0) {
                 $department_id = $product_locations[0]['department_id'];
                 $category_id = $product_locations[0]['category_id'];
                 header('Location: ' . htmlspecialchars_decode(Link::ToProductAdmin($department_id, $category_id, (int) $_POST['product_id'])));
             }
         }
     }
     /* If searching the catalog, get the list of products by calling
        the Search business tier method */
     if (isset($this->mSearchString)) {
         // Get search results
         $search_results = Catalog::Search($this->mSearchString, $this->mAllWords, $this->mPage, $this->mrTotalPages);
         // Get the list of products
         $this->mProducts = $search_results['products'];
         // Build the title for the list of products
         if (count($search_results['accepted_words']) > 0) {
             $this->mSearchDescription = '<p class="description">Products containing <font class="words">' . ($this->mAllWords == 'on' ? 'all' : 'any') . '</font>' . ' of these words: <font class="words">' . implode(', ', $search_results['accepted_words']) . '</font></p>';
         }
         if (count($search_results['ignored_words']) > 0) {
             $this->mSearchDescription .= '<p class="description">Ignored words: <font class="words">' . implode(', ', $search_results['ignored_words']) . '</font></p>';
         }
         if (!(count($search_results['products']) > 0)) {
             $this->mSearchDescription .= '<p class="description">Your search generated no results.</p>';
         }
     } elseif (isset($this->_mCategoryId)) {
         $this->mProducts = Catalog::GetProductsInCategory($this->_mCategoryId, $this->mPage, $this->mrTotalPages);
     } elseif (isset($this->_mDepartmentId)) {
         $this->mProducts = Catalog::GetProductsOnDepartment($this->_mDepartmentId, $this->mPage, $this->mrTotalPages);
     } else {
         $this->mProducts = Catalog::GetProductsOnCatalog($this->mPage, $this->mrTotalPages);
     }
     /* If there are subpages of products, display navigation
        controls */
     if ($this->mrTotalPages > 1) {
         // Build the Next link
         if ($this->mPage < $this->mrTotalPages) {
             if (isset($_GET['SearchResults'])) {
                 $this->mLinkToNextPage = Link::ToSearchResults($this->mSearchString, $this->mAllWords, $this->mPage + 1);
             } elseif (isset($this->_mCategoryId)) {
                 $this->mLinkToNextPage = Link::ToCategory($this->_mDepartmentId, $this->_mCategoryId, $this->mPage + 1);
             } elseif (isset($this->_mDepartmentId)) {
                 $this->mLinkToNextPage = Link::ToDepartment($this->_mDepartmentId, $this->mPage + 1);
             } else {
                 $this->mLinkToNextPage = Link::ToIndex($this->mPage + 1);
             }
         }
         // Build the Previous link
         if ($this->mPage > 1) {
             if (isset($_GET['SearchResults'])) {
                 $this->mLinkToPreviousPage = Link::ToSearchResults($this->mSearchString, $this->mAllWords, $this->mPage - 1);
             } elseif (isset($this->_mCategoryId)) {
                 $this->mLinkToPreviousPage = Link::ToCategory($this->_mDepartmentId, $this->_mCategoryId, $this->mPage - 1);
             } elseif (isset($this->_mDepartmentId)) {
                 $this->mLinkToPreviousPage = Link::ToDepartment($this->_mDepartmentId, $this->mPage - 1);
             } else {
                 $this->mLinkToPreviousPage = Link::ToIndex($this->mPage - 1);
             }
         }
         // Build the pages links
         for ($i = 1; $i <= $this->mrTotalPages; $i++) {
             if (isset($_GET['SearchResults'])) {
                 $this->mProductListPages[] = Link::ToSearchResults($this->mSearchString, $this->mAllWords, $i);
             } elseif (isset($this->_mCategoryId)) {
                 $this->mProductListPages[] = Link::ToCategory($this->_mDepartmentId, $this->_mCategoryId, $i);
             } elseif (isset($this->_mDepartmentId)) {
                 $this->mProductListPages[] = Link::ToDepartment($this->_mDepartmentId, $i);
             } else {
                 $this->mProductListPages[] = Link::ToIndex($i);
             }
         }
     }
     /* 404 redirect if the page number is larger than
        the total number of pages */
     if ($this->mPage > $this->mrTotalPages && !empty($this->mrTotalPages)) {
         // Clean output buffer
         ob_clean();
         // Load the 404 page
         include '404.php';
         // Clear the output buffer and stop execution
         flush();
         ob_flush();
         ob_end_clean();
         exit;
     }
     // Build links for product details pages
     for ($i = 0; $i < count($this->mProducts); $i++) {
         $this->mProducts[$i]['link_to_product'] = Link::ToProduct($this->mProducts[$i]['product_id']);
         if ($this->mProducts[$i]['thumbnail']) {
             $this->mProducts[$i]['thumbnail'] = Link::Build('images/product_images/' . $this->mProducts[$i]['thumbnail']);
         }
         // Create the Add to Cart link
         $this->mProducts[$i]['link_to_add_product'] = Link::ToCart(ADD_PRODUCT, $this->mProducts[$i]['product_id']);
         $this->mProducts[$i]['attributes'] = Catalog::GetProductAttributes($this->mProducts[$i]['product_id']);
     }
 }
开发者ID:naOyD,项目名称:tshirtshop_g,代码行数:101,代码来源:products_list.php


注:本文中的Catalog::GetProductAttributes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。