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


PHP product::getId方法代码示例

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


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

示例1: transform

 /**
  * Transforms an object (product) to a string (number).
  *
  * @param  product|null $product
  * @return string
  */
 public function transform($product)
 {
     if (null === $product) {
         return '';
     }
     return $product->getId();
 }
开发者ID:DWS-DAW,项目名称:T0,代码行数:13,代码来源:ProductToNumberTransformer.php

示例2: getReviewsUrl

 /**
  * Rewriting this method to output new urls.
  * Checks if a rewrite already exists, otherwise creates it.
  * 
  * @param product $product
  * @param category $category
  * @param array $params
  */
 public function getReviewsUrl($product, $category = null, $params = array())
 {
     $routePath = '';
     $routeParams = $params;
     $storeId = $product->getStoreId();
     if (!$storeId) {
         $storeId = Mage::app()->getStore()->getId();
         $product->setStoreId($storeId);
     }
     $categoryId = $product->getCategoryId() && !$product->getDoNotUseCategoryId() ? $product->getCategoryId() : null;
     $idPath = sprintf('reviews/%d', $product->getId());
     //if ($categoryId) {
     //     $idPath = sprintf('%s/%d', $idPath, $categoryId);
     //}
     $rewrite = $this->getUrlRewrite();
     $rewrite->setStoreId($storeId)->loadByIdPath($idPath);
     $oldRequestPath = $product->getRequestPath();
     if ($rewrite->getId()) {
         // REWRITE RULE EXISTS
         $requestPath = $rewrite->getRequestPath();
         $product->setRequestPath($requestPath);
     } else {
         // CREATE REWRITE RULE
         $model = Mage::getModel('reviewsearchfriendlyurls/url');
         $requestPath = $model->addUrlRewrite($product);
     }
     if (isset($routeParams['_store'])) {
         $storeId = Mage::app()->getStore($routeParams['_store'])->getId();
     }
     if ($storeId != Mage::app()->getStore()->getId()) {
         $routeParams['_store_to_url'] = true;
     }
     if (!empty($requestPath)) {
         $routeParams['_direct'] = $requestPath;
     } else {
         $routePath = 'catalog/product/view';
         $routeParams['id'] = $product->getId();
         $routeParams['s'] = $product->getUrlKey();
         //if ($categoryId) {
         //   $routeParams['category'] = $categoryId;
         //}
     }
     // reset cached URL instance GET query params
     if (!isset($routeParams['_query'])) {
         $routeParams['_query'] = array();
     }
     $url = $this->getUrlInstance()->setStore($storeId)->getUrl($routePath, $routeParams);
     $product->setRequestPath($oldRequestPath);
     return $url;
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:58,代码来源:Reviews.php

示例3: deleteOne

 /**
  * Delete
  */
 public function deleteOne(product $p)
 {
     try {
         dibi::query('DELETE FROM [:prefix:products]', 'WHERE [id] = %i', $p->getId(), 'LIMIT 1');
         dibi::query('DELETE FROM [:prefix:pages]', 'WHERE [nice_name] = %s', $p->getNiceName(), 'LIMIT 1');
         //<fulltext>
         foreach (fulltext::index()->termDocs(new Zend_Search_Lucene_Index_Term($p->getId(), 'id')) as $id) {
             fulltext::index()->delete($id);
         }
         fulltext::dirty($p->getId(), FALSE);
         //</fulltext>
         return TRUE;
     } catch (Exception $e) {
         return FALSE;
     }
 }
开发者ID:jakubkulhan,项目名称:shopaholic,代码行数:19,代码来源:products.php


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