当前位置: 首页>>代码示例>>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;未经允许,请勿转载。