本文整理汇总了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');
}
示例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');
}
}
}