當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ProductCategory::publish方法代碼示例

本文整理匯總了PHP中ProductCategory::publish方法的典型用法代碼示例。如果您正苦於以下問題:PHP ProductCategory::publish方法的具體用法?PHP ProductCategory::publish怎麽用?PHP ProductCategory::publish使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ProductCategory的用法示例。


在下文中一共展示了ProductCategory::publish方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setUp

 public function setUp()
 {
     parent::setUp();
     ProductCategory::config()->must_have_price = false;
     $this->products = $this->objFromFixture('ProductCategory', 'products');
     $this->products->publish('Stage', 'Live');
     $this->clothing = $this->objFromFixture('ProductCategory', 'clothing');
     $this->clothing->publish('Stage', 'Live');
     $this->electronics = $this->objFromFixture('ProductCategory', 'electronics');
     $this->electronics->publish('Stage', 'Live');
     $this->socks = $this->objFromFixture('Product', 'socks');
     $this->socks->publish('Stage', 'Live');
     $this->tshirt = $this->objFromFixture('Product', 'tshirt');
     $this->tshirt->publish('Stage', 'Live');
     $this->hdtv = $this->objFromFixture('Product', 'hdtv');
     $this->hdtv->publish('Stage', 'Live');
     $this->beachball = $this->objFromFixture('Product', 'beachball');
     $this->beachball->publish('Stage', 'Live');
     $this->mp3player = $this->objFromFixture('Product', 'mp3player');
     $this->mp3player->publish('Stage', 'Live');
     Versioned::reading_stage('Live');
 }
開發者ID:burnbright,項目名稱:silverstripe-shop,代碼行數:22,代碼來源:ProductCategoryTest.php

示例2: setParent

 public function setParent(&$obj, $val, $record)
 {
     $title = strtolower(Convert::raw2sql($val));
     if ($title) {
         if ($parentpage = DataObject::get_one('ProductCategory', "LOWER(\"Title\") = '{$title}'", '"Created" DESC')) {
             // find or create parent category, if provided
             $obj->ParentID = $parentpage->ID;
             $obj->write();
             $obj->writeToStage('Stage');
             $obj->publish('Stage', 'Live');
             //TODO: otherwise assign it to the first prodcut group found
         } elseif (self::$createnewproductgroups) {
             //create parent product group
             $pg = new ProductCategory();
             $pg->setTitle($title);
             $pg->ParentID = self::$parentpageid ? $parentpageid : 0;
             $pg->writeToStage('Stage');
             $pg->publish('Stage', 'Live');
             $obj->ParentID = $pg->ID;
             $obj->write();
             $obj->writeToStage('Stage');
             $obj->publish('Stage', 'Live');
         }
     }
 }
開發者ID:helpfulrobot,項目名稱:silvershop-core,代碼行數:25,代碼來源:ProductBulkLoader.php


注:本文中的ProductCategory::publish方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。